@nx/nuxt 22.2.0-beta.0 → 22.2.0-beta.1

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 (45) hide show
  1. package/migrations.json +34 -2
  2. package/package.json +11 -10
  3. package/src/generators/application/application.d.ts.map +1 -1
  4. package/src/generators/application/application.js +13 -5
  5. package/src/generators/application/files/app-dir/__dot__npmrc +2 -0
  6. package/src/generators/application/files/app-dir/app/app.vue__tmpl__ +48 -0
  7. package/src/generators/application/files/app-dir/app/assets/css/styles.__style__ +41 -0
  8. package/src/generators/application/files/app-dir/app/pages/about.vue__tmpl__ +16 -0
  9. package/src/generators/application/files/app-dir/app/pages/index.vue__tmpl__ +3 -0
  10. package/src/generators/application/files/app-dir/nuxt.config.ts__tmpl__ +29 -0
  11. package/src/generators/application/files/app-dir/public/__dot__gitkeep +0 -0
  12. package/src/generators/application/files/app-dir/public/favicon.ico__tmpl__ +0 -0
  13. package/src/generators/application/files/app-dir/server/api/greet.ts__tmpl__ +10 -0
  14. package/src/generators/application/files/app-dir/server/tsconfig.json__tmpl__ +3 -0
  15. package/src/generators/application/files/nx-welcome-app-dir/claimed/app/components/NxWelcome.vue__tmpl__ +791 -0
  16. package/src/generators/application/files/nx-welcome-app-dir/not-configured/app/components/NxWelcome.vue__tmpl__ +795 -0
  17. package/src/generators/application/files/nx-welcome-app-dir/unclaimed/app/components/NxWelcome.vue__tmpl__ +792 -0
  18. package/src/generators/application/lib/ensure-dependencies.d.ts +1 -1
  19. package/src/generators/application/lib/ensure-dependencies.d.ts.map +1 -1
  20. package/src/generators/application/lib/ensure-dependencies.js +8 -6
  21. package/src/generators/application/lib/normalize-options.d.ts.map +1 -1
  22. package/src/generators/application/lib/normalize-options.js +8 -0
  23. package/src/generators/application/schema.d.ts +3 -0
  24. package/src/generators/application/schema.json +5 -0
  25. package/src/generators/init/init.js +1 -1
  26. package/src/generators/init/lib/utils.d.ts +1 -1
  27. package/src/generators/init/lib/utils.d.ts.map +1 -1
  28. package/src/generators/init/lib/utils.js +4 -2
  29. package/src/generators/storybook-configuration/configuration.d.ts.map +1 -1
  30. package/src/generators/storybook-configuration/configuration.js +12 -2
  31. package/src/migrations/update-22-2-0/create-ai-instructions-for-nuxt-4.d.ts +3 -0
  32. package/src/migrations/update-22-2-0/create-ai-instructions-for-nuxt-4.d.ts.map +1 -0
  33. package/src/migrations/update-22-2-0/create-ai-instructions-for-nuxt-4.js +16 -0
  34. package/src/migrations/update-22-2-0/files/ai-instructions-for-nuxt-4.md +531 -0
  35. package/src/utils/add-linting.d.ts.map +1 -1
  36. package/src/utils/add-linting.js +82 -21
  37. package/src/utils/create-ts-config.d.ts +1 -0
  38. package/src/utils/create-ts-config.d.ts.map +1 -1
  39. package/src/utils/create-ts-config.js +27 -2
  40. package/src/utils/version-utils.d.ts +15 -0
  41. package/src/utils/version-utils.d.ts.map +1 -0
  42. package/src/utils/version-utils.js +85 -0
  43. package/src/utils/versions.d.ts +11 -3
  44. package/src/utils/versions.d.ts.map +1 -1
  45. package/src/utils/versions.js +15 -5
package/migrations.json CHANGED
@@ -1,4 +1,36 @@
1
1
  {
2
- "generators": {},
3
- "packageJsonUpdates": {}
2
+ "generators": {
3
+ "update-22-2-0-create-ai-instructions-for-nuxt-4": {
4
+ "version": "22.2.0-beta.0",
5
+ "description": "Create AI Instructions to help migrate workspaces to Nuxt 4.",
6
+ "implementation": "./src/migrations/update-22-2-0/create-ai-instructions-for-nuxt-4"
7
+ }
8
+ },
9
+ "packageJsonUpdates": {
10
+ "22.2.0": {
11
+ "version": "22.2.0-beta.0",
12
+ "packages": {
13
+ "nuxt": {
14
+ "version": "^4.0.0",
15
+ "alwaysAddToPackageJson": false
16
+ },
17
+ "@nuxt/eslint-config": {
18
+ "version": "^1.10.0",
19
+ "alwaysAddToPackageJson": false
20
+ },
21
+ "@nuxt/kit": {
22
+ "version": "^4.0.0",
23
+ "alwaysAddToPackageJson": false
24
+ },
25
+ "@nuxt/schema": {
26
+ "version": "^4.0.0",
27
+ "alwaysAddToPackageJson": false
28
+ },
29
+ "@nuxt/devtools": {
30
+ "version": "^3.0.0",
31
+ "alwaysAddToPackageJson": false
32
+ }
33
+ }
34
+ }
35
+ }
4
36
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/nuxt",
3
- "version": "22.2.0-beta.0",
3
+ "version": "22.2.0-beta.1",
4
4
  "private": false,
5
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, Playwright, 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": {
@@ -43,19 +43,20 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "tslib": "^2.3.0",
46
- "@nuxt/kit": "^3.10.0",
47
- "@nx/devkit": "22.2.0-beta.0",
48
- "@nx/js": "22.2.0-beta.0",
49
- "@nx/eslint": "22.2.0-beta.0",
50
- "@nx/vue": "22.2.0-beta.0",
51
- "@nx/vite": "22.2.0-beta.0",
52
- "@nx/vitest": "22.2.0-beta.0"
46
+ "@nuxt/kit": "^3.10.0 || ^4.0.0",
47
+ "@nx/devkit": "22.2.0-beta.1",
48
+ "@nx/js": "22.2.0-beta.1",
49
+ "@nx/eslint": "22.2.0-beta.1",
50
+ "@nx/vue": "22.2.0-beta.1",
51
+ "@nx/vite": "22.2.0-beta.1",
52
+ "@nx/vitest": "22.2.0-beta.1",
53
+ "semver": "^7.5.3"
53
54
  },
54
55
  "devDependencies": {
55
- "nx": "22.2.0-beta.0"
56
+ "nx": "22.2.0-beta.1"
56
57
  },
57
58
  "peerDependencies": {
58
- "@nuxt/schema": "^3.10.0"
59
+ "@nuxt/schema": "^3.10.0 || ^4.0.0"
59
60
  },
60
61
  "publishConfig": {
61
62
  "access": "public"
@@ -1 +1 @@
1
- {"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../../../../../packages/nuxt/src/generators/application/application.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,iBAAiB,EAKjB,IAAI,EAEL,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AA6BlC,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAKpE;AAED,wBAAsB,4BAA4B,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAqM5E;AAED,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../../../../../packages/nuxt/src/generators/application/application.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,iBAAiB,EAKjB,IAAI,EAEL,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AA6BlC,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAKpE;AAED,wBAAsB,4BAA4B,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAiN5E;AAED,eAAe,oBAAoB,CAAC"}
@@ -42,7 +42,7 @@ async function applicationGeneratorInternal(tree, schema) {
42
42
  const onBoardingStatus = await (0, onboarding_1.createNxCloudOnboardingURLForWelcomeApp)(tree, options.nxCloudToken);
43
43
  const connectCloudUrl = onBoardingStatus === 'unclaimed' &&
44
44
  (await (0, onboarding_1.getNxCloudAppOnBoardingUrl)(options.nxCloudToken));
45
- tasks.push((0, ensure_dependencies_1.ensureDependencies)(tree, options));
45
+ tasks.push(await (0, ensure_dependencies_1.ensureDependencies)(tree, options));
46
46
  const packageJson = {
47
47
  name: options.importPath,
48
48
  version: '0.0.1',
@@ -58,10 +58,11 @@ async function applicationGeneratorInternal(tree, schema) {
58
58
  }
59
59
  }
60
60
  else {
61
+ const sourceDir = options.useAppDir ? 'app' : 'src';
61
62
  (0, devkit_1.addProjectConfiguration)(tree, options.projectName, {
62
63
  root: options.appProjectRoot,
63
64
  projectType: 'application',
64
- sourceRoot: `${options.appProjectRoot}/src`,
65
+ sourceRoot: `${options.appProjectRoot}/${sourceDir}`,
65
66
  tags: options.parsedTags?.length ? options.parsedTags : undefined,
66
67
  targets: {},
67
68
  });
@@ -69,7 +70,10 @@ async function applicationGeneratorInternal(tree, schema) {
69
70
  if (!options.useProjectJson || options.isUsingTsSolutionConfig) {
70
71
  (0, devkit_1.writeJson)(tree, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'package.json'), packageJson);
71
72
  }
72
- (0, devkit_1.generateFiles)(tree, (0, node_path_1.join)(__dirname, './files/base'), options.appProjectRoot, {
73
+ // Select template directory based on useAppDir
74
+ const templateDir = options.useAppDir ? 'app-dir' : 'base';
75
+ const nxWelcomeDir = options.useAppDir ? 'nx-welcome-app-dir' : 'nx-welcome';
76
+ (0, devkit_1.generateFiles)(tree, (0, node_path_1.join)(__dirname, './files', templateDir), options.appProjectRoot, {
73
77
  ...options,
74
78
  offsetFromRoot: projectOffsetFromRoot,
75
79
  relativePathToRootTsConfig: (0, js_1.getRelativePathToRootTsConfig)(tree, options.appProjectRoot),
@@ -80,7 +84,7 @@ async function applicationGeneratorInternal(tree, schema) {
80
84
  projectRoot: options.appProjectRoot,
81
85
  hasVitest: options.unitTestRunner === 'vitest',
82
86
  });
83
- (0, devkit_1.generateFiles)(tree, (0, node_path_1.join)(__dirname, './files/nx-welcome', onBoardingStatus), options.appProjectRoot, {
87
+ (0, devkit_1.generateFiles)(tree, (0, node_path_1.join)(__dirname, './files', nxWelcomeDir, onBoardingStatus), options.appProjectRoot, {
84
88
  ...options,
85
89
  connectCloudUrl,
86
90
  offsetFromRoot: projectOffsetFromRoot,
@@ -92,13 +96,17 @@ async function applicationGeneratorInternal(tree, schema) {
92
96
  hasVitest: options.unitTestRunner === 'vitest',
93
97
  });
94
98
  if (options.style === 'none') {
95
- tree.delete((0, devkit_1.joinPathFragments)(options.appProjectRoot, `src/assets/css/styles.none`));
99
+ const stylesPath = options.useAppDir
100
+ ? `app/assets/css/styles.none`
101
+ : `src/assets/css/styles.none`;
102
+ tree.delete((0, devkit_1.joinPathFragments)(options.appProjectRoot, stylesPath));
96
103
  }
97
104
  (0, create_ts_config_1.createTsConfig)(tree, {
98
105
  projectRoot: options.appProjectRoot,
99
106
  rootProject: options.rootProject,
100
107
  unitTestRunner: options.unitTestRunner,
101
108
  isUsingTsSolutionConfig: options.isUsingTsSolutionConfig,
109
+ useAppDir: options.useAppDir,
102
110
  }, (0, js_1.getRelativePathToRootTsConfig)(tree, options.appProjectRoot));
103
111
  (0, update_gitignore_1.updateGitIgnore)(tree);
104
112
  // If we are using the new TS solution
@@ -0,0 +1,2 @@
1
+ shamefully-hoist=true
2
+ strict-peer-dependencies=false
@@ -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
+ }
@@ -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,3 @@
1
+ <template>
2
+ <NxWelcome title="<%= title %>" />
3
+ </template>
@@ -0,0 +1,29 @@
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
+ devtools: { enabled: true },
8
+ devServer: {
9
+ host: 'localhost',
10
+ port: 4200,
11
+ },
12
+ typescript: {
13
+ typeCheck: true,
14
+ tsConfig: {
15
+ extends: '../<%= relativePathToRootTsConfig %>', // Nuxt copies this string as-is to the `./.nuxt/tsconfig.json`, therefore it needs to be relative to that directory
16
+ },
17
+ },
18
+ imports: {
19
+ autoImport: true,
20
+ },
21
+ <%_ if (style !== 'none') { _%>
22
+ css: ['~/assets/css/styles.<%= style %>'],
23
+ <%_ } _%>
24
+ vite: {
25
+ plugins: [
26
+ nxViteTsPaths()
27
+ ],
28
+ },
29
+ });
@@ -0,0 +1,10 @@
1
+ import { defineEventHandler, getQuery } from 'h3';
2
+
3
+ export default defineEventHandler((event) => {
4
+ const q = getQuery(event);
5
+ const projectName = q.name || 'World';
6
+
7
+ return {
8
+ message: `Hello ${projectName}`,
9
+ };
10
+ });
@@ -0,0 +1,3 @@
1
+ {
2
+ "extends": "../.nuxt/tsconfig.server.json"
3
+ }