diff --git a/.babelrc.js b/.babelrc.js index 7a34d98c3184..c3768f9aaa08 100644 --- a/.babelrc.js +++ b/.babelrc.js @@ -1,14 +1,15 @@ module.exports = { presets: [ ['@babel/preset-env', { shippedProposals: true, useBuiltIns: 'usage' }], + '@babel/preset-typescript', '@babel/preset-react', '@babel/preset-flow', ], plugins: [ - ['@babel/plugin-proposal-object-rest-spread', { loose: true, useBuiltIns: true }], + ['@babel/plugin-proposal-class-properties', { loose: true }], '@babel/plugin-proposal-export-default-from', '@babel/plugin-syntax-dynamic-import', - ['@babel/plugin-proposal-class-properties', { loose: true }], + ['@babel/plugin-proposal-object-rest-spread', { loose: true, useBuiltIns: true }], 'babel-plugin-macros', ['emotion', { sourceMap: true, autoLabel: true }], ], @@ -62,6 +63,13 @@ module.exports = { }, ], ], + plugins: [ + 'emotion', + 'babel-plugin-macros', + ['@babel/plugin-proposal-class-properties', { loose: true }], + '@babel/plugin-proposal-object-rest-spread', + '@babel/plugin-proposal-export-default-from', + ], }, ], }; diff --git a/addons/a11y/src/components/Report/__snapshots__/HighlightToggle.test.js.snap b/addons/a11y/src/components/Report/__snapshots__/HighlightToggle.test.js.snap index 9c557211a97d..243ad1680359 100644 --- a/addons/a11y/src/components/Report/__snapshots__/HighlightToggle.test.js.snap +++ b/addons/a11y/src/components/Report/__snapshots__/HighlightToggle.test.js.snap @@ -78,25 +78,13 @@ exports[`HighlightToggle component should match snapshot 1`] = ` "toString": [Function], }, "hoverable": Object { - "map": undefined, - "name": "wpaw6f", - "next": undefined, - "styles": " - transition: all 150ms ease-out; - transform: translate3d(0, 0, 0); - - &:hover { - transform: translate3d(0, -2px, 0); - } - - &:active { - transform: translate3d(0, 0, 0); - } -", + "map": "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9hbmltYXRpb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBd0NxQiIsImZpbGUiOiIuLi9zcmMvYW5pbWF0aW9uLnRzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgY3NzLCBrZXlmcmFtZXMgfSBmcm9tICdAZW1vdGlvbi9jb3JlJztcblxuZXhwb3J0IGNvbnN0IGVhc2luZyA9IHtcbiAgcnViYmVyOiAnY3ViaWMtYmV6aWVyKDAuMTc1LCAwLjg4NSwgMC4zMzUsIDEuMDUpJyxcbn07XG5cbmNvbnN0IHJvdGF0ZTM2MCA9IGtleWZyYW1lc2Bcblx0ZnJvbSB7XG5cdFx0dHJhbnNmb3JtOiByb3RhdGUoMGRlZyk7XG5cdH1cblx0dG8ge1xuXHRcdHRyYW5zZm9ybTogcm90YXRlKDM2MGRlZyk7XG5cdH1cbmA7XG5cbmNvbnN0IGdsb3cgPSBrZXlmcmFtZXNgXG4gIDAlLCAxMDAlIHsgb3BhY2l0eTogMTsgfVxuICA1MCUgeyBvcGFjaXR5OiAuNDsgfVxuYDtcblxuY29uc3QgZmxvYXQgPSBrZXlmcmFtZXNgXG4gIDAlIHsgdHJhbnNmb3JtOiB0cmFuc2xhdGVZKDFweCk7IH1cbiAgMjUlIHsgdHJhbnNmb3JtOiB0cmFuc2xhdGVZKDBweCk7IH1cbiAgNTAlIHsgdHJhbnNmb3JtOiB0cmFuc2xhdGVZKC0zcHgpOyB9XG4gIDEwMCUgeyB0cmFuc2Zvcm06IHRyYW5zbGF0ZVkoMXB4KTsgfVxuYDtcblxuY29uc3QgamlnZ2xlID0ga2V5ZnJhbWVzYFxuICAwJSwgMTAwJSB7IHRyYW5zZm9ybTp0cmFuc2xhdGUzZCgwLDAsMCk7IH1cbiAgMTIuNSUsIDYyLjUlIHsgdHJhbnNmb3JtOnRyYW5zbGF0ZTNkKC00cHgsMCwwKTsgfVxuICAzNy41JSwgODcuNSUgeyAgdHJhbnNmb3JtOiB0cmFuc2xhdGUzZCg0cHgsMCwwKTsgIH1cbmA7XG5cbmNvbnN0IGlubGluZUdsb3cgPSBjc3NgXG4gIGFuaW1hdGlvbjogJHtnbG93fSAxLjVzIGVhc2UtaW4tb3V0IGluZmluaXRlO1xuICBjb2xvcjogdHJhbnNwYXJlbnQ7XG4gIGN1cnNvcjogcHJvZ3Jlc3M7XG5gO1xuXG4vLyBob3ZlciAmIGFjdGl2ZSBzdGF0ZSBmb3IgbGlua3MgYW5kIGJ1dHRvbnNcbmNvbnN0IGhvdmVyYWJsZSA9IGNzc2BcbiAgdHJhbnNpdGlvbjogYWxsIDE1MG1zIGVhc2Utb3V0O1xuICB0cmFuc2Zvcm06IHRyYW5zbGF0ZTNkKDAsIDAsIDApO1xuXG4gICY6aG92ZXIge1xuICAgIHRyYW5zZm9ybTogdHJhbnNsYXRlM2QoMCwgLTJweCwgMCk7XG4gIH1cblxuICAmOmFjdGl2ZSB7XG4gICAgdHJhbnNmb3JtOiB0cmFuc2xhdGUzZCgwLCAwLCAwKTtcbiAgfVxuYDtcblxuZXhwb3J0IGNvbnN0IGFuaW1hdGlvbiA9IHtcbiAgcm90YXRlMzYwLFxuICBnbG93LFxuICBmbG9hdCxcbiAgamlnZ2xlLFxuICBpbmxpbmVHbG93LFxuICBob3ZlcmFibGUsXG59O1xuIl19 */", + "name": "1023qba-hoverable", + "styles": "transition:all 150ms ease-out;transform:translate3d(0,0,0);&:hover{transform:translate3d(0,-2px,0);}&:active{transform:translate3d(0,0,0);}label:hoverable;", }, "inlineGlow": Object { - "map": undefined, - "name": "zv3h0s", + "map": "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9hbmltYXRpb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBaUNzQiIsImZpbGUiOiIuLi9zcmMvYW5pbWF0aW9uLnRzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgY3NzLCBrZXlmcmFtZXMgfSBmcm9tICdAZW1vdGlvbi9jb3JlJztcblxuZXhwb3J0IGNvbnN0IGVhc2luZyA9IHtcbiAgcnViYmVyOiAnY3ViaWMtYmV6aWVyKDAuMTc1LCAwLjg4NSwgMC4zMzUsIDEuMDUpJyxcbn07XG5cbmNvbnN0IHJvdGF0ZTM2MCA9IGtleWZyYW1lc2Bcblx0ZnJvbSB7XG5cdFx0dHJhbnNmb3JtOiByb3RhdGUoMGRlZyk7XG5cdH1cblx0dG8ge1xuXHRcdHRyYW5zZm9ybTogcm90YXRlKDM2MGRlZyk7XG5cdH1cbmA7XG5cbmNvbnN0IGdsb3cgPSBrZXlmcmFtZXNgXG4gIDAlLCAxMDAlIHsgb3BhY2l0eTogMTsgfVxuICA1MCUgeyBvcGFjaXR5OiAuNDsgfVxuYDtcblxuY29uc3QgZmxvYXQgPSBrZXlmcmFtZXNgXG4gIDAlIHsgdHJhbnNmb3JtOiB0cmFuc2xhdGVZKDFweCk7IH1cbiAgMjUlIHsgdHJhbnNmb3JtOiB0cmFuc2xhdGVZKDBweCk7IH1cbiAgNTAlIHsgdHJhbnNmb3JtOiB0cmFuc2xhdGVZKC0zcHgpOyB9XG4gIDEwMCUgeyB0cmFuc2Zvcm06IHRyYW5zbGF0ZVkoMXB4KTsgfVxuYDtcblxuY29uc3QgamlnZ2xlID0ga2V5ZnJhbWVzYFxuICAwJSwgMTAwJSB7IHRyYW5zZm9ybTp0cmFuc2xhdGUzZCgwLDAsMCk7IH1cbiAgMTIuNSUsIDYyLjUlIHsgdHJhbnNmb3JtOnRyYW5zbGF0ZTNkKC00cHgsMCwwKTsgfVxuICAzNy41JSwgODcuNSUgeyAgdHJhbnNmb3JtOiB0cmFuc2xhdGUzZCg0cHgsMCwwKTsgIH1cbmA7XG5cbmNvbnN0IGlubGluZUdsb3cgPSBjc3NgXG4gIGFuaW1hdGlvbjogJHtnbG93fSAxLjVzIGVhc2UtaW4tb3V0IGluZmluaXRlO1xuICBjb2xvcjogdHJhbnNwYXJlbnQ7XG4gIGN1cnNvcjogcHJvZ3Jlc3M7XG5gO1xuXG4vLyBob3ZlciAmIGFjdGl2ZSBzdGF0ZSBmb3IgbGlua3MgYW5kIGJ1dHRvbnNcbmNvbnN0IGhvdmVyYWJsZSA9IGNzc2BcbiAgdHJhbnNpdGlvbjogYWxsIDE1MG1zIGVhc2Utb3V0O1xuICB0cmFuc2Zvcm06IHRyYW5zbGF0ZTNkKDAsIDAsIDApO1xuXG4gICY6aG92ZXIge1xuICAgIHRyYW5zZm9ybTogdHJhbnNsYXRlM2QoMCwgLTJweCwgMCk7XG4gIH1cblxuICAmOmFjdGl2ZSB7XG4gICAgdHJhbnNmb3JtOiB0cmFuc2xhdGUzZCgwLCAwLCAwKTtcbiAgfVxuYDtcblxuZXhwb3J0IGNvbnN0IGFuaW1hdGlvbiA9IHtcbiAgcm90YXRlMzYwLFxuICBnbG93LFxuICBmbG9hdCxcbiAgamlnZ2xlLFxuICBpbmxpbmVHbG93LFxuICBob3ZlcmFibGUsXG59O1xuIl19 */", + "name": "1euta6d-inlineGlow", "next": Object { "name": "animation-r0iffl", "next": undefined, @@ -105,12 +93,7 @@ exports[`HighlightToggle component should match snapshot 1`] = ` 50% { opacity: .4; } }", }, - "styles": " - animation: animation-r0iffl 1.5s ease-in-out infinite; - background: rgba(0,0,0,.1); - color: transparent; - cursor: progress; -", + "styles": "animation:animation-r0iffl 1.5s ease-in-out infinite;color:transparent;cursor:progress;label:inlineGlow;", }, "jiggle": Object { "anim": 1, diff --git a/addons/centered/angular.d.ts b/addons/centered/angular.d.ts index 1a918ac4c4fa..cd316de77896 100644 --- a/addons/centered/angular.d.ts +++ b/addons/centered/angular.d.ts @@ -1,6 +1,22 @@ // tslint:disable-next-line:no-implicit-dependencies -import { IStory } from '@storybook/angular'; +export interface ICollection { + [p: string]: any; +} + +export interface NgModuleMetadata { + declarations?: any[]; + entryComponents?: any[]; + imports?: any[]; + schemas?: any[]; + providers?: any[]; +} +export interface IStory { + props?: ICollection; + moduleMetadata?: Partial; + component?: any; + template?: string; +} declare module '@storybook/addon-centered/angular' { export function centered(story: IStory): IStory; } diff --git a/addons/storyshots/storyshots-core/src/frameworks/angular/loader.js b/addons/storyshots/storyshots-core/src/frameworks/angular/loader.js index 9019699ac72e..8a236f84f3dc 100644 --- a/addons/storyshots/storyshots-core/src/frameworks/angular/loader.js +++ b/addons/storyshots/storyshots-core/src/frameworks/angular/loader.js @@ -1,9 +1,15 @@ +import 'core-js'; +import 'core-js/es6/reflect'; +import 'core-js/es7/reflect'; import hasDependency from '../hasDependency'; import configure from '../configure'; function setupAngularJestPreset() { // Needed to prevent "Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten." + require.requireActual('core-js'); require.requireActual('core-js/modules/es6.promise'); + // require.requireActual('core-js/es6/reflect'); + // require.requireActual('core-js/es7/reflect'); // Angular + Jest + Storyshots = Crazy Shit: // We need to require 'jest-preset-angular/setupJest' before any storybook code diff --git a/addons/storyshots/storyshots-core/tsconfig.json b/addons/storyshots/storyshots-core/tsconfig.json index 4dfc8c494582..e2aac223a612 100644 --- a/addons/storyshots/storyshots-core/tsconfig.json +++ b/addons/storyshots/storyshots-core/tsconfig.json @@ -3,8 +3,8 @@ "include": [ "src/**/*.ts" ], - "compileOnSave": false, "compilerOptions": { - "rootDir": "./src" + "rootDir": "./src", + "experimentalDecorators": true } } diff --git a/app/angular/index.d.ts b/app/angular/index.d.ts index 5fb420e543f0..6675e3358162 100644 --- a/app/angular/index.d.ts +++ b/app/angular/index.d.ts @@ -1,5 +1,28 @@ -import { NgModuleMetadata, ICollection } from './dist/client/preview/angular/types'; -export { moduleMetadata } from './dist/client/preview/angular/decorators'; +/* + * ATTENTION: + * - moduleMetadata + * - NgModuleMetadata + * - ICollection + * + * These typings are coped out of decorators.d.ts and types.d.ts in order to fix a bug with tsc + * It was imported out of dist before which was not the proper way of exporting public API + * + * This can be fixed by migrating app/angular to typescript + */ +export declare const moduleMetadata: ( + metadata: Partial +) => (storyFn: () => any) => any; + +export interface NgModuleMetadata { + declarations?: any[]; + entryComponents?: any[]; + imports?: any[]; + schemas?: any[]; + providers?: any[]; +} +export interface ICollection { + [p: string]: any; +} export interface IStorybookStory { name: string; @@ -36,10 +59,16 @@ export interface IApi { declare module '@storybook/angular' { export function storiesOf(kind: string, module: NodeModule): IApi; + export function setAddon(addon: any): void; + export function addDecorator(decorator: any): IApi; + export function addParameters(parameters: any): IApi; + export function configure(loaders: () => void, module: NodeModule): void; + export function getStorybook(): IStoribookSection[]; + export function forceReRender(): void; } diff --git a/app/angular/src/client/preview/index.d.ts b/app/angular/src/client/preview/index.d.ts index b053e1ac3b8b..bd13704d6e87 100644 --- a/app/angular/src/client/preview/index.d.ts +++ b/app/angular/src/client/preview/index.d.ts @@ -1,3 +1,5 @@ +import { IApi, IStoribookSection } from '../../../index'; + export function storiesOf(kind: string, module: NodeModule): IApi; export function setAddon(addon: any): void; export function addDecorator(decorator: any): IApi; diff --git a/app/angular/src/server/build.js b/app/angular/src/server/build.js old mode 100755 new mode 100644 diff --git a/app/angular/src/server/index.js b/app/angular/src/server/index.js old mode 100755 new mode 100644 diff --git a/app/angular/tsconfig.json b/app/angular/tsconfig.json index 84fb13689add..48b8f369e8ea 100644 --- a/app/angular/tsconfig.json +++ b/app/angular/tsconfig.json @@ -5,6 +5,14 @@ ], "compileOnSave": false, "compilerOptions": { - "rootDir": "./src" + "outDir": "dist", + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "declaration": true, + "rootDir": "./src", + "lib": [ + "es2017", + "dom" + ] } } diff --git a/examples/angular-cli/.storybook/webpack.config.ts b/examples/angular-cli/.storybook/webpack.config.ts index e4b756c7aa8d..3a2d1f390e3f 100644 --- a/examples/angular-cli/.storybook/webpack.config.ts +++ b/examples/angular-cli/.storybook/webpack.config.ts @@ -1,6 +1,6 @@ -const path = require('path'); +import { resolve } from 'path'; -module.exports = async ({ config }) => { +module.exports = async ({ config }: { config: any }) => { config.module.rules.push({ test: [/\.stories\.tsx?$/, /index\.ts$/], loaders: [ @@ -11,7 +11,7 @@ module.exports = async ({ config }) => { }, }, ], - include: [path.resolve(__dirname, '../src')], + include: [resolve(__dirname, '../src')], enforce: 'pre', }); return config; diff --git a/examples/angular-cli/package.json b/examples/angular-cli/package.json index 09e096d8270a..270b21f4f494 100644 --- a/examples/angular-cli/package.json +++ b/examples/angular-cli/package.json @@ -57,6 +57,6 @@ "jest-preset-angular": "^6.0.1", "protractor": "~5.4.2", "ts-node": "~8.0.3", - "typescript": "^3.3.3333" + "typescript": "^3.4.1" } } diff --git a/examples/angular-cli/tsconfig.json b/examples/angular-cli/tsconfig.json index eefc14d2b741..873ddb613f1d 100644 --- a/examples/angular-cli/tsconfig.json +++ b/examples/angular-cli/tsconfig.json @@ -6,7 +6,6 @@ "compilerOptions": { "outDir": "./dist/out-tsc", "sourceMap": true, - "declaration": false, "moduleResolution": "node", "emitDecoratorMetadata": true, "experimentalDecorators": true, diff --git a/examples/cra-ts-kitchen-sink/package.json b/examples/cra-ts-kitchen-sink/package.json index 21a15e754fde..9785ff82fa22 100644 --- a/examples/cra-ts-kitchen-sink/package.json +++ b/examples/cra-ts-kitchen-sink/package.json @@ -39,6 +39,6 @@ "react-scripts": "^2.1.3", "tslint": "^5.14.0", "tslint-config-airbnb": "^5.11.1", - "typescript": "^3.3.3333" + "typescript": "^3.4.1" } } diff --git a/examples/cra-ts-kitchen-sink/tsconfig.json b/examples/cra-ts-kitchen-sink/tsconfig.json index fbdbe2a6867d..69d9d5934107 100644 --- a/examples/cra-ts-kitchen-sink/tsconfig.json +++ b/examples/cra-ts-kitchen-sink/tsconfig.json @@ -12,10 +12,12 @@ "strict": true, "forceConsistentCasingInFileNames": true, "resolveJsonModule": true, - "isolatedModules": true, - "noEmit": true + "isolatedModules": true }, "include": [ "src" + ], + "exclude": [ + "src/setupTests.js" ] } diff --git a/examples/official-storybook/tests/__snapshots__/storyshots.test.js.snap b/examples/official-storybook/tests/__snapshots__/storyshots.test.js.snap index bea339bf46fb..9d9615ef07de 100644 --- a/examples/official-storybook/tests/__snapshots__/storyshots.test.js.snap +++ b/examples/official-storybook/tests/__snapshots__/storyshots.test.js.snap @@ -7891,7 +7891,6 @@ exports[`Storyshots UI|Sidebar/Sidebar loading 1`] = ` .emotion-11.emotion-11 > * { -webkit-animation: animation-0 1.5s ease-in-out infinite; animation: animation-0 1.5s ease-in-out infinite; - background: rgba(0,0,0,.1); color: transparent; cursor: progress; } @@ -7924,7 +7923,6 @@ exports[`Storyshots UI|Sidebar/Sidebar loading 1`] = ` .emotion-19.emotion-19 > * { -webkit-animation: animation-0 1.5s ease-in-out infinite; animation: animation-0 1.5s ease-in-out infinite; - background: rgba(0,0,0,.1); color: transparent; cursor: progress; } @@ -7957,7 +7955,6 @@ exports[`Storyshots UI|Sidebar/Sidebar loading 1`] = ` .emotion-27.emotion-27 > * { -webkit-animation: animation-0 1.5s ease-in-out infinite; animation: animation-0 1.5s ease-in-out infinite; - background: rgba(0,0,0,.1); color: transparent; cursor: progress; } @@ -7990,7 +7987,6 @@ exports[`Storyshots UI|Sidebar/Sidebar loading 1`] = ` .emotion-31.emotion-31 > * { -webkit-animation: animation-0 1.5s ease-in-out infinite; animation: animation-0 1.5s ease-in-out infinite; - background: rgba(0,0,0,.1); color: transparent; cursor: progress; } @@ -8254,7 +8250,6 @@ exports[`Storyshots UI|Sidebar/Sidebar loading 1`] = ` .emotion-11.emotion-11 > * { -webkit-animation: animation-0 1.5s ease-in-out infinite; animation: animation-0 1.5s ease-in-out infinite; - background: rgba(0,0,0,.1); color: transparent; cursor: progress; } @@ -8287,7 +8282,6 @@ exports[`Storyshots UI|Sidebar/Sidebar loading 1`] = ` .emotion-19.emotion-19 > * { -webkit-animation: animation-0 1.5s ease-in-out infinite; animation: animation-0 1.5s ease-in-out infinite; - background: rgba(0,0,0,.1); color: transparent; cursor: progress; } @@ -8320,7 +8314,6 @@ exports[`Storyshots UI|Sidebar/Sidebar loading 1`] = ` .emotion-27.emotion-27 > * { -webkit-animation: animation-0 1.5s ease-in-out infinite; animation: animation-0 1.5s ease-in-out infinite; - background: rgba(0,0,0,.1); color: transparent; cursor: progress; } @@ -8353,7 +8346,6 @@ exports[`Storyshots UI|Sidebar/Sidebar loading 1`] = ` .emotion-31.emotion-31 > * { -webkit-animation: animation-0 1.5s ease-in-out infinite; animation: animation-0 1.5s ease-in-out infinite; - background: rgba(0,0,0,.1); color: transparent; cursor: progress; } @@ -12939,7 +12931,6 @@ exports[`Storyshots UI|Sidebar/SidebarItem loading 1`] = ` .emotion-3.emotion-3 > * { -webkit-animation: animation-0 1.5s ease-in-out infinite; animation: animation-0 1.5s ease-in-out infinite; - background: rgba(0,0,0,.1); color: transparent; cursor: progress; } @@ -13044,7 +13035,6 @@ exports[`Storyshots UI|Sidebar/SidebarItem loading 1`] = ` .emotion-3.emotion-3 > * { -webkit-animation: animation-0 1.5s ease-in-out infinite; animation: animation-0 1.5s ease-in-out infinite; - background: rgba(0,0,0,.1); color: transparent; cursor: progress; } @@ -15154,7 +15144,6 @@ exports[`Storyshots UI|Sidebar/SidebarStories loading 1`] = ` .emotion-3.emotion-3 > * { -webkit-animation: animation-0 1.5s ease-in-out infinite; animation: animation-0 1.5s ease-in-out infinite; - background: rgba(0,0,0,.1); color: transparent; cursor: progress; } @@ -15187,7 +15176,6 @@ exports[`Storyshots UI|Sidebar/SidebarStories loading 1`] = ` .emotion-11.emotion-11 > * { -webkit-animation: animation-0 1.5s ease-in-out infinite; animation: animation-0 1.5s ease-in-out infinite; - background: rgba(0,0,0,.1); color: transparent; cursor: progress; } @@ -15220,7 +15208,6 @@ exports[`Storyshots UI|Sidebar/SidebarStories loading 1`] = ` .emotion-19.emotion-19 > * { -webkit-animation: animation-0 1.5s ease-in-out infinite; animation: animation-0 1.5s ease-in-out infinite; - background: rgba(0,0,0,.1); color: transparent; cursor: progress; } @@ -15253,7 +15240,6 @@ exports[`Storyshots UI|Sidebar/SidebarStories loading 1`] = ` .emotion-23.emotion-23 > * { -webkit-animation: animation-0 1.5s ease-in-out infinite; animation: animation-0 1.5s ease-in-out infinite; - background: rgba(0,0,0,.1); color: transparent; cursor: progress; } @@ -15366,7 +15352,6 @@ exports[`Storyshots UI|Sidebar/SidebarStories loading 1`] = ` .emotion-3.emotion-3 > * { -webkit-animation: animation-0 1.5s ease-in-out infinite; animation: animation-0 1.5s ease-in-out infinite; - background: rgba(0,0,0,.1); color: transparent; cursor: progress; } @@ -15399,7 +15384,6 @@ exports[`Storyshots UI|Sidebar/SidebarStories loading 1`] = ` .emotion-11.emotion-11 > * { -webkit-animation: animation-0 1.5s ease-in-out infinite; animation: animation-0 1.5s ease-in-out infinite; - background: rgba(0,0,0,.1); color: transparent; cursor: progress; } @@ -15432,7 +15416,6 @@ exports[`Storyshots UI|Sidebar/SidebarStories loading 1`] = ` .emotion-19.emotion-19 > * { -webkit-animation: animation-0 1.5s ease-in-out infinite; animation: animation-0 1.5s ease-in-out infinite; - background: rgba(0,0,0,.1); color: transparent; cursor: progress; } @@ -15465,7 +15448,6 @@ exports[`Storyshots UI|Sidebar/SidebarStories loading 1`] = ` .emotion-23.emotion-23 > * { -webkit-animation: animation-0 1.5s ease-in-out infinite; animation: animation-0 1.5s ease-in-out infinite; - background: rgba(0,0,0,.1); color: transparent; cursor: progress; } diff --git a/lib/cli/test/fixtures/angular-cli-v6/src/polyfills.ts b/lib/cli/test/fixtures/angular-cli-v6/src/polyfills.ts index d310405a6817..9a4296c3314a 100644 --- a/lib/cli/test/fixtures/angular-cli-v6/src/polyfills.ts +++ b/lib/cli/test/fixtures/angular-cli-v6/src/polyfills.ts @@ -38,7 +38,7 @@ // import 'classlist.js'; // Run `npm install --save classlist.js`. /** IE10 and IE11 requires the following for the Reflect API. */ -// import 'core-js/es6/reflect'; +import 'core-js/es6/reflect'; /** Evergreen browsers require these. **/ diff --git a/lib/cli/test/fixtures/angular-cli-v7/src/polyfills.ts b/lib/cli/test/fixtures/angular-cli-v7/src/polyfills.ts index ee8b84da807c..744b692ea8cf 100644 --- a/lib/cli/test/fixtures/angular-cli-v7/src/polyfills.ts +++ b/lib/cli/test/fixtures/angular-cli-v7/src/polyfills.ts @@ -45,7 +45,8 @@ // import 'classlist.js'; // Run `npm install --save classlist.js`. /** IE10 and IE11 requires the following for the Reflect API. */ -// import 'core-js/es6/reflect'; +import 'core-js/es6/reflect'; +import 'core-js/es7/reflect'; /** * Web Animations `@angular/platform-browser/animations` diff --git a/lib/cli/test/fixtures/react_native_scripts/package.json b/lib/cli/test/fixtures/react_native_scripts/package.json index 0305422b7966..b59679dbe7f9 100644 --- a/lib/cli/test/fixtures/react_native_scripts/package.json +++ b/lib/cli/test/fixtures/react_native_scripts/package.json @@ -4,10 +4,10 @@ "private": true, "main": "node_modules/expo/AppEntry.js", "scripts": { - "start": "expo start", "android": "expo start --android", + "eject": "expo eject", "ios": "expo start --ios", - "eject": "expo eject" + "start": "expo start" }, "dependencies": { "expo": "^32.0.0", diff --git a/lib/client-logger/package.json b/lib/client-logger/package.json index 24cff5a45525..456456881f6f 100644 --- a/lib/client-logger/package.json +++ b/lib/client-logger/package.json @@ -20,10 +20,10 @@ "scripts": { "prepare": "node ../../scripts/prepare.js" }, - "publishConfig": { - "access": "public" - }, "dependencies": { "core-js": "^2.6.5" + }, + "publishConfig": { + "access": "public" } } diff --git a/lib/components/src/tooltip/__snapshots__/ListItem.stories.storyshot b/lib/components/src/tooltip/__snapshots__/ListItem.stories.storyshot index d8481a0e4e68..953ec2576b8b 100644 --- a/lib/components/src/tooltip/__snapshots__/ListItem.stories.storyshot +++ b/lib/components/src/tooltip/__snapshots__/ListItem.stories.storyshot @@ -242,7 +242,6 @@ exports[`Storyshots basics|Tooltip/ListItem all 1`] = ` color: #333333; -webkit-animation: animation-0 1.5s ease-in-out infinite; animation: animation-0 1.5s ease-in-out infinite; - background: rgba(0,0,0,.1); color: transparent; cursor: progress; } @@ -947,7 +946,6 @@ exports[`Storyshots basics|Tooltip/ListItem loading 1`] = ` color: #333333; -webkit-animation: animation-0 1.5s ease-in-out infinite; animation: animation-0 1.5s ease-in-out infinite; - background: rgba(0,0,0,.1); color: transparent; cursor: progress; } diff --git a/lib/core-events/package.json b/lib/core-events/package.json index 07f51c79b3e2..b3ce6d15c2e4 100644 --- a/lib/core-events/package.json +++ b/lib/core-events/package.json @@ -20,10 +20,10 @@ "scripts": { "prepare": "node ../../scripts/prepare.js" }, - "publishConfig": { - "access": "public" - }, "dependencies": { "core-js": "^2.6.5" + }, + "publishConfig": { + "access": "public" } } diff --git a/lib/core/src/server/common/babel.js b/lib/core/src/server/common/babel.js index 4283275696d0..2657bff8439b 100644 --- a/lib/core/src/server/common/babel.js +++ b/lib/core/src/server/common/babel.js @@ -16,7 +16,10 @@ export default ({ configType }) => { return { presets: [ - [require.resolve('@babel/preset-env'), { shippedProposals: true, useBuiltIns: 'usage', corejs: 2 }], + [ + require.resolve('@babel/preset-env'), + { shippedProposals: true, useBuiltIns: 'usage', corejs: 2 }, + ], ...prodPresets, ], plugins: [ diff --git a/lib/router/package.json b/lib/router/package.json index 476115e204cf..b96e8b67ad70 100644 --- a/lib/router/package.json +++ b/lib/router/package.json @@ -28,14 +28,14 @@ "memoizerific": "^1.11.3", "qs": "^6.6.0" }, + "devDependencies": { + "@types/reach__router": "^1.2.3" + }, "peerDependencies": { "react": "*", "react-dom": "*" }, "publishConfig": { "access": "public" - }, - "devDependencies": { - "@types/reach__router": "^1.2.3" } } diff --git a/lib/router/tsconfig.json b/lib/router/tsconfig.json index c477a63e62bf..48a78502378b 100644 --- a/lib/router/tsconfig.json +++ b/lib/router/tsconfig.json @@ -8,7 +8,6 @@ "src/**/*" ], "exclude": [ - "dist", "src/tests/**/*", "src/__tests__/**/*" ] diff --git a/lib/theming/src/animation.ts b/lib/theming/src/animation.ts index bda09e7fd97b..c92be3f7cc97 100644 --- a/lib/theming/src/animation.ts +++ b/lib/theming/src/animation.ts @@ -1,5 +1,4 @@ import { css, keyframes } from '@emotion/core'; -import { color } from './base'; export const easing = { rubber: 'cubic-bezier(0.175, 0.885, 0.335, 1.05)', @@ -34,7 +33,6 @@ const jiggle = keyframes` const inlineGlow = css` animation: ${glow} 1.5s ease-in-out infinite; - background: ${color.border}; color: transparent; cursor: progress; `; diff --git a/lib/theming/src/typings.d.ts b/lib/theming/src/typings.d.ts index a767a7664a30..151bb56deda3 100644 --- a/lib/theming/src/typings.d.ts +++ b/lib/theming/src/typings.d.ts @@ -1,4 +1,2 @@ // todo the following packages need definition files or a TS migration -declare module 'lodash.mergewith'; -declare module 'lodash.isequal'; declare module 'react-inspector'; diff --git a/lib/ui/paths.js b/lib/ui/paths.js index 7d032622154e..76ca41e804b2 100644 --- a/lib/ui/paths.js +++ b/lib/ui/paths.js @@ -6,6 +6,7 @@ module.exports = { '@emotion/core': dirname(require.resolve('@emotion/core/package.json')), '@emotion/styled': dirname(require.resolve('@emotion/styled/package.json')), '@storybook/addons': dirname(require.resolve('@storybook/addons/package.json')), + '@storybook/api': dirname(require.resolve('@storybook/api/package.json')), '@storybook/channels': dirname(require.resolve('@storybook/channels/package.json')), '@storybook/components': dirname(require.resolve('@storybook/components/package.json')), '@storybook/core-events': dirname(require.resolve('@storybook/core-events/package.json')), diff --git a/lib/ui/scripts/createDlls.js b/lib/ui/scripts/createDlls.js index e586b0cc83c5..cee4c21f7b88 100644 --- a/lib/ui/scripts/createDlls.js +++ b/lib/ui/scripts/createDlls.js @@ -23,16 +23,17 @@ const run = () => '@emotion/core', '@emotion/styled', '@storybook/addons', + '@storybook/api', + '@storybook/components', '@storybook/core-events', '@storybook/theming', - '@storybook/components', 'airbnb-js-shims', 'core-js/es6/symbol', 'core-js/fn/array/iterator', 'emotion-theming', 'prop-types', - 'react-dom', 'react', + 'react-dom', 'regenerator-runtime/runtime', resolveLocal('../dist/index.js'), ], diff --git a/lib/ui/src/keyboard/keyCodes.ts b/lib/ui/src/keyboard/keyCodes.ts index d6f810d361ae..027d9a4d5297 100644 --- a/lib/ui/src/keyboard/keyCodes.ts +++ b/lib/ui/src/keyboard/keyCodes.ts @@ -1,7 +1,7 @@ // tslint:disable-next-line:no-implicit-dependencies import { OperatingSystem } from './platform'; -export const enum KeyCode { +export enum KeyCode { Unknown = 0, Backspace = 1, @@ -354,15 +354,15 @@ const userSettingsGeneralMap = new KeyCodeStrMap(); })(); // tslint:disable-next-line:no-namespace -export namespace KeyCodeUtils { - export function toString(keyCode: KeyCode): string { - return uiMap.keyCodeToStr(keyCode); - } +// export namespace KeyCodeUtils { +// export function toString(keyCode: KeyCode): string { +// return uiMap.keyCodeToStr(keyCode); +// } - export function fromString(key: string): KeyCode { - return uiMap.strToKeyCode(key); - } -} +// export function fromString(key: string): KeyCode { +// return uiMap.strToKeyCode(key); +// } +// } /** * Binary encoding strategy: @@ -378,7 +378,7 @@ export namespace KeyCodeUtils { * ``` */ -const enum BinaryKeybindingsMask { +enum BinaryKeybindingsMask { // tslint:disable:no-bitwise CtrlCmd = (1 << 11) >>> 0, Shift = (1 << 10) >>> 0, @@ -387,7 +387,7 @@ const enum BinaryKeybindingsMask { KeyCode = 0x000000ff, } -export const enum KeyMod { +export enum KeyMod { CtrlCmd = (1 << 11) >>> 0, Shift = (1 << 10) >>> 0, Alt = (1 << 9) >>> 0, @@ -399,7 +399,7 @@ export function KeyChord(firstPart: number, secondPart: number): number { return (firstPart | chordPart) >>> 0; } -export const enum KeybindingType { +export enum KeybindingType { Simple = 1, Chord = 2, } diff --git a/lib/ui/src/keyboard/platform.ts b/lib/ui/src/keyboard/platform.ts index 563a5e488f37..46116eb7cf5f 100644 --- a/lib/ui/src/keyboard/platform.ts +++ b/lib/ui/src/keyboard/platform.ts @@ -6,7 +6,7 @@ let _isLinux = false; let _locale: string | undefined; let _language: string | undefined; -export const enum Platform { +export enum Platform { Mac, Linux, Windows, @@ -25,7 +25,7 @@ if (typeof navigator === 'object') { _language = _locale; } -export const enum OperatingSystem { +export enum OperatingSystem { Windows = 1, Macintosh = 2, Linux = 3, diff --git a/lib/ui/src/keyboard/scanCode.ts b/lib/ui/src/keyboard/scanCode.ts index 1b0b4498762d..e0acf64fec54 100644 --- a/lib/ui/src/keyboard/scanCode.ts +++ b/lib/ui/src/keyboard/scanCode.ts @@ -3,7 +3,7 @@ import { KeyCode } from './keyCodes'; /** * keyboardEvent.code */ -export const enum ScanCode { +export enum ScanCode { None, Hyper, diff --git a/lib/ui/tsconfig.json b/lib/ui/tsconfig.json index 4b566356cc21..46410055c136 100644 --- a/lib/ui/tsconfig.json +++ b/lib/ui/tsconfig.json @@ -4,5 +4,7 @@ "rootDir": "./src" }, "include": ["src/**/*"], - "exclude": [] + "exclude": [ + "src/__tests__/**/*" + ] } diff --git a/package.json b/package.json index 305918afd01c..9f48ad8f4c61 100644 --- a/package.json +++ b/package.json @@ -25,13 +25,16 @@ "chromatic": "npm --prefix examples/official-storybook run chromatic", "coverage": "codecov", "danger": "danger", - "dev": "concurrently --kill-others \"yarn dev:ts\" \"yarn dev:js\"", - "dev:js": "lerna exec --parallel -- cross-env-shell node \\$LERNA_ROOT_PATH/scripts/watch-js.js", - "dev:ts": "lerna exec --parallel -- cross-env-shell node \\$LERNA_ROOT_PATH/scripts/watch-ts.js", + "dev": "concurrently --kill-others \"yarn dev:tsc\" \"yarn dev:babel\"", + "dev:babel": "lerna exec --scope @storybook/* --parallel -- cross-env-shell node \\$LERNA_ROOT_PATH/scripts/watch-babel.js", + "dev:check-types": "tsc --noEmit", + "dev:js": "echo 'DEPRECATED: Please use yarn dev:babel' && yarn dev:babel", + "dev:ts": "echo 'DEPRECATED: Please use yarn dev:tsc' && yarn dev:tsc", + "dev:tsc": "lerna exec --scope @storybook/* --parallel -- cross-env-shell node \\$LERNA_ROOT_PATH/scripts/watch-tsc.js", "docs:build": "npm --prefix docs run build", "docs:dev": "npm --prefix docs run dev", "github-release": "github-release-from-changelog", - "lint": "yarn lint:js . && yarn lint:ts **/*.ts && yarn lint:md .", + "lint": "yarn lint:js . && yarn lint:ts **/*.ts **/.tsx && yarn lint:md .", "lint:ci": "yarn lint:js --format ./node_modules/eslint-teamcity/index.js . && yarn lint:ts **/*.ts && yarn lint:md .", "lint:js": "cross-env NODE_ENV=production eslint --cache --cache-location=.cache/eslint --ext .js,.jsx,.json,.html --report-unused-disable-directives", "lint:md": "remark -q", @@ -89,15 +92,21 @@ "@babel/cli": "^7.2.3", "@babel/core": "^7.3.4", "@babel/plugin-proposal-class-properties": "^7.3.3", + "@babel/plugin-proposal-decorators": "^7.3.0", "@babel/plugin-proposal-export-default-from": "^7.2.0", + "@babel/plugin-proposal-object-rest-spread": "^7.2.0", "@babel/plugin-transform-react-constant-elements": "^7.2.0", "@babel/preset-env": "^7.4.1", "@babel/preset-flow": "^7.0.0", "@babel/preset-react": "^7.0.0", + "@babel/preset-typescript": "^7.1.0", + "@emotion/snapshot-serializer": "^0.8.2", "@types/common-tags": "^1.8.0", "@types/jest": "^24.0.11", - "@types/node": "^11.11.0", + "@types/lodash": "^4.14.123", + "@types/node": "~11.11.3", "@types/react": "^16.8.4", + "@types/webpack": "^4.4.25", "@types/webpack-env": "^1.13.7", "babel-core": "^7.0.0-bridge.0", "babel-eslint": "^10.0.1", @@ -171,7 +180,7 @@ "tslint": "~5.14.0", "tslint-config-prettier": "^1.18.0", "tslint-plugin-prettier": "^2.0.1", - "typescript": "^3.3.3333", + "typescript": "^3.4.1", "weak": "^1.0.1" }, "resolutions": { diff --git a/scripts/compile-babel.js b/scripts/compile-babel.js new file mode 100644 index 000000000000..eaa97968e4c0 --- /dev/null +++ b/scripts/compile-babel.js @@ -0,0 +1,78 @@ +/* eslint-disable no-console */ +const fs = require('fs'); +const path = require('path'); +const shell = require('shelljs'); + +function getCommand(watch) { + const babel = path.join(__dirname, '..', 'node_modules', '.bin', 'babel'); + + const ignore = [ + '**/__mocks__/', + '**/tests/', + '**/__tests__/', + '**/*.test.*', + '**/stories/', + '**/*.story.*', + '**/*.stories.*', + '**/__snapshots__', + '**/*.d.ts', + ]; + + const args = [ + './src', + '--out-dir ./dist', + `--config-file ${path.resolve(__dirname, '../.babelrc.js')}`, + `--copy-files`, + `--ignore "${ignore.join('","')}"`, + ]; + + /* + * angular needs to be compiled with tsc; a compilation with babel is possible but throws + * runtime errors because of the the babel decorators plugin + * Only transpile .js and let tsc do the job for .ts files + */ + if ( + process.cwd().includes(path.join('app', 'angular')) || + process.cwd().includes(path.join('addons', 'storyshots')) + ) { + args.push(`--extensions ".js"`); + } else { + args.push(`--extensions ".js,.jsx,.ts,.tsx"`); + } + + if (watch) { + args.push('-w'); + } + + return `${babel} ${args.join(' ')}`; +} + +function handleExit(code, stderr, errorCallback) { + if (code !== 0) { + if (errorCallback && typeof errorCallback === 'function') { + errorCallback(stderr); + } + + shell.exit(code); + } +} + +function babelify(options = {}) { + const { watch = false, silent = true, errorCallback } = options; + + if (!fs.existsSync('src')) { + if (!silent) { + console.log('No src dir'); + } + return; + } + + const command = getCommand(watch); + const { code, stderr } = shell.exec(command, { silent }); + + handleExit(code, stderr, errorCallback); +} + +module.exports = { + babelify, +}; diff --git a/scripts/compile-js.js b/scripts/compile-js.js deleted file mode 100644 index 196fb3b99b74..000000000000 --- a/scripts/compile-js.js +++ /dev/null @@ -1,53 +0,0 @@ -/* eslint-disable no-console */ -const fs = require('fs'); -const path = require('path'); -const shell = require('shelljs'); - -function getCommand(watch) { - const babel = path.join(__dirname, '..', 'node_modules', '.bin', 'babel'); - - const args = [ - '--ignore **/__mocks__/,**/tests/*,**/__tests__/,**/**.test.js,**/stories/,**/**.story.js,**/**.stories.js,**/__snapshots__', - './src --out-dir ./dist', - '--copy-files', - '--ignore *.ts', - '--ignore *.tsx', - `--config-file ${path.resolve(__dirname, '../.babelrc.js')}`, - ]; - - if (watch) { - args.push('-w'); - } - - return `${babel} ${args.join(' ')}`; -} - -function handleExit(code, errorCallback) { - if (code !== 0) { - if (errorCallback && typeof errorCallback === 'function') { - errorCallback(); - } - - shell.exit(code); - } -} - -function babelify(options = {}) { - const { watch = false, silent = true, errorCallback } = options; - - if (!fs.existsSync('src')) { - if (!silent) { - console.log('No src dir'); - } - return; - } - - const command = getCommand(watch); - const { code } = shell.exec(command, { silent }); - - handleExit(code, errorCallback); -} - -module.exports = { - babelify, -}; diff --git a/scripts/compile-ts.js b/scripts/compile-tsc.js similarity index 58% rename from scripts/compile-ts.js rename to scripts/compile-tsc.js index d7d9a3948615..29b361348a99 100644 --- a/scripts/compile-ts.js +++ b/scripts/compile-tsc.js @@ -1,4 +1,5 @@ /* eslint-disable no-console */ +// tslint:disable:no-console const fs = require('fs'); const path = require('path'); const shell = require('shelljs'); @@ -6,7 +7,19 @@ const shell = require('shelljs'); function getCommand(watch) { const tsc = path.join(__dirname, '..', 'node_modules', '.bin', 'tsc'); - const args = ['--outDir ./dist', '-d true', '--listEmittedFiles true']; + const args = ['--outDir ./dist', '--listEmittedFiles true']; + + /** + * Only emit declarations if it does not need to be compiled with tsc + * Currently, angular and storyshots (that contains an angular component) need to be compiled + * with tsc. (see comments in compile-babel.js) + */ + if ( + !process.cwd().includes(path.join('app', 'angular')) && + !process.cwd().includes(path.join('addons', 'storyshots')) + ) { + args.push('--emitDeclarationOnly --declaration true'); + } if (watch) { args.push('-w'); @@ -15,12 +28,11 @@ function getCommand(watch) { return `${tsc} ${args.join(' ')}`; } -function handleExit(code, errorCallback) { +function handleExit(code, stderr, errorCallback) { if (code !== 0) { if (errorCallback && typeof errorCallback === 'function') { - errorCallback(); + errorCallback(stderr); } - shell.exit(code); } } @@ -47,9 +59,9 @@ function tscfy(options = {}) { } const command = getCommand(watch); - const { code } = shell.exec(command, { silent }); + const { code, stderr } = shell.exec(command, { silent }); - handleExit(code, errorCallback); + handleExit(code, stderr, errorCallback); } module.exports = { diff --git a/scripts/prepare.js b/scripts/prepare.js index 177e1c5cd1e7..74af9aed12a0 100644 --- a/scripts/prepare.js +++ b/scripts/prepare.js @@ -1,10 +1,12 @@ /* eslint-disable no-console */ +/* tslint:disable:no-console */ const path = require('path'); const shell = require('shelljs'); const chalk = require('chalk'); +const fs = require('fs'); const log = require('npmlog'); -const { babelify } = require('./compile-js'); -const { tscfy } = require('./compile-ts'); +const { babelify } = require('./compile-babel'); +const { tscfy } = require('./compile-tsc'); function getPackageJson() { const modulePath = path.resolve('./'); @@ -17,19 +19,21 @@ function removeDist() { shell.rm('-rf', 'dist'); } -function removeTsFromDist() { +function cleanup() { // add .ts filtering to babel args and remove after babel - 7 is adopted // --copy-files option doesn't work with --ignore // https://github.com/babel/babel/issues/5404 - - const tsFiles = shell.find('dist').filter(tsFile => tsFile.match(/\.ts$/)); - - if (tsFiles.length) { - shell.rm(tsFiles); + if (fs.existsSync(path.join(process.cwd(), 'dist'))) { + // ^(?!.*\.d\.ts$).*\.(ts|tsx)$ => Remove everything except .d.ts files https://regex101.com/r/gEBQ0U/16 + const files = shell.find('dist').filter(tsFile => tsFile.match(/^(?!.*\.d\.ts$).*\.(ts|tsx)$/)); + if (files.length) { + shell.rm(files); + } } } -function logError(type, packageJson) { +function logError(type, packageJson, errorLogs) { + log.error(`FAILED (${type}) : ${errorLogs}`); log.error( `FAILED to compile ${type}: ${chalk.bold(`${packageJson.name}@${packageJson.version}`)}` ); @@ -38,12 +42,9 @@ function logError(type, packageJson) { const packageJson = getPackageJson(); removeDist(); -if (packageJson && packageJson.types && packageJson.types.indexOf('d.ts') !== -1) { - tscfy({ errorCallback: () => logError('ts', packageJson) }); -} else { - babelify({ errorCallback: () => logError('js', packageJson) }); - removeTsFromDist(); - tscfy({ errorCallback: () => logError('ts', packageJson) }); -} +babelify({ errorCallback: errorLogs => logError('js', packageJson, errorLogs) }); +cleanup(); + +tscfy({ errorCallback: errorLogs => logError('ts', packageJson, errorLogs) }); console.log(chalk.gray(`Built: ${chalk.bold(`${packageJson.name}@${packageJson.version}`)}`)); diff --git a/scripts/watch-js.js b/scripts/watch-babel.js similarity index 75% rename from scripts/watch-js.js rename to scripts/watch-babel.js index fa55099c9d71..c90303503727 100644 --- a/scripts/watch-js.js +++ b/scripts/watch-babel.js @@ -1,4 +1,4 @@ -const { babelify } = require('./compile-js'); +const { babelify } = require('./compile-babel'); babelify({ watch: true, diff --git a/scripts/watch-ts.js b/scripts/watch-tsc.js similarity index 77% rename from scripts/watch-ts.js rename to scripts/watch-tsc.js index 3cabb8386a01..24c36717d986 100644 --- a/scripts/watch-ts.js +++ b/scripts/watch-tsc.js @@ -1,4 +1,4 @@ -const { tscfy } = require('./compile-ts'); +const { tscfy } = require('./compile-tsc'); tscfy({ watch: true, diff --git a/tsconfig.json b/tsconfig.json index bb7998f364be..2261ec059c1e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,13 +2,14 @@ "compileOnSave": false, "compilerOptions": { "baseUrl": ".", - "declaration": true, - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "skipLibCheck": true, + "incremental": false, "noImplicitAny": true, + "experimentalDecorators": true, + "emitDecoratorMetadata": true, "jsx": "react", "module": "commonjs", + "skipDefaultLibCheck": true, + "skipLibCheck": true, "allowSyntheticDefaultImports": true, "esModuleInterop": true, "target": "es5", @@ -20,5 +21,13 @@ "es2017", "dom" ] - } -} \ No newline at end of file + }, + "exclude": [ + "**/dist", + "node_modules", + "**/node_modules", + "**/*.spec.ts", + "**/__tests__", + "**/*.test.ts" + ] +} diff --git a/yarn.lock b/yarn.lock index b2d004459cc8..f37553581e7e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -336,6 +336,18 @@ "@babel/helper-replace-supers" "^7.3.4" "@babel/helper-split-export-declaration" "^7.0.0" +"@babel/helper-create-class-features-plugin@^7.4.0": + version "7.4.0" + resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.4.0.tgz#30fd090e059d021995c1762a5b76798fa0b51d82" + integrity sha512-2K8NohdOT7P6Vyp23QH4w2IleP8yG3UJsbRKwA4YP6H8fErcLkFuuEEqbF2/BYBKSNci/FWJiqm6R3VhM/QHgw== + dependencies: + "@babel/helper-function-name" "^7.1.0" + "@babel/helper-member-expression-to-functions" "^7.0.0" + "@babel/helper-optimise-call-expression" "^7.0.0" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-replace-supers" "^7.4.0" + "@babel/helper-split-export-declaration" "^7.4.0" + "@babel/helper-define-map@^7.1.0": version "7.1.0" resolved "https://registry.yarnpkg.com/@babel/helper-define-map/-/helper-define-map-7.1.0.tgz#3b74caec329b3c80c116290887c0dd9ae468c20c" @@ -569,6 +581,15 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-decorators" "^7.2.0" +"@babel/plugin-proposal-decorators@^7.3.0": + version "7.4.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-decorators/-/plugin-proposal-decorators-7.4.0.tgz#8e1bfd83efa54a5f662033afcc2b8e701f4bb3a9" + integrity sha512-d08TLmXeK/XbgCo7ZeZ+JaeZDtDai/2ctapTRsWWkkmy7G/cqz8DQN/HlWG7RR4YmfXxmExsbU3SuCjlM7AtUg== + dependencies: + "@babel/helper-create-class-features-plugin" "^7.4.0" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-decorators" "^7.2.0" + "@babel/plugin-proposal-export-default-from@^7.0.0", "@babel/plugin-proposal-export-default-from@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-export-default-from/-/plugin-proposal-export-default-from-7.2.0.tgz#737b0da44b9254b6152fe29bb99c64e5691f6f68" @@ -609,7 +630,7 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-object-rest-spread" "^7.2.0" -"@babel/plugin-proposal-object-rest-spread@^7.4.0": +"@babel/plugin-proposal-object-rest-spread@^7.2.0", "@babel/plugin-proposal-object-rest-spread@^7.4.0": version "7.4.0" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.4.0.tgz#e4960575205eadf2a1ab4e0c79f9504d5b82a97f" integrity sha512-uTNi8pPYyUH2eWHyYWWSYJKwKg34hhgl4/dbejEjL+64OhbHjTX7wEVWMQl82tEmdDsGeu77+s8HHLS627h6OQ== @@ -1589,6 +1610,14 @@ resolved "https://registry.yarnpkg.com/@emotion/sheet/-/sheet-0.9.2.tgz#74e5c6b5e489a1ba30ab246ab5eedd96916487c4" integrity sha512-pVBLzIbC/QCHDKJF2E82V2H/W/B004mDFQZiyo/MSR+VC4pV5JLG0TF/zgQDFvP3fZL/5RTPGEmXlYJBMUuJ+A== +"@emotion/snapshot-serializer@^0.8.2": + version "0.8.2" + resolved "https://registry.yarnpkg.com/@emotion/snapshot-serializer/-/snapshot-serializer-0.8.2.tgz#817a3d7aa8dc5a73da0ba33404fc1fd564679be7" + integrity sha512-R6K9N+jxoeigSN8tDntvTVxKYDY4eSutDETmAy9O5+DTneuGxobICHFp8F5/q0t3Q5GkKfJjDVlehbBUgYIDYA== + dependencies: + chalk "^2.4.1" + css "^2.2.1" + "@emotion/styled-base@^10.0.7": version "10.0.7" resolved "https://registry.yarnpkg.com/@emotion/styled-base/-/styled-base-10.0.7.tgz#87cee1043ffdf17690bdd96d7269a21f705bf224" @@ -2926,6 +2955,11 @@ dependencies: "@types/estree" "*" +"@types/anymatch@*": + version "1.3.1" + resolved "https://registry.yarnpkg.com/@types/anymatch/-/anymatch-1.3.1.tgz#336badc1beecb9dacc38bea2cf32adf627a8421a" + integrity sha512-/+CRPXpBDpo2RK9C68N3b2cOvO0Cf5B9aPijHsoDQTHivnGSObdOF2BRQOYjojWTDy6nQvMjmqRXIxH55VjxxA== + "@types/babel__core@^7.1.0": version "7.1.0" resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.0.tgz#710f2487dda4dcfd010ca6abb2b4dc7394365c51" @@ -3099,7 +3133,7 @@ resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d" integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA== -"@types/node@*", "@types/node@^11.11.0", "@types/node@~11.11.0": +"@types/node@*", "@types/node@~11.11.0": version "11.11.0" resolved "https://registry.yarnpkg.com/@types/node/-/node-11.11.0.tgz#070e9ce7c90e727aca0e0c14e470f9a93ffe9390" integrity sha512-D5Rt+HXgEywr3RQJcGlZUCTCx1qVbCZpVk3/tOOA6spLNZdGm8BU+zRgdRYDoF1pO3RuXLxADzMrF903JlQXqg== @@ -3119,6 +3153,11 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-9.6.46.tgz#bb2eeb0eeb58e401ef9e4e29abc4f81003ee767c" integrity sha512-W8W76mPzOkN1KuzB25yFIqv1ESj2gp8MILJByUnLcDhOZsuSaDhY8vXLEP9+6OWCqNe7W+3zh2L+rb8kg9rsFA== +"@types/node@~11.11.3": + version "11.11.5" + resolved "https://registry.yarnpkg.com/@types/node/-/node-11.11.5.tgz#0c57e12eb44d44e5b6735593925286553ee7cebf" + integrity sha512-pz6wNe/XwyesgfVX7P6B0hY3TnTAYXk6KSTLdpQfbuq3be+hnMoCuFzE+yLTskPdBwmNiGRL2TAsnF09aRugvQ== + "@types/npmlog@^4.1.1": version "4.1.1" resolved "https://registry.yarnpkg.com/@types/npmlog/-/npmlog-4.1.1.tgz#b51cf39a6324a4ede17ef72dfa58a64fbefb39c7" @@ -3229,11 +3268,23 @@ "@types/react" "*" "@types/webpack-env" "*" +"@types/tapable@*": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@types/tapable/-/tapable-1.0.4.tgz#b4ffc7dc97b498c969b360a41eee247f82616370" + integrity sha512-78AdXtlhpCHT0K3EytMpn4JNxaf5tbqbLcbIRoQIHzpTIyjpxLQKRoxU55ujBXAtg3Nl2h/XWvfDa9dsMOd0pQ== + "@types/tapable@1.0.2": version "1.0.2" resolved "https://registry.yarnpkg.com/@types/tapable/-/tapable-1.0.2.tgz#e13182e1b69871a422d7863e11a4a6f5b814a4bd" integrity sha512-42zEJkBpNfMEAvWR5WlwtTH22oDzcMjFsL9gDGExwF8X8WvAiw7Vwop7hPw03QT8TKfec83LwbHj6SvpqM4ELQ== +"@types/uglify-js@*": + version "3.0.4" + resolved "https://registry.yarnpkg.com/@types/uglify-js/-/uglify-js-3.0.4.tgz#96beae23df6f561862a830b4288a49e86baac082" + integrity sha512-SudIN9TRJ+v8g5pTG8RRCqfqTMNqgWCKKd3vtynhGzkIIjxaicNAMuY5TRadJ6tzDu3Dotf3ngaMILtmOdmWEQ== + dependencies: + source-map "^0.6.1" + "@types/unist@*", "@types/unist@^2.0.0": version "2.0.3" resolved "https://registry.yarnpkg.com/@types/unist/-/unist-2.0.3.tgz#9c088679876f374eb5983f150d4787aa6fb32d7e" @@ -3287,6 +3338,17 @@ "@types/source-list-map" "*" source-map "^0.6.1" +"@types/webpack@^4.4.25": + version "4.4.26" + resolved "https://registry.yarnpkg.com/@types/webpack/-/webpack-4.4.26.tgz#b52f605351f2ed60e6ce24fa7df39ab7abd03470" + integrity sha512-vs8LjgEZUQTBxotXbMf8s4jgykozkqjv6P0JRi+1BLh0n7LQUkMXfvsoPb5U/dBL1ay5Lu0c46G6FRmAZBhAUA== + dependencies: + "@types/anymatch" "*" + "@types/node" "*" + "@types/tapable" "*" + "@types/uglify-js" "*" + source-map "^0.6.0" + "@types/websql@^0.0.27": version "0.0.27" resolved "https://registry.yarnpkg.com/@types/websql/-/websql-0.0.27.tgz#621a666a7f02018e7cbb4abab956a25736c27d71" @@ -25633,10 +25695,10 @@ typescript@3.2.4: resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.2.4.tgz#c585cb952912263d915b462726ce244ba510ef3d" integrity sha512-0RNDbSdEokBeEAkgNbxJ+BLwSManFy9TeXz8uW+48j/xhEXv1ePME60olyzw2XzUqUBNAYFeJadIqAgNqIACwg== -typescript@^3.3.3333: - version "3.3.3333" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.3.3333.tgz#171b2c5af66c59e9431199117a3bcadc66fdcfd6" - integrity sha512-JjSKsAfuHBE/fB2oZ8NxtRTk5iGcg6hkYXMnZ3Wc+b2RSqejEqTaem11mHASMnFilHrax3sLK0GDzcJrekZYLw== +typescript@^3.4.1: + version "3.4.1" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.4.1.tgz#b6691be11a881ffa9a05765a205cb7383f3b63c6" + integrity sha512-3NSMb2VzDQm8oBTLH6Nj55VVtUEpe/rgkIzMir0qVoLyjDZlnMBva0U6vDiV3IH+sl/Yu6oP5QwsAQtHPmDd2Q== ua-parser-js@^0.7.18, ua-parser-js@^0.7.19: version "0.7.19"