Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core: Pre-bundle @storybook/theming to avoid emotion11 conflicts #17000

Merged
merged 47 commits into from
Feb 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
3289a41
add prebundle script && prebundle lib/theming
ndelangen Jan 19, 2022
7d90149
fix dts-bundler to work with typescript 3.9
ndelangen Jan 19, 2022
99bfb63
fix lockfiles
ndelangen Jan 19, 2022
01aef69
cleanup
ndelangen Jan 19, 2022
080a4d3
Merge branch 'tech/lockfile-regen' into tech/prebundle-wip
ndelangen Jan 20, 2022
0e6dd4b
auto load externals based on list of normal dependencies and peerDepe…
ndelangen Jan 20, 2022
623a347
generate dts-bundle in to a cache dir, so that it's not published
ndelangen Jan 20, 2022
4603a50
rather then placing the tmp in a different directory, simply remove t…
ndelangen Jan 20, 2022
3436a00
cleanup
ndelangen Jan 20, 2022
dce8b42
improve the prebundle script
ndelangen Jan 24, 2022
a4cbcec
make eslint config stricter again
ndelangen Jan 24, 2022
bbb184c
trying to make sense of the dev command, build command, etc. more ref…
ndelangen Jan 24, 2022
eb9449f
improve dev scripts
ndelangen Jan 25, 2022
821290a
fix
ndelangen Jan 25, 2022
1ac2640
Merge branch 'next' into tech/prebundle-wip
ndelangen Jan 25, 2022
213f4eb
add sourcemaps
ndelangen Jan 25, 2022
3d3e2ad
update docs to remove mention of yarn dev
ndelangen Jan 25, 2022
c5ee722
add optimized flag && cleanup
ndelangen Jan 25, 2022
81ef863
format all tsconfig files
ndelangen Jan 25, 2022
a2cce64
cleanup
ndelangen Jan 25, 2022
db69c74
cleanup & fix babel not picking up tsx files
ndelangen Jan 25, 2022
a51da8d
remove the need the need to --copy-files with babel by moving the fav…
ndelangen Jan 25, 2022
55a631d
fix issues
ndelangen Jan 25, 2022
13a48bd
if we do not copy these files, they should be in the package root, di…
ndelangen Jan 25, 2022
0645dde
Merge branch 'next' into tech/prebundle-wip
ndelangen Jan 25, 2022
5451f72
oops, wrong package
ndelangen Jan 25, 2022
e28558f
Merge branch 'next' into tech/prebundle-wip
ndelangen Jan 25, 2022
725fc16
fix more paths being missing
ndelangen Jan 25, 2022
e4d485f
oops wrong package
ndelangen Jan 25, 2022
2836b1c
change the generation of versions.json to be a versions.ts
ndelangen Jan 25, 2022
9576309
move this svelte HOC for docs to the package root
ndelangen Jan 25, 2022
68b9d86
more non-js files reloated to the package root
ndelangen Jan 25, 2022
018ce83
it is a bity hacky for sure, but this works, I hope
ndelangen Jan 25, 2022
31c72b7
fix ts complaining about every thing needing to be a module
ndelangen Jan 25, 2022
580b9e8
enable --copy-fiule for babel for lib/cli
ndelangen Jan 26, 2022
5dabe05
cleanup
ndelangen Jan 26, 2022
8c0a47f
Merge branch 'tech/improve-dev-babel-setup' into tech/prebundle-wip
ndelangen Jan 27, 2022
fd0ea3e
Restore CONTRIBUTING.old.md
ndelangen Jan 27, 2022
65b4843
Merge branch 'next' into tech/prebundle-wip
ndelangen Jan 28, 2022
d154896
fix incorrect version after bad merge
ndelangen Jan 28, 2022
c96715c
fix infinite loop with cyclical type dependencies
ndelangen Jan 28, 2022
7278215
improve base tsconfig
ndelangen Jan 28, 2022
85a6886
add --reset flag to prebundle
ndelangen Jan 28, 2022
70269ce
Merge branch 'next' into tech/prebundle-wip
ndelangen Jan 31, 2022
48f5911
Merge branch 'next' into tech/prebundle-wip
ndelangen Jan 31, 2022
4607ea6
fix lockfile
ndelangen Jan 31, 2022
be09c8f
Merge branch 'next' into tech/prebundle-wip
ndelangen Jan 31, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,12 @@ module.exports = {
'react/no-unknown-property': 'off', // Need to deactivate otherwise eslint replaces some unknown properties with React ones
},
},
{
// this package uses pre-bundling, dependencies will be bundled, and will be in devDepenencies
files: ['**/lib/theming/**/*'],
rules: {
'import/no-extraneous-dependencies': ['error', { bundledDependencies: false }],
},
},
],
};
112 changes: 56 additions & 56 deletions lib/cli/src/versions.ts
Original file line number Diff line number Diff line change
@@ -1,58 +1,58 @@
// auto generated file, do not edit
export default {
"@storybook/addon-a11y": "6.5.0-alpha.30",
"@storybook/addon-actions": "6.5.0-alpha.30",
"@storybook/addon-backgrounds": "6.5.0-alpha.30",
"@storybook/addon-controls": "6.5.0-alpha.30",
"@storybook/addon-docs": "6.5.0-alpha.30",
"@storybook/addon-essentials": "6.5.0-alpha.30",
"@storybook/addon-interactions": "6.5.0-alpha.30",
"@storybook/addon-jest": "6.5.0-alpha.30",
"@storybook/addon-links": "6.5.0-alpha.30",
"@storybook/addon-measure": "6.5.0-alpha.30",
"@storybook/addon-outline": "6.5.0-alpha.30",
"@storybook/addon-storyshots": "6.5.0-alpha.30",
"@storybook/addon-storyshots-puppeteer": "6.5.0-alpha.30",
"@storybook/addon-storysource": "6.5.0-alpha.30",
"@storybook/addon-toolbars": "6.5.0-alpha.30",
"@storybook/addon-viewport": "6.5.0-alpha.30",
"@storybook/addons": "6.5.0-alpha.30",
"@storybook/angular": "6.5.0-alpha.30",
"@storybook/api": "6.5.0-alpha.30",
"@storybook/builder-webpack4": "6.5.0-alpha.30",
"@storybook/builder-webpack5": "6.5.0-alpha.30",
"@storybook/channel-postmessage": "6.5.0-alpha.30",
"@storybook/channel-websocket": "6.5.0-alpha.30",
"@storybook/channels": "6.5.0-alpha.30",
"@storybook/cli": "6.5.0-alpha.30",
"@storybook/client-api": "6.5.0-alpha.30",
"@storybook/client-logger": "6.5.0-alpha.30",
"@storybook/codemod": "6.5.0-alpha.30",
"@storybook/components": "6.5.0-alpha.30",
"@storybook/core": "6.5.0-alpha.30",
"@storybook/core-client": "6.5.0-alpha.30",
"@storybook/core-common": "6.5.0-alpha.30",
"@storybook/core-events": "6.5.0-alpha.30",
"@storybook/core-server": "6.5.0-alpha.30",
"@storybook/csf-tools": "6.5.0-alpha.30",
"@storybook/ember": "6.5.0-alpha.30",
"@storybook/html": "6.5.0-alpha.30",
"@storybook/instrumenter": "6.5.0-alpha.30",
"@storybook/manager-webpack4": "6.5.0-alpha.30",
"@storybook/manager-webpack5": "6.5.0-alpha.30",
"@storybook/node-logger": "6.5.0-alpha.30",
"@storybook/postinstall": "6.5.0-alpha.30",
"@storybook/preact": "6.5.0-alpha.30",
"@storybook/preview-web": "6.5.0-alpha.30",
"@storybook/react": "6.5.0-alpha.30",
"@storybook/router": "6.5.0-alpha.30",
"@storybook/server": "6.5.0-alpha.30",
"@storybook/source-loader": "6.5.0-alpha.30",
"@storybook/store": "6.5.0-alpha.30",
"@storybook/svelte": "6.5.0-alpha.30",
"@storybook/theming": "6.5.0-alpha.30",
"@storybook/ui": "6.5.0-alpha.30",
"@storybook/vue": "6.5.0-alpha.30",
"@storybook/vue3": "6.5.0-alpha.30",
"@storybook/web-components": "6.5.0-alpha.30"
}
'@storybook/addon-a11y': '6.5.0-alpha.30',
'@storybook/addon-actions': '6.5.0-alpha.30',
'@storybook/addon-backgrounds': '6.5.0-alpha.30',
'@storybook/addon-controls': '6.5.0-alpha.30',
'@storybook/addon-docs': '6.5.0-alpha.30',
'@storybook/addon-essentials': '6.5.0-alpha.30',
'@storybook/addon-interactions': '6.5.0-alpha.30',
'@storybook/addon-jest': '6.5.0-alpha.30',
'@storybook/addon-links': '6.5.0-alpha.30',
'@storybook/addon-measure': '6.5.0-alpha.30',
'@storybook/addon-outline': '6.5.0-alpha.30',
'@storybook/addon-storyshots': '6.5.0-alpha.30',
'@storybook/addon-storyshots-puppeteer': '6.5.0-alpha.30',
'@storybook/addon-storysource': '6.5.0-alpha.30',
'@storybook/addon-toolbars': '6.5.0-alpha.30',
'@storybook/addon-viewport': '6.5.0-alpha.30',
'@storybook/addons': '6.5.0-alpha.30',
'@storybook/angular': '6.5.0-alpha.30',
'@storybook/api': '6.5.0-alpha.30',
'@storybook/builder-webpack4': '6.5.0-alpha.30',
'@storybook/builder-webpack5': '6.5.0-alpha.30',
'@storybook/channel-postmessage': '6.5.0-alpha.30',
'@storybook/channel-websocket': '6.5.0-alpha.30',
'@storybook/channels': '6.5.0-alpha.30',
'@storybook/cli': '6.5.0-alpha.30',
'@storybook/client-api': '6.5.0-alpha.30',
'@storybook/client-logger': '6.5.0-alpha.30',
'@storybook/codemod': '6.5.0-alpha.30',
'@storybook/components': '6.5.0-alpha.30',
'@storybook/core': '6.5.0-alpha.30',
'@storybook/core-client': '6.5.0-alpha.30',
'@storybook/core-common': '6.5.0-alpha.30',
'@storybook/core-events': '6.5.0-alpha.30',
'@storybook/core-server': '6.5.0-alpha.30',
'@storybook/csf-tools': '6.5.0-alpha.30',
'@storybook/ember': '6.5.0-alpha.30',
'@storybook/html': '6.5.0-alpha.30',
'@storybook/instrumenter': '6.5.0-alpha.30',
'@storybook/manager-webpack4': '6.5.0-alpha.30',
'@storybook/manager-webpack5': '6.5.0-alpha.30',
'@storybook/node-logger': '6.5.0-alpha.30',
'@storybook/postinstall': '6.5.0-alpha.30',
'@storybook/preact': '6.5.0-alpha.30',
'@storybook/preview-web': '6.5.0-alpha.30',
'@storybook/react': '6.5.0-alpha.30',
'@storybook/router': '6.5.0-alpha.30',
'@storybook/server': '6.5.0-alpha.30',
'@storybook/source-loader': '6.5.0-alpha.30',
'@storybook/store': '6.5.0-alpha.30',
'@storybook/svelte': '6.5.0-alpha.30',
'@storybook/theming': '6.5.0-alpha.30',
'@storybook/ui': '6.5.0-alpha.30',
'@storybook/vue': '6.5.0-alpha.30',
'@storybook/vue3': '6.5.0-alpha.30',
'@storybook/web-components': '6.5.0-alpha.30',
};
3 changes: 0 additions & 3 deletions lib/core-server/src/__snapshots__/vue-3-cli_preview-dev-posix
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,6 @@ Object {
"options": Object {
"docgenOptions": Object {
"alias": Object {
"@emotion/core": "NODE_MODULES/@emotion/core",
"@emotion/styled": "NODE_MODULES/@emotion/styled",
"@storybook/addons": "ROOT/lib/addons",
ndelangen marked this conversation as resolved.
Show resolved Hide resolved
"@storybook/api": "ROOT/lib/api",
"@storybook/channel-postmessage": "ROOT/lib/channel-postmessage",
Expand All @@ -505,7 +503,6 @@ Object {
"@storybook/semver": "NODE_MODULES/@storybook/semver",
"@storybook/store": "ROOT/lib/store",
"@storybook/theming": "ROOT/lib/theming",
"emotion-theming": "NODE_MODULES/emotion-theming",
"react": "NODE_MODULES/react",
"react-dom": "NODE_MODULES/react-dom",
"vue$": "NODE_MODULES/vue/dist/vue.esm-bundler.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -489,8 +489,6 @@ Object {
"options": Object {
"docgenOptions": Object {
"alias": Object {
"@emotion/core": "NODE_MODULES/@emotion/core",
"@emotion/styled": "NODE_MODULES/@emotion/styled",
"@storybook/addons": "ROOT/lib/addons",
"@storybook/api": "ROOT/lib/api",
"@storybook/channel-postmessage": "ROOT/lib/channel-postmessage",
Expand All @@ -504,7 +502,6 @@ Object {
"@storybook/semver": "NODE_MODULES/@storybook/semver",
"@storybook/store": "ROOT/lib/store",
"@storybook/theming": "ROOT/lib/theming",
"emotion-theming": "NODE_MODULES/emotion-theming",
"react": "NODE_MODULES/react",
"react-dom": "NODE_MODULES/react-dom",
"vue$": "NODE_MODULES/vue/dist/vue.esm-bundler.js",
Expand Down
14 changes: 9 additions & 5 deletions lib/theming/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,24 @@
"*.d.ts"
],
"scripts": {
"prepare": "node ../../scripts/prepare.js"
"prepare": "ts-node ../../scripts/prebundle.ts"
},
"dependencies": {
"@storybook/client-logger": "6.5.0-alpha.30",
"core-js": "^3.8.2"
},
"devDependencies": {
"@emotion/core": "^10.3.1",
"@emotion/is-prop-valid": "^0.8.6",
"@emotion/styled": "^10.0.27",
"@storybook/client-logger": "6.5.0-alpha.30",
"core-js": "^3.8.2",
"@types/node": "^14.14.20 || ^16.0.0",
"deep-object-diff": "^1.1.0",
"emotion-theming": "^10.0.27",
"global": "^4.4.0",
"memoizerific": "^1.11.3",
"polished": "^4.0.5",
"resolve-from": "^5.0.0",
"ts-dedent": "^2.0.0"
"ts-dedent": "^2.0.0",
"ts-node": "^10.4.0"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0",
Expand All @@ -60,6 +63,7 @@
"publishConfig": {
"access": "public"
},
"bundlerEntrypoint": "./src/index.ts",
"gitHead": "4dc5ec5956f3a8cfb07e3c4b3442fb3f6ac95662",
"sbmodern": "dist/modern/index.js"
}
14 changes: 2 additions & 12 deletions lib/theming/paths.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,2 @@
const { dirname } = require('path');
const resolveFrom = require('resolve-from');

const resolve = resolveFrom.bind(null, __dirname);

// These paths need to be aliased in the manager webpack config to ensure that all
// code running inside the manager uses the *same* versions of each package.
module.exports = {
'@emotion/core': dirname(resolve('@emotion/core/package.json')),
'@emotion/styled': dirname(resolve('@emotion/styled/package.json')),
'emotion-theming': dirname(resolve('emotion-theming/package.json')),
};
// We used to alias paths, but now that we are bundling dependencies, we do not need to
module.exports = {};
3 changes: 3 additions & 0 deletions lib/theming/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// eslint-disable-next-line @typescript-eslint/triple-slash-reference
/// <reference path="./typings.d.ts" />

ndelangen marked this conversation as resolved.
Show resolved Hide resolved
import emotionStyled, { CreateStyled } from '@emotion/styled';
import { Theme } from './types';

Expand Down
2 changes: 1 addition & 1 deletion lib/theming/src/typings.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// todo the following packages need definition files or a TS migration
declare module 'react-inspector';
declare module 'global';
declare module 'global';
9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@
"@nrwl/nx-cloud": "12.1.1",
"@nrwl/tao": "12.3.4",
"@nrwl/workspace": "12.3.4",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-commonjs": "^21.0.1",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^13.0.6",
"@rollup/plugin-typescript": "^8.3.0",
"@storybook/addon-a11y": "workspace:*",
"@storybook/addon-actions": "workspace:*",
"@storybook/addon-backgrounds": "workspace:*",
Expand Down Expand Up @@ -223,6 +228,7 @@
"danger": "^10.6.2",
"detect-port": "^1.3.0",
"downlevel-dts": "^0.6.0",
"dts-bundle-generator": "^6.2.0",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.5",
"eslint": "^7.17.0",
Expand Down Expand Up @@ -271,6 +277,9 @@
"remark-cli": "^9.0.0",
"remark-lint": "^8.0.0",
"remark-preset-lint-recommended": "^5.0.0",
"rollup": "^2.60.2",
"rollup-plugin-jsx": "^1.0.3",
"rollup-plugin-terser": "^7.0.2",
"serve-static": "^1.14.1",
"shelljs": "^0.8.4",
"shx": "^0.3.2",
Expand Down
Loading