Skip to content

Commit

Permalink
chore: remove storybook doc references (#8944)
Browse files Browse the repository at this point in the history
**Related Issue:** #8911

## Summary
Storybook is no longer the central place for documentation for calcite.
Thus, there are some parts of the codebase that must be refactored to
better reflect that change.

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
brandentheintern and github-actions[bot] authored Mar 19, 2024
1 parent f036ac2 commit 06843f7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 34 deletions.
1 change: 0 additions & 1 deletion packages/calcite-components/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
module.exports = {
addons: [
"@storybook/addon-a11y",
"@storybook/addon-docs",
"@storybook/addon-interactions",
"@storybook/addon-knobs",
"@storybook/testing-library",
Expand Down
18 changes: 1 addition & 17 deletions packages/calcite-components/.storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Theme as Mode } from "storybook-addon-themes/dist/models/Theme";
import { withDirection } from "storybook-rtl-addon";
import { globalDocsPage, modes, parseReadme } from "./utils";
import { modes } from "./utils";

declare global {
interface Window {}
Expand Down Expand Up @@ -30,22 +30,6 @@ export const parameters = {
manual: false,
},
modes,
docs: {
extractComponentDescription: (_component, { notes }) => {
if (notes) {
if (typeof notes === "string") {
return parseReadme(notes);
}

const multipleNotes = Array.isArray(notes) ? notes : Object.keys(notes).map((section) => notes[section]);

return parseReadme(multipleNotes.join("\n"));
}

return null;
},
page: globalDocsPage,
},
layout: "centered",
options: {
storySort: {
Expand Down
11 changes: 0 additions & 11 deletions packages/calcite-components/.storybook/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,6 @@ export const modesDarkDefault = {
list,
};

/**
* This transforms a component markdown to properly render in Storybook notes.
*/
export const parseReadme = (content: string) =>
content
// the generated readme includes escape characters which actually get rendered, remove them
.replace(/ \\\| /g, " | ")

// markdown uses relative paths for component links
.replace(/\.\.\//g, "https://github.com/Esri/calcite-design-system/tree/main/src/components/");

export interface KnobbedAttribute {
name: string;
value: ReturnType<
Expand Down
10 changes: 5 additions & 5 deletions packages/calcite-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,23 @@
"postbuild": "npm run util:patch && npm run util:generate-t9n-docs-json && npm run util:clean-readmes",
"build:watch": "npm run util:prep-build-reqs && stencil build --no-docs --watch",
"build:watch-dev": "npm run util:prep-build-reqs && stencil build --no-docs --dev --watch",
"build-storybook": "npm run util:build-docs && NODE_OPTIONS=--openssl-legacy-provider build-storybook --output-dir ./docs --quiet",
"build-storybook": "npm run util:prep-storybook-build && NODE_OPTIONS=--openssl-legacy-provider build-storybook --output-dir ./docs --quiet",
"clean": "npm run util:clean-js-files && npm run util:clean-readmes && rimraf node_modules dist www hydrate docs .turbo",
"deps:update": "updtr --exclude chalk cheerio typescript @types/jest jest jest-cli ts-jest @whitespace/storybook-addon-html && npm audit fix",
"docs": "build-storybook",
"docs:preview": "npm run util:build-docs && NODE_OPTIONS=--openssl-legacy-provider STORYBOOK_SCREENSHOT_LOCAL_BUILD=true start-storybook",
"lint": "concurrently npm:lint:*",
"lint:html": "prettier --write \"**/*.html\" >/dev/null",
"lint:json": "prettier --write \"**/*.json\" >/dev/null",
"lint:md": "prettier --write \"**/*.md\" >/dev/null && markdownlint \"**/*.md\" --fix --dot --ignore-path .gitignore",
"lint:scss": "stylelint --fix \"src/**/*.scss\" && prettier --write \"**/*.scss\" >/dev/null",
"lint:ts": "eslint --ext .ts,.tsx --fix . && prettier --write \"**/*.ts?(x)\" >/dev/null",
"posttest": "npm run test:prerender",
"release:docs": "npm run docs && storybook-to-ghpages --existing-output-dir=docs",
"screenshot-tests": "build-storybook",
"screenshot-tests:preview": "npm run util:prep-storybook-build && NODE_OPTIONS=--openssl-legacy-provider STORYBOOK_SCREENSHOT_LOCAL_BUILD=true start-storybook",
"screenshot-tests:publish": "npm run screenshot-tests && storybook-to-ghpages --existing-output-dir=docs",
"start": "npm run util:clean-js-files && concurrently --kill-others --raw \"tsc --project ./tsconfig-demos.json --watch\" \"npm run build:watch-dev -- --serve\"",
"test": "stencil test --no-docs --no-build --spec --e2e",
"test:prerender": "npm run build -- --prerender",
"test:watch": "npm run build && npm run test -- -- --watchAll",
"util:build-docs": "npm run util:prep-build-reqs && stencil build --docs --config stencil.storybook.config.ts && npm run lint:md",
"util:clean-tested-build": "npm ci && npm test && npm run build",
"util:copy-assets": "npm run util:copy-icons",
"util:copy-icons": "cpy \"./node_modules/@esri/calcite-ui-icons/js/*.json\" \"./src/components/icon/assets/icon/\" --flat",
Expand All @@ -50,6 +49,7 @@
"util:patch": "npm run util:patch-esm-resolution",
"util:patch-esm-resolution": "tsx support/patchESMResolution.ts",
"util:prep-build-reqs": "npm run util:copy-assets && npm run util:generate-t9n-types",
"util:prep-storybook-build": "npm run util:prep-build-reqs && stencil build --config stencil.storybook.config.ts && npm run lint:md",
"util:sync-t9n-en-bundles": "tsx support/syncEnT9nBundles.ts",
"util:test-types": "! grep -rnw 'dist/types' -e '<reference types='",
"util:clean-js-files": "rimraf --glob -- *.js {src,.storybook,support}/**.js",
Expand Down

0 comments on commit 06843f7

Please sign in to comment.