@nx/vue 17.0.2 → 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.
Files changed (49) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +9 -4
  3. package/generators.json +3 -3
  4. package/index.d.ts +3 -1
  5. package/index.js +3 -3
  6. package/migrations.json +11 -1
  7. package/package.json +8 -9
  8. package/src/generators/application/application.d.ts +2 -1
  9. package/src/generators/application/application.js +25 -9
  10. package/src/generators/application/files/common/src/app/NxWelcome.vue.template +56 -16
  11. package/src/generators/application/lib/add-e2e.js +13 -4
  12. package/src/generators/application/lib/add-vite.js +5 -2
  13. package/src/generators/application/schema.d.ts +2 -1
  14. package/src/generators/application/schema.json +4 -4
  15. package/src/generators/component/component.d.ts +3 -3
  16. package/src/generators/component/lib/utils.d.ts +2 -2
  17. package/src/generators/component/schema.d.ts +6 -6
  18. package/src/generators/component/schema.json +8 -18
  19. package/src/generators/init/init.js +12 -30
  20. package/src/generators/init/schema.d.ts +2 -4
  21. package/src/generators/init/schema.json +6 -16
  22. package/src/generators/library/files/tsconfig.lib.json__tmpl__ +3 -10
  23. package/src/generators/library/lib/add-vite.js +3 -1
  24. package/src/generators/library/lib/normalize-options.js +1 -0
  25. package/src/generators/library/library.d.ts +1 -0
  26. package/src/generators/library/library.js +16 -6
  27. package/src/generators/library/schema.d.ts +3 -2
  28. package/src/generators/library/schema.json +2 -2
  29. package/src/generators/setup-tailwind/lib/add-tailwind-style-imports.js +7 -0
  30. package/src/generators/setup-tailwind/schema.json +1 -1
  31. package/src/generators/stories/schema.json +1 -1
  32. package/src/generators/stories/stories.js +5 -5
  33. package/src/generators/storybook-configuration/configuration.d.ts +1 -0
  34. package/src/generators/storybook-configuration/configuration.js +15 -7
  35. package/src/generators/storybook-configuration/schema.d.ts +2 -1
  36. package/src/generators/storybook-configuration/schema.json +4 -4
  37. package/src/utils/add-linting.d.ts +2 -1
  38. package/src/utils/add-linting.js +1 -4
  39. package/src/utils/create-ts-config.js +1 -1
  40. package/src/utils/ensure-dependencies.d.ts +6 -0
  41. package/src/utils/ensure-dependencies.js +24 -0
  42. package/src/utils/versions.d.ts +1 -3
  43. package/src/utils/versions.js +2 -5
  44. package/src/generators/application/lib/add-jest.d.ts +0 -5
  45. package/src/generators/application/lib/add-jest.js +0 -22
  46. package/src/generators/library/lib/add-jest.d.ts +0 -3
  47. package/src/generators/library/lib/add-jest.js +0 -23
  48. package/src/utils/setup-jest.d.ts +0 -4
  49. package/src/utils/setup-jest.js +0 -96
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  (The MIT License)
2
2
 
3
- Copyright (c) 2017-2023 Narwhal Technologies Inc.
3
+ Copyright (c) 2017-2024 Narwhal Technologies Inc.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
package/README.md CHANGED
@@ -1,4 +1,9 @@
1
- <p style="text-align: center;"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx.png" width="600" alt="Nx - Smart, Fast and Extensible Build System"></p>
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, Fast and Extensible Build System
23
+ # Nx: Smart Monorepos · Fast CI
19
24
 
20
- Nx is a next generation build system with first class monorepo support and powerful integrations.
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, Fast and Extensible Build System"></a></p>
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,10 +2,12 @@ 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
- export { addJest } from './src/generators/application/lib/add-jest';
10
12
  export * from './src/utils/versions';
11
13
  export * from './src/utils/add-linting';
package/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addJest = 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,9 +13,9 @@ 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
- var add_jest_1 = require("./src/generators/application/lib/add-jest");
19
- Object.defineProperty(exports, "addJest", { enumerable: true, get: function () { return add_jest_1.addJest; } });
20
20
  tslib_1.__exportStar(require("./src/utils/versions"), exports);
21
21
  tslib_1.__exportStar(require("./src/utils/add-linting"), exports);
package/migrations.json CHANGED
@@ -1,4 +1,14 @@
1
1
  {
2
2
  "generators": {},
3
- "packageJsonUpdates": {}
3
+ "packageJsonUpdates": {
4
+ "17.2.0": {
5
+ "version": "17.2.0-beta.2",
6
+ "packages": {
7
+ "@vitejs/plugin-vue": {
8
+ "version": "^4.5.0",
9
+ "alwaysAddToPackageJson": false
10
+ }
11
+ }
12
+ }
13
+ }
4
14
  }
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@nx/vue",
3
- "version": "17.0.2",
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 Jest, 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.",
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,14 +28,13 @@
28
28
  "migrations": "./migrations.json"
29
29
  },
30
30
  "dependencies": {
31
- "minimatch": "3.0.5",
31
+ "minimatch": "9.0.3",
32
32
  "tslib": "^2.3.0",
33
- "@nx/devkit": "17.0.2",
34
- "@nx/js": "17.0.2",
35
- "@nx/eslint": "17.0.2",
36
- "@nx/vite": "17.0.2",
37
- "@nx/web": "17.0.2",
38
- "@phenomnomnominal/tsquery": "~5.0.1"
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"
39
38
  },
40
39
  "publishConfig": {
41
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, _options: Schema): Promise<GeneratorCallback>;
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,18 +1,25 @@
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");
9
10
  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
- const add_jest_1 = require("./lib/add-jest");
13
13
  const create_ts_config_1 = require("../../utils/create-ts-config");
14
- async function applicationGenerator(tree, _options) {
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) {
15
21
  const options = await (0, normalize_options_1.normalizeOptions)(tree, _options);
22
+ options.addPlugin ??= process.env.NX_ADD_PLUGINS !== 'false';
16
23
  const tasks = [];
17
24
  (0, devkit_1.addProjectConfiguration)(tree, options.name, {
18
25
  root: options.appProjectRoot,
@@ -20,10 +27,20 @@ async function applicationGenerator(tree, _options) {
20
27
  sourceRoot: `${options.appProjectRoot}/src`,
21
28
  targets: {},
22
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
+ }));
23
37
  tasks.push(await (0, init_1.vueInitGenerator)(tree, {
24
38
  ...options,
25
39
  skipFormat: true,
26
40
  }));
41
+ if (!options.skipPackageJson) {
42
+ tasks.push((0, ensure_dependencies_1.ensureDependencies)(tree, options));
43
+ }
27
44
  if (!options.rootProject) {
28
45
  (0, create_ts_config_1.extractTsConfigBase)(tree);
29
46
  }
@@ -36,19 +53,18 @@ async function applicationGenerator(tree, _options) {
36
53
  skipPackageJson: options.skipPackageJson,
37
54
  setParserOptionsProject: options.setParserOptionsProject,
38
55
  rootProject: options.rootProject,
56
+ addPlugin: options.addPlugin,
39
57
  }, 'app'));
40
58
  tasks.push(await (0, add_vite_1.addVite)(tree, options));
41
- if (options.unitTestRunner === 'jest')
42
- tasks.push(await (0, add_jest_1.addJest)(tree, {
43
- name: options.name,
44
- projectRoot: options.appProjectRoot,
45
- }));
46
59
  tasks.push(await (0, add_e2e_1.addE2e)(tree, options));
47
60
  if (options.js)
48
61
  (0, devkit_1.toJS)(tree);
49
62
  if (!options.skipFormat)
50
63
  await (0, devkit_1.formatFiles)(tree);
64
+ tasks.push(() => {
65
+ (0, log_show_project_command_1.logShowProjectCommand)(options.projectName);
66
+ });
51
67
  return (0, devkit_1.runTasksInSerial)(...tasks);
52
68
  }
53
- exports.applicationGenerator = applicationGenerator;
69
+ exports.applicationGeneratorInternal = applicationGeneratorInternal;
54
70
  exports.default = applicationGenerator;
@@ -235,7 +235,8 @@ defineProps<{
235
235
  </div>
236
236
  <div id="other-links">
237
237
  <a
238
- class="button-pill nx-console rounded shadow"
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 plugin for Nx.</span>
255
+ <span>The official VSCode extension for Nx.</span>
255
256
  </span>
256
257
  </a>
257
258
  <a
258
- class="button-pill nx-console rounded shadow"
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
- fill="currentColor"
265
- role="img"
266
- viewBox="0 0 24 24"
266
+ height="48"
267
+ width="48"
268
+ viewBox="20 20 60 60"
267
269
  xmlns="http://www.w3.org/2000/svg"
268
270
  >
269
- <title>IntelliJ</title>
270
- <path d="M0 0v24h24V0zm3.723 3.111h5v1.834h-1.39v6.277h1.39v1.834h-5v-1.834h1.444V4.945H3.723zm11.055 0H17v6.5c0 .612-.055 1.111-.222 1.556-.167.444-.39.777-.723 1.11-.277.279-.666.557-1.11.668a3.933 3.933 0 0 1-1.445.278c-.778 0-1.444-.167-1.944-.445a4.81 4.81 0 0 1-1.279-1.056l1.39-1.555c.277.334.555.555.833.722.277.167.611.278.945.278.389 0 .721-.111 1-.389.221-.278.333-.667.333-1.278zM2.222 19.5h9V21h-9z"></path>
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
- NxCloud
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-to-nx-cloud</pre>
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/react:lib ui
374
+ nx g @nx/vue:lib ui
363
375
  <span># Add a component</span>
364
- nx g @nx/react:component button --project ui
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
- .nx-console:hover {
687
+ #nx-console:hover {
657
688
  background-color: rgba(0, 122, 204, 1);
658
689
  }
659
- .nx-console svg {
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, web_1.webStaticServeGenerator)(tree, {
11
- buildTarget: `${options.projectName}:build`,
12
- targetName: 'serve-static',
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.build.options.skipTypeCheck = true;
29
- (0, devkit_1.updateProjectConfiguration)(tree, options.name, projectConfig);
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;
@@ -8,7 +8,7 @@ export interface Schema {
8
8
  directory?: string;
9
9
  projectNameAndRootFormat?: ProjectNameAndRootFormat;
10
10
  tags?: string;
11
- unitTestRunner?: 'jest' | 'vitest' | 'none';
11
+ unitTestRunner?: 'vitest' | 'none';
12
12
  inSourceTests?: boolean;
13
13
  e2eTestRunner: 'cypress' | 'playwright' | 'none';
14
14
  linter: Linter;
@@ -18,6 +18,7 @@ export interface Schema {
18
18
  setParserOptionsProject?: boolean;
19
19
  skipPackageJson?: boolean;
20
20
  rootProject?: boolean;
21
+ addPlugin?: boolean;
21
22
  }
22
23
 
23
24
  export interface NormalizedSchema extends Schema {
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "http://json-schema.org/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) [ http://sass-lang.com ]"
55
+ "label": "SASS(.scss) [ https://sass-lang.com ]"
56
56
  },
57
57
  {
58
58
  "value": "less",
59
- "label": "LESS [ http://lesscss.org ]"
59
+ "label": "LESS [ https://lesscss.org ]"
60
60
  },
61
61
  {
62
62
  "value": "none",
@@ -85,7 +85,7 @@
85
85
  },
86
86
  "unitTestRunner": {
87
87
  "type": "string",
88
- "enum": ["jest", "vitest", "none"],
88
+ "enum": ["vitest", "none"],
89
89
  "description": "Test runner to use for unit tests.",
90
90
  "x-prompt": "Which unit test runner would you like to use?",
91
91
  "default": "vitest"
@@ -1,5 +1,5 @@
1
1
  import { Tree } from '@nx/devkit';
2
- import { Schema } from './schema';
3
- export declare function componentGenerator(host: Tree, schema: Schema): Promise<void>;
4
- export declare function componentGeneratorInternal(host: Tree, schema: Schema): Promise<void>;
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, Schema } from '../schema';
3
- export declare function normalizeOptions(host: Tree, options: Schema): Promise<NormalizedSchema>;
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 Schema {
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 v18.
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 v18.
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 v18.
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 v18.
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 Schema {
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": "http://json-schema.org/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-component --project=mylib",
11
- "description": "Generate a component in the `mylib` library"
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 v18."
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 v18."
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 v18."
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 v18."
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",
@@ -102,13 +98,7 @@
102
98
  "type": "boolean",
103
99
  "default": false,
104
100
  "x-priority": "internal"
105
- },
106
- "unitTestRunner": {
107
- "type": "string",
108
- "enum": ["vitest", "jest", "none"],
109
- "description": "Test runner to use for unit tests.",
110
- "x-prompt": "What unit test runner should be used?"
111
101
  }
112
102
  },
113
- "required": ["name", "project"]
103
+ "required": ["name"]
114
104
  }