@nx/nuxt 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 (56) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +68 -0
  3. package/generators.json +26 -0
  4. package/index.d.ts +5 -0
  5. package/index.js +11 -0
  6. package/migrations.json +14 -0
  7. package/package.json +51 -0
  8. package/plugin.d.ts +1 -0
  9. package/plugin.js +5 -0
  10. package/src/generators/application/application.d.ts +4 -0
  11. package/src/generators/application/application.js +83 -0
  12. package/src/generators/application/files/__dot__npmrc +2 -0
  13. package/src/generators/application/files/nuxt.config.ts__tmpl__ +30 -0
  14. package/src/generators/application/files/src/app.vue__tmpl__ +48 -0
  15. package/src/generators/application/files/src/assets/css/styles.__style__ +41 -0
  16. package/src/generators/application/files/src/components/NxWelcome.vue__tmpl__ +843 -0
  17. package/src/generators/application/files/src/pages/about.vue__tmpl__ +16 -0
  18. package/src/generators/application/files/src/pages/index.vue__tmpl__ +6 -0
  19. package/src/generators/application/files/src/public/__dot__gitkeep +0 -0
  20. package/src/generators/application/files/src/public/favicon.ico__tmpl__ +0 -0
  21. package/src/generators/application/files/src/server/api/greet.ts__tmpl__ +10 -0
  22. package/src/generators/application/files/src/server/tsconfig.json__tmpl__ +3 -0
  23. package/src/generators/application/lib/add-e2e.d.ts +3 -0
  24. package/src/generators/application/lib/add-e2e.js +56 -0
  25. package/src/generators/application/lib/add-vitest.d.ts +3 -0
  26. package/src/generators/application/lib/add-vitest.js +38 -0
  27. package/src/generators/application/lib/ensure-dependencies.d.ts +3 -0
  28. package/src/generators/application/lib/ensure-dependencies.js +27 -0
  29. package/src/generators/application/lib/normalize-options.d.ts +4 -0
  30. package/src/generators/application/lib/normalize-options.js +65 -0
  31. package/src/generators/application/schema.d.ts +29 -0
  32. package/src/generators/application/schema.json +110 -0
  33. package/src/generators/init/init.d.ts +4 -0
  34. package/src/generators/init/init.js +19 -0
  35. package/src/generators/init/lib/utils.d.ts +5 -0
  36. package/src/generators/init/lib/utils.js +65 -0
  37. package/src/generators/init/schema.d.ts +6 -0
  38. package/src/generators/init/schema.json +33 -0
  39. package/src/generators/storybook-configuration/configuration.d.ts +4 -0
  40. package/src/generators/storybook-configuration/configuration.js +28 -0
  41. package/src/generators/storybook-configuration/schema.d.ts +12 -0
  42. package/src/generators/storybook-configuration/schema.json +80 -0
  43. package/src/migrations/update-18-1-0/add-include-tsconfig.d.ts +2 -0
  44. package/src/migrations/update-18-1-0/add-include-tsconfig.js +48 -0
  45. package/src/plugins/plugin.d.ts +9 -0
  46. package/src/plugins/plugin.js +168 -0
  47. package/src/utils/add-linting.d.ts +10 -0
  48. package/src/utils/add-linting.js +43 -0
  49. package/src/utils/create-ts-config.d.ts +6 -0
  50. package/src/utils/create-ts-config.js +47 -0
  51. package/src/utils/executor-utils.d.ts +1 -0
  52. package/src/utils/executor-utils.js +7 -0
  53. package/src/utils/update-gitignore.d.ts +2 -0
  54. package/src/utils/update-gitignore.js +23 -0
  55. package/src/utils/versions.d.ts +6 -0
  56. package/src/utils/versions.js +11 -0
@@ -0,0 +1,16 @@
1
+ <template>
2
+ <div class="about">
3
+ <h1>This is an about page.</h1>
4
+ </div>
5
+ </template>
6
+
7
+ <style>
8
+ @media (min-width: 768px) {
9
+ .about {
10
+ max-width: 768px;
11
+ margin-left: auto;
12
+ margin-right: auto;
13
+ padding: 0 1rem;
14
+ }
15
+ }
16
+ </style>
@@ -0,0 +1,6 @@
1
+ <template>
2
+ <NxWelcome title="<%= title %>" />
3
+ </template>
4
+
5
+
6
+
@@ -0,0 +1,10 @@
1
+ import { defineEventHandler, getQuery } from 'h3';
2
+
3
+ export default defineEventHandler((event) => {
4
+ const q = getQuery(event);
5
+ const name = q.name || 'World';
6
+
7
+ return {
8
+ message: `Hello ${name}`,
9
+ };
10
+ });
@@ -0,0 +1,3 @@
1
+ {
2
+ "extends": "../.nuxt/tsconfig.server.json"
3
+ }
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import { NormalizedSchema } from '../schema';
3
+ export declare function addE2e(host: Tree, options: NormalizedSchema): Promise<import("@nx/devkit").GeneratorCallback>;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addE2e = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const versions_1 = require("../../../utils/versions");
6
+ async function addE2e(host, options) {
7
+ if (options.e2eTestRunner === 'cypress') {
8
+ const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/cypress', versions_1.nxVersion);
9
+ (0, devkit_1.addProjectConfiguration)(host, options.e2eProjectName, {
10
+ projectType: 'application',
11
+ root: options.e2eProjectRoot,
12
+ sourceRoot: (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'src'),
13
+ targets: {},
14
+ tags: [],
15
+ implicitDependencies: [options.projectName],
16
+ });
17
+ return await configurationGenerator(host, {
18
+ ...options,
19
+ project: options.e2eProjectName,
20
+ directory: 'src',
21
+ bundler: 'vite',
22
+ skipFormat: true,
23
+ devServerTarget: `${options.projectName}:${options.e2eWebServerTarget}`,
24
+ webServerCommands: {
25
+ default: `${(0, devkit_1.getPackageManagerCommand)().exec} nx ${options.e2eWebServerTarget} ${options.projectName}`,
26
+ },
27
+ ciWebServerCommand: `nx run ${options.projectName}:serve-static`,
28
+ baseUrl: options.e2eWebServerAddress,
29
+ jsx: true,
30
+ addPlugin: true,
31
+ });
32
+ }
33
+ else if (options.e2eTestRunner === 'playwright') {
34
+ const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/playwright', versions_1.nxVersion);
35
+ (0, devkit_1.addProjectConfiguration)(host, options.e2eProjectName, {
36
+ root: options.e2eProjectRoot,
37
+ sourceRoot: (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'src'),
38
+ targets: {},
39
+ implicitDependencies: [options.projectName],
40
+ });
41
+ return configurationGenerator(host, {
42
+ project: options.e2eProjectName,
43
+ skipFormat: true,
44
+ skipPackageJson: options.skipPackageJson,
45
+ directory: 'src',
46
+ js: false,
47
+ linter: options.linter,
48
+ setParserOptionsProject: options.setParserOptionsProject,
49
+ webServerAddress: options.e2eWebServerAddress,
50
+ webServerCommand: `${(0, devkit_1.getPackageManagerCommand)().exec} nx ${options.e2eWebServerTarget} ${options.projectName}`,
51
+ addPlugin: true,
52
+ });
53
+ }
54
+ return () => { };
55
+ }
56
+ exports.addE2e = addE2e;
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import { NormalizedSchema } from '../schema';
3
+ export declare function addVitest(tree: Tree, options: NormalizedSchema): Promise<import("@nx/devkit").GeneratorCallback>;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addVitest = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const utils_1 = require("../../init/lib/utils");
6
+ const versions_1 = require("../../../utils/versions");
7
+ async function addVitest(tree, options) {
8
+ (0, utils_1.addVitestTargetDefaults)(tree);
9
+ const nxJson = (0, devkit_1.readNxJson)(tree);
10
+ const hasPlugin = nxJson.plugins?.some((p) => typeof p === 'string'
11
+ ? p === '@nx/nuxt/plugin'
12
+ : p.plugin === '@nx/nuxt/plugin');
13
+ const { createOrEditViteConfig, vitestGenerator } = (0, devkit_1.ensurePackage)('@nx/vite', versions_1.nxVersion);
14
+ const vitestTask = await vitestGenerator(tree, {
15
+ project: options.name,
16
+ uiFramework: 'none',
17
+ coverageProvider: 'v8',
18
+ skipFormat: true,
19
+ testEnvironment: 'jsdom',
20
+ skipViteConfig: true,
21
+ addPlugin: true,
22
+ }, hasPlugin);
23
+ createOrEditViteConfig(tree, {
24
+ project: options.name,
25
+ includeLib: false,
26
+ includeVitest: true,
27
+ testEnvironment: 'jsdom',
28
+ imports: [`import vue from '@vitejs/plugin-vue'`],
29
+ plugins: ['vue()'],
30
+ }, true, undefined, true);
31
+ (0, devkit_1.updateJson)(tree, `${options.appProjectRoot}/tsconfig.spec.json`, (json) => {
32
+ json.compilerOptions ??= {};
33
+ json.compilerOptions.composite = true;
34
+ return json;
35
+ });
36
+ return vitestTask;
37
+ }
38
+ exports.addVitest = addVitest;
@@ -0,0 +1,3 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ import type { NormalizedSchema } from '../schema';
3
+ export declare function ensureDependencies(host: Tree, options: NormalizedSchema): import("@nx/devkit").GeneratorCallback;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ensureDependencies = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const vue_1 = require("@nx/vue");
6
+ const versions_1 = require("../../../utils/versions");
7
+ function ensureDependencies(host, options) {
8
+ const devDependencies = {
9
+ '@nx/vite': versions_1.nxVersion, // needed for the nxViteTsPaths plugin and @nx/vite/plugin
10
+ '@nuxt/devtools': versions_1.nuxtDevtoolsVersion,
11
+ '@nuxt/kit': versions_1.nuxtVersion,
12
+ '@nuxt/ui-templates': versions_1.nuxtUiTemplatesVersion,
13
+ nuxt: versions_1.nuxtVersion,
14
+ h3: versions_1.h3Version,
15
+ vue: vue_1.vueVersion,
16
+ 'vue-router': vue_1.vueRouterVersion,
17
+ 'vue-tsc': vue_1.vueTscVersion,
18
+ };
19
+ if (options.style === 'scss') {
20
+ devDependencies['sass'] = vue_1.sassVersion;
21
+ }
22
+ else if (options.style === 'less') {
23
+ devDependencies['less'] = vue_1.lessVersion;
24
+ }
25
+ return (0, devkit_1.addDependenciesToPackageJson)(host, {}, devDependencies);
26
+ }
27
+ exports.ensureDependencies = ensureDependencies;
@@ -0,0 +1,4 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import { NormalizedSchema, Schema } from '../schema';
3
+ export declare function normalizeDirectory(options: Schema): string;
4
+ export declare function normalizeOptions(host: Tree, options: Schema, callingGenerator?: string): Promise<NormalizedSchema>;
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.normalizeOptions = exports.normalizeDirectory = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
6
+ function normalizeDirectory(options) {
7
+ options.directory = options.directory?.replace(/\\{1,2}/g, '/');
8
+ const { projectDirectory } = (0, devkit_1.extractLayoutDirectory)(options.directory);
9
+ return projectDirectory
10
+ ? `${(0, devkit_1.names)(projectDirectory).fileName}/${(0, devkit_1.names)(options.name).fileName}`
11
+ : (0, devkit_1.names)(options.name).fileName;
12
+ }
13
+ exports.normalizeDirectory = normalizeDirectory;
14
+ async function normalizeOptions(host, options, callingGenerator = '@nx/nuxt:application') {
15
+ const { projectName: appProjectName, projectRoot: appProjectRoot, projectNameAndRootFormat, } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
16
+ name: options.name,
17
+ projectType: 'application',
18
+ directory: options.directory,
19
+ projectNameAndRootFormat: options.projectNameAndRootFormat,
20
+ rootProject: options.rootProject,
21
+ callingGenerator,
22
+ });
23
+ options.rootProject = appProjectRoot === '.';
24
+ options.projectNameAndRootFormat = projectNameAndRootFormat;
25
+ const nxJson = (0, devkit_1.readNxJson)(host);
26
+ let e2eWebServerTarget = 'serve';
27
+ if (nxJson.plugins) {
28
+ for (const plugin of nxJson.plugins) {
29
+ if (typeof plugin === 'object' &&
30
+ plugin.plugin === '@nx/nuxt/plugin' &&
31
+ plugin.options.serveTargetName) {
32
+ e2eWebServerTarget = plugin.options
33
+ .serveTargetName;
34
+ }
35
+ }
36
+ }
37
+ let e2ePort = 4200;
38
+ if (nxJson.targetDefaults?.[e2eWebServerTarget] &&
39
+ nxJson.targetDefaults?.[e2eWebServerTarget].options?.port) {
40
+ e2ePort = nxJson.targetDefaults?.[e2eWebServerTarget].options?.port;
41
+ }
42
+ const e2eProjectName = options.rootProject ? 'e2e' : `${appProjectName}-e2e`;
43
+ const e2eProjectRoot = options.rootProject ? 'e2e' : `${appProjectRoot}-e2e`;
44
+ const e2eWebServerAddress = `http://localhost:${e2ePort}`;
45
+ const parsedTags = options.tags
46
+ ? options.tags.split(',').map((s) => s.trim())
47
+ : [];
48
+ const normalized = {
49
+ ...options,
50
+ name: (0, devkit_1.names)(options.name).fileName,
51
+ projectName: appProjectName,
52
+ appProjectRoot,
53
+ e2eProjectName,
54
+ e2eProjectRoot,
55
+ e2eWebServerAddress,
56
+ e2eWebServerTarget,
57
+ e2ePort,
58
+ parsedTags,
59
+ style: options.style ?? 'none',
60
+ };
61
+ normalized.unitTestRunner ??= 'vitest';
62
+ normalized.e2eTestRunner = normalized.e2eTestRunner ?? 'cypress';
63
+ return normalized;
64
+ }
65
+ exports.normalizeOptions = normalizeOptions;
@@ -0,0 +1,29 @@
1
+ import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils';
2
+ import type { Linter } from '@nx/eslint';
3
+
4
+ export interface Schema {
5
+ name: string;
6
+ directory?: string;
7
+ projectNameAndRootFormat?: ProjectNameAndRootFormat;
8
+ linter?: Linter;
9
+ skipFormat?: boolean;
10
+ unitTestRunner?: 'vitest' | 'none';
11
+ e2eTestRunner?: 'cypress' | 'playwright' | 'none';
12
+ tags?: string;
13
+ js?: boolean;
14
+ skipPackageJson?: boolean;
15
+ rootProject?: boolean;
16
+ setParserOptionsProject?: boolean;
17
+ style?: 'css' | 'scss' | 'less' | 'none';
18
+ }
19
+
20
+ export interface NormalizedSchema extends Schema {
21
+ projectName: string;
22
+ appProjectRoot: string;
23
+ e2eProjectName: string;
24
+ e2eProjectRoot: string;
25
+ e2eWebServerAddress: string;
26
+ e2eWebServerTarget: string;
27
+ e2ePort: number;
28
+ parsedTags: string[];
29
+ }
@@ -0,0 +1,110 @@
1
+ {
2
+ "$schema": "https://json-schema.org/schema",
3
+ "cli": "nx",
4
+ "$id": "NxNuxtApp",
5
+ "title": "Create a Nuxt Application for Nx",
6
+ "description": "Create a Nuxt Application for Nx.",
7
+ "type": "object",
8
+ "properties": {
9
+ "name": {
10
+ "description": "The name of the application.",
11
+ "type": "string",
12
+ "$default": {
13
+ "$source": "argv",
14
+ "index": 0
15
+ },
16
+ "x-prompt": "What name would you like to use for the application?",
17
+ "pattern": "^[a-zA-Z][^:]*$",
18
+ "x-priority": "important"
19
+ },
20
+ "directory": {
21
+ "description": "The directory of the new application.",
22
+ "type": "string",
23
+ "alias": "dir",
24
+ "x-priority": "important"
25
+ },
26
+ "projectNameAndRootFormat": {
27
+ "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
28
+ "type": "string",
29
+ "enum": ["as-provided", "derived"]
30
+ },
31
+ "linter": {
32
+ "description": "The tool to use for running lint checks.",
33
+ "type": "string",
34
+ "enum": ["eslint"],
35
+ "default": "eslint"
36
+ },
37
+ "skipFormat": {
38
+ "description": "Skip formatting files.",
39
+ "type": "boolean",
40
+ "default": false,
41
+ "x-priority": "internal"
42
+ },
43
+ "unitTestRunner": {
44
+ "type": "string",
45
+ "enum": ["vitest", "none"],
46
+ "description": "Test runner to use for unit tests.",
47
+ "x-prompt": "Which unit test runner would you like to use?",
48
+ "default": "none"
49
+ },
50
+ "e2eTestRunner": {
51
+ "type": "string",
52
+ "enum": ["cypress", "playwright", "none"],
53
+ "description": "Test runner to use for end to end (E2E) tests.",
54
+ "x-prompt": "Which E2E test runner would you like to use?",
55
+ "default": "cypress"
56
+ },
57
+ "tags": {
58
+ "type": "string",
59
+ "description": "Add tags to the application (used for linting).",
60
+ "alias": "t"
61
+ },
62
+ "js": {
63
+ "type": "boolean",
64
+ "description": "Generate JavaScript files rather than TypeScript files.",
65
+ "default": false
66
+ },
67
+ "skipPackageJson": {
68
+ "type": "boolean",
69
+ "default": false,
70
+ "description": "Do not add dependencies to `package.json`.",
71
+ "x-priority": "internal"
72
+ },
73
+ "rootProject": {
74
+ "description": "Create an application at the root of the workspace.",
75
+ "type": "boolean",
76
+ "default": false,
77
+ "hidden": true,
78
+ "x-priority": "internal"
79
+ },
80
+ "style": {
81
+ "description": "The file extension to be used for style files.",
82
+ "type": "string",
83
+ "alias": "s",
84
+ "default": "css",
85
+ "x-prompt": {
86
+ "message": "Which stylesheet format would you like to use?",
87
+ "type": "list",
88
+ "items": [
89
+ { "value": "css", "label": "CSS" },
90
+ {
91
+ "value": "scss",
92
+ "label": "SASS(.scss) [ https://sass-lang.com ]"
93
+ },
94
+ {
95
+ "value": "less",
96
+ "label": "LESS [ https://lesscss.org ]"
97
+ },
98
+ { "value": "none", "label": "None" }
99
+ ]
100
+ }
101
+ },
102
+ "setParserOptionsProject": {
103
+ "type": "boolean",
104
+ "description": "Whether or not to configure the ESLint `parserOptions.project` option. We do not do this by default for lint performance reasons.",
105
+ "default": false
106
+ }
107
+ },
108
+ "required": [],
109
+ "examplesFile": "../../../docs/application-examples.md"
110
+ }
@@ -0,0 +1,4 @@
1
+ import { GeneratorCallback, Tree } from '@nx/devkit';
2
+ import { InitSchema } from './schema';
3
+ export declare function nuxtInitGenerator(host: Tree, schema: InitSchema): Promise<GeneratorCallback>;
4
+ export default nuxtInitGenerator;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.nuxtInitGenerator = void 0;
4
+ const update_package_scripts_1 = require("@nx/devkit/src/utils/update-package-scripts");
5
+ const plugin_1 = require("../../plugins/plugin");
6
+ const utils_1 = require("./lib/utils");
7
+ async function nuxtInitGenerator(host, schema) {
8
+ (0, utils_1.addPlugin)(host);
9
+ let installTask = () => { };
10
+ if (!schema.skipPackageJson) {
11
+ installTask = (0, utils_1.updateDependencies)(host, schema);
12
+ }
13
+ if (schema.updatePackageScripts) {
14
+ await (0, update_package_scripts_1.updatePackageScripts)(host, plugin_1.createNodes);
15
+ }
16
+ return installTask;
17
+ }
18
+ exports.nuxtInitGenerator = nuxtInitGenerator;
19
+ exports.default = nuxtInitGenerator;
@@ -0,0 +1,5 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import { InitSchema } from '../schema';
3
+ export declare function updateDependencies(host: Tree, schema: InitSchema): import("@nx/devkit").GeneratorCallback;
4
+ export declare function addVitestTargetDefaults(tree: Tree): void;
5
+ export declare function addPlugin(tree: Tree): void;
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addPlugin = exports.addVitestTargetDefaults = exports.updateDependencies = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const versions_1 = require("../../../utils/versions");
6
+ function updateDependencies(host, schema) {
7
+ return (0, devkit_1.addDependenciesToPackageJson)(host, {}, {
8
+ '@nx/nuxt': versions_1.nxVersion,
9
+ nuxt: versions_1.nuxtVersion,
10
+ '@nx/vite': versions_1.nxVersion,
11
+ }, undefined, schema.keepExistingVersions);
12
+ }
13
+ exports.updateDependencies = updateDependencies;
14
+ function addVitestTargetDefaults(tree) {
15
+ const nxJson = (0, devkit_1.readNxJson)(tree);
16
+ const productionFileSet = nxJson.namedInputs?.production;
17
+ if (productionFileSet) {
18
+ productionFileSet.push('!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)', '!{projectRoot}/tsconfig.spec.json');
19
+ nxJson.namedInputs.production = Array.from(new Set(productionFileSet));
20
+ }
21
+ (0, devkit_1.updateNxJson)(tree, nxJson);
22
+ }
23
+ exports.addVitestTargetDefaults = addVitestTargetDefaults;
24
+ function addPlugin(tree) {
25
+ const nxJson = (0, devkit_1.readNxJson)(tree);
26
+ nxJson.plugins ??= [];
27
+ let hasNxNuxtPlugin = false;
28
+ let hasNxVitePlugin = false;
29
+ for (const plugin of nxJson.plugins) {
30
+ if (typeof plugin === 'string'
31
+ ? plugin === '@nx/nuxt/plugin'
32
+ : plugin.plugin === '@nx/nuxt/plugin') {
33
+ hasNxNuxtPlugin = true;
34
+ }
35
+ if (typeof plugin === 'string'
36
+ ? plugin === '@nx/vite/plugin'
37
+ : plugin.plugin === '@nx/vite/plugin') {
38
+ hasNxVitePlugin = true;
39
+ }
40
+ }
41
+ if (!hasNxNuxtPlugin) {
42
+ nxJson.plugins.push({
43
+ plugin: '@nx/nuxt/plugin',
44
+ options: {
45
+ buildTargetName: 'build',
46
+ serveTargetName: 'serve',
47
+ serveStaticTargetName: 'serve-static',
48
+ },
49
+ });
50
+ }
51
+ if (!hasNxVitePlugin) {
52
+ nxJson.plugins.push({
53
+ plugin: '@nx/vite/plugin',
54
+ options: {
55
+ buildTargetName: 'build',
56
+ previewTargetName: 'preview',
57
+ testTargetName: 'test',
58
+ serveTargetName: 'serve',
59
+ serveStaticTargetName: 'serve-static',
60
+ },
61
+ });
62
+ }
63
+ (0, devkit_1.updateNxJson)(tree, nxJson);
64
+ }
65
+ exports.addPlugin = addPlugin;
@@ -0,0 +1,6 @@
1
+ export interface InitSchema {
2
+ skipFormat?: boolean;
3
+ skipPackageJson?: boolean;
4
+ keepExistingVersions?: boolean;
5
+ updatePackageScripts?: boolean;
6
+ }
@@ -0,0 +1,33 @@
1
+ {
2
+ "$schema": "https://json-schema.org/schema",
3
+ "$id": "NxNuxtInit",
4
+ "title": "Init Nuxt Plugin",
5
+ "description": "Initialize a Nuxt Plugin.",
6
+ "cli": "nx",
7
+ "type": "object",
8
+ "properties": {
9
+ "skipFormat": {
10
+ "description": "Skip formatting files.",
11
+ "type": "boolean",
12
+ "default": false
13
+ },
14
+ "skipPackageJson": {
15
+ "description": "Do not add dependencies to `package.json`.",
16
+ "type": "boolean",
17
+ "default": false
18
+ },
19
+ "keepExistingVersions": {
20
+ "type": "boolean",
21
+ "x-priority": "internal",
22
+ "description": "Keep existing dependencies versions",
23
+ "default": false
24
+ },
25
+ "updatePackageScripts": {
26
+ "type": "boolean",
27
+ "x-priority": "internal",
28
+ "description": "Update `package.json` scripts with inferred targets",
29
+ "default": false
30
+ }
31
+ },
32
+ "required": []
33
+ }
@@ -0,0 +1,4 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import { Schema } from './schema';
3
+ export declare function storybookConfigurationGenerator(tree: Tree, options: Schema): Promise<import("@nx/devkit").GeneratorCallback>;
4
+ export default storybookConfigurationGenerator;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.storybookConfigurationGenerator = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const vue_1 = require("@nx/vue");
6
+ /*
7
+ * This generator is basically the Vue one, but for Nuxt we
8
+ * are just adding the styles in `.storybook/preview.ts`
9
+ */
10
+ async function storybookConfigurationGenerator(tree, options) {
11
+ const storybookConfigurationGenerator = await (0, vue_1.storybookConfigurationGenerator)(tree, {
12
+ ...options,
13
+ addPlugin: true,
14
+ });
15
+ const { root } = (0, devkit_1.readProjectConfiguration)(tree, options.project);
16
+ tree.write((0, devkit_1.joinPathFragments)(root, '.storybook', 'preview.' + options.tsConfiguration ? 'ts' : 'js'), `import '../src/assets/css/styles.css';`);
17
+ (0, devkit_1.updateJson)(tree, `${root}/tsconfig.storybook.json`, (json) => {
18
+ json.compilerOptions = {
19
+ ...json.compilerOptions,
20
+ composite: true,
21
+ };
22
+ return json;
23
+ });
24
+ await (0, devkit_1.formatFiles)(tree);
25
+ return (0, devkit_1.runTasksInSerial)(storybookConfigurationGenerator);
26
+ }
27
+ exports.storybookConfigurationGenerator = storybookConfigurationGenerator;
28
+ exports.default = storybookConfigurationGenerator;
@@ -0,0 +1,12 @@
1
+ import { Linter } from '@nx/eslint';
2
+
3
+ export interface Schema {
4
+ project: string;
5
+ interactionTests?: boolean;
6
+ generateStories?: boolean;
7
+ js?: boolean;
8
+ tsConfiguration?: boolean;
9
+ linter?: Linter;
10
+ ignorePaths?: string[];
11
+ configureStaticServe?: boolean;
12
+ }