@nx/next 0.0.0-pr-22179-271588f

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 (158) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +68 -0
  3. package/babel.d.ts +0 -0
  4. package/babel.js +12 -0
  5. package/executors.json +20 -0
  6. package/generators.json +47 -0
  7. package/index.d.ts +8 -0
  8. package/index.js +19 -0
  9. package/migrations.json +106 -0
  10. package/package.json +60 -0
  11. package/plugin.d.ts +1 -0
  12. package/plugin.js +5 -0
  13. package/plugins/component-testing.d.ts +2 -0
  14. package/plugins/component-testing.js +96 -0
  15. package/plugins/with-less.d.ts +3 -0
  16. package/plugins/with-less.js +79 -0
  17. package/plugins/with-nx.d.ts +25 -0
  18. package/plugins/with-nx.js +297 -0
  19. package/plugins/with-stylus.d.ts +3 -0
  20. package/plugins/with-stylus.js +12 -0
  21. package/src/executors/build/build.impl.d.ts +5 -0
  22. package/src/executors/build/build.impl.js +106 -0
  23. package/src/executors/build/lib/check-project.d.ts +1 -0
  24. package/src/executors/build/lib/check-project.js +12 -0
  25. package/src/executors/build/lib/create-next-config-file.d.ts +14 -0
  26. package/src/executors/build/lib/create-next-config-file.js +162 -0
  27. package/src/executors/build/lib/test-fixtures/ensure-exts/baz.json +1 -0
  28. package/src/executors/build/lib/update-package-json.d.ts +3 -0
  29. package/src/executors/build/lib/update-package-json.js +30 -0
  30. package/src/executors/build/schema.json +76 -0
  31. package/src/executors/export/export.impl.d.ts +17 -0
  32. package/src/executors/export/export.impl.js +58 -0
  33. package/src/executors/export/schema.json +30 -0
  34. package/src/executors/server/custom-server.impl.d.ts +6 -0
  35. package/src/executors/server/custom-server.impl.js +36 -0
  36. package/src/executors/server/schema.json +63 -0
  37. package/src/executors/server/server.impl.d.ts +6 -0
  38. package/src/executors/server/server.impl.js +66 -0
  39. package/src/generators/application/application.d.ts +4 -0
  40. package/src/generators/application/application.js +85 -0
  41. package/src/generators/application/files/app/api/hello/route.ts__tmpl__ +4 -0
  42. package/src/generators/application/files/app/global.__stylesExt____tmpl__ +1 -0
  43. package/src/generators/application/files/app/page.module.__style__ +1 -0
  44. package/src/generators/application/files/app/page.tsx__tmpl__ +30 -0
  45. package/src/generators/application/files/app-default-layout/layout.tsx__tmpl__ +18 -0
  46. package/src/generators/application/files/app-styled-components/layout.tsx__tmpl__ +21 -0
  47. package/src/generators/application/files/app-styled-components/registry.tsx__tmpl__ +33 -0
  48. package/src/generators/application/files/app-styled-jsx/layout.tsx__tmpl__ +16 -0
  49. package/src/generators/application/files/app-styled-jsx/registry.tsx__tmpl__ +23 -0
  50. package/src/generators/application/files/common/__dot__babelrc +21 -0
  51. package/src/generators/application/files/common/index.d.ts__tmpl__ +13 -0
  52. package/src/generators/application/files/common/next-env.d.ts__tmpl__ +5 -0
  53. package/src/generators/application/files/common/next.config.js__tmpl__ +82 -0
  54. package/src/generators/application/files/common/public/.gitkeep +0 -0
  55. package/src/generators/application/files/common/public/favicon.ico +0 -0
  56. package/src/generators/application/files/common/specs/__fileName__.spec.tsx__tmpl__ +18 -0
  57. package/src/generators/application/files/common/tsconfig.json__tmpl__ +29 -0
  58. package/src/generators/application/files/pages/__fileName__.module.__style__ +1 -0
  59. package/src/generators/application/files/pages/__fileName__.tsx__tmpl__ +30 -0
  60. package/src/generators/application/files/pages/_app.tsx__tmpl__ +18 -0
  61. package/src/generators/application/files/pages/_document.tsx__tmpl__ +33 -0
  62. package/src/generators/application/files/pages/styles.__stylesExt____tmpl__ +1 -0
  63. package/src/generators/application/lib/add-e2e.d.ts +3 -0
  64. package/src/generators/application/lib/add-e2e.js +72 -0
  65. package/src/generators/application/lib/add-jest.d.ts +3 -0
  66. package/src/generators/application/lib/add-jest.js +38 -0
  67. package/src/generators/application/lib/add-linting.d.ts +3 -0
  68. package/src/generators/application/lib/add-linting.js +62 -0
  69. package/src/generators/application/lib/add-plugin.d.ts +2 -0
  70. package/src/generators/application/lib/add-plugin.js +25 -0
  71. package/src/generators/application/lib/add-project.d.ts +3 -0
  72. package/src/generators/application/lib/add-project.js +66 -0
  73. package/src/generators/application/lib/create-application-files.d.ts +3 -0
  74. package/src/generators/application/lib/create-application-files.helpers.d.ts +2 -0
  75. package/src/generators/application/lib/create-application-files.helpers.js +846 -0
  76. package/src/generators/application/lib/create-application-files.js +114 -0
  77. package/src/generators/application/lib/normalize-options.d.ts +14 -0
  78. package/src/generators/application/lib/normalize-options.js +56 -0
  79. package/src/generators/application/lib/set-defaults.d.ts +3 -0
  80. package/src/generators/application/lib/set-defaults.js +14 -0
  81. package/src/generators/application/lib/show-possible-warnings.d.ts +3 -0
  82. package/src/generators/application/lib/show-possible-warnings.js +10 -0
  83. package/src/generators/application/lib/update-cypress-tsconfig.d.ts +3 -0
  84. package/src/generators/application/lib/update-cypress-tsconfig.js +16 -0
  85. package/src/generators/application/lib/update-jest-config.d.ts +3 -0
  86. package/src/generators/application/lib/update-jest-config.js +15 -0
  87. package/src/generators/application/schema.d.ts +24 -0
  88. package/src/generators/application/schema.json +146 -0
  89. package/src/generators/component/component.d.ts +28 -0
  90. package/src/generators/component/component.js +66 -0
  91. package/src/generators/component/schema.json +125 -0
  92. package/src/generators/custom-server/custom-server.d.ts +3 -0
  93. package/src/generators/custom-server/custom-server.js +104 -0
  94. package/src/generators/custom-server/files/server/main.ts__tmpl__ +46 -0
  95. package/src/generators/custom-server/files/tsconfig.server.json__tmpl__ +17 -0
  96. package/src/generators/custom-server/schema.d.ts +4 -0
  97. package/src/generators/custom-server/schema.json +30 -0
  98. package/src/generators/cypress-component-configuration/cypress-component-configuration.d.ts +5 -0
  99. package/src/generators/cypress-component-configuration/cypress-component-configuration.js +87 -0
  100. package/src/generators/cypress-component-configuration/schema.d.ts +6 -0
  101. package/src/generators/cypress-component-configuration/schema.json +42 -0
  102. package/src/generators/init/init.d.ts +5 -0
  103. package/src/generators/init/init.js +46 -0
  104. package/src/generators/init/lib/add-plugin.d.ts +2 -0
  105. package/src/generators/init/lib/add-plugin.js +26 -0
  106. package/src/generators/init/schema.d.ts +7 -0
  107. package/src/generators/init/schema.json +34 -0
  108. package/src/generators/library/lib/normalize-options.d.ts +7 -0
  109. package/src/generators/library/lib/normalize-options.js +26 -0
  110. package/src/generators/library/library.d.ts +5 -0
  111. package/src/generators/library/library.js +92 -0
  112. package/src/generators/library/schema.d.ts +28 -0
  113. package/src/generators/library/schema.json +156 -0
  114. package/src/generators/page/page.d.ts +5 -0
  115. package/src/generators/page/page.js +96 -0
  116. package/src/generators/page/schema.d.ts +20 -0
  117. package/src/generators/page/schema.json +111 -0
  118. package/src/migrations/update-15-8-8/add-style-packages.d.ts +3 -0
  119. package/src/migrations/update-15-8-8/add-style-packages.js +23 -0
  120. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +2 -0
  121. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +9 -0
  122. package/src/migrations/update-16-3-0/remove-root-build-option.d.ts +2 -0
  123. package/src/migrations/update-16-3-0/remove-root-build-option.js +17 -0
  124. package/src/migrations/update-16-4-0/update-nx-next-dependency.d.ts +2 -0
  125. package/src/migrations/update-16-4-0/update-nx-next-dependency.js +17 -0
  126. package/src/migrations/update-17-2-7/remove-eslint-rules-patch.d.ts +2 -0
  127. package/src/migrations/update-17-2-7/remove-eslint-rules-patch.js +15 -0
  128. package/src/plugins/plugin.d.ts +11 -0
  129. package/src/plugins/plugin.js +182 -0
  130. package/src/utils/add-gitignore-entry.d.ts +2 -0
  131. package/src/utils/add-gitignore-entry.js +17 -0
  132. package/src/utils/add-swc-to-custom-server.d.ts +2 -0
  133. package/src/utils/add-swc-to-custom-server.js +37 -0
  134. package/src/utils/compose-plugins.d.ts +3 -0
  135. package/src/utils/compose-plugins.js +22 -0
  136. package/src/utils/config-invalid-function.fixture.d.ts +0 -0
  137. package/src/utils/config-invalid-function.fixture.js +1 -0
  138. package/src/utils/config-not-a-function.fixture.d.ts +0 -0
  139. package/src/utils/config-not-a-function.fixture.js +1 -0
  140. package/src/utils/config.d.ts +13 -0
  141. package/src/utils/config.js +24 -0
  142. package/src/utils/constants.d.ts +1 -0
  143. package/src/utils/constants.js +4 -0
  144. package/src/utils/create-cli-options.d.ts +1 -0
  145. package/src/utils/create-cli-options.js +13 -0
  146. package/src/utils/create-copy-plugin.d.ts +2 -0
  147. package/src/utils/create-copy-plugin.js +64 -0
  148. package/src/utils/generate-globs.d.ts +5 -0
  149. package/src/utils/generate-globs.js +29 -0
  150. package/src/utils/styles.d.ts +67 -0
  151. package/src/utils/styles.js +67 -0
  152. package/src/utils/types.d.ts +57 -0
  153. package/src/utils/types.js +2 -0
  154. package/src/utils/versions.d.ts +12 -0
  155. package/src/utils/versions.js +15 -0
  156. package/tailwind.d.ts +2 -0
  157. package/tailwind.js +6 -0
  158. package/typings/image.d.ts +12 -0
@@ -0,0 +1,156 @@
1
+ {
2
+ "$schema": "https://json-schema.org/schema",
3
+ "cli": "nx",
4
+ "$id": "NxReactLibrary",
5
+ "title": "Create a React Library for Nx",
6
+ "description": "Create a React Library for an Nx workspace.",
7
+ "type": "object",
8
+ "properties": {
9
+ "name": {
10
+ "type": "string",
11
+ "description": "Library name",
12
+ "$default": {
13
+ "$source": "argv",
14
+ "index": 0
15
+ },
16
+ "x-prompt": "What name would you like to use for the library?",
17
+ "pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$",
18
+ "x-priority": "important"
19
+ },
20
+ "directory": {
21
+ "type": "string",
22
+ "description": "A directory where the lib is placed.",
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
+ "style": {
32
+ "description": "The file extension to be used for style files.",
33
+ "type": "string",
34
+ "default": "css",
35
+ "alias": "s",
36
+ "x-prompt": {
37
+ "message": "Which stylesheet format would you like to use?",
38
+ "type": "list",
39
+ "items": [
40
+ { "value": "css", "label": "CSS" },
41
+ {
42
+ "value": "scss",
43
+ "label": "SASS(.scss) [ https://sass-lang.com ]"
44
+ },
45
+ {
46
+ "value": "less",
47
+ "label": "LESS [ https://lesscss.org ]"
48
+ },
49
+ {
50
+ "value": "styled-components",
51
+ "label": "styled-components [ https://styled-components.com ]"
52
+ },
53
+ {
54
+ "value": "@emotion/styled",
55
+ "label": "emotion [ https://emotion.sh ]"
56
+ },
57
+ {
58
+ "value": "styled-jsx",
59
+ "label": "styled-jsx [ https://www.npmjs.com/package/styled-jsx ]"
60
+ },
61
+ {
62
+ "value": "none",
63
+ "label": "None"
64
+ }
65
+ ]
66
+ }
67
+ },
68
+ "linter": {
69
+ "description": "The tool to use for running lint checks.",
70
+ "type": "string",
71
+ "enum": ["eslint"],
72
+ "default": "eslint"
73
+ },
74
+ "unitTestRunner": {
75
+ "type": "string",
76
+ "enum": ["jest", "vitest", "none"],
77
+ "description": "Test runner to use for unit tests."
78
+ },
79
+ "tags": {
80
+ "type": "string",
81
+ "description": "Add tags to the library (used for linting).",
82
+ "alias": "t"
83
+ },
84
+ "skipFormat": {
85
+ "description": "Skip formatting files.",
86
+ "type": "boolean",
87
+ "default": false
88
+ },
89
+ "skipTsConfig": {
90
+ "type": "boolean",
91
+ "default": false,
92
+ "description": "Do not update tsconfig.json for development experience."
93
+ },
94
+ "pascalCaseFiles": {
95
+ "type": "boolean",
96
+ "description": "Use pascal case component file name (e.g. `App.tsx`).",
97
+ "alias": "P",
98
+ "default": false
99
+ },
100
+ "routing": {
101
+ "type": "boolean",
102
+ "description": "Generate library with routes."
103
+ },
104
+ "appProject": {
105
+ "type": "string",
106
+ "description": "The application project to add the library route to.",
107
+ "alias": "a"
108
+ },
109
+ "publishable": {
110
+ "type": "boolean",
111
+ "description": "Create a publishable library."
112
+ },
113
+ "buildable": {
114
+ "type": "boolean",
115
+ "default": false,
116
+ "description": "Generate a buildable library."
117
+ },
118
+ "importPath": {
119
+ "type": "string",
120
+ "description": "The library name used to import it, like `@myorg/my-awesome-lib`."
121
+ },
122
+ "component": {
123
+ "type": "boolean",
124
+ "description": "Generate a default component.",
125
+ "default": true
126
+ },
127
+ "js": {
128
+ "type": "boolean",
129
+ "description": "Generate JavaScript files rather than TypeScript files.",
130
+ "default": false
131
+ },
132
+ "globalCss": {
133
+ "type": "boolean",
134
+ "description": "When true, the stylesheet is generated using global CSS instead of CSS modules (e.g. file is `*.css` rather than `*.module.css`).",
135
+ "default": false
136
+ },
137
+ "strict": {
138
+ "type": "boolean",
139
+ "description": "Whether to enable tsconfig strict mode or not.",
140
+ "default": true
141
+ },
142
+ "setParserOptionsProject": {
143
+ "type": "boolean",
144
+ "description": "Whether or not to configure the ESLint `parserOptions.project` option. We do not do this by default for lint performance reasons.",
145
+ "default": false
146
+ },
147
+ "skipPackageJson": {
148
+ "type": "boolean",
149
+ "default": false,
150
+ "description": "Do not add dependencies to `package.json`.",
151
+ "x-priority": "internal"
152
+ }
153
+ },
154
+ "required": ["name"],
155
+ "examplesFile": "../../../docs/library-examples.md"
156
+ }
@@ -0,0 +1,5 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import { Schema } from './schema';
3
+ export declare function pageGenerator(host: Tree, schema: Schema): Promise<import("@nx/devkit").GeneratorCallback>;
4
+ export declare function pageGeneratorInternal(host: Tree, schema: Schema): Promise<import("@nx/devkit").GeneratorCallback>;
5
+ export default pageGenerator;
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.pageGeneratorInternal = exports.pageGenerator = void 0;
4
+ const react_1 = require("@nx/react");
5
+ const devkit_1 = require("@nx/devkit");
6
+ const styles_1 = require("../../utils/styles");
7
+ const artifact_name_and_directory_utils_1 = require("@nx/devkit/src/generators/artifact-name-and-directory-utils");
8
+ async function pageGenerator(host, schema) {
9
+ return pageGeneratorInternal(host, {
10
+ nameAndDirectoryFormat: 'derived',
11
+ ...schema,
12
+ });
13
+ }
14
+ exports.pageGenerator = pageGenerator;
15
+ /*
16
+ * This schematic is basically the React component one, but for Next we need
17
+ * extra dependencies for css, sass, less style options, and make sure
18
+ * it is under `pages` folder.
19
+ */
20
+ async function pageGeneratorInternal(host, schema) {
21
+ const options = await normalizeOptions(host, schema);
22
+ const componentTask = await (0, react_1.componentGenerator)(host, {
23
+ ...options,
24
+ isNextPage: true,
25
+ nameAndDirectoryFormat: 'as-provided', // already determined the directory so use as is
26
+ export: false,
27
+ classComponent: false,
28
+ routing: false,
29
+ skipTests: !options.withTests,
30
+ skipFormat: true,
31
+ });
32
+ const project = (0, devkit_1.readProjectConfiguration)(host, options.projectName);
33
+ const styledTask = (0, styles_1.addStyleDependencies)(host, {
34
+ style: options.style,
35
+ swc: !host.exists((0, devkit_1.joinPathFragments)(project.root, '.babelrc')),
36
+ });
37
+ if (!options.skipFormat) {
38
+ await (0, devkit_1.formatFiles)(host);
39
+ }
40
+ return (0, devkit_1.runTasksInSerial)(componentTask, styledTask);
41
+ }
42
+ exports.pageGeneratorInternal = pageGeneratorInternal;
43
+ async function normalizeOptions(host, options) {
44
+ let isAppRouter;
45
+ let derivedDirectory;
46
+ let routerDirectory;
47
+ if (options.project) {
48
+ // Legacy behavior, detect app vs page router from specified project.
49
+ // TODO(v19): remove this logic
50
+ const project = (0, devkit_1.readProjectConfiguration)(host, options.project);
51
+ // app/ is a reserved folder in nextjs so it is safe to check it's existence
52
+ isAppRouter =
53
+ host.exists(`${project.root}/app`) ||
54
+ host.exists(`${project.root}/src/app`);
55
+ routerDirectory = isAppRouter ? 'app' : 'pages';
56
+ derivedDirectory = options.directory
57
+ ? `${routerDirectory}/${options.directory}`
58
+ : `${routerDirectory}`;
59
+ }
60
+ else {
61
+ // Get the project name first so we can determine the router directory
62
+ const { project: determinedProjectName } = await (0, artifact_name_and_directory_utils_1.determineArtifactNameAndDirectoryOptions)(host, {
63
+ artifactType: 'page',
64
+ callingGenerator: '@nx/next:page',
65
+ name: options.name,
66
+ directory: options.directory,
67
+ });
68
+ const project = (0, devkit_1.readProjectConfiguration)(host, determinedProjectName);
69
+ // app/ is a reserved folder in nextjs so it is safe to check it's existence
70
+ isAppRouter =
71
+ host.exists(`${project.root}/app`) ||
72
+ host.exists(`${project.root}/src/app`);
73
+ routerDirectory = isAppRouter ? 'app' : 'pages';
74
+ // New behavior, use directory as is without detecting whether we're using app or pages router.
75
+ derivedDirectory = options.directory;
76
+ }
77
+ const { artifactName: name, project: projectName, fileName, directory, } = await (0, artifact_name_and_directory_utils_1.determineArtifactNameAndDirectoryOptions)(host, {
78
+ artifactType: 'page',
79
+ callingGenerator: '@nx/next:page',
80
+ name: options.name,
81
+ fileName: isAppRouter ? 'page' : 'index',
82
+ directory: options.directory,
83
+ derivedDirectory,
84
+ flat: options.flat,
85
+ nameAndDirectoryFormat: options.nameAndDirectoryFormat,
86
+ project: options.project,
87
+ fileExtension: 'tsx',
88
+ });
89
+ return {
90
+ ...options,
91
+ directory,
92
+ fileName,
93
+ projectName,
94
+ };
95
+ }
96
+ exports.default = pageGenerator;
@@ -0,0 +1,20 @@
1
+ import { SupportedStyles } from '@nx/react';
2
+
3
+ export interface Schema {
4
+ name: string;
5
+ /**
6
+ * @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.
7
+ */
8
+ project?: string;
9
+ style: SupportedStyles;
10
+ directory?: string;
11
+ fileName?: string;
12
+ withTests?: boolean;
13
+ js?: boolean;
14
+ /**
15
+ * @deprecated Provide the `directory` option instead and use the `as-provided` format. This option will be removed in Nx v19.
16
+ */
17
+ flat?: boolean;
18
+ skipFormat?: boolean;
19
+ nameAndDirectoryFormat?: 'as-provided' | 'derived';
20
+ }
@@ -0,0 +1,111 @@
1
+ {
2
+ "$schema": "https://json-schema.org/schema",
3
+ "cli": "nx",
4
+ "$id": "NxNextReactPage",
5
+ "title": "Create a Page for Next",
6
+ "description": "Create a Page for Next.",
7
+ "type": "object",
8
+ "properties": {
9
+ "project": {
10
+ "type": "string",
11
+ "description": "The name of the project.",
12
+ "alias": "p",
13
+ "$default": {
14
+ "$source": "projectName"
15
+ },
16
+ "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."
17
+ },
18
+ "name": {
19
+ "type": "string",
20
+ "description": "The name of the component.",
21
+ "$default": {
22
+ "$source": "argv",
23
+ "index": 0
24
+ },
25
+ "x-prompt": "What name would you like to use for the component?",
26
+ "x-priority": "important"
27
+ },
28
+ "directory": {
29
+ "type": "string",
30
+ "description": "The directory at which to create the page file. When `--nameAndDirectoryFormat=as-provided`, it will be relative to the current working directory. Otherwise, it will be relative to the project root.",
31
+ "alias": "dir",
32
+ "x-priority": "important"
33
+ },
34
+ "nameAndDirectoryFormat": {
35
+ "description": "Whether to generate the component in the directory as provided, relative to the current working directory and ignoring the project (`as-provided`) or generate it using the project and directory relative to the workspace root (`derived`).",
36
+ "type": "string",
37
+ "enum": ["as-provided", "derived"]
38
+ },
39
+ "style": {
40
+ "description": "The file extension to be used for style files.",
41
+ "type": "string",
42
+ "alias": "s",
43
+ "default": "css",
44
+ "x-prompt": {
45
+ "message": "Which stylesheet format would you like to use?",
46
+ "type": "list",
47
+ "items": [
48
+ {
49
+ "value": "css",
50
+ "label": "CSS"
51
+ },
52
+ {
53
+ "value": "scss",
54
+ "label": "SASS(.scss) [ https://sass-lang.com ]"
55
+ },
56
+ {
57
+ "value": "less",
58
+ "label": "LESS [ https://lesscss.org ]"
59
+ },
60
+ {
61
+ "value": "styled-components",
62
+ "label": "styled-components [ https://styled-components.com ]"
63
+ },
64
+ {
65
+ "value": "@emotion/styled",
66
+ "label": "emotion [ https://emotion.sh ]"
67
+ },
68
+ {
69
+ "value": "styled-jsx",
70
+ "label": "styled-jsx [ https://www.npmjs.com/package/styled-jsx ]"
71
+ },
72
+ {
73
+ "value": "none",
74
+ "label": "None"
75
+ }
76
+ ]
77
+ },
78
+ "x-priority": "important"
79
+ },
80
+ "withTests": {
81
+ "type": "boolean",
82
+ "description": "When true, creates a `spec.ts` test file for the new page.",
83
+ "default": false
84
+ },
85
+ "export": {
86
+ "type": "boolean",
87
+ "description": "When true, the component is exported from the project `index.ts` (if it exists).",
88
+ "alias": "e",
89
+ "default": false
90
+ },
91
+ "js": {
92
+ "type": "boolean",
93
+ "description": "Generate JavaScript files rather than TypeScript files.",
94
+ "default": false
95
+ },
96
+ "flat": {
97
+ "type": "boolean",
98
+ "description": "Create component at the source root rather than its own directory.",
99
+ "default": false,
100
+ "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v19."
101
+ },
102
+ "skipFormat": {
103
+ "description": "Skip formatting files.",
104
+ "type": "boolean",
105
+ "default": false,
106
+ "x-priority": "internal"
107
+ }
108
+ },
109
+ "required": ["name"],
110
+ "examplesFile": "../../../docs/page-examples.md"
111
+ }
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export declare function update(tree: Tree): Promise<import("@nx/devkit").GeneratorCallback>;
3
+ export default update;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.update = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ async function update(tree) {
6
+ const projects = (0, devkit_1.getProjects)(tree);
7
+ const missingDeps = {};
8
+ for (const [, config] of projects) {
9
+ if (config.targets?.build?.executor === '@nrwl/next:build' &&
10
+ tree.exists((0, devkit_1.joinPathFragments)(config.root, 'next.config.js'))) {
11
+ const nextConfigContent = tree.read((0, devkit_1.joinPathFragments)(config.root, 'next.config.js'), 'utf-8');
12
+ if (nextConfigContent.includes('@nrwl/next/plugins/with-less')) {
13
+ missingDeps['less'] = '3.12.2';
14
+ }
15
+ if (nextConfigContent.includes('@nrwl/next/plugins/with-stylus')) {
16
+ missingDeps['stylus'] = '^0.55.0';
17
+ }
18
+ }
19
+ }
20
+ return (0, devkit_1.addDependenciesToPackageJson)(tree, {}, missingDeps);
21
+ }
22
+ exports.update = update;
23
+ exports.default = update;
@@ -0,0 +1,2 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export default function replacePackage(tree: Tree): Promise<void>;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const devkit_1 = require("@nx/devkit");
4
+ const replace_package_1 = require("@nx/devkit/src/utils/replace-package");
5
+ async function replacePackage(tree) {
6
+ await (0, replace_package_1.replaceNrwlPackageWithNxPackage)(tree, '@nrwl/next', '@nx/next');
7
+ await (0, devkit_1.formatFiles)(tree);
8
+ }
9
+ exports.default = replacePackage;
@@ -0,0 +1,2 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export default function update(tree: Tree): Promise<void>;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const devkit_1 = require("@nx/devkit");
4
+ const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
5
+ async function update(tree) {
6
+ (0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nx/next:build', (options, projectName, targetName) => {
7
+ const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, projectName);
8
+ delete projectConfig.targets[targetName].options.root;
9
+ (0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfig);
10
+ });
11
+ (0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nrwl/next:build', (options, projectName, targetName) => {
12
+ const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, projectName);
13
+ delete projectConfig.targets[targetName].options.root;
14
+ (0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfig);
15
+ });
16
+ }
17
+ exports.default = update;
@@ -0,0 +1,2 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export default function update(tree: Tree): Promise<void>;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const devkit_1 = require("@nx/devkit");
4
+ async function update(tree) {
5
+ if (tree.exists('./package.json')) {
6
+ (0, devkit_1.updateJson)(tree, 'package.json', (packageJson) => {
7
+ if (packageJson.dependencies['@nx/next']) {
8
+ packageJson.devDependencies['@nx/next'] =
9
+ packageJson.dependencies['@nx/next'];
10
+ delete packageJson.dependencies['@nx/next'];
11
+ }
12
+ return packageJson;
13
+ });
14
+ }
15
+ await (0, devkit_1.formatFiles)(tree);
16
+ }
17
+ exports.default = update;
@@ -0,0 +1,2 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export default function update(tree: Tree): Promise<void>;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const devkit_1 = require("@nx/devkit");
4
+ const eslint_file_1 = require("@nx/eslint/src/generators/utils/eslint-file");
5
+ async function update(tree) {
6
+ const projects = (0, devkit_1.getProjects)(tree);
7
+ projects.forEach((project) => {
8
+ if (!(0, eslint_file_1.isEslintConfigSupported)(tree, project.root))
9
+ return;
10
+ (0, eslint_file_1.updateOverrideInLintConfig)(tree, project.root, (o) => o.rules?.['@next/next/no-html-link-for-pages'] &&
11
+ o.files?.includes('**/*.*'), (o) => undefined);
12
+ });
13
+ await (0, devkit_1.formatFiles)(tree);
14
+ }
15
+ exports.default = update;
@@ -0,0 +1,11 @@
1
+ /// <reference types="node" />
2
+ import { CreateDependencies, CreateNodes } from '@nx/devkit';
3
+ export interface NextPluginOptions {
4
+ buildTargetName?: string;
5
+ devTargetName?: string;
6
+ startTargetName?: string;
7
+ serveStaticTargetName?: string;
8
+ }
9
+ export declare const createDependencies: CreateDependencies;
10
+ export declare const createNodes: CreateNodes<NextPluginOptions>;
11
+ export declare function loadEsmModule<T>(modulePath: string | URL): Promise<T>;