@nx/vue 17.0.3 → 17.0.4
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/LICENSE +1 -1
- package/README.md +9 -4
- package/generators.json +3 -3
- package/index.d.ts +3 -0
- package/index.js +3 -1
- package/migrations.json +11 -1
- package/package.json +8 -8
- package/src/generators/application/application.d.ts +2 -1
- package/src/generators/application/application.js +25 -3
- package/src/generators/application/files/common/src/app/NxWelcome.vue.template +56 -16
- package/src/generators/application/lib/add-e2e.js +13 -4
- package/src/generators/application/lib/add-vite.js +5 -2
- package/src/generators/application/schema.d.ts +1 -0
- package/src/generators/application/schema.json +3 -3
- package/src/generators/component/component.d.ts +3 -3
- package/src/generators/component/lib/utils.d.ts +2 -2
- package/src/generators/component/schema.d.ts +6 -6
- package/src/generators/component/schema.json +7 -11
- package/src/generators/init/init.js +12 -30
- package/src/generators/init/schema.d.ts +2 -4
- package/src/generators/init/schema.json +6 -16
- package/src/generators/library/files/tsconfig.lib.json__tmpl__ +3 -10
- package/src/generators/library/lib/add-vite.js +3 -1
- package/src/generators/library/lib/normalize-options.js +1 -0
- package/src/generators/library/library.d.ts +1 -0
- package/src/generators/library/library.js +16 -3
- package/src/generators/library/schema.d.ts +1 -0
- package/src/generators/library/schema.json +1 -1
- package/src/generators/setup-tailwind/lib/add-tailwind-style-imports.js +7 -0
- package/src/generators/setup-tailwind/schema.json +1 -1
- package/src/generators/stories/schema.json +1 -1
- package/src/generators/stories/stories.js +5 -5
- package/src/generators/storybook-configuration/configuration.d.ts +1 -0
- package/src/generators/storybook-configuration/configuration.js +15 -7
- package/src/generators/storybook-configuration/schema.d.ts +2 -1
- package/src/generators/storybook-configuration/schema.json +4 -4
- package/src/utils/add-linting.d.ts +1 -0
- package/src/utils/add-linting.js +1 -4
- package/src/utils/ensure-dependencies.d.ts +6 -0
- package/src/utils/ensure-dependencies.js +24 -0
- package/src/utils/versions.d.ts +1 -2
- package/src/utils/versions.js +2 -4
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
<p style="text-align: center;"
|
|
1
|
+
<p style="text-align: center;">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-dark.svg">
|
|
4
|
+
<img alt="Nx - Smart Monorepos · Fast CI" src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-light.svg" width="100%">
|
|
5
|
+
</picture>
|
|
6
|
+
</p>
|
|
2
7
|
|
|
3
8
|
<div style="text-align: center;">
|
|
4
9
|
|
|
@@ -15,9 +20,9 @@
|
|
|
15
20
|
|
|
16
21
|
<hr>
|
|
17
22
|
|
|
18
|
-
# Nx: Smart
|
|
23
|
+
# Nx: Smart Monorepos · Fast CI
|
|
19
24
|
|
|
20
|
-
Nx is a
|
|
25
|
+
Nx is a build system with built-in tooling and advanced CI capabilities. It helps you maintain and scale monorepos, both locally and on CI.
|
|
21
26
|
|
|
22
27
|
This package is a [Vue plugin for Nx](https://nx.dev/packages/vue).
|
|
23
28
|
|
|
@@ -59,5 +64,5 @@ npx nx@latest init
|
|
|
59
64
|
- [Blog Posts About Nx](https://blog.nrwl.io/nx/home)
|
|
60
65
|
|
|
61
66
|
<p style="text-align: center;"><a href="https://nx.dev/#learning-materials" target="_blank" rel="noreferrer"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-courses-and-videos.svg"
|
|
62
|
-
width="100%" alt="Nx - Smart
|
|
67
|
+
width="100%" alt="Nx - Smart Monorepos · Fast CI"></a></p>
|
|
63
68
|
|
package/generators.json
CHANGED
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
"hidden": true
|
|
11
11
|
},
|
|
12
12
|
"application": {
|
|
13
|
-
"factory": "./src/generators/application/application",
|
|
13
|
+
"factory": "./src/generators/application/application#applicationGeneratorInternal",
|
|
14
14
|
"schema": "./src/generators/application/schema.json",
|
|
15
15
|
"aliases": ["app"],
|
|
16
16
|
"description": "Create a Vue application."
|
|
17
17
|
},
|
|
18
18
|
"library": {
|
|
19
|
-
"factory": "./src/generators/library/library",
|
|
19
|
+
"factory": "./src/generators/library/library#libraryGeneratorInternal",
|
|
20
20
|
"schema": "./src/generators/library/schema.json",
|
|
21
21
|
"aliases": ["lib"],
|
|
22
22
|
"x-type": "library",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"description": "Set up Tailwind configuration for a project."
|
|
36
36
|
},
|
|
37
37
|
"storybook-configuration": {
|
|
38
|
-
"factory": "./src/generators/storybook-configuration/configuration",
|
|
38
|
+
"factory": "./src/generators/storybook-configuration/configuration#storybookConfigurationGeneratorInternal",
|
|
39
39
|
"schema": "./src/generators/storybook-configuration/schema.json",
|
|
40
40
|
"description": "Set up storybook for a Vue app or library.",
|
|
41
41
|
"hidden": false
|
package/index.d.ts
CHANGED
|
@@ -2,8 +2,11 @@ export * from './src/utils/versions';
|
|
|
2
2
|
export { applicationGenerator } from './src/generators/application/application';
|
|
3
3
|
export { libraryGenerator } from './src/generators/library/library';
|
|
4
4
|
export { componentGenerator } from './src/generators/component/component';
|
|
5
|
+
export { ComponentGeneratorSchema } from './src/generators/component/schema';
|
|
5
6
|
export { storybookConfigurationGenerator } from './src/generators/storybook-configuration/configuration';
|
|
6
7
|
export { storiesGenerator, StorybookStoriesSchema, } from './src/generators/stories/stories';
|
|
8
|
+
export { setupTailwindGenerator } from './src/generators/setup-tailwind/setup-tailwind';
|
|
9
|
+
export { SetupTailwindOptions } from './src/generators/setup-tailwind/schema';
|
|
7
10
|
export { type InitSchema } from './src/generators/init/schema';
|
|
8
11
|
export { vueInitGenerator } from './src/generators/init/init';
|
|
9
12
|
export * from './src/utils/versions';
|
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.vueInitGenerator = exports.storiesGenerator = exports.storybookConfigurationGenerator = exports.componentGenerator = exports.libraryGenerator = exports.applicationGenerator = void 0;
|
|
3
|
+
exports.vueInitGenerator = exports.setupTailwindGenerator = exports.storiesGenerator = exports.storybookConfigurationGenerator = exports.componentGenerator = exports.libraryGenerator = exports.applicationGenerator = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
tslib_1.__exportStar(require("./src/utils/versions"), exports);
|
|
6
6
|
var application_1 = require("./src/generators/application/application");
|
|
@@ -13,6 +13,8 @@ var configuration_1 = require("./src/generators/storybook-configuration/configur
|
|
|
13
13
|
Object.defineProperty(exports, "storybookConfigurationGenerator", { enumerable: true, get: function () { return configuration_1.storybookConfigurationGenerator; } });
|
|
14
14
|
var stories_1 = require("./src/generators/stories/stories");
|
|
15
15
|
Object.defineProperty(exports, "storiesGenerator", { enumerable: true, get: function () { return stories_1.storiesGenerator; } });
|
|
16
|
+
var setup_tailwind_1 = require("./src/generators/setup-tailwind/setup-tailwind");
|
|
17
|
+
Object.defineProperty(exports, "setupTailwindGenerator", { enumerable: true, get: function () { return setup_tailwind_1.setupTailwindGenerator; } });
|
|
16
18
|
var init_1 = require("./src/generators/init/init");
|
|
17
19
|
Object.defineProperty(exports, "vueInitGenerator", { enumerable: true, get: function () { return init_1.vueInitGenerator; } });
|
|
18
20
|
tslib_1.__exportStar(require("./src/utils/versions"), exports);
|
package/migrations.json
CHANGED
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/vue",
|
|
3
|
-
"version": "17.0.
|
|
3
|
+
"version": "17.0.4",
|
|
4
4
|
"private": false,
|
|
5
|
-
"description": "The Vue plugin for Nx contains executors and generators for managing Vue applications and libraries within an Nx workspace. It provides:\n\n\n- Integration with libraries such as
|
|
5
|
+
"description": "The Vue plugin for Nx contains executors and generators for managing Vue applications and libraries within an Nx workspace. It provides:\n\n\n- Integration with libraries such as Vitest, Cypress, and Storybook.\n\n- Generators for applications, libraries, and more.\n\n- Library build support for publishing packages to npm or other registries.\n\n- Utilities for automatic workspace refactoring.",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://github.com/nrwl/nx.git",
|
|
@@ -28,13 +28,13 @@
|
|
|
28
28
|
"migrations": "./migrations.json"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"minimatch": "
|
|
31
|
+
"minimatch": "9.0.3",
|
|
32
32
|
"tslib": "^2.3.0",
|
|
33
|
-
"@nx/devkit": "17.0.
|
|
34
|
-
"@nx/js": "17.0.
|
|
35
|
-
"@nx/eslint": "17.0.
|
|
36
|
-
"@nx/vite": "17.0.
|
|
37
|
-
"@nx/web": "17.0.
|
|
33
|
+
"@nx/devkit": "17.0.4",
|
|
34
|
+
"@nx/js": "17.0.4",
|
|
35
|
+
"@nx/eslint": "17.0.4",
|
|
36
|
+
"@nx/vite": "17.0.4",
|
|
37
|
+
"@nx/web": "17.0.4"
|
|
38
38
|
},
|
|
39
39
|
"publishConfig": {
|
|
40
40
|
"access": "public"
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { GeneratorCallback, Tree } from '@nx/devkit';
|
|
2
2
|
import { Schema } from './schema';
|
|
3
|
-
export declare function applicationGenerator(tree: Tree,
|
|
3
|
+
export declare function applicationGenerator(tree: Tree, options: Schema): Promise<GeneratorCallback>;
|
|
4
|
+
export declare function applicationGeneratorInternal(tree: Tree, _options: Schema): Promise<GeneratorCallback>;
|
|
4
5
|
export default applicationGenerator;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.applicationGenerator = void 0;
|
|
3
|
+
exports.applicationGeneratorInternal = exports.applicationGenerator = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const eslint_1 = require("@nx/eslint");
|
|
6
|
+
const js_1 = require("@nx/js");
|
|
6
7
|
const normalize_options_1 = require("./lib/normalize-options");
|
|
7
8
|
const init_1 = require("../init/init");
|
|
8
9
|
const add_linting_1 = require("../../utils/add-linting");
|
|
@@ -10,8 +11,15 @@ const add_e2e_1 = require("./lib/add-e2e");
|
|
|
10
11
|
const create_application_files_1 = require("./lib/create-application-files");
|
|
11
12
|
const add_vite_1 = require("./lib/add-vite");
|
|
12
13
|
const create_ts_config_1 = require("../../utils/create-ts-config");
|
|
13
|
-
|
|
14
|
+
const ensure_dependencies_1 = require("../../utils/ensure-dependencies");
|
|
15
|
+
const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
|
|
16
|
+
function applicationGenerator(tree, options) {
|
|
17
|
+
return applicationGeneratorInternal(tree, { addPlugin: false, ...options });
|
|
18
|
+
}
|
|
19
|
+
exports.applicationGenerator = applicationGenerator;
|
|
20
|
+
async function applicationGeneratorInternal(tree, _options) {
|
|
14
21
|
const options = await (0, normalize_options_1.normalizeOptions)(tree, _options);
|
|
22
|
+
options.addPlugin ??= process.env.NX_ADD_PLUGINS !== 'false';
|
|
15
23
|
const tasks = [];
|
|
16
24
|
(0, devkit_1.addProjectConfiguration)(tree, options.name, {
|
|
17
25
|
root: options.appProjectRoot,
|
|
@@ -19,10 +27,20 @@ async function applicationGenerator(tree, _options) {
|
|
|
19
27
|
sourceRoot: `${options.appProjectRoot}/src`,
|
|
20
28
|
targets: {},
|
|
21
29
|
});
|
|
30
|
+
tasks.push(await (0, js_1.initGenerator)(tree, {
|
|
31
|
+
...options,
|
|
32
|
+
tsConfigName: options.rootProject
|
|
33
|
+
? 'tsconfig.json'
|
|
34
|
+
: 'tsconfig.base.json',
|
|
35
|
+
skipFormat: true,
|
|
36
|
+
}));
|
|
22
37
|
tasks.push(await (0, init_1.vueInitGenerator)(tree, {
|
|
23
38
|
...options,
|
|
24
39
|
skipFormat: true,
|
|
25
40
|
}));
|
|
41
|
+
if (!options.skipPackageJson) {
|
|
42
|
+
tasks.push((0, ensure_dependencies_1.ensureDependencies)(tree, options));
|
|
43
|
+
}
|
|
26
44
|
if (!options.rootProject) {
|
|
27
45
|
(0, create_ts_config_1.extractTsConfigBase)(tree);
|
|
28
46
|
}
|
|
@@ -35,6 +53,7 @@ async function applicationGenerator(tree, _options) {
|
|
|
35
53
|
skipPackageJson: options.skipPackageJson,
|
|
36
54
|
setParserOptionsProject: options.setParserOptionsProject,
|
|
37
55
|
rootProject: options.rootProject,
|
|
56
|
+
addPlugin: options.addPlugin,
|
|
38
57
|
}, 'app'));
|
|
39
58
|
tasks.push(await (0, add_vite_1.addVite)(tree, options));
|
|
40
59
|
tasks.push(await (0, add_e2e_1.addE2e)(tree, options));
|
|
@@ -42,7 +61,10 @@ async function applicationGenerator(tree, _options) {
|
|
|
42
61
|
(0, devkit_1.toJS)(tree);
|
|
43
62
|
if (!options.skipFormat)
|
|
44
63
|
await (0, devkit_1.formatFiles)(tree);
|
|
64
|
+
tasks.push(() => {
|
|
65
|
+
(0, log_show_project_command_1.logShowProjectCommand)(options.projectName);
|
|
66
|
+
});
|
|
45
67
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
46
68
|
}
|
|
47
|
-
exports.
|
|
69
|
+
exports.applicationGeneratorInternal = applicationGeneratorInternal;
|
|
48
70
|
exports.default = applicationGenerator;
|
|
@@ -235,7 +235,8 @@ defineProps<{
|
|
|
235
235
|
</div>
|
|
236
236
|
<div id="other-links">
|
|
237
237
|
<a
|
|
238
|
-
|
|
238
|
+
id="nx-console"
|
|
239
|
+
class="button-pill rounded shadow"
|
|
239
240
|
href="https://marketplace.visualstudio.com/items?itemName=nrwl.angular-console&utm_source=nx-project"
|
|
240
241
|
target="_blank"
|
|
241
242
|
rel="noreferrer"
|
|
@@ -251,23 +252,35 @@ defineProps<{
|
|
|
251
252
|
</svg>
|
|
252
253
|
<span>
|
|
253
254
|
Install Nx Console for VSCode
|
|
254
|
-
<span>The official VSCode
|
|
255
|
+
<span>The official VSCode extension for Nx.</span>
|
|
255
256
|
</span>
|
|
256
257
|
</a>
|
|
257
258
|
<a
|
|
258
|
-
|
|
259
|
+
id="nx-console-jetbrains"
|
|
260
|
+
class="button-pill rounded shadow"
|
|
259
261
|
href="https://plugins.jetbrains.com/plugin/21060-nx-console"
|
|
260
262
|
target="_blank"
|
|
261
263
|
rel="noreferrer"
|
|
262
264
|
>
|
|
263
265
|
<svg
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
viewBox="
|
|
266
|
+
height="48"
|
|
267
|
+
width="48"
|
|
268
|
+
viewBox="20 20 60 60"
|
|
267
269
|
xmlns="http://www.w3.org/2000/svg"
|
|
268
270
|
>
|
|
269
|
-
<
|
|
270
|
-
<
|
|
271
|
+
<path d="m22.5 22.5h60v60h-60z" />
|
|
272
|
+
<g fill="#fff">
|
|
273
|
+
<path d="m29.03 71.25h22.5v3.75h-22.5z" />
|
|
274
|
+
<path d="m28.09 38 1.67-1.58a1.88 1.88 0 0 0 1.47.87c.64 0 1.06-.44 1.06-1.31v-5.98h2.58v6a3.48 3.48 0 0 1 -.87 2.6 3.56 3.56 0 0 1 -2.57.95 3.84 3.84 0 0 1 -3.34-1.55z" />
|
|
275
|
+
<path d="m36 30h7.53v2.19h-5v1.44h4.49v2h-4.42v1.49h5v2.21h-7.6z" />
|
|
276
|
+
<path d="m47.23 32.29h-2.8v-2.29h8.21v2.27h-2.81v7.1h-2.6z" />
|
|
277
|
+
<path d="m29.13 43.08h4.42a3.53 3.53 0 0 1 2.55.83 2.09 2.09 0 0 1 .6 1.53 2.16 2.16 0 0 1 -1.44 2.09 2.27 2.27 0 0 1 1.86 2.29c0 1.61-1.31 2.59-3.55 2.59h-4.44zm5 2.89c0-.52-.42-.8-1.18-.8h-1.29v1.64h1.24c.79 0 1.25-.26 1.25-.81zm-.9 2.66h-1.57v1.73h1.62c.8 0 1.24-.31 1.24-.86 0-.5-.4-.87-1.27-.87z" />
|
|
278
|
+
<path d="m38 43.08h4.1a4.19 4.19 0 0 1 3 1 2.93 2.93 0 0 1 .9 2.19 3 3 0 0 1 -1.93 2.89l2.24 3.27h-3l-1.88-2.84h-.87v2.84h-2.56zm4 4.5c.87 0 1.39-.43 1.39-1.11 0-.75-.54-1.12-1.4-1.12h-1.44v2.26z" />
|
|
279
|
+
<path d="m49.59 43h2.5l4 9.44h-2.79l-.67-1.69h-3.63l-.67 1.69h-2.71zm2.27 5.73-1-2.65-1.06 2.65z" />
|
|
280
|
+
<path d="m56.46 43.05h2.6v9.37h-2.6z" />
|
|
281
|
+
<path d="m60.06 43.05h2.42l3.37 5v-5h2.57v9.37h-2.26l-3.53-5.14v5.14h-2.57z" />
|
|
282
|
+
<path d="m68.86 51 1.45-1.73a4.84 4.84 0 0 0 3 1.13c.71 0 1.08-.24 1.08-.65 0-.4-.31-.6-1.59-.91-2-.46-3.53-1-3.53-2.93 0-1.74 1.37-3 3.62-3a5.89 5.89 0 0 1 3.86 1.25l-1.26 1.84a4.63 4.63 0 0 0 -2.62-.92c-.63 0-.94.25-.94.6 0 .42.32.61 1.63.91 2.14.46 3.44 1.16 3.44 2.91 0 1.91-1.51 3-3.79 3a6.58 6.58 0 0 1 -4.35-1.5z" />
|
|
283
|
+
</g>
|
|
271
284
|
</svg>
|
|
272
285
|
<span>
|
|
273
286
|
Install Nx Console for JetBrains
|
|
@@ -296,7 +309,7 @@ defineProps<{
|
|
|
296
309
|
/>
|
|
297
310
|
</svg>
|
|
298
311
|
<h2>
|
|
299
|
-
|
|
312
|
+
Nx Cloud
|
|
300
313
|
<span>Enable faster CI & better DX</span>
|
|
301
314
|
</h2>
|
|
302
315
|
</div>
|
|
@@ -304,14 +317,13 @@ defineProps<{
|
|
|
304
317
|
You can activate distributed tasks executions and caching by
|
|
305
318
|
running:
|
|
306
319
|
</p>
|
|
307
|
-
<pre>nx connect
|
|
320
|
+
<pre>nx connect</pre>
|
|
308
321
|
<a
|
|
309
322
|
href="https://nx.app/?utm_source=nx-project"
|
|
310
323
|
target="_blank"
|
|
311
324
|
rel="noreferrer"
|
|
312
325
|
>
|
|
313
|
-
|
|
314
|
-
What is Nx Cloud?{' '}
|
|
326
|
+
What is Nx Cloud?
|
|
315
327
|
</a>
|
|
316
328
|
</div>
|
|
317
329
|
<a
|
|
@@ -359,11 +371,30 @@ defineProps<{
|
|
|
359
371
|
</summary>
|
|
360
372
|
<pre>
|
|
361
373
|
<span># Generate UI lib</span>
|
|
362
|
-
nx g @nx/
|
|
374
|
+
nx g @nx/vue:lib ui
|
|
363
375
|
<span># Add a component</span>
|
|
364
|
-
nx g @nx/
|
|
376
|
+
nx g @nx/vue:component ui/src/lib/button
|
|
365
377
|
</pre>
|
|
366
378
|
</details>
|
|
379
|
+
<details>
|
|
380
|
+
<summary>
|
|
381
|
+
<svg
|
|
382
|
+
fill="none"
|
|
383
|
+
stroke="currentColor"
|
|
384
|
+
viewBox="0 0 24 24"
|
|
385
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
386
|
+
>
|
|
387
|
+
<path
|
|
388
|
+
strokeLinecap="round"
|
|
389
|
+
strokeLinejoin="round"
|
|
390
|
+
strokeWidth="2"
|
|
391
|
+
d="M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"
|
|
392
|
+
/>
|
|
393
|
+
</svg>
|
|
394
|
+
View project details
|
|
395
|
+
</summary>
|
|
396
|
+
<pre>nx show project {{ title }} --web</pre>
|
|
397
|
+
</details>
|
|
367
398
|
<details>
|
|
368
399
|
<summary>
|
|
369
400
|
<svg
|
|
@@ -653,12 +684,21 @@ pre {
|
|
|
653
684
|
.button-pill:hover {
|
|
654
685
|
color: rgba(255, 255, 255, 1) !important;
|
|
655
686
|
}
|
|
656
|
-
|
|
687
|
+
#nx-console:hover {
|
|
657
688
|
background-color: rgba(0, 122, 204, 1);
|
|
658
689
|
}
|
|
659
|
-
|
|
690
|
+
#nx-console svg {
|
|
660
691
|
color: rgba(0, 122, 204, 1);
|
|
661
692
|
}
|
|
693
|
+
#nx-console-jetbrains {
|
|
694
|
+
margin-top: 2rem;
|
|
695
|
+
}
|
|
696
|
+
#nx-console-jetbrains:hover {
|
|
697
|
+
background-color: rgba(255, 49, 140, 1);
|
|
698
|
+
}
|
|
699
|
+
#nx-console-jetbrains svg {
|
|
700
|
+
color: rgba(255, 49, 140, 1);
|
|
701
|
+
}
|
|
662
702
|
#nx-repo:hover {
|
|
663
703
|
background-color: rgba(24, 23, 23, 1);
|
|
664
704
|
}
|
|
@@ -7,10 +7,17 @@ const versions_1 = require("../../../utils/versions");
|
|
|
7
7
|
async function addE2e(tree, options) {
|
|
8
8
|
switch (options.e2eTestRunner) {
|
|
9
9
|
case 'cypress': {
|
|
10
|
-
(0,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
11
|
+
const hasPlugin = nxJson.plugins?.some((p) => typeof p === 'string'
|
|
12
|
+
? p === '@nx/vite/plugin'
|
|
13
|
+
: p.plugin === '@nx/vite/plugin');
|
|
14
|
+
if (!hasPlugin) {
|
|
15
|
+
await (0, web_1.webStaticServeGenerator)(tree, {
|
|
16
|
+
buildTarget: `${options.projectName}:build`,
|
|
17
|
+
targetName: 'serve-static',
|
|
18
|
+
spa: true,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
14
21
|
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/cypress', versions_1.nxVersion);
|
|
15
22
|
(0, devkit_1.addProjectConfiguration)(tree, options.e2eProjectName, {
|
|
16
23
|
projectType: 'application',
|
|
@@ -27,6 +34,7 @@ async function addE2e(tree, options) {
|
|
|
27
34
|
bundler: 'vite',
|
|
28
35
|
skipFormat: true,
|
|
29
36
|
devServerTarget: `${options.projectName}:serve`,
|
|
37
|
+
baseUrl: 'http://localhost:4200',
|
|
30
38
|
jsx: true,
|
|
31
39
|
});
|
|
32
40
|
}
|
|
@@ -40,6 +48,7 @@ async function addE2e(tree, options) {
|
|
|
40
48
|
implicitDependencies: [options.projectName],
|
|
41
49
|
});
|
|
42
50
|
return configurationGenerator(tree, {
|
|
51
|
+
...options,
|
|
43
52
|
project: options.e2eProjectName,
|
|
44
53
|
skipFormat: true,
|
|
45
54
|
skipPackageJson: options.skipPackageJson,
|
|
@@ -13,6 +13,7 @@ async function addVite(tree, options) {
|
|
|
13
13
|
includeVitest: options.unitTestRunner === 'vitest',
|
|
14
14
|
skipFormat: true,
|
|
15
15
|
testEnvironment: 'jsdom',
|
|
16
|
+
addPlugin: options.addPlugin,
|
|
16
17
|
});
|
|
17
18
|
(0, vite_1.createOrEditViteConfig)(tree, {
|
|
18
19
|
project: options.name,
|
|
@@ -25,8 +26,10 @@ async function addVite(tree, options) {
|
|
|
25
26
|
// Update build to skip type checking since tsc won't work on .vue files.
|
|
26
27
|
// Need to use vue-tsc instead.
|
|
27
28
|
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.name);
|
|
28
|
-
projectConfig.targets
|
|
29
|
-
|
|
29
|
+
if (projectConfig.targets?.build?.options) {
|
|
30
|
+
projectConfig.targets.build.options.skipTypeCheck = true;
|
|
31
|
+
(0, devkit_1.updateProjectConfiguration)(tree, options.name, projectConfig);
|
|
32
|
+
}
|
|
30
33
|
return viteTask;
|
|
31
34
|
}
|
|
32
35
|
exports.addVite = addVite;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
3
|
"cli": "nx",
|
|
4
4
|
"$id": "NxVueApp",
|
|
5
5
|
"title": "Create a Vue Application",
|
|
@@ -52,11 +52,11 @@
|
|
|
52
52
|
},
|
|
53
53
|
{
|
|
54
54
|
"value": "scss",
|
|
55
|
-
"label": "SASS(.scss) [
|
|
55
|
+
"label": "SASS(.scss) [ https://sass-lang.com ]"
|
|
56
56
|
},
|
|
57
57
|
{
|
|
58
58
|
"value": "less",
|
|
59
|
-
"label": "LESS [
|
|
59
|
+
"label": "LESS [ https://lesscss.org ]"
|
|
60
60
|
},
|
|
61
61
|
{
|
|
62
62
|
"value": "none",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Tree } from '@nx/devkit';
|
|
2
|
-
import {
|
|
3
|
-
export declare function componentGenerator(host: Tree, schema:
|
|
4
|
-
export declare function componentGeneratorInternal(host: Tree, schema:
|
|
2
|
+
import { ComponentGeneratorSchema } from './schema';
|
|
3
|
+
export declare function componentGenerator(host: Tree, schema: ComponentGeneratorSchema): Promise<void>;
|
|
4
|
+
export declare function componentGeneratorInternal(host: Tree, schema: ComponentGeneratorSchema): Promise<void>;
|
|
5
5
|
export default componentGenerator;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Tree } from '@nx/devkit';
|
|
2
|
-
import { NormalizedSchema,
|
|
3
|
-
export declare function normalizeOptions(host: Tree, options:
|
|
2
|
+
import { NormalizedSchema, ComponentGeneratorSchema } from '../schema';
|
|
3
|
+
export declare function normalizeOptions(host: Tree, options: ComponentGeneratorSchema): Promise<NormalizedSchema>;
|
|
4
4
|
export declare function addExportsToBarrel(host: Tree, options: NormalizedSchema): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export interface
|
|
1
|
+
export interface ComponentGeneratorSchema {
|
|
2
2
|
name: string;
|
|
3
3
|
skipTests?: boolean;
|
|
4
4
|
directory?: string;
|
|
@@ -11,24 +11,24 @@ export interface Schema {
|
|
|
11
11
|
nameAndDirectoryFormat?: 'as-provided' | 'derived';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* @deprecated Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx
|
|
14
|
+
* @deprecated Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v19.
|
|
15
15
|
*/
|
|
16
16
|
flat?: boolean;
|
|
17
17
|
/**
|
|
18
|
-
* @deprecated Provide the desired `directory` option instead and use the `as-provided` format. It will be removed in Nx
|
|
18
|
+
* @deprecated Provide the desired `directory` option instead and use the `as-provided` format. It will be removed in Nx v19.
|
|
19
19
|
*/
|
|
20
20
|
pascalCaseDirectory?: boolean;
|
|
21
21
|
/**
|
|
22
|
-
* @deprecated Provide the desired `name` option instead and use the `as-provided` format. It will be removed in Nx
|
|
22
|
+
* @deprecated Provide the desired `name` option instead and use the `as-provided` format. It will be removed in Nx v19.
|
|
23
23
|
*/
|
|
24
24
|
pascalCaseFiles?: boolean;
|
|
25
25
|
/**
|
|
26
|
-
* @deprecated Provide the `directory` option instead. The project will be determined from the directory provided. It will be removed in Nx
|
|
26
|
+
* @deprecated Provide the `directory` option instead. The project will be determined from the directory provided. It will be removed in Nx v19.
|
|
27
27
|
*/
|
|
28
28
|
project?: string;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
export interface NormalizedSchema extends
|
|
31
|
+
export interface NormalizedSchema extends ComponentGeneratorSchema {
|
|
32
32
|
projectName: string;
|
|
33
33
|
projectSourceRoot: string;
|
|
34
34
|
fileName: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
3
|
"cli": "nx",
|
|
4
4
|
"$id": "NxVueComponent",
|
|
5
5
|
"title": "Create a Vue Component",
|
|
@@ -7,12 +7,8 @@
|
|
|
7
7
|
"type": "object",
|
|
8
8
|
"examples": [
|
|
9
9
|
{
|
|
10
|
-
"command": "nx g component my-
|
|
11
|
-
"description": "Generate a component in the `
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
"command": "nx g component my-component --project=mylib --classComponent",
|
|
15
|
-
"description": "Generate a class component in the `mylib` library"
|
|
10
|
+
"command": "nx g @nx/vue:component --directory=my-app/src/app/one --name=one --nameAndDirectoryFormat=as-provided --unitTestRunner=vitest",
|
|
11
|
+
"description": "Generate a component in the `my-app` application"
|
|
16
12
|
}
|
|
17
13
|
],
|
|
18
14
|
"properties": {
|
|
@@ -23,7 +19,7 @@
|
|
|
23
19
|
"$default": {
|
|
24
20
|
"$source": "projectName"
|
|
25
21
|
},
|
|
26
|
-
"x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx
|
|
22
|
+
"x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v19."
|
|
27
23
|
},
|
|
28
24
|
"name": {
|
|
29
25
|
"type": "string",
|
|
@@ -61,7 +57,7 @@
|
|
|
61
57
|
"type": "boolean",
|
|
62
58
|
"description": "Create component at the source root rather than its own directory.",
|
|
63
59
|
"default": false,
|
|
64
|
-
"x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx
|
|
60
|
+
"x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v19."
|
|
65
61
|
},
|
|
66
62
|
"export": {
|
|
67
63
|
"type": "boolean",
|
|
@@ -75,14 +71,14 @@
|
|
|
75
71
|
"description": "Use pascal case component file name (e.g. `App.tsx`).",
|
|
76
72
|
"alias": "P",
|
|
77
73
|
"default": false,
|
|
78
|
-
"x-deprecated": "Provide the desired `name` option instead and use the `as-provided` format. It will be removed in Nx
|
|
74
|
+
"x-deprecated": "Provide the desired `name` option instead and use the `as-provided` format. It will be removed in Nx v19."
|
|
79
75
|
},
|
|
80
76
|
"pascalCaseDirectory": {
|
|
81
77
|
"type": "boolean",
|
|
82
78
|
"description": "Use pascal case directory name (e.g. `App/App.tsx`).",
|
|
83
79
|
"alias": "R",
|
|
84
80
|
"default": false,
|
|
85
|
-
"x-deprecated": "Provide the desired `directory` option instead and use the `as-provided` format. It will be removed in Nx
|
|
81
|
+
"x-deprecated": "Provide the desired `directory` option instead and use the `as-provided` format. It will be removed in Nx v19."
|
|
86
82
|
},
|
|
87
83
|
"routing": {
|
|
88
84
|
"type": "boolean",
|
|
@@ -2,40 +2,22 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.vueInitGenerator = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const js_1 = require("@nx/js");
|
|
6
5
|
const versions_1 = require("../../utils/versions");
|
|
7
6
|
function updateDependencies(host, schema) {
|
|
8
|
-
(0, devkit_1.removeDependenciesFromPackageJson)(host, ['@nx/vue'], []);
|
|
9
|
-
let dependencies = {
|
|
10
|
-
vue: versions_1.vueVersion,
|
|
11
|
-
};
|
|
12
|
-
let devDependencies = {
|
|
13
|
-
'@nx/vue': versions_1.nxVersion,
|
|
14
|
-
'@vue/tsconfig': versions_1.vueTsconfigVersion,
|
|
15
|
-
'@vue/test-utils': versions_1.vueTestUtilsVersion,
|
|
16
|
-
'@vitejs/plugin-vue': versions_1.vitePluginVueVersion,
|
|
17
|
-
'vue-tsc': versions_1.vueTscVersion,
|
|
18
|
-
};
|
|
19
|
-
if (schema.routing) {
|
|
20
|
-
dependencies['vue-router'] = versions_1.vueRouterVersion;
|
|
21
|
-
}
|
|
22
|
-
if (schema.style === 'scss') {
|
|
23
|
-
devDependencies['sass'] = versions_1.sassVersion;
|
|
24
|
-
}
|
|
25
|
-
else if (schema.style === 'less') {
|
|
26
|
-
devDependencies['less'] = versions_1.lessVersion;
|
|
27
|
-
}
|
|
28
|
-
return (0, devkit_1.addDependenciesToPackageJson)(host, dependencies, devDependencies);
|
|
29
|
-
}
|
|
30
|
-
async function vueInitGenerator(host, schema) {
|
|
31
7
|
const tasks = [];
|
|
32
|
-
tasks.push(
|
|
33
|
-
|
|
34
|
-
tsConfigName: schema.rootProject ? 'tsconfig.json' : 'tsconfig.base.json',
|
|
35
|
-
skipFormat: true,
|
|
36
|
-
}));
|
|
37
|
-
tasks.push(updateDependencies(host, schema));
|
|
8
|
+
tasks.push((0, devkit_1.removeDependenciesFromPackageJson)(host, ['@nx/vue'], []));
|
|
9
|
+
tasks.push((0, devkit_1.addDependenciesToPackageJson)(host, { vue: versions_1.vueVersion }, { '@nx/vue': versions_1.nxVersion }, undefined, schema.keepExistingVersions));
|
|
38
10
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
39
11
|
}
|
|
12
|
+
async function vueInitGenerator(host, schema) {
|
|
13
|
+
let installTask = () => { };
|
|
14
|
+
if (!schema.skipPackageJson) {
|
|
15
|
+
installTask = updateDependencies(host, schema);
|
|
16
|
+
}
|
|
17
|
+
if (!schema.skipFormat) {
|
|
18
|
+
await (0, devkit_1.formatFiles)(host);
|
|
19
|
+
}
|
|
20
|
+
return installTask;
|
|
21
|
+
}
|
|
40
22
|
exports.vueInitGenerator = vueInitGenerator;
|
|
41
23
|
exports.default = vueInitGenerator;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
3
|
"$id": "NxVueInit",
|
|
4
4
|
"title": "Init Vue Plugin",
|
|
5
5
|
"description": "Initialize a Vue Plugin.",
|
|
@@ -11,26 +11,16 @@
|
|
|
11
11
|
"type": "boolean",
|
|
12
12
|
"default": false
|
|
13
13
|
},
|
|
14
|
-
"
|
|
14
|
+
"skipPackageJson": {
|
|
15
|
+
"description": "Do not add dependencies to `package.json`.",
|
|
15
16
|
"type": "boolean",
|
|
16
|
-
"description": "Use JavaScript instead of TypeScript",
|
|
17
17
|
"default": false
|
|
18
18
|
},
|
|
19
|
-
"
|
|
20
|
-
"description": "Create a project at the root of the workspace",
|
|
19
|
+
"keepExistingVersions": {
|
|
21
20
|
"type": "boolean",
|
|
21
|
+
"x-priority": "internal",
|
|
22
|
+
"description": "Keep existing dependencies versions",
|
|
22
23
|
"default": false
|
|
23
|
-
},
|
|
24
|
-
"routing": {
|
|
25
|
-
"type": "boolean",
|
|
26
|
-
"description": "Generate application with routes.",
|
|
27
|
-
"x-prompt": "Would you like to add Vue Router to this application?",
|
|
28
|
-
"default": false
|
|
29
|
-
},
|
|
30
|
-
"style": {
|
|
31
|
-
"description": "The file extension to be used for style files.",
|
|
32
|
-
"type": "string",
|
|
33
|
-
"default": "css"
|
|
34
24
|
}
|
|
35
25
|
},
|
|
36
26
|
"required": []
|
|
@@ -2,16 +2,7 @@
|
|
|
2
2
|
"extends": "./tsconfig.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"outDir": "<%= offsetFromRoot %>dist/out-tsc",
|
|
5
|
-
"baseUrl": ".",
|
|
6
|
-
"paths": {
|
|
7
|
-
"@/*": ["./src/*"]
|
|
8
|
-
},
|
|
9
5
|
"types": [],
|
|
10
|
-
"lib": [
|
|
11
|
-
"ES2016",
|
|
12
|
-
"DOM",
|
|
13
|
-
"DOM.Iterable"
|
|
14
|
-
],
|
|
15
6
|
},
|
|
16
7
|
"exclude": [
|
|
17
8
|
"src/**/__tests__/*",
|
|
@@ -22,7 +13,9 @@
|
|
|
22
13
|
"src/**/*.spec.js",
|
|
23
14
|
"src/**/*.test.js",
|
|
24
15
|
"src/**/*.spec.jsx",
|
|
25
|
-
"src/**/*.test.jsx"
|
|
16
|
+
"src/**/*.test.jsx",
|
|
17
|
+
"src/**/*.spec.vue",
|
|
18
|
+
"src/**/*.test.vue"
|
|
26
19
|
],
|
|
27
20
|
"include": [
|
|
28
21
|
"src/**/*.js",
|
|
@@ -17,6 +17,7 @@ async function addVite(tree, options) {
|
|
|
17
17
|
includeVitest: options.unitTestRunner === 'vitest',
|
|
18
18
|
skipFormat: true,
|
|
19
19
|
testEnvironment: 'jsdom',
|
|
20
|
+
addPlugin: options.addPlugin,
|
|
20
21
|
});
|
|
21
22
|
tasks.push(viteTask);
|
|
22
23
|
createOrEditViteConfig(tree, {
|
|
@@ -36,10 +37,11 @@ async function addVite(tree, options) {
|
|
|
36
37
|
const vitestTask = await vitestGenerator(tree, {
|
|
37
38
|
uiFramework: 'none',
|
|
38
39
|
project: options.name,
|
|
39
|
-
coverageProvider: '
|
|
40
|
+
coverageProvider: 'v8',
|
|
40
41
|
inSourceTests: options.inSourceTests,
|
|
41
42
|
skipFormat: true,
|
|
42
43
|
testEnvironment: 'jsdom',
|
|
44
|
+
addPlugin: options.addPlugin,
|
|
43
45
|
});
|
|
44
46
|
tasks.push(vitestTask);
|
|
45
47
|
createOrEditViteConfig(tree, {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { GeneratorCallback, Tree } from '@nx/devkit';
|
|
2
2
|
import { Schema } from './schema';
|
|
3
3
|
export declare function libraryGenerator(tree: Tree, schema: Schema): Promise<GeneratorCallback>;
|
|
4
|
+
export declare function libraryGeneratorInternal(tree: Tree, schema: Schema): Promise<GeneratorCallback>;
|
|
4
5
|
export default libraryGenerator;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.libraryGenerator = void 0;
|
|
3
|
+
exports.libraryGeneratorInternal = exports.libraryGenerator = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const js_1 = require("@nx/js");
|
|
6
6
|
const init_1 = require("../init/init");
|
|
@@ -10,7 +10,13 @@ const create_library_files_1 = require("./lib/create-library-files");
|
|
|
10
10
|
const create_ts_config_1 = require("../../utils/create-ts-config");
|
|
11
11
|
const component_1 = require("../component/component");
|
|
12
12
|
const add_vite_1 = require("./lib/add-vite");
|
|
13
|
-
|
|
13
|
+
const ensure_dependencies_1 = require("../../utils/ensure-dependencies");
|
|
14
|
+
const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
|
|
15
|
+
function libraryGenerator(tree, schema) {
|
|
16
|
+
return libraryGeneratorInternal(tree, { addPlugin: false, ...schema });
|
|
17
|
+
}
|
|
18
|
+
exports.libraryGenerator = libraryGenerator;
|
|
19
|
+
async function libraryGeneratorInternal(tree, schema) {
|
|
14
20
|
const tasks = [];
|
|
15
21
|
const options = await (0, normalize_options_1.normalizeOptions)(tree, schema);
|
|
16
22
|
if (options.publishable === true && !schema.importPath) {
|
|
@@ -23,10 +29,14 @@ async function libraryGenerator(tree, schema) {
|
|
|
23
29
|
tags: options.parsedTags,
|
|
24
30
|
targets: {},
|
|
25
31
|
});
|
|
32
|
+
tasks.push(await (0, js_1.initGenerator)(tree, { ...schema, skipFormat: true }));
|
|
26
33
|
tasks.push(await (0, init_1.vueInitGenerator)(tree, {
|
|
27
34
|
...options,
|
|
28
35
|
skipFormat: true,
|
|
29
36
|
}));
|
|
37
|
+
if (!options.skipPackageJson) {
|
|
38
|
+
tasks.push((0, ensure_dependencies_1.ensureDependencies)(tree, options));
|
|
39
|
+
}
|
|
30
40
|
(0, create_ts_config_1.extractTsConfigBase)(tree);
|
|
31
41
|
tasks.push(await (0, add_linting_1.addLinting)(tree, options, 'lib'));
|
|
32
42
|
(0, create_library_files_1.createLibraryFiles)(tree, options);
|
|
@@ -61,7 +71,10 @@ async function libraryGenerator(tree, schema) {
|
|
|
61
71
|
(0, devkit_1.toJS)(tree);
|
|
62
72
|
if (!options.skipFormat)
|
|
63
73
|
await (0, devkit_1.formatFiles)(tree);
|
|
74
|
+
tasks.push(() => {
|
|
75
|
+
(0, log_show_project_command_1.logShowProjectCommand)(options.name);
|
|
76
|
+
});
|
|
64
77
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
65
78
|
}
|
|
66
|
-
exports.
|
|
79
|
+
exports.libraryGeneratorInternal = libraryGeneratorInternal;
|
|
67
80
|
exports.default = libraryGenerator;
|
|
@@ -7,12 +7,19 @@ const knownStylesheetLocations = [
|
|
|
7
7
|
'src/styles.css',
|
|
8
8
|
'src/styles.scss',
|
|
9
9
|
'src/styles.less',
|
|
10
|
+
// What we generate for nuxt by default
|
|
11
|
+
'src/assets/css/styles.css',
|
|
12
|
+
'src/assets/css/styles.scss',
|
|
13
|
+
'src/assets/css/styles.less',
|
|
10
14
|
// Other common locations (e.g. what `npm create vue` does)
|
|
11
15
|
'src/assets/styles.css',
|
|
12
16
|
'src/assets/styles.scss',
|
|
13
17
|
'src/assets/styles.less',
|
|
14
18
|
];
|
|
15
19
|
function addTailwindStyleImports(tree, project, _options) {
|
|
20
|
+
if (_options.stylesheet) {
|
|
21
|
+
knownStylesheetLocations.push(_options.stylesheet);
|
|
22
|
+
}
|
|
16
23
|
const stylesPath = knownStylesheetLocations
|
|
17
24
|
.map((file) => (0, devkit_1.joinPathFragments)(project.root, file))
|
|
18
25
|
.find((file) => tree.exists(file));
|
|
@@ -5,13 +5,13 @@ const devkit_1 = require("@nx/devkit");
|
|
|
5
5
|
const path_1 = require("path");
|
|
6
6
|
const versions_1 = require("../../utils/versions");
|
|
7
7
|
const component_story_1 = require("./lib/component-story");
|
|
8
|
-
const
|
|
8
|
+
const minimatch_1 = require("minimatch");
|
|
9
9
|
async function createAllStories(tree, projectName, interactionTests, js, projectConfiguration, ignorePaths) {
|
|
10
|
-
const { sourceRoot
|
|
10
|
+
const { sourceRoot } = projectConfiguration;
|
|
11
11
|
let componentPaths = [];
|
|
12
12
|
const pathsToCheck = [
|
|
13
|
-
(0, devkit_1.joinPathFragments)(sourceRoot, 'app'),
|
|
14
|
-
(0, devkit_1.joinPathFragments)(sourceRoot, 'lib'),
|
|
13
|
+
(0, devkit_1.joinPathFragments)(sourceRoot, 'app'), // Default component folder for apps
|
|
14
|
+
(0, devkit_1.joinPathFragments)(sourceRoot, 'lib'), // Default component folder for libs
|
|
15
15
|
(0, devkit_1.joinPathFragments)(sourceRoot, 'components'), // Additional component folder used by Nuxt
|
|
16
16
|
];
|
|
17
17
|
for (const p of pathsToCheck) {
|
|
@@ -19,7 +19,7 @@ async function createAllStories(tree, projectName, interactionTests, js, project
|
|
|
19
19
|
// Ignore private files starting with "_".
|
|
20
20
|
if ((0, path_1.basename)(path).startsWith('_'))
|
|
21
21
|
return;
|
|
22
|
-
if (ignorePaths?.some((pattern) => minimatch(path, pattern)))
|
|
22
|
+
if (ignorePaths?.some((pattern) => (0, minimatch_1.minimatch)(path, pattern)))
|
|
23
23
|
return;
|
|
24
24
|
if (path.endsWith('.vue')) {
|
|
25
25
|
// Let's see if the .stories.* file exists
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { StorybookConfigureSchema } from './schema';
|
|
2
2
|
import { Tree } from '@nx/devkit';
|
|
3
3
|
export declare function storybookConfigurationGenerator(host: Tree, schema: StorybookConfigureSchema): Promise<import("@nx/devkit").GeneratorCallback>;
|
|
4
|
+
export declare function storybookConfigurationGeneratorInternal(host: Tree, schema: StorybookConfigureSchema): Promise<import("@nx/devkit").GeneratorCallback>;
|
|
4
5
|
export default storybookConfigurationGenerator;
|
|
@@ -1,29 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.storybookConfigurationGenerator = void 0;
|
|
3
|
+
exports.storybookConfigurationGeneratorInternal = exports.storybookConfigurationGenerator = void 0;
|
|
4
4
|
const stories_1 = require("../stories/stories");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const versions_1 = require("../../utils/versions");
|
|
7
7
|
async function generateStories(host, schema) {
|
|
8
8
|
await (0, stories_1.default)(host, {
|
|
9
|
-
project: schema.
|
|
9
|
+
project: schema.project,
|
|
10
10
|
js: schema.js,
|
|
11
11
|
ignorePaths: schema.ignorePaths,
|
|
12
12
|
skipFormat: true,
|
|
13
13
|
interactionTests: schema.interactionTests ?? true,
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
function storybookConfigurationGenerator(host, schema) {
|
|
17
|
+
return storybookConfigurationGeneratorInternal(host, {
|
|
18
|
+
addPlugin: false,
|
|
19
|
+
...schema,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
exports.storybookConfigurationGenerator = storybookConfigurationGenerator;
|
|
23
|
+
async function storybookConfigurationGeneratorInternal(host, schema) {
|
|
17
24
|
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/storybook', versions_1.nxVersion);
|
|
18
25
|
const installTask = await configurationGenerator(host, {
|
|
19
|
-
|
|
26
|
+
project: schema.project,
|
|
20
27
|
js: schema.js,
|
|
21
28
|
linter: schema.linter,
|
|
22
|
-
tsConfiguration: schema.tsConfiguration ?? true,
|
|
23
|
-
interactionTests: schema.interactionTests ?? true,
|
|
29
|
+
tsConfiguration: schema.tsConfiguration ?? true, // default is true
|
|
30
|
+
interactionTests: schema.interactionTests ?? true, // default is true
|
|
24
31
|
configureStaticServe: schema.configureStaticServe,
|
|
25
32
|
uiFramework: '@storybook/vue3-vite',
|
|
26
33
|
skipFormat: true,
|
|
34
|
+
addPlugin: schema.addPlugin,
|
|
27
35
|
});
|
|
28
36
|
if (schema.generateStories) {
|
|
29
37
|
await generateStories(host, schema);
|
|
@@ -31,5 +39,5 @@ async function storybookConfigurationGenerator(host, schema) {
|
|
|
31
39
|
await (0, devkit_1.formatFiles)(host);
|
|
32
40
|
return installTask;
|
|
33
41
|
}
|
|
34
|
-
exports.
|
|
42
|
+
exports.storybookConfigurationGeneratorInternal = storybookConfigurationGeneratorInternal;
|
|
35
43
|
exports.default = storybookConfigurationGenerator;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Linter } from '@nx/eslint';
|
|
2
2
|
|
|
3
3
|
export interface StorybookConfigureSchema {
|
|
4
|
-
|
|
4
|
+
project: string;
|
|
5
5
|
interactionTests?: boolean;
|
|
6
6
|
generateStories?: boolean;
|
|
7
7
|
js?: boolean;
|
|
@@ -9,4 +9,5 @@ export interface StorybookConfigureSchema {
|
|
|
9
9
|
linter?: Linter;
|
|
10
10
|
ignorePaths?: string[];
|
|
11
11
|
configureStaticServe?: boolean;
|
|
12
|
+
addPlugin?: boolean;
|
|
12
13
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
3
|
"cli": "nx",
|
|
4
4
|
"$id": "NxVueStorybookConfigure",
|
|
5
5
|
"title": "Vue Storybook Configure",
|
|
6
6
|
"description": "Set up Storybook for a Vue project.",
|
|
7
7
|
"type": "object",
|
|
8
8
|
"properties": {
|
|
9
|
-
"
|
|
9
|
+
"project": {
|
|
10
10
|
"type": "string",
|
|
11
|
-
"aliases": ["
|
|
11
|
+
"aliases": ["name", "projectName"],
|
|
12
12
|
"description": "Project for which to generate Storybook configuration.",
|
|
13
13
|
"$default": {
|
|
14
14
|
"$source": "argv",
|
|
@@ -75,6 +75,6 @@
|
|
|
75
75
|
]
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
|
-
"required": ["
|
|
78
|
+
"required": ["project"],
|
|
79
79
|
"examplesFile": "../../../docs/storybook-configuration-examples.md"
|
|
80
80
|
}
|
|
@@ -8,5 +8,6 @@ export declare function addLinting(host: Tree, options: {
|
|
|
8
8
|
setParserOptionsProject?: boolean;
|
|
9
9
|
skipPackageJson?: boolean;
|
|
10
10
|
rootProject?: boolean;
|
|
11
|
+
addPlugin?: boolean;
|
|
11
12
|
}, projectType: 'lib' | 'app'): Promise<import("@nx/devkit").GeneratorCallback>;
|
|
12
13
|
export declare function editEslintConfigFiles(tree: Tree, projectRoot: string, rootProject?: boolean): void;
|
package/src/utils/add-linting.js
CHANGED
|
@@ -6,7 +6,6 @@ const path_1 = require("nx/src/utils/path");
|
|
|
6
6
|
const devkit_1 = require("@nx/devkit");
|
|
7
7
|
const lint_1 = require("./lint");
|
|
8
8
|
const eslint_file_1 = require("@nx/eslint/src/generators/utils/eslint-file");
|
|
9
|
-
const lint_project_1 = require("@nx/eslint/src/generators/lint-project/lint-project");
|
|
10
9
|
async function addLinting(host, options, projectType) {
|
|
11
10
|
if (options.linter === eslint_1.Linter.EsLint) {
|
|
12
11
|
const lintTask = await (0, eslint_1.lintProjectGenerator)(host, {
|
|
@@ -16,12 +15,10 @@ async function addLinting(host, options, projectType) {
|
|
|
16
15
|
(0, path_1.joinPathFragments)(options.projectRoot, `tsconfig.${projectType}.json`),
|
|
17
16
|
],
|
|
18
17
|
unitTestRunner: options.unitTestRunner,
|
|
19
|
-
eslintFilePatterns: [
|
|
20
|
-
(0, lint_project_1.mapLintPattern)(options.projectRoot, '{ts,tsx,js,jsx,vue}', options.rootProject),
|
|
21
|
-
],
|
|
22
18
|
skipFormat: true,
|
|
23
19
|
setParserOptionsProject: options.setParserOptionsProject,
|
|
24
20
|
rootProject: options.rootProject,
|
|
21
|
+
addPlugin: options.addPlugin,
|
|
25
22
|
});
|
|
26
23
|
if ((0, eslint_file_1.isEslintConfigSupported)(host)) {
|
|
27
24
|
(0, eslint_file_1.addExtendsToLintConfig)(host, options.projectRoot, [
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type GeneratorCallback, type Tree } from '@nx/devkit';
|
|
2
|
+
export type EnsureDependenciesOptions = {
|
|
3
|
+
routing?: boolean;
|
|
4
|
+
style?: 'scss' | 'less' | 'none' | 'css';
|
|
5
|
+
};
|
|
6
|
+
export declare function ensureDependencies(tree: Tree, options: EnsureDependenciesOptions): GeneratorCallback;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ensureDependencies = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const versions_1 = require("./versions");
|
|
6
|
+
function ensureDependencies(tree, options) {
|
|
7
|
+
const dependencies = {};
|
|
8
|
+
const devDependencies = {
|
|
9
|
+
'@vue/test-utils': versions_1.vueTestUtilsVersion,
|
|
10
|
+
'@vitejs/plugin-vue': versions_1.vitePluginVueVersion,
|
|
11
|
+
'vue-tsc': versions_1.vueTscVersion,
|
|
12
|
+
};
|
|
13
|
+
if (options.routing) {
|
|
14
|
+
dependencies['vue-router'] = versions_1.vueRouterVersion;
|
|
15
|
+
}
|
|
16
|
+
if (options.style === 'scss') {
|
|
17
|
+
devDependencies['sass'] = versions_1.sassVersion;
|
|
18
|
+
}
|
|
19
|
+
else if (options.style === 'less') {
|
|
20
|
+
devDependencies['less'] = versions_1.lessVersion;
|
|
21
|
+
}
|
|
22
|
+
return (0, devkit_1.addDependenciesToPackageJson)(tree, dependencies, devDependencies);
|
|
23
|
+
}
|
|
24
|
+
exports.ensureDependencies = ensureDependencies;
|
package/src/utils/versions.d.ts
CHANGED
|
@@ -2,9 +2,8 @@ export declare const nxVersion: any;
|
|
|
2
2
|
export declare const vueVersion = "^3.3.4";
|
|
3
3
|
export declare const vueTscVersion = "^1.8.8";
|
|
4
4
|
export declare const vueRouterVersion = "^4.2.4";
|
|
5
|
-
export declare const vueTsconfigVersion = "^0.4.0";
|
|
6
5
|
export declare const vueTestUtilsVersion = "^2.4.1";
|
|
7
|
-
export declare const vitePluginVueVersion = "^4.
|
|
6
|
+
export declare const vitePluginVueVersion = "^4.5.0";
|
|
8
7
|
export declare const vueEslintConfigPrettierVersion = "7.1.0";
|
|
9
8
|
export declare const vueEslintConfigTypescriptVersion = "^11.0.3";
|
|
10
9
|
export declare const eslintPluginVueVersion = "^9.16.1";
|
package/src/utils/versions.js
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.lessVersion = exports.sassVersion = exports.autoprefixerVersion = exports.tailwindcssVersion = exports.postcssVersion = exports.eslintPluginVueVersion = exports.vueEslintConfigTypescriptVersion = exports.vueEslintConfigPrettierVersion = exports.vitePluginVueVersion = exports.vueTestUtilsVersion = exports.
|
|
3
|
+
exports.lessVersion = exports.sassVersion = exports.autoprefixerVersion = exports.tailwindcssVersion = exports.postcssVersion = exports.eslintPluginVueVersion = exports.vueEslintConfigTypescriptVersion = exports.vueEslintConfigPrettierVersion = exports.vitePluginVueVersion = exports.vueTestUtilsVersion = exports.vueRouterVersion = exports.vueTscVersion = exports.vueVersion = exports.nxVersion = void 0;
|
|
4
4
|
exports.nxVersion = require('../../package.json').version;
|
|
5
5
|
// vue core
|
|
6
6
|
exports.vueVersion = '^3.3.4';
|
|
7
7
|
exports.vueTscVersion = '^1.8.8';
|
|
8
8
|
exports.vueRouterVersion = '^4.2.4';
|
|
9
|
-
// build deps
|
|
10
|
-
exports.vueTsconfigVersion = '^0.4.0';
|
|
11
9
|
// test deps
|
|
12
10
|
exports.vueTestUtilsVersion = '^2.4.1';
|
|
13
|
-
exports.vitePluginVueVersion = '^4.
|
|
11
|
+
exports.vitePluginVueVersion = '^4.5.0';
|
|
14
12
|
// linting deps
|
|
15
13
|
exports.vueEslintConfigPrettierVersion = '7.1.0';
|
|
16
14
|
exports.vueEslintConfigTypescriptVersion = '^11.0.3';
|