@nx/storybook 16.10.0 → 17.0.0-beta.2
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/migrations.json +0 -171
- package/package.json +6 -7
- package/src/executors/build-storybook/build-storybook.impl.d.ts +1 -2
- package/src/executors/build-storybook/build-storybook.impl.js +13 -47
- package/src/executors/build-storybook/schema.json +0 -13
- package/src/executors/storybook/storybook.impl.d.ts +1 -2
- package/src/executors/storybook/storybook.impl.js +18 -45
- package/src/generators/configuration/configuration.js +1 -1
- package/src/generators/configuration/lib/util-functions.d.ts +6 -7
- package/src/generators/configuration/lib/util-functions.js +3 -11
- package/src/generators/configuration/schema.d.ts +2 -2
- package/src/generators/init/init.js +5 -12
- package/src/generators/init/schema.d.ts +2 -2
- package/src/generators/migrate-7/schema.d.ts +0 -2
- package/src/utils/models.d.ts +1 -4
- package/src/utils/utilities.js +3 -2
- package/src/executors/utils.d.ts +0 -6
- package/src/executors/utils.js +0 -132
- package/src/migrations/update-13-4-6/set-project-build-config.d.ts +0 -2
- package/src/migrations/update-13-4-6/set-project-build-config.js +0 -56
- package/src/migrations/update-14-0-0/migrate-defaults-5-to-6/migrate-defaults-5-to-6.d.ts +0 -6
- package/src/migrations/update-14-0-0/migrate-defaults-5-to-6/migrate-defaults-5-to-6.js +0 -117
- package/src/migrations/update-14-0-0/migrate-stories-to-6-2/migrate-stories-to-6-2.d.ts +0 -8
- package/src/migrations/update-14-0-0/migrate-stories-to-6-2/migrate-stories-to-6-2.js +0 -316
- package/src/migrations/update-14-0-0/migrate-to-storybook-6.d.ts +0 -2
- package/src/migrations/update-14-0-0/migrate-to-storybook-6.js +0 -9
- package/src/migrations/update-14-1-8/change-storybook-targets-generator.d.ts +0 -4
- package/src/migrations/update-14-1-8/change-storybook-targets-generator.js +0 -104
- package/src/migrations/update-14-1-8/change-storybook-targets.d.ts +0 -2
- package/src/migrations/update-14-1-8/change-storybook-targets.js +0 -7
- package/src/utils/test-configs/.storybook/main.js +0 -8
- package/src/utils/test-configs/.storybook/tsconfig.json +0 -19
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.changeStorybookTargetsSchematic = exports.changeStorybookTargetsGenerator = void 0;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const utilities_1 = require("../../utils/utilities");
|
|
6
|
-
async function changeStorybookTargetsGenerator(tree) {
|
|
7
|
-
let changesMade = false;
|
|
8
|
-
let changesMadeToAtLeastOne = false;
|
|
9
|
-
const projects = (0, devkit_1.getProjects)(tree);
|
|
10
|
-
[...projects.entries()].forEach(([projectName, projectConfiguration]) => {
|
|
11
|
-
changesMade = false;
|
|
12
|
-
const { storybookBuildTarget, storybookTarget, ngBuildTarget } = (0, utilities_1.findStorybookAndBuildTargetsAndCompiler)(projectConfiguration.targets);
|
|
13
|
-
if (projectName &&
|
|
14
|
-
storybookTarget &&
|
|
15
|
-
projectConfiguration?.targets?.[storybookTarget]?.options?.uiFramework ===
|
|
16
|
-
'@storybook/angular') {
|
|
17
|
-
projectConfiguration.targets[storybookTarget] = updateStorybookTarget(projectConfiguration, storybookTarget, projectName, ngBuildTarget, storybookBuildTarget);
|
|
18
|
-
changesMade = true;
|
|
19
|
-
changesMadeToAtLeastOne = true;
|
|
20
|
-
if (storybookBuildTarget) {
|
|
21
|
-
projectConfiguration.targets[storybookBuildTarget] =
|
|
22
|
-
updateStorybookBuildTarget(projectConfiguration, projectName, ngBuildTarget, storybookBuildTarget);
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
devkit_1.logger.info(`Project ${projectName} does not have a build target configured for Storybook.`);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
devkit_1.logger.warn(`Could not find a Storybook target for ${projectName}.`);
|
|
30
|
-
}
|
|
31
|
-
if (changesMade) {
|
|
32
|
-
(0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfiguration);
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
if (changesMadeToAtLeastOne) {
|
|
36
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
exports.changeStorybookTargetsGenerator = changeStorybookTargetsGenerator;
|
|
40
|
-
function updateStorybookTarget(projectConfiguration, storybookTarget, projectName, buildTarget, storybookBuildTarget) {
|
|
41
|
-
const oldStorybookTargetConfig = projectConfiguration.targets[storybookTarget];
|
|
42
|
-
const newStorybookTargetConfig = {
|
|
43
|
-
executor: '@storybook/angular:start-storybook',
|
|
44
|
-
options: {
|
|
45
|
-
port: oldStorybookTargetConfig.options.port,
|
|
46
|
-
configDir: oldStorybookTargetConfig.options.config?.configFolder,
|
|
47
|
-
browserTarget: undefined,
|
|
48
|
-
compodoc: false,
|
|
49
|
-
},
|
|
50
|
-
configurations: oldStorybookTargetConfig.configurations,
|
|
51
|
-
};
|
|
52
|
-
const { project, target } = parseTargetStringCustom(oldStorybookTargetConfig.options.projectBuildConfig);
|
|
53
|
-
if (project && target) {
|
|
54
|
-
newStorybookTargetConfig.options.browserTarget =
|
|
55
|
-
oldStorybookTargetConfig.options.projectBuildConfig;
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
newStorybookTargetConfig.options.browserTarget = `${projectName}:${buildTarget ? buildTarget : storybookBuildTarget}`;
|
|
59
|
-
}
|
|
60
|
-
const { uiFramework, outputPath, config, projectBuildConfig, ...optionsToCopy } = oldStorybookTargetConfig.options;
|
|
61
|
-
newStorybookTargetConfig.options = {
|
|
62
|
-
...optionsToCopy,
|
|
63
|
-
...newStorybookTargetConfig.options,
|
|
64
|
-
};
|
|
65
|
-
return newStorybookTargetConfig;
|
|
66
|
-
}
|
|
67
|
-
function updateStorybookBuildTarget(projectConfiguration, projectName, buildTarget, storybookBuildTarget) {
|
|
68
|
-
const oldStorybookBuildTargetConfig = projectConfiguration.targets[storybookBuildTarget];
|
|
69
|
-
const newStorybookBuildTargetConfig = {
|
|
70
|
-
executor: '@storybook/angular:build-storybook',
|
|
71
|
-
outputs: oldStorybookBuildTargetConfig.outputs,
|
|
72
|
-
options: {
|
|
73
|
-
outputDir: oldStorybookBuildTargetConfig.options.outputPath,
|
|
74
|
-
configDir: oldStorybookBuildTargetConfig.options.config?.configFolder,
|
|
75
|
-
browserTarget: undefined,
|
|
76
|
-
compodoc: false,
|
|
77
|
-
},
|
|
78
|
-
configurations: oldStorybookBuildTargetConfig.configurations,
|
|
79
|
-
};
|
|
80
|
-
const { project, target } = parseTargetStringCustom(oldStorybookBuildTargetConfig.options.projectBuildConfig);
|
|
81
|
-
if (project && target) {
|
|
82
|
-
newStorybookBuildTargetConfig.options.browserTarget =
|
|
83
|
-
oldStorybookBuildTargetConfig.options.projectBuildConfig;
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
newStorybookBuildTargetConfig.options.browserTarget = `${projectName}:${buildTarget ? buildTarget : storybookBuildTarget}`;
|
|
87
|
-
}
|
|
88
|
-
const { uiFramework, outputPath, config, projectBuildConfig, ...optionsToCopy } = oldStorybookBuildTargetConfig.options;
|
|
89
|
-
newStorybookBuildTargetConfig.options = {
|
|
90
|
-
...optionsToCopy,
|
|
91
|
-
...newStorybookBuildTargetConfig.options,
|
|
92
|
-
};
|
|
93
|
-
return newStorybookBuildTargetConfig;
|
|
94
|
-
}
|
|
95
|
-
function parseTargetStringCustom(targetString) {
|
|
96
|
-
const [project, target, configuration] = targetString.split(':');
|
|
97
|
-
return {
|
|
98
|
-
project,
|
|
99
|
-
target,
|
|
100
|
-
configuration,
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
exports.default = changeStorybookTargetsGenerator;
|
|
104
|
-
exports.changeStorybookTargetsSchematic = (0, devkit_1.convertNxGenerator)(changeStorybookTargetsGenerator);
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const change_storybook_targets_generator_1 = require("./change-storybook-targets-generator");
|
|
4
|
-
async function changeStorybookTargets(tree) {
|
|
5
|
-
return (0, change_storybook_targets_generator_1.changeStorybookTargetsGenerator)(tree);
|
|
6
|
-
}
|
|
7
|
-
exports.default = changeStorybookTargets;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"outDir": ""
|
|
4
|
-
},
|
|
5
|
-
"exclude": [
|
|
6
|
-
"../**/*.spec.ts",
|
|
7
|
-
"../**/*.spec.js",
|
|
8
|
-
"../**/*.spec.tsx",
|
|
9
|
-
"../**/*.spec.jsx"
|
|
10
|
-
],
|
|
11
|
-
"include": [
|
|
12
|
-
"../src/**/*.stories.ts",
|
|
13
|
-
"../src/**/*.stories.js",
|
|
14
|
-
"../src/**/*.stories.jsx",
|
|
15
|
-
"../src/**/*.stories.tsx",
|
|
16
|
-
"../src/**/*.stories.mdx",
|
|
17
|
-
"*.js"
|
|
18
|
-
]
|
|
19
|
-
}
|