@storybook/cli 7.0.0-alpha.20 → 7.0.0-alpha.24

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.
Files changed (37) hide show
  1. package/dist/cjs/automigrate/fixes/builder-vite.js +1 -3
  2. package/dist/cjs/detect.js +2 -18
  3. package/dist/cjs/generators/RAX/index.js +1 -3
  4. package/dist/cjs/generators/baseGenerator.js +17 -13
  5. package/dist/cjs/initiate.js +10 -3
  6. package/dist/cjs/js-package-manager/JsPackageManager.js +59 -10
  7. package/dist/cjs/js-package-manager/JsPackageManagerFactory.js +25 -11
  8. package/dist/cjs/js-package-manager/NPMProxy.js +6 -0
  9. package/dist/cjs/js-package-manager/Yarn1Proxy.js +6 -0
  10. package/dist/cjs/js-package-manager/Yarn2Proxy.js +6 -0
  11. package/dist/cjs/js-package-manager/index.js +0 -13
  12. package/dist/cjs/repro-generators/scripts.js +1 -1
  13. package/dist/cjs/versions.js +75 -75
  14. package/dist/esm/automigrate/fixes/builder-vite.js +1 -2
  15. package/dist/esm/detect.js +2 -17
  16. package/dist/esm/generators/RAX/index.js +1 -2
  17. package/dist/esm/generators/baseGenerator.js +17 -13
  18. package/dist/esm/initiate.js +10 -3
  19. package/dist/esm/js-package-manager/JsPackageManager.js +55 -9
  20. package/dist/esm/js-package-manager/JsPackageManagerFactory.js +25 -11
  21. package/dist/esm/js-package-manager/NPMProxy.js +6 -0
  22. package/dist/esm/js-package-manager/Yarn1Proxy.js +6 -0
  23. package/dist/esm/js-package-manager/Yarn2Proxy.js +6 -0
  24. package/dist/esm/js-package-manager/index.js +1 -2
  25. package/dist/esm/repro-generators/scripts.js +1 -1
  26. package/dist/esm/versions.js +75 -75
  27. package/dist/types/detect.d.ts +2 -2
  28. package/dist/types/js-package-manager/JsPackageManager.d.ts +13 -0
  29. package/dist/types/js-package-manager/JsPackageManagerFactory.d.ts +1 -1
  30. package/dist/types/js-package-manager/NPMProxy.d.ts +4 -0
  31. package/dist/types/js-package-manager/Yarn1Proxy.d.ts +6 -0
  32. package/dist/types/js-package-manager/Yarn2Proxy.d.ts +6 -0
  33. package/dist/types/js-package-manager/index.d.ts +0 -1
  34. package/package.json +9 -9
  35. package/dist/cjs/js-package-manager/PackageJsonHelper.js +0 -33
  36. package/dist/esm/js-package-manager/PackageJsonHelper.js +0 -17
  37. package/dist/types/js-package-manager/PackageJsonHelper.d.ts +0 -3
@@ -3,7 +3,6 @@ import fs from 'fs';
3
3
  import findUp from 'find-up';
4
4
  import { ProjectType, supportedTemplates, SUPPORTED_RENDERERS, SupportedLanguage, unsupportedTemplate, CoreBuilder } from './project_types';
5
5
  import { getBowerJson, paddedLog } from './helpers';
6
- import { readPackageJson } from './js-package-manager';
7
6
  import { detectNextJS } from './detect-nextjs';
8
7
  const viteConfigFiles = ['vite.config.ts', 'vite.config.js', 'vite.config.mjs'];
9
8
 
@@ -118,15 +117,8 @@ export function isStorybookInstalled(dependencies, force) {
118
117
 
119
118
  return false;
120
119
  }
121
- export function detectLanguage() {
120
+ export function detectLanguage(packageJson) {
122
121
  let language = SupportedLanguage.JAVASCRIPT;
123
- let packageJson;
124
-
125
- try {
126
- packageJson = readPackageJson();
127
- } catch (err) {//
128
- }
129
-
130
122
  const bowerJson = getBowerJson();
131
123
 
132
124
  if (!packageJson && !bowerJson) {
@@ -139,14 +131,7 @@ export function detectLanguage() {
139
131
 
140
132
  return language;
141
133
  }
142
- export function detect(options = {}) {
143
- let packageJson;
144
-
145
- try {
146
- packageJson = readPackageJson();
147
- } catch (err) {//
148
- }
149
-
134
+ export function detect(packageJson, options = {}) {
150
135
  const bowerJson = getBowerJson();
151
136
 
152
137
  if (!packageJson && !bowerJson) {
@@ -1,5 +1,4 @@
1
1
  import { baseGenerator } from '../baseGenerator';
2
- import { writePackageJson } from '../../js-package-manager';
3
2
 
4
3
  const generator = async (packageManager, npmOptions, options) => {
5
4
  const [latestRaxVersion] = await packageManager.getVersions('rax');
@@ -12,7 +11,7 @@ const generator = async (packageManager, npmOptions, options) => {
12
11
  packageJson.dependencies['rax-link'] = packageJson.dependencies['rax-link'] || raxVersion;
13
12
  packageJson.dependencies['rax-text'] = packageJson.dependencies['rax-text'] || raxVersion;
14
13
  packageJson.dependencies['rax-view'] = packageJson.dependencies['rax-view'] || raxVersion;
15
- writePackageJson(packageJson);
14
+ packageManager.writePackageJson(packageJson);
16
15
  await baseGenerator(packageManager, npmOptions, options, 'rax', {
17
16
  extraPackages: ['rax']
18
17
  });
@@ -52,6 +52,7 @@ const getFrameworkDetails = (renderer, builder, pnp) => {
52
52
  return {
53
53
  packages: [rendererPackage],
54
54
  framework: rendererPackagePath,
55
+ rendererId: 'angular',
55
56
  type: 'framework'
56
57
  };
57
58
  }
@@ -60,6 +61,7 @@ const getFrameworkDetails = (renderer, builder, pnp) => {
60
61
  return {
61
62
  packages: [frameworkPackage],
62
63
  framework: frameworkPackagePath,
64
+ rendererId: renderer,
63
65
  type: 'framework'
64
66
  };
65
67
  }
@@ -69,6 +71,7 @@ const getFrameworkDetails = (renderer, builder, pnp) => {
69
71
  packages: [rendererPackage, builderPackage],
70
72
  builder: builderPackagePath,
71
73
  renderer: rendererPackagePath,
74
+ rendererId: renderer,
72
75
  type: 'renderer'
73
76
  };
74
77
  }
@@ -78,7 +81,7 @@ const getFrameworkDetails = (renderer, builder, pnp) => {
78
81
 
79
82
  const stripVersions = addons => addons.map(addon => getPackageDetails(addon)[0]);
80
83
 
81
- const hasInteractiveStories = framework => ['react', 'angular', 'preact', 'svelte', 'vue', 'vue3', 'html'].includes(framework);
84
+ const hasInteractiveStories = rendererId => ['react', 'angular', 'preact', 'svelte', 'vue', 'vue3', 'html'].includes(rendererId);
82
85
 
83
86
  export async function baseGenerator(packageManager, npmOptions, {
84
87
  language,
@@ -96,13 +99,23 @@ export async function baseGenerator(packageManager, npmOptions, {
96
99
  addESLint,
97
100
  extraMain,
98
101
  extensions
99
- } = Object.assign({}, defaultOptions, options); // added to main.js
102
+ } = Object.assign({}, defaultOptions, options);
103
+ const {
104
+ packages: frameworkPackages,
105
+ type,
106
+ // @ts-ignore
107
+ renderer: rendererInclude,
108
+ // deepscan-disable-line UNUSED_DECL
109
+ rendererId,
110
+ framework: frameworkInclude,
111
+ builder: builderInclude
112
+ } = getFrameworkDetails(renderer, builder, pnp); // added to main.js
100
113
 
101
114
  const addons = ['@storybook/addon-links', '@storybook/addon-essentials', ...stripVersions(extraAddonPackages)]; // added to package.json
102
115
 
103
116
  const addonPackages = ['@storybook/addon-links', '@storybook/addon-essentials', ...extraAddonPackages];
104
117
 
105
- if (hasInteractiveStories(renderer)) {
118
+ if (hasInteractiveStories(rendererId)) {
106
119
  addons.push('@storybook/addon-interactions');
107
120
  addonPackages.push('@storybook/addon-interactions', '@storybook/testing-library');
108
121
  }
@@ -110,16 +123,7 @@ export async function baseGenerator(packageManager, npmOptions, {
110
123
  const yarn2ExtraPackages = packageManager.type === 'yarn2' ? ['@storybook/addon-docs', '@mdx-js/react@1.x.x'] : [];
111
124
  const files = await fse.readdir(process.cwd());
112
125
  const packageJson = packageManager.retrievePackageJson();
113
- const installedDependencies = new Set(Object.keys(Object.assign({}, packageJson.dependencies, packageJson.devDependencies)));
114
- const {
115
- packages: frameworkPackages,
116
- type,
117
- // @ts-ignore
118
- renderer: rendererInclude,
119
- // deepscan-disable-line UNUSED_DECL
120
- framework: frameworkInclude,
121
- builder: builderInclude
122
- } = getFrameworkDetails(renderer, builder, pnp); // TODO: We need to start supporting this at some point
126
+ const installedDependencies = new Set(Object.keys(Object.assign({}, packageJson.dependencies, packageJson.devDependencies))); // TODO: We need to start supporting this at some point
123
127
 
124
128
  if (type === 'renderer') {
125
129
  throw new Error(dedent`
@@ -34,7 +34,14 @@ const installStorybook = (projectType, packageManager, options) => {
34
34
  installAsDevDependencies: true,
35
35
  skipInstall: options.skipInstall
36
36
  };
37
- const language = detectLanguage();
37
+ let packageJson;
38
+
39
+ try {
40
+ packageJson = packageManager.readPackageJson();
41
+ } catch (err) {//
42
+ }
43
+
44
+ const language = detectLanguage(packageJson);
38
45
  const generatorOptions = {
39
46
  language,
40
47
  builder: options.builder || detectBuilder(packageManager),
@@ -208,7 +215,7 @@ export async function initiate(options, pkg) {
208
215
  process.exit(1);
209
216
  }
210
217
  } else {
211
- projectType = detect(options);
218
+ projectType = detect(packageJson, options);
212
219
  }
213
220
  } catch (ex) {
214
221
  done(ex.message);
@@ -225,7 +232,7 @@ export async function initiate(options, pkg) {
225
232
  }
226
233
 
227
234
  await automigrate({
228
- yes: process.env.CI === 'true'
235
+ yes: options.yes || process.env.CI === 'true'
229
236
  });
230
237
  logger.log('\nTo run your Storybook, type:\n');
231
238
  codeLog([packageManager.getRunStorybookCommand()]);
@@ -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,31 @@ export function getPackageDetails(pkg) {
25
26
  return [packageName, packageVersion];
26
27
  }
27
28
  export class JsPackageManager {
28
- constructor() {
29
- this.type = void 0;
29
+ // NOTE: for some reason yarn prefers the npm registry in
30
+ // local development, so always use npm
31
+ setRegistryURL(url) {
32
+ if (url) {
33
+ this.executeCommand('npm', ['config', 'set', 'registry', url]);
34
+ } else {
35
+ this.executeCommand('npm', ['config', 'delete', 'registry']);
36
+ }
30
37
  }
31
38
 
39
+ getRegistryURL() {
40
+ const url = this.executeCommand('npm', ['config', 'get', 'registry']).trim();
41
+ return url === 'undefined' ? undefined : url;
42
+ }
43
+
44
+ constructor(options) {
45
+ this.type = void 0;
46
+ this.cwd = void 0;
47
+ this.cwd = options?.cwd;
48
+ }
32
49
  /**
33
50
  * Install dependencies listed in `package.json`
34
51
  */
52
+
53
+
35
54
  installDependencies() {
36
55
  let done = commandLog('Preparing to install dependencies');
37
56
  done();
@@ -48,6 +67,26 @@ export class JsPackageManager {
48
67
 
49
68
  done();
50
69
  }
70
+
71
+ packageJsonPath() {
72
+ return this.cwd ? path.resolve(this.cwd, 'package.json') : path.resolve('package.json');
73
+ }
74
+
75
+ readPackageJson() {
76
+ const packageJsonPath = this.packageJsonPath();
77
+
78
+ if (!fs.existsSync(packageJsonPath)) {
79
+ throw new Error(`Could not read package.json file at ${packageJsonPath}`);
80
+ }
81
+
82
+ const jsonContent = fs.readFileSync(packageJsonPath, 'utf8');
83
+ return JSON.parse(jsonContent);
84
+ }
85
+
86
+ writePackageJson(packageJson) {
87
+ const content = `${JSON.stringify(packageJson, null, 2)}\n`;
88
+ fs.writeFileSync(this.packageJsonPath(), content, 'utf8');
89
+ }
51
90
  /**
52
91
  * Read the `package.json` file available in the directory the command was call from
53
92
  * If there is no `package.json` it will create one.
@@ -58,10 +97,10 @@ export class JsPackageManager {
58
97
  let packageJson;
59
98
 
60
99
  try {
61
- packageJson = readPackageJson();
100
+ packageJson = this.readPackageJson();
62
101
  } catch (err) {
63
102
  this.initPackageJson();
64
- packageJson = readPackageJson();
103
+ packageJson = this.readPackageJson();
65
104
  }
66
105
 
67
106
  return Object.assign({}, packageJson, {
@@ -106,7 +145,7 @@ export class JsPackageManager {
106
145
  packageJson.dependencies = Object.assign({}, packageJson.dependencies, dependenciesMap);
107
146
  }
108
147
 
109
- writePackageJson(packageJson);
148
+ this.writePackageJson(packageJson);
110
149
  } else {
111
150
  try {
112
151
  this.runAddDeps(dependencies, options.installAsDevDependencies);
@@ -148,7 +187,7 @@ export class JsPackageManager {
148
187
  delete packageJson.dependencies[dep];
149
188
  }
150
189
  });
151
- writePackageJson(packageJson);
190
+ this.writePackageJson(packageJson);
152
191
  } else {
153
192
  try {
154
193
  this.runRemoveDeps(dependencies);
@@ -253,7 +292,7 @@ export class JsPackageManager {
253
292
 
254
293
  addESLintConfig() {
255
294
  const packageJson = this.retrievePackageJson();
256
- writePackageJson(Object.assign({}, packageJson, {
295
+ this.writePackageJson(Object.assign({}, packageJson, {
257
296
  eslintConfig: Object.assign({}, packageJson.eslintConfig, {
258
297
  overrides: [...(packageJson.eslintConfig?.overrides || []), {
259
298
  files: ['**/*.stories.*'],
@@ -267,13 +306,20 @@ export class JsPackageManager {
267
306
 
268
307
  addScripts(scripts) {
269
308
  const packageJson = this.retrievePackageJson();
270
- writePackageJson(Object.assign({}, packageJson, {
309
+ this.writePackageJson(Object.assign({}, packageJson, {
271
310
  scripts: Object.assign({}, packageJson.scripts, scripts)
272
311
  }));
273
312
  }
274
313
 
314
+ addPackageResolutions(versions) {
315
+ const packageJson = this.retrievePackageJson();
316
+ const resolutions = this.getResolutions(packageJson, versions);
317
+ this.writePackageJson(Object.assign({}, packageJson, resolutions));
318
+ }
319
+
275
320
  executeCommand(command, args, stdio) {
276
321
  const commandResult = spawnSync(command, args, {
322
+ cwd: this.cwd,
277
323
  stdio: stdio ?? 'pipe',
278
324
  encoding: 'utf-8'
279
325
  });
@@ -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
- const hasNPMCommand = hasNPM();
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() : new Yarn2Proxy();
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,12 @@ export class NPMProxy extends JsPackageManager {
53
53
  return this.uninstallArgs;
54
54
  }
55
55
 
56
+ getResolutions(packageJson, versions) {
57
+ return {
58
+ overrides: Object.assign({}, packageJson.overrides, versions)
59
+ };
60
+ }
61
+
56
62
  runInstall() {
57
63
  this.executeCommand('npm', this.getInstallArgs(), 'inherit');
58
64
  }
@@ -17,6 +17,12 @@ export class Yarn1Proxy extends JsPackageManager {
17
17
  return `yarn ${command}`;
18
18
  }
19
19
 
20
+ getResolutions(packageJson, versions) {
21
+ return {
22
+ resolutions: Object.assign({}, packageJson.resolutions, versions)
23
+ };
24
+ }
25
+
20
26
  runInstall() {
21
27
  this.executeCommand('yarn', [], 'inherit');
22
28
  }
@@ -17,6 +17,12 @@ export class Yarn2Proxy extends JsPackageManager {
17
17
  return `yarn ${command}`;
18
18
  }
19
19
 
20
+ getResolutions(packageJson, versions) {
21
+ return {
22
+ resolutions: Object.assign({}, packageJson.resolutions, versions)
23
+ };
24
+ }
25
+
20
26
  runInstall() {
21
27
  this.executeCommand('yarn', [], 'inherit');
22
28
  }
@@ -1,4 +1,3 @@
1
1
  export * from './JsPackageManagerFactory';
2
2
  export * from './JsPackageManager';
3
- export * from './PackageJson';
4
- export * from './PackageJsonHelper';
3
+ export * from './PackageJson';
@@ -112,7 +112,7 @@ const configureYarn2ForE2E = async ({
112
112
  cwd
113
113
  }) => {
114
114
  const command = [// ⚠️ Need to set registry because Yarn 2 is not using the conf of Yarn 1 (URL is hardcoded in CircleCI config.yml)
115
- `yarn config set npmScopes --json '{ "storybook": { "npmRegistryServer": "http://localhost:6000/" } }'`, // Some required magic to be able to fetch deps from local registry
115
+ `yarn config set npmScopes --json '{ "storybook": { "npmRegistryServer": "http://localhost:6001/" } }'`, // Some required magic to be able to fetch deps from local registry
116
116
  `yarn config set unsafeHttpWhitelist --json '["localhost"]'`, // Disable fallback mode to make sure everything is required correctly
117
117
  `yarn config set pnpFallbackMode none`, // We need to be able to update lockfile when bootstrapping the examples
118
118
  `yarn config set enableImmutableInstalls false`, // Discard all YN0013 - FETCH_NOT_CACHED messages
@@ -1,78 +1,78 @@
1
1
  // auto generated file, do not edit
2
2
  export default {
3
- '@storybook/addon-a11y': '7.0.0-alpha.20',
4
- '@storybook/addon-actions': '7.0.0-alpha.20',
5
- '@storybook/addon-backgrounds': '7.0.0-alpha.20',
6
- '@storybook/addon-controls': '7.0.0-alpha.20',
7
- '@storybook/addon-docs': '7.0.0-alpha.20',
8
- '@storybook/addon-essentials': '7.0.0-alpha.20',
9
- '@storybook/addon-highlight': '7.0.0-alpha.20',
10
- '@storybook/addon-interactions': '7.0.0-alpha.20',
11
- '@storybook/addon-jest': '7.0.0-alpha.20',
12
- '@storybook/addon-links': '7.0.0-alpha.20',
13
- '@storybook/addon-measure': '7.0.0-alpha.20',
14
- '@storybook/addon-outline': '7.0.0-alpha.20',
15
- '@storybook/addon-storyshots': '7.0.0-alpha.20',
16
- '@storybook/addon-storyshots-puppeteer': '7.0.0-alpha.20',
17
- '@storybook/addon-storysource': '7.0.0-alpha.20',
18
- '@storybook/addon-toolbars': '7.0.0-alpha.20',
19
- '@storybook/addon-viewport': '7.0.0-alpha.20',
20
- '@storybook/addons': '7.0.0-alpha.20',
21
- '@storybook/angular': '7.0.0-alpha.20',
22
- '@storybook/api': '7.0.0-alpha.20',
23
- '@storybook/blocks': '7.0.0-alpha.20',
24
- '@storybook/builder-manager': '7.0.0-alpha.20',
25
- '@storybook/builder-webpack5': '7.0.0-alpha.20',
26
- '@storybook/channel-postmessage': '7.0.0-alpha.20',
27
- '@storybook/channel-websocket': '7.0.0-alpha.20',
28
- '@storybook/channels': '7.0.0-alpha.20',
29
- '@storybook/cli': '7.0.0-alpha.20',
30
- '@storybook/client-api': '7.0.0-alpha.20',
31
- '@storybook/client-logger': '7.0.0-alpha.20',
32
- '@storybook/codemod': '7.0.0-alpha.20',
33
- '@storybook/components': '7.0.0-alpha.20',
34
- '@storybook/core-client': '7.0.0-alpha.20',
35
- '@storybook/core-common': '7.0.0-alpha.20',
36
- '@storybook/core-events': '7.0.0-alpha.20',
37
- '@storybook/core-server': '7.0.0-alpha.20',
38
- '@storybook/core-webpack': '7.0.0-alpha.20',
39
- '@storybook/csf-tools': '7.0.0-alpha.20',
40
- '@storybook/docs-tools': '7.0.0-alpha.20',
41
- '@storybook/ember': '7.0.0-alpha.20',
42
- '@storybook/html': '7.0.0-alpha.20',
43
- '@storybook/html-webpack5': '7.0.0-alpha.20',
44
- '@storybook/instrumenter': '7.0.0-alpha.20',
45
- '@storybook/node-logger': '7.0.0-alpha.20',
46
- '@storybook/postinstall': '7.0.0-alpha.20',
47
- '@storybook/preact': '7.0.0-alpha.20',
48
- '@storybook/preact-webpack5': '7.0.0-alpha.20',
49
- '@storybook/preset-html-webpack': '7.0.0-alpha.20',
50
- '@storybook/preset-preact-webpack': '7.0.0-alpha.20',
51
- '@storybook/preset-react-webpack': '7.0.0-alpha.20',
52
- '@storybook/preset-server-webpack': '7.0.0-alpha.20',
53
- '@storybook/preset-svelte-webpack': '7.0.0-alpha.20',
54
- '@storybook/preset-vue-webpack': '7.0.0-alpha.20',
55
- '@storybook/preset-vue3-webpack': '7.0.0-alpha.20',
56
- '@storybook/preset-web-components-webpack': '7.0.0-alpha.20',
57
- '@storybook/preview-web': '7.0.0-alpha.20',
58
- '@storybook/react': '7.0.0-alpha.20',
59
- '@storybook/react-webpack5': '7.0.0-alpha.20',
60
- '@storybook/router': '7.0.0-alpha.20',
61
- '@storybook/server': '7.0.0-alpha.20',
62
- '@storybook/server-webpack5': '7.0.0-alpha.20',
63
- '@storybook/source-loader': '7.0.0-alpha.20',
64
- '@storybook/store': '7.0.0-alpha.20',
65
- '@storybook/svelte': '7.0.0-alpha.20',
66
- '@storybook/svelte-webpack5': '7.0.0-alpha.20',
67
- '@storybook/telemetry': '7.0.0-alpha.20',
68
- '@storybook/theming': '7.0.0-alpha.20',
69
- '@storybook/ui': '7.0.0-alpha.20',
70
- '@storybook/vue': '7.0.0-alpha.20',
71
- '@storybook/vue-webpack5': '7.0.0-alpha.20',
72
- '@storybook/vue3': '7.0.0-alpha.20',
73
- '@storybook/vue3-webpack5': '7.0.0-alpha.20',
74
- '@storybook/web-components': '7.0.0-alpha.20',
75
- '@storybook/web-components-webpack5': '7.0.0-alpha.20',
76
- sb: '7.0.0-alpha.20',
77
- storybook: '7.0.0-alpha.20'
3
+ '@storybook/addon-a11y': '7.0.0-alpha.24',
4
+ '@storybook/addon-actions': '7.0.0-alpha.24',
5
+ '@storybook/addon-backgrounds': '7.0.0-alpha.24',
6
+ '@storybook/addon-controls': '7.0.0-alpha.24',
7
+ '@storybook/addon-docs': '7.0.0-alpha.24',
8
+ '@storybook/addon-essentials': '7.0.0-alpha.24',
9
+ '@storybook/addon-highlight': '7.0.0-alpha.24',
10
+ '@storybook/addon-interactions': '7.0.0-alpha.24',
11
+ '@storybook/addon-jest': '7.0.0-alpha.24',
12
+ '@storybook/addon-links': '7.0.0-alpha.24',
13
+ '@storybook/addon-measure': '7.0.0-alpha.24',
14
+ '@storybook/addon-outline': '7.0.0-alpha.24',
15
+ '@storybook/addon-storyshots': '7.0.0-alpha.24',
16
+ '@storybook/addon-storyshots-puppeteer': '7.0.0-alpha.24',
17
+ '@storybook/addon-storysource': '7.0.0-alpha.24',
18
+ '@storybook/addon-toolbars': '7.0.0-alpha.24',
19
+ '@storybook/addon-viewport': '7.0.0-alpha.24',
20
+ '@storybook/addons': '7.0.0-alpha.24',
21
+ '@storybook/angular': '7.0.0-alpha.24',
22
+ '@storybook/api': '7.0.0-alpha.24',
23
+ '@storybook/blocks': '7.0.0-alpha.24',
24
+ '@storybook/builder-manager': '7.0.0-alpha.24',
25
+ '@storybook/builder-webpack5': '7.0.0-alpha.24',
26
+ '@storybook/channel-postmessage': '7.0.0-alpha.24',
27
+ '@storybook/channel-websocket': '7.0.0-alpha.24',
28
+ '@storybook/channels': '7.0.0-alpha.24',
29
+ '@storybook/cli': '7.0.0-alpha.24',
30
+ '@storybook/client-api': '7.0.0-alpha.24',
31
+ '@storybook/client-logger': '7.0.0-alpha.24',
32
+ '@storybook/codemod': '7.0.0-alpha.24',
33
+ '@storybook/components': '7.0.0-alpha.24',
34
+ '@storybook/core-client': '7.0.0-alpha.24',
35
+ '@storybook/core-common': '7.0.0-alpha.24',
36
+ '@storybook/core-events': '7.0.0-alpha.24',
37
+ '@storybook/core-server': '7.0.0-alpha.24',
38
+ '@storybook/core-webpack': '7.0.0-alpha.24',
39
+ '@storybook/csf-tools': '7.0.0-alpha.24',
40
+ '@storybook/docs-tools': '7.0.0-alpha.24',
41
+ '@storybook/ember': '7.0.0-alpha.24',
42
+ '@storybook/html': '7.0.0-alpha.24',
43
+ '@storybook/html-webpack5': '7.0.0-alpha.24',
44
+ '@storybook/instrumenter': '7.0.0-alpha.24',
45
+ '@storybook/node-logger': '7.0.0-alpha.24',
46
+ '@storybook/postinstall': '7.0.0-alpha.24',
47
+ '@storybook/preact': '7.0.0-alpha.24',
48
+ '@storybook/preact-webpack5': '7.0.0-alpha.24',
49
+ '@storybook/preset-html-webpack': '7.0.0-alpha.24',
50
+ '@storybook/preset-preact-webpack': '7.0.0-alpha.24',
51
+ '@storybook/preset-react-webpack': '7.0.0-alpha.24',
52
+ '@storybook/preset-server-webpack': '7.0.0-alpha.24',
53
+ '@storybook/preset-svelte-webpack': '7.0.0-alpha.24',
54
+ '@storybook/preset-vue-webpack': '7.0.0-alpha.24',
55
+ '@storybook/preset-vue3-webpack': '7.0.0-alpha.24',
56
+ '@storybook/preset-web-components-webpack': '7.0.0-alpha.24',
57
+ '@storybook/preview-web': '7.0.0-alpha.24',
58
+ '@storybook/react': '7.0.0-alpha.24',
59
+ '@storybook/react-webpack5': '7.0.0-alpha.24',
60
+ '@storybook/router': '7.0.0-alpha.24',
61
+ '@storybook/server': '7.0.0-alpha.24',
62
+ '@storybook/server-webpack5': '7.0.0-alpha.24',
63
+ '@storybook/source-loader': '7.0.0-alpha.24',
64
+ '@storybook/store': '7.0.0-alpha.24',
65
+ '@storybook/svelte': '7.0.0-alpha.24',
66
+ '@storybook/svelte-webpack5': '7.0.0-alpha.24',
67
+ '@storybook/telemetry': '7.0.0-alpha.24',
68
+ '@storybook/theming': '7.0.0-alpha.24',
69
+ '@storybook/ui': '7.0.0-alpha.24',
70
+ '@storybook/vue': '7.0.0-alpha.24',
71
+ '@storybook/vue-webpack5': '7.0.0-alpha.24',
72
+ '@storybook/vue3': '7.0.0-alpha.24',
73
+ '@storybook/vue3-webpack5': '7.0.0-alpha.24',
74
+ '@storybook/web-components': '7.0.0-alpha.24',
75
+ '@storybook/web-components-webpack5': '7.0.0-alpha.24',
76
+ sb: '7.0.0-alpha.24',
77
+ storybook: '7.0.0-alpha.24'
78
78
  };
@@ -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
+ setRegistryURL(url: string): void;
18
+ 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,4 @@
1
1
  import { JsPackageManager } from './JsPackageManager';
2
2
  export declare class JsPackageManagerFactory {
3
- static getPackageManager(forceNpmUsage?: boolean): JsPackageManager;
3
+ static getPackageManager(forceNpmUsage?: boolean, cwd?: string): JsPackageManager;
4
4
  }
@@ -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,9 @@ export declare class NPMProxy extends JsPackageManager {
12
13
  needsLegacyPeerDeps(version: string): boolean;
13
14
  getInstallArgs(): string[];
14
15
  getUninstallArgs(): string[];
16
+ protected getResolutions(packageJson: PackageJson, versions: Record<string, string>): {
17
+ overrides: any;
18
+ };
15
19
  protected runInstall(): void;
16
20
  protected runAddDeps(dependencies: string[], installAsDevDependencies: boolean): void;
17
21
  protected runRemoveDeps(dependencies: string[]): void;