@storybook/cli 7.0.0-alpha.4 → 7.0.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/automigrate/fixes/index.js +3 -1
- package/dist/cjs/automigrate/fixes/npm7.js +59 -0
- package/dist/cjs/frameworks/angular/Button.stories.ts +2 -2
- package/dist/cjs/frameworks/angular/Header.stories.ts +2 -2
- package/dist/cjs/frameworks/angular/Page.stories.ts +3 -3
- package/dist/cjs/frameworks/html/ts/Button.stories.ts +2 -2
- package/dist/cjs/frameworks/html/ts/Header.stories.ts +2 -2
- package/dist/cjs/frameworks/html/ts/Page.stories.ts +2 -2
- package/dist/cjs/frameworks/react/ts/Button.stories.tsx +2 -2
- package/dist/cjs/frameworks/react/ts/Header.stories.tsx +2 -2
- package/dist/cjs/frameworks/react/ts/Page.stories.tsx +2 -2
- package/dist/cjs/frameworks/web-components/ts/Button.stories.ts +2 -2
- package/dist/cjs/frameworks/web-components/ts/Header.stories.ts +2 -2
- package/dist/cjs/frameworks/web-components/ts/Page.stories.ts +2 -2
- package/dist/cjs/generators/REACT_SCRIPTS/index.js +4 -4
- package/dist/cjs/generators/SVELTE/index.js +8 -14
- package/dist/cjs/generators/baseGenerator.js +2 -1
- package/dist/cjs/js-package-manager/NPMProxy.js +18 -2
- package/dist/cjs/versions.js +74 -73
- package/dist/esm/automigrate/fixes/index.js +3 -1
- package/dist/esm/automigrate/fixes/npm7.js +59 -0
- package/dist/esm/frameworks/angular/Button.stories.ts +2 -2
- package/dist/esm/frameworks/angular/Header.stories.ts +2 -2
- package/dist/esm/frameworks/angular/Page.stories.ts +3 -3
- package/dist/esm/frameworks/html/ts/Button.stories.ts +2 -2
- package/dist/esm/frameworks/html/ts/Header.stories.ts +2 -2
- package/dist/esm/frameworks/html/ts/Page.stories.ts +2 -2
- package/dist/esm/frameworks/react/ts/Button.stories.tsx +2 -2
- package/dist/esm/frameworks/react/ts/Header.stories.tsx +2 -2
- package/dist/esm/frameworks/react/ts/Page.stories.tsx +2 -2
- package/dist/esm/frameworks/web-components/ts/Button.stories.ts +2 -2
- package/dist/esm/frameworks/web-components/ts/Header.stories.ts +2 -2
- package/dist/esm/frameworks/web-components/ts/Page.stories.ts +2 -2
- package/dist/esm/generators/REACT_SCRIPTS/index.js +4 -4
- package/dist/esm/generators/SVELTE/index.js +8 -14
- package/dist/esm/generators/baseGenerator.js +2 -1
- package/dist/esm/js-package-manager/NPMProxy.js +18 -2
- package/dist/esm/versions.js +74 -73
- package/dist/types/automigrate/fixes/npm7.d.ts +9 -0
- package/dist/types/generators/types.d.ts +1 -0
- package/dist/types/js-package-manager/NPMProxy.d.ts +4 -0
- package/dist/types/versions.d.ts +1 -0
- package/package.json +9 -9
|
@@ -22,6 +22,8 @@ var _eslintPlugin = require("./eslint-plugin");
|
|
|
22
22
|
|
|
23
23
|
var _builderVite = require("./builder-vite");
|
|
24
24
|
|
|
25
|
+
var _npm = require("./npm7");
|
|
26
|
+
|
|
25
27
|
var _types = require("../types");
|
|
26
28
|
|
|
27
29
|
Object.keys(_types).forEach(function (key) {
|
|
@@ -35,5 +37,5 @@ Object.keys(_types).forEach(function (key) {
|
|
|
35
37
|
}
|
|
36
38
|
});
|
|
37
39
|
});
|
|
38
|
-
const fixes = [_cra.cra5, _webpack.webpack5, _angular.angular12, _vue.vue3, _mainjsFramework.mainjsFramework, _eslintPlugin.eslintPlugin, _builderVite.builderVite];
|
|
40
|
+
const fixes = [_cra.cra5, _webpack.webpack5, _angular.angular12, _vue.vue3, _mainjsFramework.mainjsFramework, _eslintPlugin.eslintPlugin, _builderVite.builderVite, _npm.npm7];
|
|
39
41
|
exports.fixes = fixes;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.npm7 = void 0;
|
|
7
|
+
|
|
8
|
+
require("core-js/modules/es.promise.js");
|
|
9
|
+
|
|
10
|
+
var _chalk = _interopRequireDefault(require("chalk"));
|
|
11
|
+
|
|
12
|
+
var _tsDedent = _interopRequireDefault(require("ts-dedent"));
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Is the user using npm7+? If so create a .npmrc with legacy-peer-deps=true
|
|
18
|
+
*/
|
|
19
|
+
const npm7 = {
|
|
20
|
+
id: 'npm7',
|
|
21
|
+
|
|
22
|
+
async check({
|
|
23
|
+
packageManager
|
|
24
|
+
}) {
|
|
25
|
+
if (packageManager.type !== 'npm') return null;
|
|
26
|
+
const npmVersion = packageManager.getNpmVersion();
|
|
27
|
+
|
|
28
|
+
if (packageManager.needsLegacyPeerDeps(npmVersion)) {
|
|
29
|
+
return {
|
|
30
|
+
npmVersion
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return null;
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
prompt({
|
|
38
|
+
npmVersion
|
|
39
|
+
}) {
|
|
40
|
+
const npmFormatted = _chalk.default.cyan(`npm ${npmVersion}`);
|
|
41
|
+
|
|
42
|
+
return (0, _tsDedent.default)`
|
|
43
|
+
We've detected you are running ${npmFormatted} which has peer dependency semantics which Storybook is incompatible with.
|
|
44
|
+
|
|
45
|
+
In order to work with Storybook's package structure, you'll need to run \`npm\` with the
|
|
46
|
+
\`--legacy-peer-deps=true\` flag. We can generate an \`.npmrc\` which will do that automatically.
|
|
47
|
+
|
|
48
|
+
More info: ${_chalk.default.yellow('https://github.com/storybookjs/storybook/issues/18298')}
|
|
49
|
+
`;
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
async run({
|
|
53
|
+
packageManager
|
|
54
|
+
}) {
|
|
55
|
+
packageManager.setLegacyPeerDeps();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
};
|
|
59
|
+
exports.npm7 = npm7;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// also exported from '@storybook/angular' if you can deal with breaking changes in 6.1
|
|
2
|
-
import {
|
|
2
|
+
import type { Meta, StoryFn } from '@storybook/angular';
|
|
3
3
|
import Button from './button.component';
|
|
4
4
|
|
|
5
5
|
// More on default export: https://storybook.js.org/docs/angular/writing-stories/introduction#default-export
|
|
@@ -13,7 +13,7 @@ export default {
|
|
|
13
13
|
} as Meta;
|
|
14
14
|
|
|
15
15
|
// More on component templates: https://storybook.js.org/docs/angular/writing-stories/introduction#using-args
|
|
16
|
-
const Template:
|
|
16
|
+
const Template: StoryFn<Button> = (args: Button) => {
|
|
17
17
|
return {
|
|
18
18
|
props: { backgroundColor: null, ...args },
|
|
19
19
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { moduleMetadata } from '@storybook/angular';
|
|
2
2
|
import { CommonModule } from '@angular/common';
|
|
3
|
-
import type {
|
|
3
|
+
import type { Meta, StoryFn } from '@storybook/angular';
|
|
4
4
|
|
|
5
5
|
import Button from './button.component';
|
|
6
6
|
import Header from './header.component';
|
|
@@ -20,7 +20,7 @@ export default {
|
|
|
20
20
|
},
|
|
21
21
|
} as Meta;
|
|
22
22
|
|
|
23
|
-
const Template:
|
|
23
|
+
const Template: StoryFn<Header> = (args: Header) => ({
|
|
24
24
|
props: args,
|
|
25
25
|
});
|
|
26
26
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { moduleMetadata,
|
|
1
|
+
import { moduleMetadata, StoryFn, Meta } from '@storybook/angular';
|
|
2
2
|
import { within, userEvent } from '@storybook/testing-library';
|
|
3
3
|
import { CommonModule } from '@angular/common';
|
|
4
4
|
|
|
@@ -10,7 +10,7 @@ export default {
|
|
|
10
10
|
title: 'Example/Page',
|
|
11
11
|
component: Page,
|
|
12
12
|
parameters: {
|
|
13
|
-
// More on
|
|
13
|
+
// More on StoryFn layout: https://storybook.js.org/docs/angular/configure/story-layout
|
|
14
14
|
layout: 'fullscreen',
|
|
15
15
|
},
|
|
16
16
|
decorators: [
|
|
@@ -21,7 +21,7 @@ export default {
|
|
|
21
21
|
],
|
|
22
22
|
} as Meta;
|
|
23
23
|
|
|
24
|
-
const Template:
|
|
24
|
+
const Template: StoryFn<Page> = (args: Page) => ({
|
|
25
25
|
props: args,
|
|
26
26
|
});
|
|
27
27
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Meta, StoryFn } from '@storybook/html';
|
|
2
2
|
import { createButton, ButtonProps } from './Button';
|
|
3
3
|
|
|
4
4
|
// More on default export: https://storybook.js.org/docs/html/writing-stories/introduction#default-export
|
|
@@ -18,7 +18,7 @@ export default {
|
|
|
18
18
|
} as Meta;
|
|
19
19
|
|
|
20
20
|
// More on component templates: https://storybook.js.org/docs/html/writing-stories/introduction#using-args
|
|
21
|
-
const Template:
|
|
21
|
+
const Template: StoryFn<ButtonProps> = (args) => {
|
|
22
22
|
// You can either use a function to create DOM elements or use a plain html string!
|
|
23
23
|
// return `<div>${label}</div>`;
|
|
24
24
|
return createButton(args);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Meta, StoryFn } from '@storybook/html';
|
|
2
2
|
import { createHeader, HeaderProps } from './Header';
|
|
3
3
|
|
|
4
4
|
export default {
|
|
@@ -15,7 +15,7 @@ export default {
|
|
|
15
15
|
},
|
|
16
16
|
} as Meta;
|
|
17
17
|
|
|
18
|
-
const Template:
|
|
18
|
+
const Template: StoryFn<HeaderProps> = (args) => createHeader(args);
|
|
19
19
|
|
|
20
20
|
export const LoggedIn = Template.bind({});
|
|
21
21
|
LoggedIn.args = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { within, userEvent } from '@storybook/testing-library';
|
|
2
|
-
import {
|
|
2
|
+
import type { Meta, StoryFn } from '@storybook/html';
|
|
3
3
|
import { createPage } from './Page';
|
|
4
4
|
|
|
5
5
|
export default {
|
|
@@ -10,7 +10,7 @@ export default {
|
|
|
10
10
|
},
|
|
11
11
|
} as Meta;
|
|
12
12
|
|
|
13
|
-
const Template:
|
|
13
|
+
const Template: StoryFn = () => createPage();
|
|
14
14
|
|
|
15
15
|
export const LoggedOut = Template.bind({});
|
|
16
16
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import type { ComponentStoryFn, ComponentMeta } from '@storybook/react';
|
|
3
3
|
|
|
4
4
|
import { Button } from './Button';
|
|
5
5
|
|
|
@@ -14,7 +14,7 @@ export default {
|
|
|
14
14
|
} as ComponentMeta<typeof Button>;
|
|
15
15
|
|
|
16
16
|
// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
|
|
17
|
-
const Template:
|
|
17
|
+
const Template: ComponentStoryFn<typeof Button> = (args) => <Button {...args} />;
|
|
18
18
|
|
|
19
19
|
export const Primary = Template.bind({});
|
|
20
20
|
// More on args: https://storybook.js.org/docs/react/writing-stories/args
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import type { ComponentStoryFn, ComponentMeta } from '@storybook/react';
|
|
3
3
|
|
|
4
4
|
import { Header } from './Header';
|
|
5
5
|
|
|
@@ -12,7 +12,7 @@ export default {
|
|
|
12
12
|
},
|
|
13
13
|
} as ComponentMeta<typeof Header>;
|
|
14
14
|
|
|
15
|
-
const Template:
|
|
15
|
+
const Template: ComponentStoryFn<typeof Header> = (args) => <Header {...args} />;
|
|
16
16
|
|
|
17
17
|
export const LoggedIn = Template.bind({});
|
|
18
18
|
LoggedIn.args = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import type { ComponentStoryFn, ComponentMeta } from '@storybook/react';
|
|
3
3
|
import { within, userEvent } from '@storybook/testing-library';
|
|
4
4
|
import { Page } from './Page';
|
|
5
5
|
|
|
@@ -12,7 +12,7 @@ export default {
|
|
|
12
12
|
},
|
|
13
13
|
} as ComponentMeta<typeof Page>;
|
|
14
14
|
|
|
15
|
-
const Template:
|
|
15
|
+
const Template: ComponentStoryFn<typeof Page> = (args) => <Page {...args} />;
|
|
16
16
|
|
|
17
17
|
export const LoggedOut = Template.bind({});
|
|
18
18
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Meta, StoryFn } from '@storybook/web-components';
|
|
2
2
|
import { Button, ButtonProps } from './Button';
|
|
3
3
|
|
|
4
4
|
// More on default export: https://storybook.js.org/docs/web-components/writing-stories/introduction#default-export
|
|
@@ -16,7 +16,7 @@ export default {
|
|
|
16
16
|
} as Meta;
|
|
17
17
|
|
|
18
18
|
// More on component templates: https://storybook.js.org/docs/web-components/writing-stories/introduction#using-args
|
|
19
|
-
const Template:
|
|
19
|
+
const Template: StoryFn<ButtonProps> = (args) => Button(args);
|
|
20
20
|
|
|
21
21
|
export const Primary = Template.bind({});
|
|
22
22
|
// More on args: https://storybook.js.org/docs/web-components/writing-stories/args
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Meta, StoryFn } from '@storybook/web-components';
|
|
2
2
|
import { Header, HeaderProps } from './Header';
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
5
|
title: 'Example/Header',
|
|
6
6
|
} as Meta;
|
|
7
7
|
|
|
8
|
-
const Template:
|
|
8
|
+
const Template: StoryFn<HeaderProps> = (args) => Header(args);
|
|
9
9
|
|
|
10
10
|
export const LoggedIn = Template.bind({});
|
|
11
11
|
LoggedIn.args = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Meta, StoryFn } from '@storybook/web-components';
|
|
2
2
|
import { Page, PageProps } from './Page';
|
|
3
3
|
import * as HeaderStories from './Header.stories';
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
title: 'Example/Page',
|
|
7
7
|
} as Meta;
|
|
8
8
|
|
|
9
|
-
const Template:
|
|
9
|
+
const Template: StoryFn<PageProps> = (args) => Page(args);
|
|
10
10
|
|
|
11
11
|
export const LoggedIn = Template.bind({});
|
|
12
12
|
LoggedIn.args = {
|
|
@@ -30,10 +30,10 @@ const generator = async (packageManager, npmOptions, options) => {
|
|
|
30
30
|
config.resolve.plugins.forEach((p) => {
|
|
31
31
|
if (Array.isArray(p.appSrcs)) {
|
|
32
32
|
p.appSrcs.push('${monorepoRootPath}');
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
return config;
|
|
36
|
+
}
|
|
37
37
|
%%`
|
|
38
38
|
} : {};
|
|
39
39
|
const craVersion = (_semver$coerce = _semver.default.coerce(packageManager.retrievePackageJson().dependencies['react-scripts'])) === null || _semver$coerce === void 0 ? void 0 : _semver$coerce.version;
|
|
@@ -16,25 +16,21 @@ var _baseGenerator = require("../baseGenerator");
|
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
17
|
|
|
18
18
|
const generator = async (packageManager, npmOptions, options) => {
|
|
19
|
-
let
|
|
19
|
+
let svelteOptions;
|
|
20
20
|
let commonJs = false; // svelte.config.js ?
|
|
21
21
|
|
|
22
22
|
if (_fsExtra.default.existsSync('./svelte.config.js')) {
|
|
23
23
|
_nodeLogger.logger.info("Configuring preprocessor from 'svelte.config.js'");
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
preprocess: '%%require("../svelte.config.js").preprocess%%'
|
|
28
|
-
}
|
|
25
|
+
svelteOptions = {
|
|
26
|
+
preprocess: '%%require("../svelte.config.js").preprocess%%'
|
|
29
27
|
};
|
|
30
28
|
} else if (_fsExtra.default.existsSync('./svelte.config.cjs')) {
|
|
31
29
|
_nodeLogger.logger.info("Configuring preprocessor from 'svelte.config.cjs'");
|
|
32
30
|
|
|
33
31
|
commonJs = true;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
preprocess: '%%require("../svelte.config.cjs").preprocess%%'
|
|
37
|
-
}
|
|
32
|
+
svelteOptions = {
|
|
33
|
+
preprocess: '%%require("../svelte.config.cjs").preprocess%%'
|
|
38
34
|
};
|
|
39
35
|
} else {
|
|
40
36
|
// svelte-preprocess dependencies ?
|
|
@@ -43,10 +39,8 @@ const generator = async (packageManager, npmOptions, options) => {
|
|
|
43
39
|
if (packageJson.devDependencies && packageJson.devDependencies['svelte-preprocess']) {
|
|
44
40
|
_nodeLogger.logger.info("Configuring preprocessor with 'svelte-preprocess'");
|
|
45
41
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
preprocess: '%%require("svelte-preprocess")()%%'
|
|
49
|
-
}
|
|
42
|
+
svelteOptions = {
|
|
43
|
+
preprocess: '%%require("svelte-preprocess")()%%'
|
|
50
44
|
};
|
|
51
45
|
}
|
|
52
46
|
}
|
|
@@ -54,7 +48,7 @@ const generator = async (packageManager, npmOptions, options) => {
|
|
|
54
48
|
await (0, _baseGenerator.baseGenerator)(packageManager, npmOptions, options, 'svelte', {
|
|
55
49
|
extraPackages: ['svelte', 'svelte-loader'],
|
|
56
50
|
extensions: ['js', 'jsx', 'ts', 'tsx', 'svelte'],
|
|
57
|
-
|
|
51
|
+
framework: svelteOptions,
|
|
58
52
|
commonJs
|
|
59
53
|
});
|
|
60
54
|
};
|
|
@@ -34,6 +34,7 @@ const defaultOptions = {
|
|
|
34
34
|
addBabel: true,
|
|
35
35
|
addESLint: false,
|
|
36
36
|
extraMain: undefined,
|
|
37
|
+
framework: undefined,
|
|
37
38
|
extensions: undefined,
|
|
38
39
|
commonJs: false
|
|
39
40
|
};
|
|
@@ -152,7 +153,7 @@ async function baseGenerator(packageManager, npmOptions, {
|
|
|
152
153
|
await (0, _configure.configureMain)(Object.assign({
|
|
153
154
|
framework: {
|
|
154
155
|
name: frameworkInclude,
|
|
155
|
-
options: {}
|
|
156
|
+
options: options.framework || {}
|
|
156
157
|
},
|
|
157
158
|
addons: pnp ? addons.map(wrapForPnp) : addons,
|
|
158
159
|
extensions,
|
|
@@ -30,10 +30,26 @@ class NPMProxy extends _JsPackageManager.JsPackageManager {
|
|
|
30
30
|
return `npm run ${command}`;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
getNpmVersion() {
|
|
34
|
+
return this.executeCommand('npm', ['--version']);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
hasLegacyPeerDeps() {
|
|
38
|
+
const result = this.executeCommand('npm', ['config', 'get', 'legacy-peer-deps', '--location=project']);
|
|
39
|
+
return result.trim() === 'true';
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
setLegacyPeerDeps() {
|
|
43
|
+
this.executeCommand('npm', ['config', 'set', 'legacy-peer-deps=true', '--location=project']);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
needsLegacyPeerDeps(version) {
|
|
47
|
+
return _semver.default.gte(version, '7.0.0') && !this.hasLegacyPeerDeps();
|
|
48
|
+
}
|
|
49
|
+
|
|
33
50
|
getInstallArgs() {
|
|
34
51
|
if (!this.installArgs) {
|
|
35
|
-
|
|
36
|
-
this.installArgs = _semver.default.gte(version, '7.0.0') ? ['install', '--legacy-peer-deps'] : ['install'];
|
|
52
|
+
this.installArgs = this.needsLegacyPeerDeps(this.getNpmVersion()) ? ['install', '--legacy-peer-deps'] : ['install'];
|
|
37
53
|
}
|
|
38
54
|
|
|
39
55
|
return this.installArgs;
|
package/dist/cjs/versions.js
CHANGED
|
@@ -6,78 +6,79 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
// auto generated file, do not edit
|
|
8
8
|
var _default = {
|
|
9
|
-
'@storybook/addon-a11y': '7.0.0-alpha.
|
|
10
|
-
'@storybook/addon-actions': '7.0.0-alpha.
|
|
11
|
-
'@storybook/addon-backgrounds': '7.0.0-alpha.
|
|
12
|
-
'@storybook/addon-controls': '7.0.0-alpha.
|
|
13
|
-
'@storybook/addon-docs': '7.0.0-alpha.
|
|
14
|
-
'@storybook/addon-essentials': '7.0.0-alpha.
|
|
15
|
-
'@storybook/addon-
|
|
16
|
-
'@storybook/addon-
|
|
17
|
-
'@storybook/addon-
|
|
18
|
-
'@storybook/addon-
|
|
19
|
-
'@storybook/addon-
|
|
20
|
-
'@storybook/addon-
|
|
21
|
-
'@storybook/addon-storyshots
|
|
22
|
-
'@storybook/addon-
|
|
23
|
-
'@storybook/addon-
|
|
24
|
-
'@storybook/addon-
|
|
25
|
-
'@storybook/
|
|
26
|
-
'@storybook/
|
|
27
|
-
'@storybook/
|
|
28
|
-
'@storybook/
|
|
29
|
-
'@storybook/
|
|
30
|
-
'@storybook/channel-
|
|
31
|
-
'@storybook/
|
|
32
|
-
'@storybook/
|
|
33
|
-
'@storybook/
|
|
34
|
-
'@storybook/client-
|
|
35
|
-
'@storybook/
|
|
36
|
-
'@storybook/
|
|
37
|
-
'@storybook/
|
|
38
|
-
'@storybook/core-
|
|
39
|
-
'@storybook/core-
|
|
40
|
-
'@storybook/core-
|
|
41
|
-
'@storybook/core-
|
|
42
|
-
'@storybook/
|
|
43
|
-
'@storybook/
|
|
44
|
-
'@storybook/
|
|
45
|
-
'@storybook/
|
|
46
|
-
'@storybook/html
|
|
47
|
-
'@storybook/
|
|
48
|
-
'@storybook/
|
|
49
|
-
'@storybook/
|
|
50
|
-
'@storybook/
|
|
51
|
-
'@storybook/
|
|
52
|
-
'@storybook/preact
|
|
53
|
-
'@storybook/
|
|
54
|
-
'@storybook/preset-
|
|
55
|
-
'@storybook/preset-
|
|
56
|
-
'@storybook/preset-
|
|
57
|
-
'@storybook/preset-
|
|
58
|
-
'@storybook/preset-
|
|
59
|
-
'@storybook/preset-
|
|
60
|
-
'@storybook/preset-
|
|
61
|
-
'@storybook/
|
|
62
|
-
'@storybook/
|
|
63
|
-
'@storybook/react
|
|
64
|
-
'@storybook/
|
|
65
|
-
'@storybook/
|
|
66
|
-
'@storybook/server
|
|
67
|
-
'@storybook/
|
|
68
|
-
'@storybook/
|
|
69
|
-
'@storybook/
|
|
70
|
-
'@storybook/svelte
|
|
71
|
-
'@storybook/
|
|
72
|
-
'@storybook/
|
|
73
|
-
'@storybook/
|
|
74
|
-
'@storybook/
|
|
75
|
-
'@storybook/vue
|
|
76
|
-
'@storybook/
|
|
77
|
-
'@storybook/vue3
|
|
78
|
-
'@storybook/
|
|
79
|
-
'@storybook/web-components
|
|
80
|
-
|
|
81
|
-
|
|
9
|
+
'@storybook/addon-a11y': '7.0.0-alpha.7',
|
|
10
|
+
'@storybook/addon-actions': '7.0.0-alpha.7',
|
|
11
|
+
'@storybook/addon-backgrounds': '7.0.0-alpha.7',
|
|
12
|
+
'@storybook/addon-controls': '7.0.0-alpha.7',
|
|
13
|
+
'@storybook/addon-docs': '7.0.0-alpha.7',
|
|
14
|
+
'@storybook/addon-essentials': '7.0.0-alpha.7',
|
|
15
|
+
'@storybook/addon-highlight': '7.0.0-alpha.7',
|
|
16
|
+
'@storybook/addon-interactions': '7.0.0-alpha.7',
|
|
17
|
+
'@storybook/addon-jest': '7.0.0-alpha.7',
|
|
18
|
+
'@storybook/addon-links': '7.0.0-alpha.7',
|
|
19
|
+
'@storybook/addon-measure': '7.0.0-alpha.7',
|
|
20
|
+
'@storybook/addon-outline': '7.0.0-alpha.7',
|
|
21
|
+
'@storybook/addon-storyshots': '7.0.0-alpha.7',
|
|
22
|
+
'@storybook/addon-storyshots-puppeteer': '7.0.0-alpha.7',
|
|
23
|
+
'@storybook/addon-storysource': '7.0.0-alpha.7',
|
|
24
|
+
'@storybook/addon-toolbars': '7.0.0-alpha.7',
|
|
25
|
+
'@storybook/addon-viewport': '7.0.0-alpha.7',
|
|
26
|
+
'@storybook/addons': '7.0.0-alpha.7',
|
|
27
|
+
'@storybook/angular': '7.0.0-alpha.7',
|
|
28
|
+
'@storybook/api': '7.0.0-alpha.7',
|
|
29
|
+
'@storybook/builder-webpack5': '7.0.0-alpha.7',
|
|
30
|
+
'@storybook/channel-postmessage': '7.0.0-alpha.7',
|
|
31
|
+
'@storybook/channel-websocket': '7.0.0-alpha.7',
|
|
32
|
+
'@storybook/channels': '7.0.0-alpha.7',
|
|
33
|
+
'@storybook/cli': '7.0.0-alpha.7',
|
|
34
|
+
'@storybook/client-api': '7.0.0-alpha.7',
|
|
35
|
+
'@storybook/client-logger': '7.0.0-alpha.7',
|
|
36
|
+
'@storybook/codemod': '7.0.0-alpha.7',
|
|
37
|
+
'@storybook/components': '7.0.0-alpha.7',
|
|
38
|
+
'@storybook/core-client': '7.0.0-alpha.7',
|
|
39
|
+
'@storybook/core-common': '7.0.0-alpha.7',
|
|
40
|
+
'@storybook/core-events': '7.0.0-alpha.7',
|
|
41
|
+
'@storybook/core-server': '7.0.0-alpha.7',
|
|
42
|
+
'@storybook/core-webpack': '7.0.0-alpha.7',
|
|
43
|
+
'@storybook/csf-tools': '7.0.0-alpha.7',
|
|
44
|
+
'@storybook/docs-tools': '7.0.0-alpha.7',
|
|
45
|
+
'@storybook/ember': '7.0.0-alpha.7',
|
|
46
|
+
'@storybook/html': '7.0.0-alpha.7',
|
|
47
|
+
'@storybook/html-webpack5': '7.0.0-alpha.7',
|
|
48
|
+
'@storybook/instrumenter': '7.0.0-alpha.7',
|
|
49
|
+
'@storybook/manager-webpack5': '7.0.0-alpha.7',
|
|
50
|
+
'@storybook/node-logger': '7.0.0-alpha.7',
|
|
51
|
+
'@storybook/postinstall': '7.0.0-alpha.7',
|
|
52
|
+
'@storybook/preact': '7.0.0-alpha.7',
|
|
53
|
+
'@storybook/preact-webpack5': '7.0.0-alpha.7',
|
|
54
|
+
'@storybook/preset-html-webpack': '7.0.0-alpha.7',
|
|
55
|
+
'@storybook/preset-preact-webpack': '7.0.0-alpha.7',
|
|
56
|
+
'@storybook/preset-react-webpack': '7.0.0-alpha.7',
|
|
57
|
+
'@storybook/preset-server-webpack': '7.0.0-alpha.7',
|
|
58
|
+
'@storybook/preset-svelte-webpack': '7.0.0-alpha.7',
|
|
59
|
+
'@storybook/preset-vue-webpack': '7.0.0-alpha.7',
|
|
60
|
+
'@storybook/preset-vue3-webpack': '7.0.0-alpha.7',
|
|
61
|
+
'@storybook/preset-web-components-webpack': '7.0.0-alpha.7',
|
|
62
|
+
'@storybook/preview-web': '7.0.0-alpha.7',
|
|
63
|
+
'@storybook/react': '7.0.0-alpha.7',
|
|
64
|
+
'@storybook/react-webpack5': '7.0.0-alpha.7',
|
|
65
|
+
'@storybook/router': '7.0.0-alpha.7',
|
|
66
|
+
'@storybook/server': '7.0.0-alpha.7',
|
|
67
|
+
'@storybook/server-webpack5': '7.0.0-alpha.7',
|
|
68
|
+
'@storybook/source-loader': '7.0.0-alpha.7',
|
|
69
|
+
'@storybook/store': '7.0.0-alpha.7',
|
|
70
|
+
'@storybook/svelte': '7.0.0-alpha.7',
|
|
71
|
+
'@storybook/svelte-webpack5': '7.0.0-alpha.7',
|
|
72
|
+
'@storybook/telemetry': '7.0.0-alpha.7',
|
|
73
|
+
'@storybook/theming': '7.0.0-alpha.7',
|
|
74
|
+
'@storybook/ui': '7.0.0-alpha.7',
|
|
75
|
+
'@storybook/vue': '7.0.0-alpha.7',
|
|
76
|
+
'@storybook/vue-webpack5': '7.0.0-alpha.7',
|
|
77
|
+
'@storybook/vue3': '7.0.0-alpha.7',
|
|
78
|
+
'@storybook/vue3-webpack5': '7.0.0-alpha.7',
|
|
79
|
+
'@storybook/web-components': '7.0.0-alpha.7',
|
|
80
|
+
'@storybook/web-components-webpack5': '7.0.0-alpha.7',
|
|
81
|
+
sb: '7.0.0-alpha.7',
|
|
82
|
+
storybook: '7.0.0-alpha.7'
|
|
82
83
|
};
|
|
83
84
|
exports.default = _default;
|
|
@@ -22,6 +22,8 @@ var _eslintPlugin = require("./eslint-plugin");
|
|
|
22
22
|
|
|
23
23
|
var _builderVite = require("./builder-vite");
|
|
24
24
|
|
|
25
|
+
var _npm = require("./npm7");
|
|
26
|
+
|
|
25
27
|
var _types = require("../types");
|
|
26
28
|
|
|
27
29
|
Object.keys(_types).forEach(function (key) {
|
|
@@ -35,5 +37,5 @@ Object.keys(_types).forEach(function (key) {
|
|
|
35
37
|
}
|
|
36
38
|
});
|
|
37
39
|
});
|
|
38
|
-
const fixes = [_cra.cra5, _webpack.webpack5, _angular.angular12, _vue.vue3, _mainjsFramework.mainjsFramework, _eslintPlugin.eslintPlugin, _builderVite.builderVite];
|
|
40
|
+
const fixes = [_cra.cra5, _webpack.webpack5, _angular.angular12, _vue.vue3, _mainjsFramework.mainjsFramework, _eslintPlugin.eslintPlugin, _builderVite.builderVite, _npm.npm7];
|
|
39
41
|
exports.fixes = fixes;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.npm7 = void 0;
|
|
7
|
+
|
|
8
|
+
require("core-js/modules/es.promise.js");
|
|
9
|
+
|
|
10
|
+
var _chalk = _interopRequireDefault(require("chalk"));
|
|
11
|
+
|
|
12
|
+
var _tsDedent = _interopRequireDefault(require("ts-dedent"));
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Is the user using npm7+? If so create a .npmrc with legacy-peer-deps=true
|
|
18
|
+
*/
|
|
19
|
+
const npm7 = {
|
|
20
|
+
id: 'npm7',
|
|
21
|
+
|
|
22
|
+
async check({
|
|
23
|
+
packageManager
|
|
24
|
+
}) {
|
|
25
|
+
if (packageManager.type !== 'npm') return null;
|
|
26
|
+
const npmVersion = packageManager.getNpmVersion();
|
|
27
|
+
|
|
28
|
+
if (packageManager.needsLegacyPeerDeps(npmVersion)) {
|
|
29
|
+
return {
|
|
30
|
+
npmVersion
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return null;
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
prompt({
|
|
38
|
+
npmVersion
|
|
39
|
+
}) {
|
|
40
|
+
const npmFormatted = _chalk.default.cyan(`npm ${npmVersion}`);
|
|
41
|
+
|
|
42
|
+
return (0, _tsDedent.default)`
|
|
43
|
+
We've detected you are running ${npmFormatted} which has peer dependency semantics which Storybook is incompatible with.
|
|
44
|
+
|
|
45
|
+
In order to work with Storybook's package structure, you'll need to run \`npm\` with the
|
|
46
|
+
\`--legacy-peer-deps=true\` flag. We can generate an \`.npmrc\` which will do that automatically.
|
|
47
|
+
|
|
48
|
+
More info: ${_chalk.default.yellow('https://github.com/storybookjs/storybook/issues/18298')}
|
|
49
|
+
`;
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
async run({
|
|
53
|
+
packageManager
|
|
54
|
+
}) {
|
|
55
|
+
packageManager.setLegacyPeerDeps();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
};
|
|
59
|
+
exports.npm7 = npm7;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// also exported from '@storybook/angular' if you can deal with breaking changes in 6.1
|
|
2
|
-
import {
|
|
2
|
+
import type { Meta, StoryFn } from '@storybook/angular';
|
|
3
3
|
import Button from './button.component';
|
|
4
4
|
|
|
5
5
|
// More on default export: https://storybook.js.org/docs/angular/writing-stories/introduction#default-export
|
|
@@ -13,7 +13,7 @@ export default {
|
|
|
13
13
|
} as Meta;
|
|
14
14
|
|
|
15
15
|
// More on component templates: https://storybook.js.org/docs/angular/writing-stories/introduction#using-args
|
|
16
|
-
const Template:
|
|
16
|
+
const Template: StoryFn<Button> = (args: Button) => {
|
|
17
17
|
return {
|
|
18
18
|
props: { backgroundColor: null, ...args },
|
|
19
19
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { moduleMetadata } from '@storybook/angular';
|
|
2
2
|
import { CommonModule } from '@angular/common';
|
|
3
|
-
import type {
|
|
3
|
+
import type { Meta, StoryFn } from '@storybook/angular';
|
|
4
4
|
|
|
5
5
|
import Button from './button.component';
|
|
6
6
|
import Header from './header.component';
|
|
@@ -20,7 +20,7 @@ export default {
|
|
|
20
20
|
},
|
|
21
21
|
} as Meta;
|
|
22
22
|
|
|
23
|
-
const Template:
|
|
23
|
+
const Template: StoryFn<Header> = (args: Header) => ({
|
|
24
24
|
props: args,
|
|
25
25
|
});
|
|
26
26
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { moduleMetadata,
|
|
1
|
+
import { moduleMetadata, StoryFn, Meta } from '@storybook/angular';
|
|
2
2
|
import { within, userEvent } from '@storybook/testing-library';
|
|
3
3
|
import { CommonModule } from '@angular/common';
|
|
4
4
|
|
|
@@ -10,7 +10,7 @@ export default {
|
|
|
10
10
|
title: 'Example/Page',
|
|
11
11
|
component: Page,
|
|
12
12
|
parameters: {
|
|
13
|
-
// More on
|
|
13
|
+
// More on StoryFn layout: https://storybook.js.org/docs/angular/configure/story-layout
|
|
14
14
|
layout: 'fullscreen',
|
|
15
15
|
},
|
|
16
16
|
decorators: [
|
|
@@ -21,7 +21,7 @@ export default {
|
|
|
21
21
|
],
|
|
22
22
|
} as Meta;
|
|
23
23
|
|
|
24
|
-
const Template:
|
|
24
|
+
const Template: StoryFn<Page> = (args: Page) => ({
|
|
25
25
|
props: args,
|
|
26
26
|
});
|
|
27
27
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Meta, StoryFn } from '@storybook/html';
|
|
2
2
|
import { createButton, ButtonProps } from './Button';
|
|
3
3
|
|
|
4
4
|
// More on default export: https://storybook.js.org/docs/html/writing-stories/introduction#default-export
|
|
@@ -18,7 +18,7 @@ export default {
|
|
|
18
18
|
} as Meta;
|
|
19
19
|
|
|
20
20
|
// More on component templates: https://storybook.js.org/docs/html/writing-stories/introduction#using-args
|
|
21
|
-
const Template:
|
|
21
|
+
const Template: StoryFn<ButtonProps> = (args) => {
|
|
22
22
|
// You can either use a function to create DOM elements or use a plain html string!
|
|
23
23
|
// return `<div>${label}</div>`;
|
|
24
24
|
return createButton(args);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Meta, StoryFn } from '@storybook/html';
|
|
2
2
|
import { createHeader, HeaderProps } from './Header';
|
|
3
3
|
|
|
4
4
|
export default {
|
|
@@ -15,7 +15,7 @@ export default {
|
|
|
15
15
|
},
|
|
16
16
|
} as Meta;
|
|
17
17
|
|
|
18
|
-
const Template:
|
|
18
|
+
const Template: StoryFn<HeaderProps> = (args) => createHeader(args);
|
|
19
19
|
|
|
20
20
|
export const LoggedIn = Template.bind({});
|
|
21
21
|
LoggedIn.args = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { within, userEvent } from '@storybook/testing-library';
|
|
2
|
-
import {
|
|
2
|
+
import type { Meta, StoryFn } from '@storybook/html';
|
|
3
3
|
import { createPage } from './Page';
|
|
4
4
|
|
|
5
5
|
export default {
|
|
@@ -10,7 +10,7 @@ export default {
|
|
|
10
10
|
},
|
|
11
11
|
} as Meta;
|
|
12
12
|
|
|
13
|
-
const Template:
|
|
13
|
+
const Template: StoryFn = () => createPage();
|
|
14
14
|
|
|
15
15
|
export const LoggedOut = Template.bind({});
|
|
16
16
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import type { ComponentStoryFn, ComponentMeta } from '@storybook/react';
|
|
3
3
|
|
|
4
4
|
import { Button } from './Button';
|
|
5
5
|
|
|
@@ -14,7 +14,7 @@ export default {
|
|
|
14
14
|
} as ComponentMeta<typeof Button>;
|
|
15
15
|
|
|
16
16
|
// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
|
|
17
|
-
const Template:
|
|
17
|
+
const Template: ComponentStoryFn<typeof Button> = (args) => <Button {...args} />;
|
|
18
18
|
|
|
19
19
|
export const Primary = Template.bind({});
|
|
20
20
|
// More on args: https://storybook.js.org/docs/react/writing-stories/args
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import type { ComponentStoryFn, ComponentMeta } from '@storybook/react';
|
|
3
3
|
|
|
4
4
|
import { Header } from './Header';
|
|
5
5
|
|
|
@@ -12,7 +12,7 @@ export default {
|
|
|
12
12
|
},
|
|
13
13
|
} as ComponentMeta<typeof Header>;
|
|
14
14
|
|
|
15
|
-
const Template:
|
|
15
|
+
const Template: ComponentStoryFn<typeof Header> = (args) => <Header {...args} />;
|
|
16
16
|
|
|
17
17
|
export const LoggedIn = Template.bind({});
|
|
18
18
|
LoggedIn.args = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import type { ComponentStoryFn, ComponentMeta } from '@storybook/react';
|
|
3
3
|
import { within, userEvent } from '@storybook/testing-library';
|
|
4
4
|
import { Page } from './Page';
|
|
5
5
|
|
|
@@ -12,7 +12,7 @@ export default {
|
|
|
12
12
|
},
|
|
13
13
|
} as ComponentMeta<typeof Page>;
|
|
14
14
|
|
|
15
|
-
const Template:
|
|
15
|
+
const Template: ComponentStoryFn<typeof Page> = (args) => <Page {...args} />;
|
|
16
16
|
|
|
17
17
|
export const LoggedOut = Template.bind({});
|
|
18
18
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Meta, StoryFn } from '@storybook/web-components';
|
|
2
2
|
import { Button, ButtonProps } from './Button';
|
|
3
3
|
|
|
4
4
|
// More on default export: https://storybook.js.org/docs/web-components/writing-stories/introduction#default-export
|
|
@@ -16,7 +16,7 @@ export default {
|
|
|
16
16
|
} as Meta;
|
|
17
17
|
|
|
18
18
|
// More on component templates: https://storybook.js.org/docs/web-components/writing-stories/introduction#using-args
|
|
19
|
-
const Template:
|
|
19
|
+
const Template: StoryFn<ButtonProps> = (args) => Button(args);
|
|
20
20
|
|
|
21
21
|
export const Primary = Template.bind({});
|
|
22
22
|
// More on args: https://storybook.js.org/docs/web-components/writing-stories/args
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Meta, StoryFn } from '@storybook/web-components';
|
|
2
2
|
import { Header, HeaderProps } from './Header';
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
5
|
title: 'Example/Header',
|
|
6
6
|
} as Meta;
|
|
7
7
|
|
|
8
|
-
const Template:
|
|
8
|
+
const Template: StoryFn<HeaderProps> = (args) => Header(args);
|
|
9
9
|
|
|
10
10
|
export const LoggedIn = Template.bind({});
|
|
11
11
|
LoggedIn.args = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Meta, StoryFn } from '@storybook/web-components';
|
|
2
2
|
import { Page, PageProps } from './Page';
|
|
3
3
|
import * as HeaderStories from './Header.stories';
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
title: 'Example/Page',
|
|
7
7
|
} as Meta;
|
|
8
8
|
|
|
9
|
-
const Template:
|
|
9
|
+
const Template: StoryFn<PageProps> = (args) => Page(args);
|
|
10
10
|
|
|
11
11
|
export const LoggedIn = Template.bind({});
|
|
12
12
|
LoggedIn.args = {
|
|
@@ -30,10 +30,10 @@ const generator = async (packageManager, npmOptions, options) => {
|
|
|
30
30
|
config.resolve.plugins.forEach((p) => {
|
|
31
31
|
if (Array.isArray(p.appSrcs)) {
|
|
32
32
|
p.appSrcs.push('${monorepoRootPath}');
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
return config;
|
|
36
|
+
}
|
|
37
37
|
%%`
|
|
38
38
|
} : {};
|
|
39
39
|
const craVersion = (_semver$coerce = _semver.default.coerce(packageManager.retrievePackageJson().dependencies['react-scripts'])) === null || _semver$coerce === void 0 ? void 0 : _semver$coerce.version;
|
|
@@ -16,25 +16,21 @@ var _baseGenerator = require("../baseGenerator");
|
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
17
|
|
|
18
18
|
const generator = async (packageManager, npmOptions, options) => {
|
|
19
|
-
let
|
|
19
|
+
let svelteOptions;
|
|
20
20
|
let commonJs = false; // svelte.config.js ?
|
|
21
21
|
|
|
22
22
|
if (_fsExtra.default.existsSync('./svelte.config.js')) {
|
|
23
23
|
_nodeLogger.logger.info("Configuring preprocessor from 'svelte.config.js'");
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
preprocess: '%%require("../svelte.config.js").preprocess%%'
|
|
28
|
-
}
|
|
25
|
+
svelteOptions = {
|
|
26
|
+
preprocess: '%%require("../svelte.config.js").preprocess%%'
|
|
29
27
|
};
|
|
30
28
|
} else if (_fsExtra.default.existsSync('./svelte.config.cjs')) {
|
|
31
29
|
_nodeLogger.logger.info("Configuring preprocessor from 'svelte.config.cjs'");
|
|
32
30
|
|
|
33
31
|
commonJs = true;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
preprocess: '%%require("../svelte.config.cjs").preprocess%%'
|
|
37
|
-
}
|
|
32
|
+
svelteOptions = {
|
|
33
|
+
preprocess: '%%require("../svelte.config.cjs").preprocess%%'
|
|
38
34
|
};
|
|
39
35
|
} else {
|
|
40
36
|
// svelte-preprocess dependencies ?
|
|
@@ -43,10 +39,8 @@ const generator = async (packageManager, npmOptions, options) => {
|
|
|
43
39
|
if (packageJson.devDependencies && packageJson.devDependencies['svelte-preprocess']) {
|
|
44
40
|
_nodeLogger.logger.info("Configuring preprocessor with 'svelte-preprocess'");
|
|
45
41
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
preprocess: '%%require("svelte-preprocess")()%%'
|
|
49
|
-
}
|
|
42
|
+
svelteOptions = {
|
|
43
|
+
preprocess: '%%require("svelte-preprocess")()%%'
|
|
50
44
|
};
|
|
51
45
|
}
|
|
52
46
|
}
|
|
@@ -54,7 +48,7 @@ const generator = async (packageManager, npmOptions, options) => {
|
|
|
54
48
|
await (0, _baseGenerator.baseGenerator)(packageManager, npmOptions, options, 'svelte', {
|
|
55
49
|
extraPackages: ['svelte', 'svelte-loader'],
|
|
56
50
|
extensions: ['js', 'jsx', 'ts', 'tsx', 'svelte'],
|
|
57
|
-
|
|
51
|
+
framework: svelteOptions,
|
|
58
52
|
commonJs
|
|
59
53
|
});
|
|
60
54
|
};
|
|
@@ -34,6 +34,7 @@ const defaultOptions = {
|
|
|
34
34
|
addBabel: true,
|
|
35
35
|
addESLint: false,
|
|
36
36
|
extraMain: undefined,
|
|
37
|
+
framework: undefined,
|
|
37
38
|
extensions: undefined,
|
|
38
39
|
commonJs: false
|
|
39
40
|
};
|
|
@@ -152,7 +153,7 @@ async function baseGenerator(packageManager, npmOptions, {
|
|
|
152
153
|
await (0, _configure.configureMain)(Object.assign({
|
|
153
154
|
framework: {
|
|
154
155
|
name: frameworkInclude,
|
|
155
|
-
options: {}
|
|
156
|
+
options: options.framework || {}
|
|
156
157
|
},
|
|
157
158
|
addons: pnp ? addons.map(wrapForPnp) : addons,
|
|
158
159
|
extensions,
|
|
@@ -30,10 +30,26 @@ class NPMProxy extends _JsPackageManager.JsPackageManager {
|
|
|
30
30
|
return `npm run ${command}`;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
getNpmVersion() {
|
|
34
|
+
return this.executeCommand('npm', ['--version']);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
hasLegacyPeerDeps() {
|
|
38
|
+
const result = this.executeCommand('npm', ['config', 'get', 'legacy-peer-deps', '--location=project']);
|
|
39
|
+
return result.trim() === 'true';
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
setLegacyPeerDeps() {
|
|
43
|
+
this.executeCommand('npm', ['config', 'set', 'legacy-peer-deps=true', '--location=project']);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
needsLegacyPeerDeps(version) {
|
|
47
|
+
return _semver.default.gte(version, '7.0.0') && !this.hasLegacyPeerDeps();
|
|
48
|
+
}
|
|
49
|
+
|
|
33
50
|
getInstallArgs() {
|
|
34
51
|
if (!this.installArgs) {
|
|
35
|
-
|
|
36
|
-
this.installArgs = _semver.default.gte(version, '7.0.0') ? ['install', '--legacy-peer-deps'] : ['install'];
|
|
52
|
+
this.installArgs = this.needsLegacyPeerDeps(this.getNpmVersion()) ? ['install', '--legacy-peer-deps'] : ['install'];
|
|
37
53
|
}
|
|
38
54
|
|
|
39
55
|
return this.installArgs;
|
package/dist/esm/versions.js
CHANGED
|
@@ -6,78 +6,79 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
// auto generated file, do not edit
|
|
8
8
|
var _default = {
|
|
9
|
-
'@storybook/addon-a11y': '7.0.0-alpha.
|
|
10
|
-
'@storybook/addon-actions': '7.0.0-alpha.
|
|
11
|
-
'@storybook/addon-backgrounds': '7.0.0-alpha.
|
|
12
|
-
'@storybook/addon-controls': '7.0.0-alpha.
|
|
13
|
-
'@storybook/addon-docs': '7.0.0-alpha.
|
|
14
|
-
'@storybook/addon-essentials': '7.0.0-alpha.
|
|
15
|
-
'@storybook/addon-
|
|
16
|
-
'@storybook/addon-
|
|
17
|
-
'@storybook/addon-
|
|
18
|
-
'@storybook/addon-
|
|
19
|
-
'@storybook/addon-
|
|
20
|
-
'@storybook/addon-
|
|
21
|
-
'@storybook/addon-storyshots
|
|
22
|
-
'@storybook/addon-
|
|
23
|
-
'@storybook/addon-
|
|
24
|
-
'@storybook/addon-
|
|
25
|
-
'@storybook/
|
|
26
|
-
'@storybook/
|
|
27
|
-
'@storybook/
|
|
28
|
-
'@storybook/
|
|
29
|
-
'@storybook/
|
|
30
|
-
'@storybook/channel-
|
|
31
|
-
'@storybook/
|
|
32
|
-
'@storybook/
|
|
33
|
-
'@storybook/
|
|
34
|
-
'@storybook/client-
|
|
35
|
-
'@storybook/
|
|
36
|
-
'@storybook/
|
|
37
|
-
'@storybook/
|
|
38
|
-
'@storybook/core-
|
|
39
|
-
'@storybook/core-
|
|
40
|
-
'@storybook/core-
|
|
41
|
-
'@storybook/core-
|
|
42
|
-
'@storybook/
|
|
43
|
-
'@storybook/
|
|
44
|
-
'@storybook/
|
|
45
|
-
'@storybook/
|
|
46
|
-
'@storybook/html
|
|
47
|
-
'@storybook/
|
|
48
|
-
'@storybook/
|
|
49
|
-
'@storybook/
|
|
50
|
-
'@storybook/
|
|
51
|
-
'@storybook/
|
|
52
|
-
'@storybook/preact
|
|
53
|
-
'@storybook/
|
|
54
|
-
'@storybook/preset-
|
|
55
|
-
'@storybook/preset-
|
|
56
|
-
'@storybook/preset-
|
|
57
|
-
'@storybook/preset-
|
|
58
|
-
'@storybook/preset-
|
|
59
|
-
'@storybook/preset-
|
|
60
|
-
'@storybook/preset-
|
|
61
|
-
'@storybook/
|
|
62
|
-
'@storybook/
|
|
63
|
-
'@storybook/react
|
|
64
|
-
'@storybook/
|
|
65
|
-
'@storybook/
|
|
66
|
-
'@storybook/server
|
|
67
|
-
'@storybook/
|
|
68
|
-
'@storybook/
|
|
69
|
-
'@storybook/
|
|
70
|
-
'@storybook/svelte
|
|
71
|
-
'@storybook/
|
|
72
|
-
'@storybook/
|
|
73
|
-
'@storybook/
|
|
74
|
-
'@storybook/
|
|
75
|
-
'@storybook/vue
|
|
76
|
-
'@storybook/
|
|
77
|
-
'@storybook/vue3
|
|
78
|
-
'@storybook/
|
|
79
|
-
'@storybook/web-components
|
|
80
|
-
|
|
81
|
-
|
|
9
|
+
'@storybook/addon-a11y': '7.0.0-alpha.7',
|
|
10
|
+
'@storybook/addon-actions': '7.0.0-alpha.7',
|
|
11
|
+
'@storybook/addon-backgrounds': '7.0.0-alpha.7',
|
|
12
|
+
'@storybook/addon-controls': '7.0.0-alpha.7',
|
|
13
|
+
'@storybook/addon-docs': '7.0.0-alpha.7',
|
|
14
|
+
'@storybook/addon-essentials': '7.0.0-alpha.7',
|
|
15
|
+
'@storybook/addon-highlight': '7.0.0-alpha.7',
|
|
16
|
+
'@storybook/addon-interactions': '7.0.0-alpha.7',
|
|
17
|
+
'@storybook/addon-jest': '7.0.0-alpha.7',
|
|
18
|
+
'@storybook/addon-links': '7.0.0-alpha.7',
|
|
19
|
+
'@storybook/addon-measure': '7.0.0-alpha.7',
|
|
20
|
+
'@storybook/addon-outline': '7.0.0-alpha.7',
|
|
21
|
+
'@storybook/addon-storyshots': '7.0.0-alpha.7',
|
|
22
|
+
'@storybook/addon-storyshots-puppeteer': '7.0.0-alpha.7',
|
|
23
|
+
'@storybook/addon-storysource': '7.0.0-alpha.7',
|
|
24
|
+
'@storybook/addon-toolbars': '7.0.0-alpha.7',
|
|
25
|
+
'@storybook/addon-viewport': '7.0.0-alpha.7',
|
|
26
|
+
'@storybook/addons': '7.0.0-alpha.7',
|
|
27
|
+
'@storybook/angular': '7.0.0-alpha.7',
|
|
28
|
+
'@storybook/api': '7.0.0-alpha.7',
|
|
29
|
+
'@storybook/builder-webpack5': '7.0.0-alpha.7',
|
|
30
|
+
'@storybook/channel-postmessage': '7.0.0-alpha.7',
|
|
31
|
+
'@storybook/channel-websocket': '7.0.0-alpha.7',
|
|
32
|
+
'@storybook/channels': '7.0.0-alpha.7',
|
|
33
|
+
'@storybook/cli': '7.0.0-alpha.7',
|
|
34
|
+
'@storybook/client-api': '7.0.0-alpha.7',
|
|
35
|
+
'@storybook/client-logger': '7.0.0-alpha.7',
|
|
36
|
+
'@storybook/codemod': '7.0.0-alpha.7',
|
|
37
|
+
'@storybook/components': '7.0.0-alpha.7',
|
|
38
|
+
'@storybook/core-client': '7.0.0-alpha.7',
|
|
39
|
+
'@storybook/core-common': '7.0.0-alpha.7',
|
|
40
|
+
'@storybook/core-events': '7.0.0-alpha.7',
|
|
41
|
+
'@storybook/core-server': '7.0.0-alpha.7',
|
|
42
|
+
'@storybook/core-webpack': '7.0.0-alpha.7',
|
|
43
|
+
'@storybook/csf-tools': '7.0.0-alpha.7',
|
|
44
|
+
'@storybook/docs-tools': '7.0.0-alpha.7',
|
|
45
|
+
'@storybook/ember': '7.0.0-alpha.7',
|
|
46
|
+
'@storybook/html': '7.0.0-alpha.7',
|
|
47
|
+
'@storybook/html-webpack5': '7.0.0-alpha.7',
|
|
48
|
+
'@storybook/instrumenter': '7.0.0-alpha.7',
|
|
49
|
+
'@storybook/manager-webpack5': '7.0.0-alpha.7',
|
|
50
|
+
'@storybook/node-logger': '7.0.0-alpha.7',
|
|
51
|
+
'@storybook/postinstall': '7.0.0-alpha.7',
|
|
52
|
+
'@storybook/preact': '7.0.0-alpha.7',
|
|
53
|
+
'@storybook/preact-webpack5': '7.0.0-alpha.7',
|
|
54
|
+
'@storybook/preset-html-webpack': '7.0.0-alpha.7',
|
|
55
|
+
'@storybook/preset-preact-webpack': '7.0.0-alpha.7',
|
|
56
|
+
'@storybook/preset-react-webpack': '7.0.0-alpha.7',
|
|
57
|
+
'@storybook/preset-server-webpack': '7.0.0-alpha.7',
|
|
58
|
+
'@storybook/preset-svelte-webpack': '7.0.0-alpha.7',
|
|
59
|
+
'@storybook/preset-vue-webpack': '7.0.0-alpha.7',
|
|
60
|
+
'@storybook/preset-vue3-webpack': '7.0.0-alpha.7',
|
|
61
|
+
'@storybook/preset-web-components-webpack': '7.0.0-alpha.7',
|
|
62
|
+
'@storybook/preview-web': '7.0.0-alpha.7',
|
|
63
|
+
'@storybook/react': '7.0.0-alpha.7',
|
|
64
|
+
'@storybook/react-webpack5': '7.0.0-alpha.7',
|
|
65
|
+
'@storybook/router': '7.0.0-alpha.7',
|
|
66
|
+
'@storybook/server': '7.0.0-alpha.7',
|
|
67
|
+
'@storybook/server-webpack5': '7.0.0-alpha.7',
|
|
68
|
+
'@storybook/source-loader': '7.0.0-alpha.7',
|
|
69
|
+
'@storybook/store': '7.0.0-alpha.7',
|
|
70
|
+
'@storybook/svelte': '7.0.0-alpha.7',
|
|
71
|
+
'@storybook/svelte-webpack5': '7.0.0-alpha.7',
|
|
72
|
+
'@storybook/telemetry': '7.0.0-alpha.7',
|
|
73
|
+
'@storybook/theming': '7.0.0-alpha.7',
|
|
74
|
+
'@storybook/ui': '7.0.0-alpha.7',
|
|
75
|
+
'@storybook/vue': '7.0.0-alpha.7',
|
|
76
|
+
'@storybook/vue-webpack5': '7.0.0-alpha.7',
|
|
77
|
+
'@storybook/vue3': '7.0.0-alpha.7',
|
|
78
|
+
'@storybook/vue3-webpack5': '7.0.0-alpha.7',
|
|
79
|
+
'@storybook/web-components': '7.0.0-alpha.7',
|
|
80
|
+
'@storybook/web-components-webpack5': '7.0.0-alpha.7',
|
|
81
|
+
sb: '7.0.0-alpha.7',
|
|
82
|
+
storybook: '7.0.0-alpha.7'
|
|
82
83
|
};
|
|
83
84
|
exports.default = _default;
|
|
@@ -17,6 +17,7 @@ export interface FrameworkOptions {
|
|
|
17
17
|
addESLint?: boolean;
|
|
18
18
|
extraMain?: any;
|
|
19
19
|
extensions?: string[];
|
|
20
|
+
framework?: Record<string, any>;
|
|
20
21
|
commonJs?: boolean;
|
|
21
22
|
}
|
|
22
23
|
export declare type Generator = (packageManagerInstance: JsPackageManager, npmOptions: NpmOptions, generatorOptions: GeneratorOptions) => Promise<void>;
|
|
@@ -5,6 +5,10 @@ export declare class NPMProxy extends JsPackageManager {
|
|
|
5
5
|
initPackageJson(): string;
|
|
6
6
|
getRunStorybookCommand(): string;
|
|
7
7
|
getRunCommand(command: string): string;
|
|
8
|
+
getNpmVersion(): string;
|
|
9
|
+
hasLegacyPeerDeps(): boolean;
|
|
10
|
+
setLegacyPeerDeps(): void;
|
|
11
|
+
needsLegacyPeerDeps(version: string): boolean;
|
|
8
12
|
getInstallArgs(): string[];
|
|
9
13
|
protected runInstall(): void;
|
|
10
14
|
protected runAddDeps(dependencies: string[], installAsDevDependencies: boolean): void;
|
package/dist/types/versions.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ declare const _default: {
|
|
|
5
5
|
'@storybook/addon-controls': string;
|
|
6
6
|
'@storybook/addon-docs': string;
|
|
7
7
|
'@storybook/addon-essentials': string;
|
|
8
|
+
'@storybook/addon-highlight': string;
|
|
8
9
|
'@storybook/addon-interactions': string;
|
|
9
10
|
'@storybook/addon-jest': string;
|
|
10
11
|
'@storybook/addon-links': string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/cli",
|
|
3
|
-
"version": "7.0.0-alpha.
|
|
3
|
+
"version": "7.0.0-alpha.7",
|
|
4
4
|
"description": "Storybook's CLI - easiest method of adding storybook to your projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -47,13 +47,13 @@
|
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@babel/core": "^7.12.10",
|
|
49
49
|
"@babel/preset-env": "^7.12.11",
|
|
50
|
-
"@storybook/codemod": "7.0.0-alpha.
|
|
51
|
-
"@storybook/core-common": "7.0.0-alpha.
|
|
52
|
-
"@storybook/core-server": "7.0.0-alpha.
|
|
53
|
-
"@storybook/csf-tools": "7.0.0-alpha.
|
|
54
|
-
"@storybook/node-logger": "7.0.0-alpha.
|
|
50
|
+
"@storybook/codemod": "7.0.0-alpha.7",
|
|
51
|
+
"@storybook/core-common": "7.0.0-alpha.7",
|
|
52
|
+
"@storybook/core-server": "7.0.0-alpha.7",
|
|
53
|
+
"@storybook/csf-tools": "7.0.0-alpha.7",
|
|
54
|
+
"@storybook/node-logger": "7.0.0-alpha.7",
|
|
55
55
|
"@storybook/semver": "^7.3.2",
|
|
56
|
-
"@storybook/telemetry": "7.0.0-alpha.
|
|
56
|
+
"@storybook/telemetry": "7.0.0-alpha.7",
|
|
57
57
|
"boxen": "^5.1.2",
|
|
58
58
|
"chalk": "^4.1.0",
|
|
59
59
|
"commander": "^6.2.1",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"update-notifier": "^5.0.1"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
|
-
"@storybook/client-api": "7.0.0-alpha.
|
|
81
|
+
"@storybook/client-api": "7.0.0-alpha.7",
|
|
82
82
|
"@types/cross-spawn": "^6.0.2",
|
|
83
83
|
"@types/prompts": "^2.0.9",
|
|
84
84
|
"@types/puppeteer-core": "^2.1.0",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"publishConfig": {
|
|
92
92
|
"access": "public"
|
|
93
93
|
},
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "d334cabd251cd0ed8b845a87707dc84f007d4074"
|
|
95
95
|
}
|