Skip to content

Commit

Permalink
chore: Merge support into master
Browse files Browse the repository at this point in the history
  • Loading branch information
alanbsmith committed Sep 20, 2023
2 parents d6d7dfd + 2158542 commit dc21aca
Show file tree
Hide file tree
Showing 444 changed files with 11,671 additions and 4,765 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Optional breaking changes message. If your PR includes breaking changes. It is e

## Checklist

- [ ] MDX documentation adheres to Canvas Kit's [standard MDX template](https://github.com/Workday/canvas-kit/discussions/1131)
- [ ] MDX documentation adheres to Canvas Kit's [Documentation Guidelines](https://workday.github.io/canvas-kit/?path=/docs/guides-documentation-guidelines--page)
- [ ] Label `ready for review` has been added to PR

## For the Reviewer
Expand Down
1 change: 0 additions & 1 deletion .github/reviewer-lottery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ groups:
usernames: # github usernames of the reviewers
- jamesfan
- NicholasBoll
- willklein
- alanbsmith
- mannycarrera4
- josh-bagwell
Expand Down
142 changes: 72 additions & 70 deletions .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ const createCompiler = require('@storybook/addon-docs/mdx-compiler-plugin');
const modulesPath = path.resolve(__dirname, '../modules');
const getSpecifications = require('../modules/docs/utils/get-specifications');

const processDocs = process.env.SKIP_DOCGEN !== 'true';

module.exports = {
stories: [
'../modules/docs/mdx/**/*.mdx',
Expand All @@ -27,56 +29,60 @@ module.exports = {
},
webpackFinal: async config => {
// Get the specifications object and replace with a real object in the spec.ts file
const specs = await getSpecifications();
if (processDocs) {
const specs = await getSpecifications();

config.module.rules.push({
test: /.ts$/,
include: [path.resolve(__dirname, '../modules/docs')],
use: [
{
loader: require.resolve('string-replace-loader'),
options: {
search: '[/* SPEC_FILES_REPLACE_BY_WEBPACK */]',
replace: JSON.stringify(specs, null, ' '),
},
},
],
});

// Load the source code of story files to display in docs.
config.module.rules.push({
test: /stories.*\.tsx?$/,
include: [modulesPath],
loaders: [
{
loader: require.resolve('@storybook/source-loader'),
options: {parser: 'typescript'},
},
],
enforce: 'pre',
});

config.module.rules.push({
test: /.+\.tsx?$/,
include: [modulesPath],
exclude: /examples|stories|spec|codemod|docs/,
loaders: [
{
loader: path.resolve(__dirname, 'symbol-doc-loader'),
},
],
enforce: 'pre',
});
}

// Convert mdx links to point to github
/**
* This was added to tell webpack not to parse the typescript.js file in node_modules and suppress these warnings:
* WARN Module not found: Error: Can't resolve 'perf_hooks' in 'node_modules/typescript/lib'
* WARN resolve 'perf_hooks' in 'node_modules/typescript/lib
*
*
* These warnings relate to this open GitHub issue: https://github.com/microsoft/TypeScript/issues/39436
* If you no longer see these warnings when this is config is removed, you can safely delete this config.
*/
config.module = {
...config.module,
// This solution was taken from this comment: https://github.com/microsoft/TypeScript/issues/39436#issuecomment-817029140
noParse: [require.resolve('typescript/lib/typescript.js')],
}

config.module.rules.push({
test: /.ts$/,
include: [path.resolve(__dirname, '../modules/docs')],
use: [
{
loader: require.resolve('string-replace-loader'),
options: {
search: '[/* SPEC_FILES_REPLACE_BY_WEBPACK */]',
replace: JSON.stringify(specs, null, ' '),
},
},
],
});

/**
* Added this because Storybook 6.3 is on emotion 10, so we rewrote the imports to point to emotion 11
* https://github.com/storybookjs/storybook/issues/13145
*/
config.resolve = {
...config.resolve,
alias: {
...config.resolve.alias,
'@emotion/core': '@emotion/react',
'emotion-theming': '@emotion/react',
},
};
config.module.noParse = [require.resolve('typescript/lib/typescript.js')];

// Update @storybook/addon-docs webpack rules to load all .mdx files in storybook
const mdxRule = config.module.rules.find(rule => rule.test.toString() === /\.mdx$/.toString());
mdxRule.use.find(loader => loader.loader.includes('mdx1-csf')).options['compilers'] = [
createCompiler({}),
];

// Convert mdx links to point to github
config.module.rules.push({
test: /\.mdx?$/,
include: [path.resolve(__dirname, '..')],
Expand All @@ -85,23 +91,20 @@ module.exports = {
{
loader: path.resolve(__dirname, 'webpack-loader-redirect-mdx-to-github'),
},
{
loader: path.resolve(__dirname, 'mdx-code-block-rewrite'),
},
],
});

// Load the source code of story files to display in docs.
config.module.rules.push({
test: /stories.*\.tsx?$/,
include: [modulesPath],
loaders: [
test: /\.mdx?$/,
include: [path.resolve(__dirname, '..')],
// Don't replace `<ExampleCodeBlock>` with Storybook tags in the
// documentation guidelines
exclude: [/node_modules/, /DOCUMENTATION_GUIDELINES/],
use: [
{
loader: require.resolve('@storybook/source-loader'),
options: {parser: 'typescript'},
loader: path.resolve(__dirname, 'mdx-code-block-rewrite'),
},
],
enforce: 'pre',
});

// Load the whole example code of story files to display in docs.
Expand All @@ -116,17 +119,24 @@ module.exports = {
enforce: 'pre',
});

config.module.rules.push({
test: /.+\.tsx?$/,
include: [modulesPath],
exclude: /examples|stories|spec|codemod|docs/,
loaders: [
{
loader: path.resolve(__dirname, 'symbol-doc-loader'),
},
],
enforce: 'pre',
});
/**
* Added this because Storybook 6.3 is on emotion 10, so we rewrote the imports to point to emotion 11
* https://github.com/storybookjs/storybook/issues/13145
*/
config.resolve = {
...config.resolve,
alias: {
...config.resolve.alias,
'@emotion/core': '@emotion/react',
'emotion-theming': '@emotion/react',
},
};

// Update @storybook/addon-docs webpack rules to load all .mdx files in storybook
const mdxRule = config.module.rules.find(rule => rule.test.toString() === /\.mdx$/.toString());
mdxRule.use.find(loader => loader.loader.includes('mdx1-csf')).options['compilers'] = [
createCompiler({}),
];

// Load our scss files with postscss.
// Note: This is the same as @storybook/preset-scss, but with postcss added.
Expand All @@ -144,14 +154,6 @@ module.exports = {
include: modulesPath,
});

// Remove progress updates to reduce log lines in Travis
// See: https://github.com/storybookjs/storybook/issues/2029
if (process.env.TRAVIS) {
config.plugins = config.plugins.filter(
plugin => plugin.constructor.name !== 'ProgressPlugin'
);
}

return config;
},
babel: async options => ({
Expand Down
11 changes: 7 additions & 4 deletions .storybook/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ const routes = {
'/assets/system-icons/': 'tokens-icon--system-icon',
'/components/buttons/action-bar/': 'components-buttons-action-bar--basic',
'/components/buttons/button/': 'components-buttons--primary',
'/components/buttons/segmented-control/': 'preview-segmented-control--basic',
'/components/containers/card/': 'components-containers-card--basic',
'/components/containers/side-panel/': 'preview-side-panel--basic',
'/components/containers/table/': 'components-containers-table--basic',
'/components/containers/table/': 'preview-table--basic',
'/components/containers/tabs/': 'components-containers-tabs--basic',
'/components/indicators/banner/': 'components-indicators-banner--basic',
'/components/indicators/loading-dots/': 'components-indicators-loading-dots--basic',
'/components/indicators/skeleton/': 'components-indicators-skeleton--basic',
'/components/indicators/status-indicator/': 'components-indicators-status-indicator--basic',
'/components/indicators/status-indicator/': 'preview-status-indicator--basic',
'/components/inputs/checkbox/': 'components-inputs-checkbox--basic',
'/components/inputs/color-input/': 'components-inputs-color-picker-color-input--basic',
'/components/inputs/form-field/': 'components-inputs-form-field--basic',
Expand All @@ -28,20 +29,20 @@ const routes = {
'/components/layout/box/': 'components-layout-box--basic',
'/components/layout/flex/': 'components-layout-flex--basic',
'/components/layout/grid/': 'components-layout-grid--basic',
'/components/layout/stack/': 'components-layout-stack--basic-stack',
'/components/navigation/breadcrumbs/': 'components-navigation-breadcrumbs--basic',
'/components/navigation/pagination/': 'components-navigation-pagination--basic',
'/components/popups/menu/': 'components-popups-menu--basic',
'/components/popups/modal/': 'components-popups-modal--basic',
'/components/popups/popup/': 'components-popups-popup--basic',
'/components/popups/toast/': 'components-popups-toast--with-popper',
'/components/popups/toast/': 'components-popups-toast--basic',
'/components/popups/tooltip/': 'components-popups-tooltip--default-story',
'/components/text/body-text/': 'components-text-body-text--basic',
'/components/text/heading/': 'components-text-heading--basic',
'/components/text/label-text/': 'components-text-label-text--basic',
'/components/text/subtext/': 'components-text-subtext--basic',
'/components/text/text/': 'components-text-text--basic',
'/components/text/title/': 'components-text-title--basic',
'/examples/layout/': 'examples-layouts--area-column-positioning',
'/getting-started/for-developers/contributing/': 'guides-contributing--page',
'/getting-started/for-developers/resources/api-pattern-guidelines/':
'guides-api-pattern-guidelines--page',
Expand All @@ -65,6 +66,8 @@ const routes = {
'/whats-new/upgrade-guides/canvas-kit-v5-upgrade-guide/': 'guides-upgrade-guides-v5-0--page',
'/whats-new/upgrade-guides/canvas-kit-v6-upgrade-guide/': 'guides-upgrade-guides-v6-0--page',
'/whats-new/upgrade-guides/canvas-kit-v7-upgrade-guide/': 'guides-upgrade-guides-v7-0--page',
'/whats-new/upgrade-guides/canvas-kit-v8-upgrade-guide/': 'guides-upgrade-guides-v8-0--page',
'/whats-new/upgrade-guides/canvas-v9-upgrade-guide/': 'guides-upgrade-guides-v9-0--page',
};

module.exports = routes;
Loading

0 comments on commit dc21aca

Please sign in to comment.