@storybook/cli 7.0.0-alpha.21 → 7.0.0-alpha.23
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/builder-vite.js +1 -3
- package/dist/cjs/detect.js +2 -18
- package/dist/cjs/generators/RAX/index.js +1 -3
- package/dist/cjs/initiate.js +9 -2
- package/dist/cjs/js-package-manager/JsPackageManager.js +44 -10
- package/dist/cjs/js-package-manager/JsPackageManagerFactory.js +25 -11
- package/dist/cjs/js-package-manager/NPMProxy.js +19 -0
- package/dist/cjs/js-package-manager/Yarn1Proxy.js +19 -0
- package/dist/cjs/js-package-manager/Yarn2Proxy.js +19 -0
- package/dist/cjs/js-package-manager/index.js +0 -13
- package/dist/cjs/versions.js +75 -75
- package/dist/esm/automigrate/fixes/builder-vite.js +1 -2
- package/dist/esm/detect.js +2 -17
- package/dist/esm/generators/RAX/index.js +1 -2
- package/dist/esm/initiate.js +9 -2
- package/dist/esm/js-package-manager/JsPackageManager.js +40 -9
- package/dist/esm/js-package-manager/JsPackageManagerFactory.js +25 -11
- package/dist/esm/js-package-manager/NPMProxy.js +19 -0
- package/dist/esm/js-package-manager/Yarn1Proxy.js +19 -0
- package/dist/esm/js-package-manager/Yarn2Proxy.js +19 -0
- package/dist/esm/js-package-manager/index.js +1 -2
- package/dist/esm/versions.js +75 -75
- package/dist/types/detect.d.ts +2 -2
- package/dist/types/js-package-manager/JsPackageManager.d.ts +13 -0
- package/dist/types/js-package-manager/JsPackageManagerFactory.d.ts +1 -1
- package/dist/types/js-package-manager/NPMProxy.d.ts +6 -0
- package/dist/types/js-package-manager/Yarn1Proxy.d.ts +8 -0
- package/dist/types/js-package-manager/Yarn2Proxy.d.ts +8 -0
- package/dist/types/js-package-manager/index.d.ts +0 -1
- package/package.json +9 -9
- package/dist/cjs/js-package-manager/PackageJsonHelper.js +0 -33
- package/dist/esm/js-package-manager/PackageJsonHelper.js +0 -17
- package/dist/types/js-package-manager/PackageJsonHelper.d.ts +0 -3
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
2
|
import { gt, satisfies } from '@storybook/semver';
|
|
3
3
|
import { sync as spawnSync } from 'cross-spawn';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import fs from 'fs';
|
|
4
6
|
import { commandLog } from '../helpers';
|
|
5
|
-
import { readPackageJson, writePackageJson } from './PackageJsonHelper';
|
|
6
7
|
import storybookPackagesVersions from '../versions';
|
|
7
8
|
const logger = console;
|
|
8
9
|
/**
|
|
@@ -25,13 +26,16 @@ export function getPackageDetails(pkg) {
|
|
|
25
26
|
return [packageName, packageVersion];
|
|
26
27
|
}
|
|
27
28
|
export class JsPackageManager {
|
|
28
|
-
constructor() {
|
|
29
|
+
constructor(options) {
|
|
29
30
|
this.type = void 0;
|
|
31
|
+
this.cwd = void 0;
|
|
32
|
+
this.cwd = options?.cwd;
|
|
30
33
|
}
|
|
31
|
-
|
|
32
34
|
/**
|
|
33
35
|
* Install dependencies listed in `package.json`
|
|
34
36
|
*/
|
|
37
|
+
|
|
38
|
+
|
|
35
39
|
installDependencies() {
|
|
36
40
|
let done = commandLog('Preparing to install dependencies');
|
|
37
41
|
done();
|
|
@@ -48,6 +52,26 @@ export class JsPackageManager {
|
|
|
48
52
|
|
|
49
53
|
done();
|
|
50
54
|
}
|
|
55
|
+
|
|
56
|
+
packageJsonPath() {
|
|
57
|
+
return this.cwd ? path.resolve(this.cwd, 'package.json') : path.resolve('package.json');
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
readPackageJson() {
|
|
61
|
+
const packageJsonPath = this.packageJsonPath();
|
|
62
|
+
|
|
63
|
+
if (!fs.existsSync(packageJsonPath)) {
|
|
64
|
+
throw new Error(`Could not read package.json file at ${packageJsonPath}`);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const jsonContent = fs.readFileSync(packageJsonPath, 'utf8');
|
|
68
|
+
return JSON.parse(jsonContent);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
writePackageJson(packageJson) {
|
|
72
|
+
const content = `${JSON.stringify(packageJson, null, 2)}\n`;
|
|
73
|
+
fs.writeFileSync(this.packageJsonPath(), content, 'utf8');
|
|
74
|
+
}
|
|
51
75
|
/**
|
|
52
76
|
* Read the `package.json` file available in the directory the command was call from
|
|
53
77
|
* If there is no `package.json` it will create one.
|
|
@@ -58,10 +82,10 @@ export class JsPackageManager {
|
|
|
58
82
|
let packageJson;
|
|
59
83
|
|
|
60
84
|
try {
|
|
61
|
-
packageJson = readPackageJson();
|
|
85
|
+
packageJson = this.readPackageJson();
|
|
62
86
|
} catch (err) {
|
|
63
87
|
this.initPackageJson();
|
|
64
|
-
packageJson = readPackageJson();
|
|
88
|
+
packageJson = this.readPackageJson();
|
|
65
89
|
}
|
|
66
90
|
|
|
67
91
|
return Object.assign({}, packageJson, {
|
|
@@ -106,7 +130,7 @@ export class JsPackageManager {
|
|
|
106
130
|
packageJson.dependencies = Object.assign({}, packageJson.dependencies, dependenciesMap);
|
|
107
131
|
}
|
|
108
132
|
|
|
109
|
-
writePackageJson(packageJson);
|
|
133
|
+
this.writePackageJson(packageJson);
|
|
110
134
|
} else {
|
|
111
135
|
try {
|
|
112
136
|
this.runAddDeps(dependencies, options.installAsDevDependencies);
|
|
@@ -148,7 +172,7 @@ export class JsPackageManager {
|
|
|
148
172
|
delete packageJson.dependencies[dep];
|
|
149
173
|
}
|
|
150
174
|
});
|
|
151
|
-
writePackageJson(packageJson);
|
|
175
|
+
this.writePackageJson(packageJson);
|
|
152
176
|
} else {
|
|
153
177
|
try {
|
|
154
178
|
this.runRemoveDeps(dependencies);
|
|
@@ -253,7 +277,7 @@ export class JsPackageManager {
|
|
|
253
277
|
|
|
254
278
|
addESLintConfig() {
|
|
255
279
|
const packageJson = this.retrievePackageJson();
|
|
256
|
-
writePackageJson(Object.assign({}, packageJson, {
|
|
280
|
+
this.writePackageJson(Object.assign({}, packageJson, {
|
|
257
281
|
eslintConfig: Object.assign({}, packageJson.eslintConfig, {
|
|
258
282
|
overrides: [...(packageJson.eslintConfig?.overrides || []), {
|
|
259
283
|
files: ['**/*.stories.*'],
|
|
@@ -267,13 +291,20 @@ export class JsPackageManager {
|
|
|
267
291
|
|
|
268
292
|
addScripts(scripts) {
|
|
269
293
|
const packageJson = this.retrievePackageJson();
|
|
270
|
-
writePackageJson(Object.assign({}, packageJson, {
|
|
294
|
+
this.writePackageJson(Object.assign({}, packageJson, {
|
|
271
295
|
scripts: Object.assign({}, packageJson.scripts, scripts)
|
|
272
296
|
}));
|
|
273
297
|
}
|
|
274
298
|
|
|
299
|
+
addPackageResolutions(versions) {
|
|
300
|
+
const packageJson = this.retrievePackageJson();
|
|
301
|
+
const resolutions = this.getResolutions(packageJson, versions);
|
|
302
|
+
this.writePackageJson(Object.assign({}, packageJson, resolutions));
|
|
303
|
+
}
|
|
304
|
+
|
|
275
305
|
executeCommand(command, args, stdio) {
|
|
276
306
|
const commandResult = spawnSync(command, args, {
|
|
307
|
+
cwd: this.cwd,
|
|
277
308
|
stdio: stdio ?? 'pipe',
|
|
278
309
|
encoding: 'utf-8'
|
|
279
310
|
});
|
|
@@ -4,21 +4,31 @@ import { NPMProxy } from './NPMProxy';
|
|
|
4
4
|
import { Yarn2Proxy } from './Yarn2Proxy';
|
|
5
5
|
import { Yarn1Proxy } from './Yarn1Proxy';
|
|
6
6
|
export class JsPackageManagerFactory {
|
|
7
|
-
static getPackageManager(forceNpmUsage = false) {
|
|
7
|
+
static getPackageManager(forceNpmUsage = false, cwd) {
|
|
8
8
|
if (forceNpmUsage) {
|
|
9
|
-
return new NPMProxy(
|
|
9
|
+
return new NPMProxy({
|
|
10
|
+
cwd
|
|
11
|
+
});
|
|
10
12
|
}
|
|
11
13
|
|
|
12
|
-
const yarnVersion = getYarnVersion();
|
|
13
|
-
const hasYarnLockFile = findUpSync('yarn.lock'
|
|
14
|
-
|
|
14
|
+
const yarnVersion = getYarnVersion(cwd);
|
|
15
|
+
const hasYarnLockFile = findUpSync('yarn.lock', {
|
|
16
|
+
cwd
|
|
17
|
+
});
|
|
18
|
+
const hasNPMCommand = hasNPM(cwd);
|
|
15
19
|
|
|
16
20
|
if (yarnVersion && (hasYarnLockFile || !hasNPMCommand)) {
|
|
17
|
-
return yarnVersion === 1 ? new Yarn1Proxy(
|
|
21
|
+
return yarnVersion === 1 ? new Yarn1Proxy({
|
|
22
|
+
cwd
|
|
23
|
+
}) : new Yarn2Proxy({
|
|
24
|
+
cwd
|
|
25
|
+
});
|
|
18
26
|
}
|
|
19
27
|
|
|
20
28
|
if (hasNPMCommand) {
|
|
21
|
-
return new NPMProxy(
|
|
29
|
+
return new NPMProxy({
|
|
30
|
+
cwd
|
|
31
|
+
});
|
|
22
32
|
}
|
|
23
33
|
|
|
24
34
|
throw new Error('Unable to find a usable package manager within NPM, Yarn and Yarn 2');
|
|
@@ -26,13 +36,17 @@ export class JsPackageManagerFactory {
|
|
|
26
36
|
|
|
27
37
|
}
|
|
28
38
|
|
|
29
|
-
function hasNPM() {
|
|
30
|
-
const npmVersionCommand = spawnSync('npm', ['--version']
|
|
39
|
+
function hasNPM(cwd) {
|
|
40
|
+
const npmVersionCommand = spawnSync('npm', ['--version'], {
|
|
41
|
+
cwd
|
|
42
|
+
});
|
|
31
43
|
return npmVersionCommand.status === 0;
|
|
32
44
|
}
|
|
33
45
|
|
|
34
|
-
function getYarnVersion() {
|
|
35
|
-
const yarnVersionCommand = spawnSync('yarn', ['--version']
|
|
46
|
+
function getYarnVersion(cwd) {
|
|
47
|
+
const yarnVersionCommand = spawnSync('yarn', ['--version'], {
|
|
48
|
+
cwd
|
|
49
|
+
});
|
|
36
50
|
|
|
37
51
|
if (yarnVersionCommand.status !== 0) {
|
|
38
52
|
return undefined;
|
|
@@ -53,6 +53,25 @@ export class NPMProxy extends JsPackageManager {
|
|
|
53
53
|
return this.uninstallArgs;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
setRegistryURL(url) {
|
|
57
|
+
if (url) {
|
|
58
|
+
this.executeCommand('npm', ['config', 'set', 'registry', url]);
|
|
59
|
+
} else {
|
|
60
|
+
this.executeCommand('npm', ['config', 'delete', 'registry']);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
getRegistryURL() {
|
|
65
|
+
const url = this.executeCommand('npm', ['config', 'get', 'registry']).trim();
|
|
66
|
+
return url === 'undefined' ? undefined : url;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
getResolutions(packageJson, versions) {
|
|
70
|
+
return {
|
|
71
|
+
overrides: Object.assign({}, packageJson.overrides, versions)
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
56
75
|
runInstall() {
|
|
57
76
|
this.executeCommand('npm', this.getInstallArgs(), 'inherit');
|
|
58
77
|
}
|
|
@@ -17,6 +17,25 @@ export class Yarn1Proxy extends JsPackageManager {
|
|
|
17
17
|
return `yarn ${command}`;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
setRegistryURL(url) {
|
|
21
|
+
if (url) {
|
|
22
|
+
this.executeCommand('yarn', ['config', 'set', 'npmRegistryServer', url]);
|
|
23
|
+
} else {
|
|
24
|
+
this.executeCommand('yarn', ['config', 'delete', 'npmRegistryServer']);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
getRegistryURL() {
|
|
29
|
+
const url = this.executeCommand('yarn', ['config', 'get', 'npmRegistryServer']).trim();
|
|
30
|
+
return url === 'undefined' ? undefined : url;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
getResolutions(packageJson, versions) {
|
|
34
|
+
return {
|
|
35
|
+
resolutions: Object.assign({}, packageJson.resolutions, versions)
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
20
39
|
runInstall() {
|
|
21
40
|
this.executeCommand('yarn', [], 'inherit');
|
|
22
41
|
}
|
|
@@ -17,6 +17,25 @@ export class Yarn2Proxy extends JsPackageManager {
|
|
|
17
17
|
return `yarn ${command}`;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
setRegistryURL(url) {
|
|
21
|
+
if (url) {
|
|
22
|
+
this.executeCommand('yarn', ['config', 'set', 'npmRegistryServer', url]);
|
|
23
|
+
} else {
|
|
24
|
+
this.executeCommand('yarn', ['config', 'delete', 'npmRegistryServer']);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
getRegistryURL() {
|
|
29
|
+
const url = this.executeCommand('yarn', ['config', 'get', 'npmRegistryServer']).trim();
|
|
30
|
+
return url === 'undefined' ? undefined : url;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
getResolutions(packageJson, versions) {
|
|
34
|
+
return {
|
|
35
|
+
resolutions: Object.assign({}, packageJson.resolutions, versions)
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
20
39
|
runInstall() {
|
|
21
40
|
this.executeCommand('yarn', [], 'inherit');
|
|
22
41
|
}
|
package/dist/esm/versions.js
CHANGED
|
@@ -1,78 +1,78 @@
|
|
|
1
1
|
// auto generated file, do not edit
|
|
2
2
|
export default {
|
|
3
|
-
'@storybook/addon-a11y': '7.0.0-alpha.
|
|
4
|
-
'@storybook/addon-actions': '7.0.0-alpha.
|
|
5
|
-
'@storybook/addon-backgrounds': '7.0.0-alpha.
|
|
6
|
-
'@storybook/addon-controls': '7.0.0-alpha.
|
|
7
|
-
'@storybook/addon-docs': '7.0.0-alpha.
|
|
8
|
-
'@storybook/addon-essentials': '7.0.0-alpha.
|
|
9
|
-
'@storybook/addon-highlight': '7.0.0-alpha.
|
|
10
|
-
'@storybook/addon-interactions': '7.0.0-alpha.
|
|
11
|
-
'@storybook/addon-jest': '7.0.0-alpha.
|
|
12
|
-
'@storybook/addon-links': '7.0.0-alpha.
|
|
13
|
-
'@storybook/addon-measure': '7.0.0-alpha.
|
|
14
|
-
'@storybook/addon-outline': '7.0.0-alpha.
|
|
15
|
-
'@storybook/addon-storyshots': '7.0.0-alpha.
|
|
16
|
-
'@storybook/addon-storyshots-puppeteer': '7.0.0-alpha.
|
|
17
|
-
'@storybook/addon-storysource': '7.0.0-alpha.
|
|
18
|
-
'@storybook/addon-toolbars': '7.0.0-alpha.
|
|
19
|
-
'@storybook/addon-viewport': '7.0.0-alpha.
|
|
20
|
-
'@storybook/addons': '7.0.0-alpha.
|
|
21
|
-
'@storybook/angular': '7.0.0-alpha.
|
|
22
|
-
'@storybook/api': '7.0.0-alpha.
|
|
23
|
-
'@storybook/blocks': '7.0.0-alpha.
|
|
24
|
-
'@storybook/builder-manager': '7.0.0-alpha.
|
|
25
|
-
'@storybook/builder-webpack5': '7.0.0-alpha.
|
|
26
|
-
'@storybook/channel-postmessage': '7.0.0-alpha.
|
|
27
|
-
'@storybook/channel-websocket': '7.0.0-alpha.
|
|
28
|
-
'@storybook/channels': '7.0.0-alpha.
|
|
29
|
-
'@storybook/cli': '7.0.0-alpha.
|
|
30
|
-
'@storybook/client-api': '7.0.0-alpha.
|
|
31
|
-
'@storybook/client-logger': '7.0.0-alpha.
|
|
32
|
-
'@storybook/codemod': '7.0.0-alpha.
|
|
33
|
-
'@storybook/components': '7.0.0-alpha.
|
|
34
|
-
'@storybook/core-client': '7.0.0-alpha.
|
|
35
|
-
'@storybook/core-common': '7.0.0-alpha.
|
|
36
|
-
'@storybook/core-events': '7.0.0-alpha.
|
|
37
|
-
'@storybook/core-server': '7.0.0-alpha.
|
|
38
|
-
'@storybook/core-webpack': '7.0.0-alpha.
|
|
39
|
-
'@storybook/csf-tools': '7.0.0-alpha.
|
|
40
|
-
'@storybook/docs-tools': '7.0.0-alpha.
|
|
41
|
-
'@storybook/ember': '7.0.0-alpha.
|
|
42
|
-
'@storybook/html': '7.0.0-alpha.
|
|
43
|
-
'@storybook/html-webpack5': '7.0.0-alpha.
|
|
44
|
-
'@storybook/instrumenter': '7.0.0-alpha.
|
|
45
|
-
'@storybook/node-logger': '7.0.0-alpha.
|
|
46
|
-
'@storybook/postinstall': '7.0.0-alpha.
|
|
47
|
-
'@storybook/preact': '7.0.0-alpha.
|
|
48
|
-
'@storybook/preact-webpack5': '7.0.0-alpha.
|
|
49
|
-
'@storybook/preset-html-webpack': '7.0.0-alpha.
|
|
50
|
-
'@storybook/preset-preact-webpack': '7.0.0-alpha.
|
|
51
|
-
'@storybook/preset-react-webpack': '7.0.0-alpha.
|
|
52
|
-
'@storybook/preset-server-webpack': '7.0.0-alpha.
|
|
53
|
-
'@storybook/preset-svelte-webpack': '7.0.0-alpha.
|
|
54
|
-
'@storybook/preset-vue-webpack': '7.0.0-alpha.
|
|
55
|
-
'@storybook/preset-vue3-webpack': '7.0.0-alpha.
|
|
56
|
-
'@storybook/preset-web-components-webpack': '7.0.0-alpha.
|
|
57
|
-
'@storybook/preview-web': '7.0.0-alpha.
|
|
58
|
-
'@storybook/react': '7.0.0-alpha.
|
|
59
|
-
'@storybook/react-webpack5': '7.0.0-alpha.
|
|
60
|
-
'@storybook/router': '7.0.0-alpha.
|
|
61
|
-
'@storybook/server': '7.0.0-alpha.
|
|
62
|
-
'@storybook/server-webpack5': '7.0.0-alpha.
|
|
63
|
-
'@storybook/source-loader': '7.0.0-alpha.
|
|
64
|
-
'@storybook/store': '7.0.0-alpha.
|
|
65
|
-
'@storybook/svelte': '7.0.0-alpha.
|
|
66
|
-
'@storybook/svelte-webpack5': '7.0.0-alpha.
|
|
67
|
-
'@storybook/telemetry': '7.0.0-alpha.
|
|
68
|
-
'@storybook/theming': '7.0.0-alpha.
|
|
69
|
-
'@storybook/ui': '7.0.0-alpha.
|
|
70
|
-
'@storybook/vue': '7.0.0-alpha.
|
|
71
|
-
'@storybook/vue-webpack5': '7.0.0-alpha.
|
|
72
|
-
'@storybook/vue3': '7.0.0-alpha.
|
|
73
|
-
'@storybook/vue3-webpack5': '7.0.0-alpha.
|
|
74
|
-
'@storybook/web-components': '7.0.0-alpha.
|
|
75
|
-
'@storybook/web-components-webpack5': '7.0.0-alpha.
|
|
76
|
-
sb: '7.0.0-alpha.
|
|
77
|
-
storybook: '7.0.0-alpha.
|
|
3
|
+
'@storybook/addon-a11y': '7.0.0-alpha.23',
|
|
4
|
+
'@storybook/addon-actions': '7.0.0-alpha.23',
|
|
5
|
+
'@storybook/addon-backgrounds': '7.0.0-alpha.23',
|
|
6
|
+
'@storybook/addon-controls': '7.0.0-alpha.23',
|
|
7
|
+
'@storybook/addon-docs': '7.0.0-alpha.23',
|
|
8
|
+
'@storybook/addon-essentials': '7.0.0-alpha.23',
|
|
9
|
+
'@storybook/addon-highlight': '7.0.0-alpha.23',
|
|
10
|
+
'@storybook/addon-interactions': '7.0.0-alpha.23',
|
|
11
|
+
'@storybook/addon-jest': '7.0.0-alpha.23',
|
|
12
|
+
'@storybook/addon-links': '7.0.0-alpha.23',
|
|
13
|
+
'@storybook/addon-measure': '7.0.0-alpha.23',
|
|
14
|
+
'@storybook/addon-outline': '7.0.0-alpha.23',
|
|
15
|
+
'@storybook/addon-storyshots': '7.0.0-alpha.23',
|
|
16
|
+
'@storybook/addon-storyshots-puppeteer': '7.0.0-alpha.23',
|
|
17
|
+
'@storybook/addon-storysource': '7.0.0-alpha.23',
|
|
18
|
+
'@storybook/addon-toolbars': '7.0.0-alpha.23',
|
|
19
|
+
'@storybook/addon-viewport': '7.0.0-alpha.23',
|
|
20
|
+
'@storybook/addons': '7.0.0-alpha.23',
|
|
21
|
+
'@storybook/angular': '7.0.0-alpha.23',
|
|
22
|
+
'@storybook/api': '7.0.0-alpha.23',
|
|
23
|
+
'@storybook/blocks': '7.0.0-alpha.23',
|
|
24
|
+
'@storybook/builder-manager': '7.0.0-alpha.23',
|
|
25
|
+
'@storybook/builder-webpack5': '7.0.0-alpha.23',
|
|
26
|
+
'@storybook/channel-postmessage': '7.0.0-alpha.23',
|
|
27
|
+
'@storybook/channel-websocket': '7.0.0-alpha.23',
|
|
28
|
+
'@storybook/channels': '7.0.0-alpha.23',
|
|
29
|
+
'@storybook/cli': '7.0.0-alpha.23',
|
|
30
|
+
'@storybook/client-api': '7.0.0-alpha.23',
|
|
31
|
+
'@storybook/client-logger': '7.0.0-alpha.23',
|
|
32
|
+
'@storybook/codemod': '7.0.0-alpha.23',
|
|
33
|
+
'@storybook/components': '7.0.0-alpha.23',
|
|
34
|
+
'@storybook/core-client': '7.0.0-alpha.23',
|
|
35
|
+
'@storybook/core-common': '7.0.0-alpha.23',
|
|
36
|
+
'@storybook/core-events': '7.0.0-alpha.23',
|
|
37
|
+
'@storybook/core-server': '7.0.0-alpha.23',
|
|
38
|
+
'@storybook/core-webpack': '7.0.0-alpha.23',
|
|
39
|
+
'@storybook/csf-tools': '7.0.0-alpha.23',
|
|
40
|
+
'@storybook/docs-tools': '7.0.0-alpha.23',
|
|
41
|
+
'@storybook/ember': '7.0.0-alpha.23',
|
|
42
|
+
'@storybook/html': '7.0.0-alpha.23',
|
|
43
|
+
'@storybook/html-webpack5': '7.0.0-alpha.23',
|
|
44
|
+
'@storybook/instrumenter': '7.0.0-alpha.23',
|
|
45
|
+
'@storybook/node-logger': '7.0.0-alpha.23',
|
|
46
|
+
'@storybook/postinstall': '7.0.0-alpha.23',
|
|
47
|
+
'@storybook/preact': '7.0.0-alpha.23',
|
|
48
|
+
'@storybook/preact-webpack5': '7.0.0-alpha.23',
|
|
49
|
+
'@storybook/preset-html-webpack': '7.0.0-alpha.23',
|
|
50
|
+
'@storybook/preset-preact-webpack': '7.0.0-alpha.23',
|
|
51
|
+
'@storybook/preset-react-webpack': '7.0.0-alpha.23',
|
|
52
|
+
'@storybook/preset-server-webpack': '7.0.0-alpha.23',
|
|
53
|
+
'@storybook/preset-svelte-webpack': '7.0.0-alpha.23',
|
|
54
|
+
'@storybook/preset-vue-webpack': '7.0.0-alpha.23',
|
|
55
|
+
'@storybook/preset-vue3-webpack': '7.0.0-alpha.23',
|
|
56
|
+
'@storybook/preset-web-components-webpack': '7.0.0-alpha.23',
|
|
57
|
+
'@storybook/preview-web': '7.0.0-alpha.23',
|
|
58
|
+
'@storybook/react': '7.0.0-alpha.23',
|
|
59
|
+
'@storybook/react-webpack5': '7.0.0-alpha.23',
|
|
60
|
+
'@storybook/router': '7.0.0-alpha.23',
|
|
61
|
+
'@storybook/server': '7.0.0-alpha.23',
|
|
62
|
+
'@storybook/server-webpack5': '7.0.0-alpha.23',
|
|
63
|
+
'@storybook/source-loader': '7.0.0-alpha.23',
|
|
64
|
+
'@storybook/store': '7.0.0-alpha.23',
|
|
65
|
+
'@storybook/svelte': '7.0.0-alpha.23',
|
|
66
|
+
'@storybook/svelte-webpack5': '7.0.0-alpha.23',
|
|
67
|
+
'@storybook/telemetry': '7.0.0-alpha.23',
|
|
68
|
+
'@storybook/theming': '7.0.0-alpha.23',
|
|
69
|
+
'@storybook/ui': '7.0.0-alpha.23',
|
|
70
|
+
'@storybook/vue': '7.0.0-alpha.23',
|
|
71
|
+
'@storybook/vue-webpack5': '7.0.0-alpha.23',
|
|
72
|
+
'@storybook/vue3': '7.0.0-alpha.23',
|
|
73
|
+
'@storybook/vue3-webpack5': '7.0.0-alpha.23',
|
|
74
|
+
'@storybook/web-components': '7.0.0-alpha.23',
|
|
75
|
+
'@storybook/web-components-webpack5': '7.0.0-alpha.23',
|
|
76
|
+
sb: '7.0.0-alpha.23',
|
|
77
|
+
storybook: '7.0.0-alpha.23'
|
|
78
78
|
};
|
package/dist/types/detect.d.ts
CHANGED
|
@@ -9,8 +9,8 @@ export declare function detectFrameworkPreset(packageJson?: Partial<Pick<Package
|
|
|
9
9
|
*/
|
|
10
10
|
export declare function detectBuilder(packageManager: JsPackageManager): CoreBuilder;
|
|
11
11
|
export declare function isStorybookInstalled(dependencies: Pick<PackageJson, 'devDependencies'> | false, force?: boolean): false | ProjectType.ALREADY_HAS_STORYBOOK;
|
|
12
|
-
export declare function detectLanguage(): SupportedLanguage;
|
|
13
|
-
export declare function detect(options?: {
|
|
12
|
+
export declare function detectLanguage(packageJson?: PackageJson): SupportedLanguage;
|
|
13
|
+
export declare function detect(packageJson: PackageJson, options?: {
|
|
14
14
|
force?: boolean;
|
|
15
15
|
html?: boolean;
|
|
16
16
|
}): ProjectType;
|
|
@@ -6,15 +6,25 @@ import { PackageJson, PackageJsonWithDepsAndDevDeps } from './PackageJson';
|
|
|
6
6
|
* @return A tuple of 2 elements: [packageName, packageVersion]
|
|
7
7
|
*/
|
|
8
8
|
export declare function getPackageDetails(pkg: string): [string, string?];
|
|
9
|
+
interface JsPackageManagerOptions {
|
|
10
|
+
cwd?: string;
|
|
11
|
+
}
|
|
9
12
|
export declare abstract class JsPackageManager {
|
|
10
13
|
abstract readonly type: 'npm' | 'yarn1' | 'yarn2';
|
|
11
14
|
abstract initPackageJson(): void;
|
|
12
15
|
abstract getRunStorybookCommand(): string;
|
|
13
16
|
abstract getRunCommand(command: string): string;
|
|
17
|
+
abstract setRegistryURL(url: string): void;
|
|
18
|
+
abstract getRegistryURL(): string;
|
|
19
|
+
readonly cwd?: string;
|
|
20
|
+
constructor(options?: JsPackageManagerOptions);
|
|
14
21
|
/**
|
|
15
22
|
* Install dependencies listed in `package.json`
|
|
16
23
|
*/
|
|
17
24
|
installDependencies(): void;
|
|
25
|
+
packageJsonPath(): string;
|
|
26
|
+
readPackageJson(): PackageJson;
|
|
27
|
+
writePackageJson(packageJson: PackageJson): void;
|
|
18
28
|
/**
|
|
19
29
|
* Read the `package.json` file available in the directory the command was call from
|
|
20
30
|
* If there is no `package.json` it will create one.
|
|
@@ -91,9 +101,11 @@ export declare abstract class JsPackageManager {
|
|
|
91
101
|
}): void;
|
|
92
102
|
addESLintConfig(): void;
|
|
93
103
|
addScripts(scripts: Record<string, string>): void;
|
|
104
|
+
addPackageResolutions(versions: Record<string, string>): void;
|
|
94
105
|
protected abstract runInstall(): void;
|
|
95
106
|
protected abstract runAddDeps(dependencies: string[], installAsDevDependencies: boolean): void;
|
|
96
107
|
protected abstract runRemoveDeps(dependencies: string[]): void;
|
|
108
|
+
protected abstract getResolutions(packageJson: PackageJson, versions: Record<string, string>): Record<string, any>;
|
|
97
109
|
/**
|
|
98
110
|
* Get the latest or all versions of the input package available on npmjs.com
|
|
99
111
|
*
|
|
@@ -103,3 +115,4 @@ export declare abstract class JsPackageManager {
|
|
|
103
115
|
protected abstract runGetVersions<T extends boolean>(packageName: string, fetchAllVersions: T): Promise<T extends true ? string[] : string>;
|
|
104
116
|
executeCommand(command: string, args: string[], stdio?: 'pipe' | 'inherit'): string;
|
|
105
117
|
}
|
|
118
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { JsPackageManager } from './JsPackageManager';
|
|
2
|
+
import type { PackageJson } from './PackageJson';
|
|
2
3
|
export declare class NPMProxy extends JsPackageManager {
|
|
3
4
|
readonly type = "npm";
|
|
4
5
|
installArgs: string[] | undefined;
|
|
@@ -12,6 +13,11 @@ export declare class NPMProxy extends JsPackageManager {
|
|
|
12
13
|
needsLegacyPeerDeps(version: string): boolean;
|
|
13
14
|
getInstallArgs(): string[];
|
|
14
15
|
getUninstallArgs(): string[];
|
|
16
|
+
setRegistryURL(url: string): void;
|
|
17
|
+
getRegistryURL(): string;
|
|
18
|
+
protected getResolutions(packageJson: PackageJson, versions: Record<string, string>): {
|
|
19
|
+
overrides: any;
|
|
20
|
+
};
|
|
15
21
|
protected runInstall(): void;
|
|
16
22
|
protected runAddDeps(dependencies: string[], installAsDevDependencies: boolean): void;
|
|
17
23
|
protected runRemoveDeps(dependencies: string[]): void;
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { JsPackageManager } from './JsPackageManager';
|
|
2
|
+
import type { PackageJson } from './PackageJson';
|
|
2
3
|
export declare class Yarn1Proxy extends JsPackageManager {
|
|
3
4
|
readonly type = "yarn1";
|
|
4
5
|
initPackageJson(): string;
|
|
5
6
|
getRunStorybookCommand(): string;
|
|
6
7
|
getRunCommand(command: string): string;
|
|
8
|
+
setRegistryURL(url: string): void;
|
|
9
|
+
getRegistryURL(): string;
|
|
10
|
+
protected getResolutions(packageJson: PackageJson, versions: Record<string, string>): {
|
|
11
|
+
resolutions: {
|
|
12
|
+
[x: string]: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
7
15
|
protected runInstall(): void;
|
|
8
16
|
protected runAddDeps(dependencies: string[], installAsDevDependencies: boolean): void;
|
|
9
17
|
protected runRemoveDeps(dependencies: string[]): void;
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { JsPackageManager } from './JsPackageManager';
|
|
2
|
+
import type { PackageJson } from './PackageJson';
|
|
2
3
|
export declare class Yarn2Proxy extends JsPackageManager {
|
|
3
4
|
readonly type = "yarn2";
|
|
4
5
|
initPackageJson(): string;
|
|
5
6
|
getRunStorybookCommand(): string;
|
|
6
7
|
getRunCommand(command: string): string;
|
|
8
|
+
setRegistryURL(url: string): void;
|
|
9
|
+
getRegistryURL(): string;
|
|
10
|
+
protected getResolutions(packageJson: PackageJson, versions: Record<string, string>): {
|
|
11
|
+
resolutions: {
|
|
12
|
+
[x: string]: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
7
15
|
protected runInstall(): void;
|
|
8
16
|
protected runAddDeps(dependencies: string[], installAsDevDependencies: boolean): void;
|
|
9
17
|
protected runRemoveDeps(dependencies: string[]): void;
|
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.23",
|
|
4
4
|
"description": "Storybook's CLI - easiest method of adding storybook to your projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -48,13 +48,13 @@
|
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@babel/core": "^7.12.10",
|
|
50
50
|
"@babel/preset-env": "^7.12.11",
|
|
51
|
-
"@storybook/codemod": "7.0.0-alpha.
|
|
52
|
-
"@storybook/core-common": "7.0.0-alpha.
|
|
53
|
-
"@storybook/core-server": "7.0.0-alpha.
|
|
54
|
-
"@storybook/csf-tools": "7.0.0-alpha.
|
|
55
|
-
"@storybook/node-logger": "7.0.0-alpha.
|
|
51
|
+
"@storybook/codemod": "7.0.0-alpha.23",
|
|
52
|
+
"@storybook/core-common": "7.0.0-alpha.23",
|
|
53
|
+
"@storybook/core-server": "7.0.0-alpha.23",
|
|
54
|
+
"@storybook/csf-tools": "7.0.0-alpha.23",
|
|
55
|
+
"@storybook/node-logger": "7.0.0-alpha.23",
|
|
56
56
|
"@storybook/semver": "^7.3.2",
|
|
57
|
-
"@storybook/telemetry": "7.0.0-alpha.
|
|
57
|
+
"@storybook/telemetry": "7.0.0-alpha.23",
|
|
58
58
|
"boxen": "^5.1.2",
|
|
59
59
|
"chalk": "^4.1.0",
|
|
60
60
|
"commander": "^6.2.1",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"update-notifier": "^5.0.1"
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
|
-
"@storybook/client-api": "7.0.0-alpha.
|
|
84
|
+
"@storybook/client-api": "7.0.0-alpha.23",
|
|
85
85
|
"@types/cross-spawn": "^6.0.2",
|
|
86
86
|
"@types/degit": "^2.8.3",
|
|
87
87
|
"@types/prompts": "^2.0.9",
|
|
@@ -96,5 +96,5 @@
|
|
|
96
96
|
"publishConfig": {
|
|
97
97
|
"access": "public"
|
|
98
98
|
},
|
|
99
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "0900e20acfbc12551c6a3f788b8de5dd6af5f80a"
|
|
100
100
|
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.readPackageJson = readPackageJson;
|
|
7
|
-
exports.writePackageJson = writePackageJson;
|
|
8
|
-
|
|
9
|
-
var _path = _interopRequireDefault(require("path"));
|
|
10
|
-
|
|
11
|
-
var _fs = _interopRequireDefault(require("fs"));
|
|
12
|
-
|
|
13
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
|
|
15
|
-
function readPackageJson() {
|
|
16
|
-
const packageJsonPath = _path.default.resolve('package.json');
|
|
17
|
-
|
|
18
|
-
if (!_fs.default.existsSync(packageJsonPath)) {
|
|
19
|
-
throw new Error(`Could not read package.json file at ${packageJsonPath}`);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const jsonContent = _fs.default.readFileSync(packageJsonPath, 'utf8');
|
|
23
|
-
|
|
24
|
-
return JSON.parse(jsonContent);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function writePackageJson(packageJson) {
|
|
28
|
-
const content = `${JSON.stringify(packageJson, null, 2)}\n`;
|
|
29
|
-
|
|
30
|
-
const packageJsonPath = _path.default.resolve('package.json');
|
|
31
|
-
|
|
32
|
-
_fs.default.writeFileSync(packageJsonPath, content, 'utf8');
|
|
33
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
import fs from 'fs';
|
|
3
|
-
export function readPackageJson() {
|
|
4
|
-
const packageJsonPath = path.resolve('package.json');
|
|
5
|
-
|
|
6
|
-
if (!fs.existsSync(packageJsonPath)) {
|
|
7
|
-
throw new Error(`Could not read package.json file at ${packageJsonPath}`);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const jsonContent = fs.readFileSync(packageJsonPath, 'utf8');
|
|
11
|
-
return JSON.parse(jsonContent);
|
|
12
|
-
}
|
|
13
|
-
export function writePackageJson(packageJson) {
|
|
14
|
-
const content = `${JSON.stringify(packageJson, null, 2)}\n`;
|
|
15
|
-
const packageJsonPath = path.resolve('package.json');
|
|
16
|
-
fs.writeFileSync(packageJsonPath, content, 'utf8');
|
|
17
|
-
}
|