@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
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ (The MIT License)
2
+
3
+ Copyright (c) 2017-2024 Narwhal Technologies Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ 'Software'), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,68 @@
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>
7
+
8
+ <div style="text-align: center;">
9
+
10
+ [![CircleCI](https://circleci.com/gh/nrwl/nx.svg?style=svg)](https://circleci.com/gh/nrwl/nx)
11
+ [![License](https://img.shields.io/npm/l/@nx/workspace.svg?style=flat-square)]()
12
+ [![NPM Version](https://badge.fury.io/js/%40nrwl%2Fworkspace.svg)](https://www.npmjs.com/@nx/workspace)
13
+ [![Semantic Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)]()
14
+ [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
15
+ [![Join the chat at https://gitter.im/nrwl-nx/community](https://badges.gitter.im/nrwl-nx/community.svg)](https://gitter.im/nrwl-nx/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
16
+ [![Join us on the Official Nx Discord Server](https://img.shields.io/discord/1143497901675401286?label=discord)](https://go.nx.dev/community)
17
+
18
+ </div>
19
+
20
+
21
+ <hr>
22
+
23
+ # Nx: Smart Monorepos · Fast CI
24
+
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.
26
+
27
+ This package is a [Nuxt plugin for Nx](https://nx.dev/nx-api/nuxt).
28
+
29
+ ## Getting Started
30
+
31
+ ### Creating an Nx Workspace
32
+
33
+ **Using `npx`**
34
+
35
+ ```bash
36
+ npx create-nx-workspace
37
+ ```
38
+
39
+ **Using `npm init`**
40
+
41
+ ```bash
42
+ npm init nx-workspace
43
+ ```
44
+
45
+ **Using `yarn create`**
46
+
47
+ ```bash
48
+ yarn create nx-workspace
49
+ ```
50
+
51
+ ### Adding Nx to an Existing Repository
52
+
53
+ Run:
54
+
55
+ ```bash
56
+ npx nx@latest init
57
+ ```
58
+
59
+ ## Documentation & Resources
60
+
61
+ - [Nx.Dev: Documentation, Guides, Tutorials](https://nx.dev)
62
+ - [Intro to Nx](https://nx.dev/getting-started/intro)
63
+ - [Official Nx YouTube Channel](https://www.youtube.com/@NxDevtools)
64
+ - [Blog Posts About Nx](https://blog.nrwl.io/nx/home)
65
+
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"
67
+ width="100%" alt="Nx - Smart Monorepos · Fast CI"></a></p>
68
+
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "Nx Nuxt",
3
+ "version": "0.1",
4
+ "extends": ["@nx/vue"],
5
+ "generators": {
6
+ "init": {
7
+ "factory": "./src/generators/init/init",
8
+ "schema": "./src/generators/init/schema.json",
9
+ "description": "Initialize the `@nx/nuxt` plugin.",
10
+ "aliases": ["ng-add"],
11
+ "hidden": true
12
+ },
13
+ "application": {
14
+ "factory": "./src/generators/application/application",
15
+ "schema": "./src/generators/application/schema.json",
16
+ "aliases": ["app"],
17
+ "description": "Create a Nuxt application."
18
+ },
19
+ "storybook-configuration": {
20
+ "factory": "./src/generators/storybook-configuration/configuration",
21
+ "schema": "./src/generators/storybook-configuration/schema.json",
22
+ "description": "Set up storybook for a Nuxt app.",
23
+ "hidden": false
24
+ }
25
+ }
26
+ }
package/index.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ export * from './src/utils/versions';
2
+ export { applicationGenerator } from './src/generators/application/application';
3
+ export { type InitSchema } from './src/generators/init/schema';
4
+ export { nuxtInitGenerator } from './src/generators/init/init';
5
+ export { storybookConfigurationGenerator } from './src/generators/storybook-configuration/configuration';
package/index.js ADDED
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.storybookConfigurationGenerator = exports.nuxtInitGenerator = exports.applicationGenerator = void 0;
4
+ const tslib_1 = require("tslib");
5
+ tslib_1.__exportStar(require("./src/utils/versions"), exports);
6
+ var application_1 = require("./src/generators/application/application");
7
+ Object.defineProperty(exports, "applicationGenerator", { enumerable: true, get: function () { return application_1.applicationGenerator; } });
8
+ var init_1 = require("./src/generators/init/init");
9
+ Object.defineProperty(exports, "nuxtInitGenerator", { enumerable: true, get: function () { return init_1.nuxtInitGenerator; } });
10
+ var configuration_1 = require("./src/generators/storybook-configuration/configuration");
11
+ Object.defineProperty(exports, "storybookConfigurationGenerator", { enumerable: true, get: function () { return configuration_1.storybookConfigurationGenerator; } });
@@ -0,0 +1,14 @@
1
+ {
2
+ "generators": {},
3
+ "packageJsonUpdates": {
4
+ "18.2.0": {
5
+ "version": "18.2.0-beta.0",
6
+ "packages": {
7
+ "@nuxt/eslint-config": {
8
+ "version": "~0.3.0-alpha.1",
9
+ "alwaysAddToPackageJson": false
10
+ }
11
+ }
12
+ }
13
+ }
14
+ }
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@nx/nuxt",
3
+ "version": "17.0.4",
4
+ "private": false,
5
+ "description": "The Nuxt plugin for Nx contains executors and generators for managing Nuxt 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
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/nrwl/nx.git",
9
+ "directory": "packages/nuxt"
10
+ },
11
+ "keywords": [
12
+ "Monorepo",
13
+ "Nuxt",
14
+ "Web",
15
+ "CLI"
16
+ ],
17
+ "main": "./index.js",
18
+ "typings": "./index.d.ts",
19
+ "author": "Victor Savkin",
20
+ "license": "MIT",
21
+ "bugs": {
22
+ "url": "https://github.com/nrwl/nx/issues"
23
+ },
24
+ "homepage": "https://nx.dev",
25
+ "generators": "./generators.json",
26
+ "executors": "./executors.json",
27
+ "nx-migrations": {
28
+ "migrations": "./migrations.json"
29
+ },
30
+ "dependencies": {
31
+ "tslib": "^2.3.0",
32
+ "@nuxt/kit": "^3.10.0",
33
+ "@nx/devkit": "17.0.4",
34
+ "@nx/js": "17.0.4",
35
+ "@nx/eslint": "17.0.4",
36
+ "@nx/vue": "17.0.4",
37
+ "@nx/vite": "17.0.4"
38
+ },
39
+ "peerDependencies": {},
40
+ "publishConfig": {
41
+ "access": "public"
42
+ },
43
+ "exports": {
44
+ "./package.json": "./package.json",
45
+ ".": "./index.js",
46
+ "./generators.json": "./generators.json",
47
+ "./migrations.json": "./migrations.json",
48
+ "./plugin": "./plugin.js"
49
+ },
50
+ "type": "commonjs"
51
+ }
package/plugin.d.ts ADDED
@@ -0,0 +1 @@
1
+ export { createNodes, NuxtPluginOptions } from './src/plugins/plugin';
package/plugin.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createNodes = void 0;
4
+ var plugin_1 = require("./src/plugins/plugin");
5
+ Object.defineProperty(exports, "createNodes", { enumerable: true, get: function () { return plugin_1.createNodes; } });
@@ -0,0 +1,4 @@
1
+ import { GeneratorCallback, Tree } from '@nx/devkit';
2
+ import { Schema } from './schema';
3
+ export declare function applicationGenerator(tree: Tree, schema: Schema): Promise<GeneratorCallback>;
4
+ export default applicationGenerator;
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.applicationGenerator = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const init_1 = require("../init/init");
6
+ const normalize_options_1 = require("./lib/normalize-options");
7
+ const create_ts_config_1 = require("../../utils/create-ts-config");
8
+ const js_1 = require("@nx/js");
9
+ const update_gitignore_1 = require("../../utils/update-gitignore");
10
+ const eslint_1 = require("@nx/eslint");
11
+ const add_e2e_1 = require("./lib/add-e2e");
12
+ const add_linting_1 = require("../../utils/add-linting");
13
+ const add_vitest_1 = require("./lib/add-vitest");
14
+ const vue_1 = require("@nx/vue");
15
+ const ensure_dependencies_1 = require("./lib/ensure-dependencies");
16
+ const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
17
+ async function applicationGenerator(tree, schema) {
18
+ const tasks = [];
19
+ const options = await (0, normalize_options_1.normalizeOptions)(tree, schema);
20
+ const projectOffsetFromRoot = (0, devkit_1.offsetFromRoot)(options.appProjectRoot);
21
+ const jsInitTask = await (0, js_1.initGenerator)(tree, {
22
+ ...schema,
23
+ tsConfigName: schema.rootProject ? 'tsconfig.json' : 'tsconfig.base.json',
24
+ skipFormat: true,
25
+ });
26
+ tasks.push(jsInitTask);
27
+ const nuxtInitTask = await (0, init_1.default)(tree, {
28
+ ...options,
29
+ skipFormat: true,
30
+ });
31
+ tasks.push(nuxtInitTask);
32
+ tasks.push((0, ensure_dependencies_1.ensureDependencies)(tree, options));
33
+ (0, devkit_1.addProjectConfiguration)(tree, options.name, {
34
+ root: options.appProjectRoot,
35
+ projectType: 'application',
36
+ sourceRoot: `${options.appProjectRoot}/src`,
37
+ targets: {},
38
+ });
39
+ (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, './files'), options.appProjectRoot, {
40
+ ...options,
41
+ offsetFromRoot: projectOffsetFromRoot,
42
+ title: options.projectName,
43
+ dot: '.',
44
+ tmpl: '',
45
+ style: options.style,
46
+ projectRoot: options.appProjectRoot,
47
+ hasVitest: options.unitTestRunner === 'vitest',
48
+ });
49
+ if (options.style === 'none') {
50
+ tree.delete((0, devkit_1.joinPathFragments)(options.appProjectRoot, `src/assets/css/styles.none`));
51
+ }
52
+ (0, create_ts_config_1.createTsConfig)(tree, {
53
+ projectRoot: options.appProjectRoot,
54
+ rootProject: options.rootProject,
55
+ unitTestRunner: options.unitTestRunner,
56
+ }, (0, js_1.getRelativePathToRootTsConfig)(tree, options.appProjectRoot));
57
+ (0, update_gitignore_1.updateGitIgnore)(tree);
58
+ tasks.push(await (0, add_linting_1.addLinting)(tree, {
59
+ projectName: options.projectName,
60
+ projectRoot: options.appProjectRoot,
61
+ linter: options.linter ?? eslint_1.Linter.EsLint,
62
+ unitTestRunner: options.unitTestRunner,
63
+ rootProject: options.rootProject,
64
+ }));
65
+ if (options.unitTestRunner === 'vitest') {
66
+ tasks.push((0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
67
+ '@vue/test-utils': vue_1.vueTestUtilsVersion,
68
+ '@vitejs/plugin-vue': vue_1.vitePluginVueVersion,
69
+ }));
70
+ tasks.push(await (0, add_vitest_1.addVitest)(tree, options));
71
+ }
72
+ tasks.push(await (0, add_e2e_1.addE2e)(tree, options));
73
+ if (options.js)
74
+ (0, devkit_1.toJS)(tree);
75
+ if (!options.skipFormat)
76
+ await (0, devkit_1.formatFiles)(tree);
77
+ tasks.push(() => {
78
+ (0, log_show_project_command_1.logShowProjectCommand)(options.projectName);
79
+ });
80
+ return (0, devkit_1.runTasksInSerial)(...tasks);
81
+ }
82
+ exports.applicationGenerator = applicationGenerator;
83
+ exports.default = applicationGenerator;
@@ -0,0 +1,2 @@
1
+ shamefully-hoist=true
2
+ strict-peer-dependencies=false
@@ -0,0 +1,30 @@
1
+ import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
2
+ import { defineNuxtConfig } from 'nuxt/config';
3
+
4
+ // https://nuxt.com/docs/api/configuration/nuxt-config
5
+ export default defineNuxtConfig({
6
+ workspaceDir: '<%= offsetFromRoot %>',
7
+ srcDir: 'src',
8
+ devtools: { enabled: true },
9
+ devServer: {
10
+ host: 'localhost',
11
+ port: 4200,
12
+ },
13
+ typescript: {
14
+ typeCheck: true,
15
+ tsConfig: {
16
+ extends: './tsconfig.app.json',
17
+ },
18
+ },
19
+ imports: {
20
+ autoImport: true,
21
+ },
22
+ <% if (style !== 'none') { %>
23
+ css: ['~/assets/css/styles.<%= style %>'],
24
+ <% } %>
25
+ vite: {
26
+ plugins: [
27
+ nxViteTsPaths()
28
+ ],
29
+ },
30
+ });
@@ -0,0 +1,48 @@
1
+ <script setup lang="ts"></script>
2
+
3
+ <template>
4
+ <main>
5
+ <header>
6
+ <nav>
7
+ <NuxtLink to="/">
8
+ Home
9
+ </NuxtLink>
10
+ <NuxtLink to="/about">
11
+ About
12
+ </NuxtLink>
13
+ </nav>
14
+ </header>
15
+ <nuxt-page />
16
+ </main>
17
+ </template>
18
+
19
+ <style scoped lang="css">
20
+ header {
21
+ line-height: 1.5;
22
+ max-width: 100vw;
23
+ }
24
+
25
+ nav>a {
26
+ padding-left: 1rem;
27
+ padding-right: 1rem;
28
+ }
29
+
30
+ @media (min-width: 768px) {
31
+ header {
32
+ display: flex;
33
+ place-items: center;
34
+ padding-right: calc(var(--section-gap) / 2);
35
+ margin-left: auto;
36
+ margin-right: auto;
37
+ max-width: 768px;
38
+ }
39
+
40
+ nav {
41
+ text-align: left;
42
+ font-size: 1rem;
43
+
44
+ padding: 1rem 0;
45
+ margin-top: 1rem;
46
+ }
47
+ }
48
+ </style>
@@ -0,0 +1,41 @@
1
+ html {
2
+ -webkit-text-size-adjust: 100%;
3
+ font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
4
+ 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif,
5
+ 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
6
+ line-height: 1.5;
7
+ tab-size: 4;
8
+ scroll-behavior: smooth;
9
+ }
10
+ body {
11
+ font-family: inherit;
12
+ line-height: inherit;
13
+ margin: 0;
14
+ }
15
+ h1,
16
+ h2,
17
+ p,
18
+ pre {
19
+ margin: 0;
20
+ }
21
+ *,
22
+ ::before,
23
+ ::after {
24
+ box-sizing: border-box;
25
+ border-width: 0;
26
+ border-style: solid;
27
+ border-color: currentColor;
28
+ }
29
+ h1,
30
+ h2 {
31
+ font-size: inherit;
32
+ font-weight: inherit;
33
+ }
34
+ a {
35
+ color: inherit;
36
+ text-decoration: inherit;
37
+ }
38
+ pre {
39
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
40
+ 'Liberation Mono', 'Courier New', monospace;
41
+ }