Skip to content

Commit

Permalink
Merge pull request #20156 from storybookjs/tech/remove-prepare-babel
Browse files Browse the repository at this point in the history
Tech: cleanup babel prepare related code & dependencies
  • Loading branch information
ndelangen authored Jan 8, 2023
2 parents 16c344c + c43672e commit 429277c
Show file tree
Hide file tree
Showing 39 changed files with 718 additions and 2,487 deletions.
2 changes: 0 additions & 2 deletions code/.eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ scripts/storage
scripts/repros-generator
*.bundle.js
*.js.map
examples/ember-cli/.storybook/preview-head.html
examples/official-storybook/tests/addon-jest.test.js
ember-output
.yarn
!.remarkrc.js
Expand Down
6 changes: 0 additions & 6 deletions code/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,16 @@ dist
coverage/
*.lerna_backup
build
packages/examples/automated-*
/**/LICENSE
docs/public
packs/*.tgz
package-lock.json
.nvmrc
storybook-static
integration/__image_snapshots__/__diff_output__
.jest-test-results.json
lib/*.jar
lib/**/dll
/false
/addons/docs/common/config-*
built-storybooks
cypress/videos
cypress/screenshots
.verdaccio-cache
tsconfig.tsbuildinfo
junit.xml
Expand Down
2 changes: 0 additions & 2 deletions code/.yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ logFilters:
level: discard
- code: YN0076
level: discard
- level: discard
pattern: '@workspace:examples'
- level: discard
pattern: '@storybook/root@workspace:.'
- level: discard
Expand Down
6 changes: 2 additions & 4 deletions code/addons/storyshots-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@
"*.d.ts"
],
"scripts": {
"build-storybook": "sb build",
"example": "jest storyshot.test",
"prep": "../../../scripts/prepare/tsc.ts",
"storybook": "yarn sb dev -p 6006"
"prep": "../../../scripts/prepare/tsc.ts"
},
"dependencies": {
"@jest/transform": "^29.3.1",
Expand Down Expand Up @@ -72,6 +69,7 @@
"jest-preset-angular": "^8.3.2",
"jest-vue-preprocessor": "^1.7.1",
"react-test-renderer": "^16",
"rimraf": "^3.0.2",
"rxjs": "^6.6.3",
"vue-jest": "^5.0.0-alpha.8"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ function integrityTest(integrityOptions: any, stories2snapsConverter: any) {
const snapshotExtension = stories2snapsConverter.getSnapshotExtension();
const storyshots = glob.sync(`**/*${snapshotExtension}`, integrityOptions);

// @ts-expect-error (ts doesn't 'get' the extension happening on line 9)
expect(storyshots).notToBeAbandoned(stories2snapsConverter);
});
});
Expand Down
23 changes: 23 additions & 0 deletions code/addons/storyshots-core/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"extends": "./tsconfig.json",
"compileOnSave": false,
"compilerOptions": {
"target": "ES2020",
"module": "CommonJS",
"lib": ["es2020", "dom"],
"esModuleInterop": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"declaration": true,
"outDir": "dist",
"types": ["node"],
"skipLibCheck": true,
"resolveJsonModule": true,
"allowJs": true,
"pretty": true,
"noErrorTruncation": true,
"listEmittedFiles": false,
"noUnusedLocals": false
},
"include": ["src/**/*", "src/**/*.json"]
}
3 changes: 1 addition & 2 deletions code/addons/storyshots-core/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"declaration": true,
"jsx": "preserve",
"skipLibCheck": true,
"skipDefaultLibCheck": true,
"types": ["jest", "testing-library__jest-dom"]
"skipDefaultLibCheck": true
},
"include": ["src/**/*.ts"]
}
3 changes: 2 additions & 1 deletion code/addons/storyshots-puppeteer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
},
"devDependencies": {
"@types/puppeteer": "^5.4.0",
"puppeteer": "^2.0.0 || ^3.0.0"
"puppeteer": "^2.0.0 || ^3.0.0",
"rimraf": "^3.0.2"
},
"peerDependencies": {
"@storybook/addon-storyshots": "7.0.0-beta.20",
Expand Down
23 changes: 23 additions & 0 deletions code/addons/storyshots-puppeteer/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"extends": "./tsconfig.json",
"compileOnSave": false,
"compilerOptions": {
"target": "ES2020",
"module": "CommonJS",
"lib": ["es2020", "dom"],
"esModuleInterop": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"declaration": true,
"outDir": "dist",
"types": ["node"],
"skipLibCheck": true,
"resolveJsonModule": true,
"allowJs": true,
"pretty": true,
"noErrorTruncation": true,
"listEmittedFiles": false,
"noUnusedLocals": false
},
"include": ["src/**/*", "src/**/*.json"]
}
7 changes: 0 additions & 7 deletions code/cypress.json

This file was deleted.

4 changes: 0 additions & 4 deletions code/jest.init.base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import '@testing-library/jest-dom';
import { configure } from 'enzyme';
// @ts-expect-error (Converted from ts-ignore)
import Adapter from 'enzyme-adapter-react-16';
// @ts-expect-error (Converted from ts-ignore)
import regeneratorRuntime from 'regenerator-runtime';
import registerRequireContextHook from '@storybook/babel-plugin-require-context-hook/register';

registerRequireContextHook();
Expand All @@ -24,8 +22,6 @@ const localStorageMock = {
};
// @ts-expect-error (Converted from ts-ignore)
global.localStorage = localStorageMock;
// @ts-expect-error (Converted from ts-ignore)
global.regeneratorRuntime = regeneratorRuntime;

configure({ adapter: new Adapter() });

Expand Down
2 changes: 1 addition & 1 deletion code/lib/cli/src/generators/ANGULAR/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const generator: Generator = async (packageManager, npmOptions, options) => {
}
*/

// to the user's angular.json file. see: https://github.com/storybookjs/storybook/blob/next/examples/angular-cli/angular.json#L78
// to the user's angular.json file.

// then we want to add these scripts to package.json
// packageManager.addScripts({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Button from './Button';

export default {
title: 'Some.Button',
decorators: [withKnobs, storyFn => <div className="foo">{storyFn}</div>],
decorators: [withKnobs, (storyFn) => <div className="foo">{storyFn}</div>],
};

export const story1 = () => <Button label="The Button" />;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ import Button from './Button';
// This isn't a valid story, but it tests the `import { comp } from ...` case
storiesOf('Some.Button', module)
.addDecorator(withKnobs)
.addDecorator(storyFn => <div className="foo">{storyFn}</div>)
.addDecorator((storyFn) => <div className="foo">{storyFn}</div>)
.add('with decorator', () => <Button label="The Button" />);
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ export function someHelper() {
}

storiesOf('ComponentItem', module)
.addDecorator(storyFn => <div style={{ margin: '1rem' }}>{storyFn()}</div>)
.addDecorator((storyFn) => <div style={{ margin: '1rem' }}>{storyFn()}</div>)
.add('loading', () => <ComponentItem loading />);
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Button from './Button';
storiesOf('Some.Button', module)
.add('with story params and decorators', () => <Button label="The Button" />, {
bar: 1,
decorators: [withKnobs, storyFn => <div className="foo">{storyFn}</div>],
decorators: [withKnobs, (storyFn) => <div className="foo">{storyFn}</div>],
})
.add('with story decorators', () => <Button label="The Button" />, {
decorators: [withKnobs],
Expand Down
Loading

0 comments on commit 429277c

Please sign in to comment.