@storybook/cli 7.0.0-beta.6 → 7.0.0-beta.61
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/.eslintrc.js +1 -0
- package/bin/index.js +6 -1
- package/dist/chunk-HBVTX4IN.mjs +1239 -0
- package/dist/chunk-ZKUAYCCT.mjs +16 -0
- package/dist/generate.d.ts +1 -0
- package/dist/generate.js +5671 -291
- package/dist/generate.mjs +4423 -274
- package/dist/index.d.ts +134 -0
- package/dist/index.js +845 -0
- package/dist/index.mjs +12 -0
- package/package.json +33 -17
- package/rendererAssets/common/Introduction.mdx +1 -1
- package/rendererAssets/common/header.css +1 -1
- package/rendererAssets/common/page.css +1 -1
- package/templates/angular/template-csf/.storybook/tsconfig.json +5 -4
- package/templates/react-native/template-csf/storybook/addons.js +0 -3
- package/templates/react-native/template-csf/storybook/index.js +0 -29
- package/templates/react-native/template-csf/storybook/rn-addons.js +0 -2
- package/templates/react-native/template-csf/storybook/stories/Button/Button.stories.js +0 -20
- package/templates/react-native/template-csf/storybook/stories/Button/index.js +0 -17
- package/templates/react-native/template-csf/storybook/stories/CenterView/index.js +0 -16
- package/templates/react-native/template-csf/storybook/stories/CenterView/style.js +0 -8
- package/templates/react-native/template-csf/storybook/stories/Welcome/Welcome.stories.js +0 -6
- package/templates/react-native/template-csf/storybook/stories/Welcome/index.js +0 -57
- package/templates/react-native/template-csf/storybook/stories/index.js +0 -2
- package/templates/server/template-csf/.storybook/preview.js +0 -5
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { PackageJson } from '@storybook/types';
|
|
2
|
+
export { PackageJson } from '@storybook/types';
|
|
3
|
+
|
|
4
|
+
declare const useNpmWarning: () => void;
|
|
5
|
+
|
|
6
|
+
type PackageJsonWithDepsAndDevDeps = PackageJson & Required<Pick<PackageJson, 'dependencies' | 'devDependencies'>>;
|
|
7
|
+
type PackageJsonWithMaybeDeps = Partial<Pick<PackageJson, 'dependencies' | 'devDependencies' | 'peerDependencies' | 'files'>>;
|
|
8
|
+
|
|
9
|
+
type PackageManagerName = 'npm' | 'yarn1' | 'yarn2' | 'pnpm';
|
|
10
|
+
/**
|
|
11
|
+
* Extract package name and version from input
|
|
12
|
+
*
|
|
13
|
+
* @param pkg A string like `@storybook/cli`, `react` or `react@^16`
|
|
14
|
+
* @return A tuple of 2 elements: [packageName, packageVersion]
|
|
15
|
+
*/
|
|
16
|
+
declare function getPackageDetails(pkg: string): [string, string?];
|
|
17
|
+
interface JsPackageManagerOptions {
|
|
18
|
+
cwd?: string;
|
|
19
|
+
}
|
|
20
|
+
declare abstract class JsPackageManager {
|
|
21
|
+
abstract readonly type: PackageManagerName;
|
|
22
|
+
abstract initPackageJson(): void;
|
|
23
|
+
abstract getRunStorybookCommand(): string;
|
|
24
|
+
abstract getRunCommand(command: string): string;
|
|
25
|
+
setRegistryURL(url: string): void;
|
|
26
|
+
getRegistryURL(): string;
|
|
27
|
+
readonly cwd?: string;
|
|
28
|
+
constructor(options?: JsPackageManagerOptions);
|
|
29
|
+
/**
|
|
30
|
+
* Install dependencies listed in `package.json`
|
|
31
|
+
*/
|
|
32
|
+
installDependencies(): void;
|
|
33
|
+
packageJsonPath(): string;
|
|
34
|
+
readPackageJson(): PackageJson;
|
|
35
|
+
writePackageJson(packageJson: PackageJson): void;
|
|
36
|
+
/**
|
|
37
|
+
* Read the `package.json` file available in the directory the command was call from
|
|
38
|
+
* If there is no `package.json` it will create one.
|
|
39
|
+
*/
|
|
40
|
+
retrievePackageJson(): PackageJsonWithDepsAndDevDeps;
|
|
41
|
+
getAllDependencies(): Record<string, string>;
|
|
42
|
+
/**
|
|
43
|
+
* Add dependencies to a project using `yarn add` or `npm install`.
|
|
44
|
+
*
|
|
45
|
+
* @param {Object} options contains `skipInstall`, `packageJson` and `installAsDevDependencies` which we use to determine how we install packages.
|
|
46
|
+
* @param {Array} dependencies contains a list of packages to add.
|
|
47
|
+
* @example
|
|
48
|
+
* addDependencies(options, [
|
|
49
|
+
* `@storybook/react@${storybookVersion}`,
|
|
50
|
+
* `@storybook/addon-actions@${actionsVersion}`,
|
|
51
|
+
* `@storybook/addon-links@${linksVersion}`,
|
|
52
|
+
* `@storybook/preview-api@${addonsVersion}`,
|
|
53
|
+
* ]);
|
|
54
|
+
*/
|
|
55
|
+
addDependencies(options: {
|
|
56
|
+
skipInstall?: boolean;
|
|
57
|
+
installAsDevDependencies?: boolean;
|
|
58
|
+
packageJson?: PackageJson;
|
|
59
|
+
}, dependencies: string[]): void;
|
|
60
|
+
/**
|
|
61
|
+
* Remove dependencies from a project using `yarn remove` or `npm uninstall`.
|
|
62
|
+
*
|
|
63
|
+
* @param {Object} options contains `skipInstall`, `packageJson` and `installAsDevDependencies` which we use to determine how we install packages.
|
|
64
|
+
* @param {Array} dependencies contains a list of packages to remove.
|
|
65
|
+
* @example
|
|
66
|
+
* removeDependencies(options, [
|
|
67
|
+
* `@storybook/react`,
|
|
68
|
+
* `@storybook/addon-actions`,
|
|
69
|
+
* ]);
|
|
70
|
+
*/
|
|
71
|
+
removeDependencies(options: {
|
|
72
|
+
skipInstall?: boolean;
|
|
73
|
+
packageJson?: PackageJson;
|
|
74
|
+
}, dependencies: string[]): void;
|
|
75
|
+
/**
|
|
76
|
+
* Return an array of strings matching following format: `<package_name>@<package_latest_version>`
|
|
77
|
+
*
|
|
78
|
+
* @param packages
|
|
79
|
+
*/
|
|
80
|
+
getVersionedPackages(packages: string[]): Promise<string[]>;
|
|
81
|
+
/**
|
|
82
|
+
* Return an array of string standing for the latest version of the input packages.
|
|
83
|
+
* To be able to identify which version goes with which package the order of the input array is keep.
|
|
84
|
+
*
|
|
85
|
+
* @param packageNames
|
|
86
|
+
*/
|
|
87
|
+
getVersions(...packageNames: string[]): Promise<string[]>;
|
|
88
|
+
/**
|
|
89
|
+
* Return the latest version of the input package available on npmjs registry.
|
|
90
|
+
* If constraint are provided it return the latest version matching the constraints.
|
|
91
|
+
*
|
|
92
|
+
* For `@storybook/*` packages the latest version is retrieved from `cli/src/versions.json` file directly
|
|
93
|
+
*
|
|
94
|
+
* @param packageName The name of the package
|
|
95
|
+
* @param constraint A valid semver constraint, example: '1.x || >=2.5.0 || 5.0.0 - 7.2.3'
|
|
96
|
+
*/
|
|
97
|
+
getVersion(packageName: string, constraint?: string): Promise<string>;
|
|
98
|
+
/**
|
|
99
|
+
* Get the latest version of the package available on npmjs.com.
|
|
100
|
+
* If constraint is set then it returns a version satisfying it, otherwise the latest version available is returned.
|
|
101
|
+
*
|
|
102
|
+
* @param packageName Name of the package
|
|
103
|
+
* @param constraint Version range to use to constraint the returned version
|
|
104
|
+
*/
|
|
105
|
+
latestVersion(packageName: string, constraint?: string): Promise<string>;
|
|
106
|
+
addStorybookCommandInScripts(options?: {
|
|
107
|
+
port: number;
|
|
108
|
+
preCommand?: string;
|
|
109
|
+
}): void;
|
|
110
|
+
addESLintConfig(): void;
|
|
111
|
+
addScripts(scripts: Record<string, string>): void;
|
|
112
|
+
addPackageResolutions(versions: Record<string, string>): void;
|
|
113
|
+
protected abstract runInstall(): void;
|
|
114
|
+
protected abstract runAddDeps(dependencies: string[], installAsDevDependencies: boolean): void;
|
|
115
|
+
protected abstract runRemoveDeps(dependencies: string[]): void;
|
|
116
|
+
protected abstract getResolutions(packageJson: PackageJson, versions: Record<string, string>): Record<string, any>;
|
|
117
|
+
/**
|
|
118
|
+
* Get the latest or all versions of the input package available on npmjs.com
|
|
119
|
+
*
|
|
120
|
+
* @param packageName Name of the package
|
|
121
|
+
* @param fetchAllVersions Should return
|
|
122
|
+
*/
|
|
123
|
+
protected abstract runGetVersions<T extends boolean>(packageName: string, fetchAllVersions: T): Promise<T extends true ? string[] : string>;
|
|
124
|
+
abstract runPackageCommand(command: string, args: string[], cwd?: string): string;
|
|
125
|
+
executeCommand(command: string, args: string[], stdio?: 'pipe' | 'inherit', cwd?: string): string;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
declare class JsPackageManagerFactory {
|
|
129
|
+
static getPackageManager({ force }?: {
|
|
130
|
+
force?: PackageManagerName;
|
|
131
|
+
}, cwd?: string): JsPackageManager;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export { JsPackageManager, JsPackageManagerFactory, PackageJsonWithDepsAndDevDeps, PackageJsonWithMaybeDeps, PackageManagerName, getPackageDetails, useNpmWarning };
|