@nx/next 16.10.0 → 17.0.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.
- package/migrations.json +0 -260
- package/package.json +8 -8
- package/src/generators/application/lib/add-linting.js +4 -1
- package/src/generators/custom-server/custom-server.js +6 -7
- package/src/migrations/update-12-10-0/fix-page-dir-for-eslint.d.ts +0 -3
- package/src/migrations/update-12-10-0/fix-page-dir-for-eslint.js +0 -32
- package/src/migrations/update-12-8-0/remove-styled-jsx-babel-plugin.d.ts +0 -3
- package/src/migrations/update-12-8-0/remove-styled-jsx-babel-plugin.js +0 -22
- package/src/migrations/update-13-0-0/update-emotion-setup.d.ts +0 -3
- package/src/migrations/update-13-0-0/update-emotion-setup.js +0 -35
- package/src/migrations/update-13-0-0/update-to-webpack-5.d.ts +0 -3
- package/src/migrations/update-13-0-0/update-to-webpack-5.js +0 -28
- package/src/migrations/update-13-0-3/fix-less.d.ts +0 -3
- package/src/migrations/update-13-0-3/fix-less.js +0 -23
- package/src/migrations/update-13-1-1/enable-swc.d.ts +0 -3
- package/src/migrations/update-13-1-1/enable-swc.js +0 -41
- package/src/migrations/update-14-0-0/add-default-development-configurations.d.ts +0 -3
- package/src/migrations/update-14-0-0/add-default-development-configurations.js +0 -30
- package/src/migrations/update-14-4-3/add-dev-output-path.d.ts +0 -3
- package/src/migrations/update-14-4-3/add-dev-output-path.js +0 -19
- package/src/migrations/update-14-5-3/add-gitignore-entry.d.ts +0 -3
- package/src/migrations/update-14-5-3/add-gitignore-entry.js +0 -11
- package/src/migrations/update-14-5-3/update-dev-output-path.d.ts +0 -3
- package/src/migrations/update-14-5-3/update-dev-output-path.js +0 -23
- package/src/migrations/update-14-5-7/update-next-eslint.d.ts +0 -3
- package/src/migrations/update-14-5-7/update-next-eslint.js +0 -27
package/migrations.json
CHANGED
|
@@ -1,59 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"generators": {
|
|
3
|
-
"fix-nextjs-lib-babel-config-12.8.0": {
|
|
4
|
-
"cli": "nx",
|
|
5
|
-
"version": "12.8.0-beta.11",
|
|
6
|
-
"description": "Adjust the Next.js lib babel configuration for styled-jsx",
|
|
7
|
-
"factory": "./src/migrations/update-12-8-0/remove-styled-jsx-babel-plugin"
|
|
8
|
-
},
|
|
9
|
-
"fix-page-dir-for-eslint": {
|
|
10
|
-
"cli": "nx",
|
|
11
|
-
"version": "12.10.0-beta.1",
|
|
12
|
-
"description": "Updates .eslintrc.json file to use the correct pages directory for '@next/next/no-html-link-for-pages'.",
|
|
13
|
-
"factory": "./src/migrations/update-12-10-0/fix-page-dir-for-eslint"
|
|
14
|
-
},
|
|
15
|
-
"update-emotion-setup-13.0.0": {
|
|
16
|
-
"cli": "nx",
|
|
17
|
-
"version": "13.0.0-beta.0",
|
|
18
|
-
"description": "Update tsconfig.json to use `jsxImportSource` to support css prop",
|
|
19
|
-
"factory": "./src/migrations/update-13-0-0/update-emotion-setup"
|
|
20
|
-
},
|
|
21
|
-
"update-to-webpack-5": {
|
|
22
|
-
"cli": "nx",
|
|
23
|
-
"version": "13.0.0-beta.1",
|
|
24
|
-
"description": "Set `webpack5: true` for all next.js projects.",
|
|
25
|
-
"factory": "./src/migrations/update-13-0-0/update-to-webpack-5"
|
|
26
|
-
},
|
|
27
|
-
"fix-less": {
|
|
28
|
-
"cli": "nx",
|
|
29
|
-
"version": "13.0.3-beta.1",
|
|
30
|
-
"description": "Fix setup for less stylesheets",
|
|
31
|
-
"factory": "./src/migrations/update-13-0-3/fix-less"
|
|
32
|
-
},
|
|
33
|
-
"add-default-development-configurations-14.0.0": {
|
|
34
|
-
"cli": "nx",
|
|
35
|
-
"version": "14.0.0-beta.0",
|
|
36
|
-
"description": "Add a default development configuration for build and serve targets.",
|
|
37
|
-
"factory": "./src/migrations/update-14-0-0/add-default-development-configurations"
|
|
38
|
-
},
|
|
39
|
-
"add-dev-output-path": {
|
|
40
|
-
"cli": "nx",
|
|
41
|
-
"version": "14.4.3-beta.0",
|
|
42
|
-
"description": "Add a development outputPath to avoid conflict with the production build.",
|
|
43
|
-
"factory": "./src/migrations/update-14-4-3/add-dev-output-path"
|
|
44
|
-
},
|
|
45
|
-
"add-gitignore-entry": {
|
|
46
|
-
"cli": "nx",
|
|
47
|
-
"version": "14.5.3-beta.0",
|
|
48
|
-
"description": "Add .next folder to gitignore.",
|
|
49
|
-
"factory": "./src/migrations/update-14-5-3/add-gitignore-entry"
|
|
50
|
-
},
|
|
51
|
-
"update-dev-output-path": {
|
|
52
|
-
"cli": "nx",
|
|
53
|
-
"version": "14.5.3-beta.0",
|
|
54
|
-
"description": "Update development outputPath to the project root.",
|
|
55
|
-
"factory": "./src/migrations/update-14-5-3/update-dev-output-path"
|
|
56
|
-
},
|
|
57
3
|
"add-style-packages": {
|
|
58
4
|
"cli": "nx",
|
|
59
5
|
"version": "15.8.8-beta.0",
|
|
@@ -80,212 +26,6 @@
|
|
|
80
26
|
}
|
|
81
27
|
},
|
|
82
28
|
"packageJsonUpdates": {
|
|
83
|
-
"12.1.2": {
|
|
84
|
-
"version": "12.1.2-beta.0",
|
|
85
|
-
"packages": {
|
|
86
|
-
"next": {
|
|
87
|
-
"version": "10.2.0",
|
|
88
|
-
"alwaysAddToPackageJson": false
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
"12.6.0": {
|
|
93
|
-
"version": "12.6.0-beta.0",
|
|
94
|
-
"packages": {
|
|
95
|
-
"next": {
|
|
96
|
-
"version": "11.0.1",
|
|
97
|
-
"alwaysAddToPackageJson": false
|
|
98
|
-
},
|
|
99
|
-
"eslint-config-next": {
|
|
100
|
-
"version": "11.0.1",
|
|
101
|
-
"addToPackageJson": "devDependencies"
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
"update-12.7.2": {
|
|
106
|
-
"version": "12.7.2-beta.0",
|
|
107
|
-
"packages": {
|
|
108
|
-
"next": {
|
|
109
|
-
"version": "11.1.0",
|
|
110
|
-
"alwaysAddToPackageJson": false
|
|
111
|
-
},
|
|
112
|
-
"eslint-config-next": {
|
|
113
|
-
"version": "11.1.0",
|
|
114
|
-
"alwaysAddToPackageJson": false
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
},
|
|
118
|
-
"update-13.0.3": {
|
|
119
|
-
"version": "13.0.3-beta.0",
|
|
120
|
-
"packages": {
|
|
121
|
-
"next": {
|
|
122
|
-
"version": "12.0.0",
|
|
123
|
-
"alwaysAddToPackageJson": false
|
|
124
|
-
},
|
|
125
|
-
"eslint-config-next": {
|
|
126
|
-
"version": "12.0.0",
|
|
127
|
-
"alwaysAddToPackageJson": false
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
"13.3.0": {
|
|
132
|
-
"version": "13.3.0-beta.0",
|
|
133
|
-
"packages": {
|
|
134
|
-
"next": {
|
|
135
|
-
"version": "12.0.7",
|
|
136
|
-
"alwaysAddToPackageJson": false
|
|
137
|
-
},
|
|
138
|
-
"eslint-config-next": {
|
|
139
|
-
"version": "12.0.7",
|
|
140
|
-
"alwaysAddToPackageJson": false
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
},
|
|
144
|
-
"13.9.0": {
|
|
145
|
-
"version": "13.9.0-beta.0",
|
|
146
|
-
"packages": {
|
|
147
|
-
"next": {
|
|
148
|
-
"version": "12.1.0",
|
|
149
|
-
"alwaysAddToPackageJson": false
|
|
150
|
-
},
|
|
151
|
-
"eslint-config-next": {
|
|
152
|
-
"version": "12.1.0",
|
|
153
|
-
"alwaysAddToPackageJson": false
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
},
|
|
157
|
-
"13.10.0": {
|
|
158
|
-
"version": "13.10.0-beta.1",
|
|
159
|
-
"packages": {
|
|
160
|
-
"next": {
|
|
161
|
-
"version": "12.1.2",
|
|
162
|
-
"alwaysAddToPackageJson": false
|
|
163
|
-
},
|
|
164
|
-
"eslint-config-next": {
|
|
165
|
-
"version": "12.1.2",
|
|
166
|
-
"alwaysAddToPackageJson": false
|
|
167
|
-
},
|
|
168
|
-
"sass": {
|
|
169
|
-
"version": "1.49.9",
|
|
170
|
-
"alwaysAddToPackageJson": false
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
},
|
|
174
|
-
"14.0.0": {
|
|
175
|
-
"version": "14.0.0-beta.1",
|
|
176
|
-
"packages": {
|
|
177
|
-
"next": {
|
|
178
|
-
"version": "12.1.5",
|
|
179
|
-
"alwaysAddToPackageJson": false
|
|
180
|
-
},
|
|
181
|
-
"eslint-config-next": {
|
|
182
|
-
"version": "12.1.5",
|
|
183
|
-
"alwaysAddToPackageJson": false
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
},
|
|
187
|
-
"14.2.3": {
|
|
188
|
-
"version": "14.2.3-beta.0",
|
|
189
|
-
"packages": {
|
|
190
|
-
"next": {
|
|
191
|
-
"version": "12.1.6",
|
|
192
|
-
"alwaysAddToPackageJson": false
|
|
193
|
-
},
|
|
194
|
-
"eslint-config-next": {
|
|
195
|
-
"version": "12.1.6",
|
|
196
|
-
"alwaysAddToPackageJson": false
|
|
197
|
-
},
|
|
198
|
-
"sass": {
|
|
199
|
-
"version": "1.52.3",
|
|
200
|
-
"alwaysAddToPackageJson": false
|
|
201
|
-
},
|
|
202
|
-
"less-loader": {
|
|
203
|
-
"version": "11.0.0",
|
|
204
|
-
"alwaysAddToPackageJson": false
|
|
205
|
-
},
|
|
206
|
-
"stylus-loader": {
|
|
207
|
-
"version": "7.0.0",
|
|
208
|
-
"alwaysAddToPackageJson": false
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
},
|
|
212
|
-
"14.4.3": {
|
|
213
|
-
"version": "14.4.3",
|
|
214
|
-
"packages": {
|
|
215
|
-
"next": {
|
|
216
|
-
"version": "12.2.2",
|
|
217
|
-
"alwaysAddToPackageJson": false
|
|
218
|
-
},
|
|
219
|
-
"eslint-config-next": {
|
|
220
|
-
"version": "12.2.2",
|
|
221
|
-
"alwaysAddToPackageJson": false
|
|
222
|
-
},
|
|
223
|
-
"sass": {
|
|
224
|
-
"version": "1.53.0",
|
|
225
|
-
"alwaysAddToPackageJson": false
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
},
|
|
229
|
-
"14.5.0": {
|
|
230
|
-
"version": "14.5.0-beta.0",
|
|
231
|
-
"packages": {
|
|
232
|
-
"next": {
|
|
233
|
-
"version": "12.2.3",
|
|
234
|
-
"alwaysAddToPackageJson": false
|
|
235
|
-
},
|
|
236
|
-
"eslint-config-next": {
|
|
237
|
-
"version": "12.2.3",
|
|
238
|
-
"alwaysAddToPackageJson": false
|
|
239
|
-
},
|
|
240
|
-
"sass": {
|
|
241
|
-
"version": "1.54.0",
|
|
242
|
-
"alwaysAddToPackageJson": false
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
},
|
|
246
|
-
"14.5.3": {
|
|
247
|
-
"version": "14.5.3-beta.0",
|
|
248
|
-
"packages": {
|
|
249
|
-
"@emotion/server": {
|
|
250
|
-
"version": "11.10.0",
|
|
251
|
-
"alwaysAddToPackageJson": false
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
},
|
|
255
|
-
"14.6.0": {
|
|
256
|
-
"version": "14.6.0-beta.1",
|
|
257
|
-
"packages": {
|
|
258
|
-
"next": {
|
|
259
|
-
"version": "12.2.5",
|
|
260
|
-
"alwaysAddToPackageJson": false
|
|
261
|
-
},
|
|
262
|
-
"eslint-config-next": {
|
|
263
|
-
"version": "12.2.5",
|
|
264
|
-
"alwaysAddToPackageJson": false
|
|
265
|
-
},
|
|
266
|
-
"sass": {
|
|
267
|
-
"version": "1.54.5",
|
|
268
|
-
"alwaysAddToPackageJson": false
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
},
|
|
272
|
-
"14.7.10": {
|
|
273
|
-
"version": "14.7.10-beta.1",
|
|
274
|
-
"packages": {
|
|
275
|
-
"next": {
|
|
276
|
-
"version": "12.3.1",
|
|
277
|
-
"alwaysAddToPackageJson": false
|
|
278
|
-
},
|
|
279
|
-
"eslint-config-next": {
|
|
280
|
-
"version": "12.3.1",
|
|
281
|
-
"alwaysAddToPackageJson": false
|
|
282
|
-
},
|
|
283
|
-
"sass": {
|
|
284
|
-
"version": "1.55.0",
|
|
285
|
-
"alwaysAddToPackageJson": false
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
},
|
|
289
29
|
"15.0.4": {
|
|
290
30
|
"version": "15.0.4-beta.0",
|
|
291
31
|
"packages": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/next",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "17.0.0-beta.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Next.js plugin for Nx contains executors and generators for managing Next.js applications and libraries within an Nx workspace. It provides:\n\n\n- Scaffolding for creating, building, serving, linting, and testing Next.js applications.\n\n- Integration with building, serving, and exporting a Next.js application.\n\n- Integration with React libraries within the workspace. \n\nWhen using Next.js in Nx, you get the out-of-the-box support for TypeScript, Cypress, and Jest. No need to configure anything: watch mode, source maps, and typings just work.",
|
|
6
6
|
"repository": {
|
|
@@ -44,13 +44,13 @@
|
|
|
44
44
|
"url-loader": "^4.1.1",
|
|
45
45
|
"tslib": "^2.3.0",
|
|
46
46
|
"webpack-merge": "^5.8.0",
|
|
47
|
-
"@nx/devkit": "
|
|
48
|
-
"@nx/js": "
|
|
49
|
-
"@nx/linter": "
|
|
50
|
-
"@nx/react": "
|
|
51
|
-
"@nx/web": "
|
|
52
|
-
"@nx/workspace": "
|
|
53
|
-
"@nrwl/next": "
|
|
47
|
+
"@nx/devkit": "17.0.0-beta.1",
|
|
48
|
+
"@nx/js": "17.0.0-beta.1",
|
|
49
|
+
"@nx/linter": "17.0.0-beta.1",
|
|
50
|
+
"@nx/react": "17.0.0-beta.1",
|
|
51
|
+
"@nx/web": "17.0.0-beta.1",
|
|
52
|
+
"@nx/workspace": "17.0.0-beta.1",
|
|
53
|
+
"@nrwl/next": "17.0.0-beta.1"
|
|
54
54
|
},
|
|
55
55
|
"publishConfig": {
|
|
56
56
|
"access": "public"
|
|
@@ -5,6 +5,7 @@ const linter_1 = require("@nx/linter");
|
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const lint_1 = require("@nx/react/src/utils/lint");
|
|
7
7
|
const eslint_file_1 = require("@nx/linter/src/generators/utils/eslint-file");
|
|
8
|
+
const lint_project_1 = require("@nx/linter/src/generators/lint-project/lint-project");
|
|
8
9
|
async function addLinting(host, options) {
|
|
9
10
|
const lintTask = await (0, linter_1.lintProjectGenerator)(host, {
|
|
10
11
|
linter: options.linter,
|
|
@@ -13,7 +14,9 @@ async function addLinting(host, options) {
|
|
|
13
14
|
(0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.app.json'),
|
|
14
15
|
],
|
|
15
16
|
unitTestRunner: options.unitTestRunner,
|
|
16
|
-
eslintFilePatterns: [
|
|
17
|
+
eslintFilePatterns: [
|
|
18
|
+
(0, lint_project_1.mapLintPattern)(options.appProjectRoot, '{ts,tsx,js,jsx}', options.rootProject),
|
|
19
|
+
],
|
|
17
20
|
skipFormat: true,
|
|
18
21
|
rootProject: options.rootProject,
|
|
19
22
|
});
|
|
@@ -66,14 +66,13 @@ async function customServerGenerator(host, options) {
|
|
|
66
66
|
};
|
|
67
67
|
(0, devkit_1.updateProjectConfiguration)(host, options.project, project);
|
|
68
68
|
(0, devkit_1.updateJson)(host, 'nx.json', (json) => {
|
|
69
|
-
if (!json.tasksRunnerOptions?.default?.options?.cacheableOperations?.includes('build-custom-server')
|
|
70
|
-
json.tasksRunnerOptions
|
|
71
|
-
json.tasksRunnerOptions.default
|
|
72
|
-
json.tasksRunnerOptions.default.options.cacheableOperations = [
|
|
73
|
-
...json.tasksRunnerOptions.default.options.cacheableOperations,
|
|
74
|
-
'build-custom-server',
|
|
75
|
-
];
|
|
69
|
+
if (!json.tasksRunnerOptions?.default?.options?.cacheableOperations?.includes('build-custom-server') &&
|
|
70
|
+
json.tasksRunnerOptions?.default?.options?.cacheableOperations) {
|
|
71
|
+
json.tasksRunnerOptions.default.options.cacheableOperations.push('build-custom-server');
|
|
76
72
|
}
|
|
73
|
+
json.targetDefaults ??= {};
|
|
74
|
+
json.targetDefaults['build-custom-server'] ??= {};
|
|
75
|
+
json.targetDefaults['build-custom-server'].cache ??= true;
|
|
77
76
|
return json;
|
|
78
77
|
});
|
|
79
78
|
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fixPageDirForEslint = void 0;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
async function fixPageDirForEslint(host) {
|
|
6
|
-
const projects = (0, devkit_1.getProjects)(host);
|
|
7
|
-
projects.forEach((project) => {
|
|
8
|
-
const eslintRcJson = (0, devkit_1.joinPathFragments)(project.root, '.eslintrc.json');
|
|
9
|
-
if (host.exists(eslintRcJson)) {
|
|
10
|
-
const config = (0, devkit_1.readJson)(host, eslintRcJson);
|
|
11
|
-
// Ignore non-nextjs projects
|
|
12
|
-
if (!config?.extends?.includes('next'))
|
|
13
|
-
return;
|
|
14
|
-
// Find the override that handles both TS and JS files.
|
|
15
|
-
const commonOverride = config.overrides?.find((o) => ['*.ts', '*.tsx', '*.js', '*.jsx'].every((ext) => o.files.includes(ext)));
|
|
16
|
-
if (commonOverride &&
|
|
17
|
-
!commonOverride.rules['@next/next/no-html-link-for-pages']) {
|
|
18
|
-
commonOverride.rules = {
|
|
19
|
-
...commonOverride.rules,
|
|
20
|
-
'@next/next/no-html-link-for-pages': [
|
|
21
|
-
'error',
|
|
22
|
-
`${project.root}/pages`,
|
|
23
|
-
],
|
|
24
|
-
};
|
|
25
|
-
(0, devkit_1.writeJson)(host, eslintRcJson, config);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
await (0, devkit_1.formatFiles)(host);
|
|
30
|
-
}
|
|
31
|
-
exports.fixPageDirForEslint = fixPageDirForEslint;
|
|
32
|
-
exports.default = fixPageDirForEslint;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.removeStyledJsxBabelConfig = void 0;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
async function removeStyledJsxBabelConfig(host) {
|
|
6
|
-
const projects = (0, devkit_1.getProjects)(host);
|
|
7
|
-
projects.forEach((project) => {
|
|
8
|
-
const babelRcPath = (0, devkit_1.joinPathFragments)(project.root, '.babelrc');
|
|
9
|
-
if (host.exists(babelRcPath)) {
|
|
10
|
-
const babelRcContent = (0, devkit_1.readJson)(host, babelRcPath);
|
|
11
|
-
// check whether next.js project
|
|
12
|
-
if (babelRcContent.presets.includes('next/babel')) {
|
|
13
|
-
babelRcContent.plugins = babelRcContent.plugins.filter((x) => x !== 'styled-jsx/babel');
|
|
14
|
-
// update .babelrc
|
|
15
|
-
(0, devkit_1.writeJson)(host, babelRcPath, babelRcContent);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
await (0, devkit_1.formatFiles)(host);
|
|
20
|
-
}
|
|
21
|
-
exports.removeStyledJsxBabelConfig = removeStyledJsxBabelConfig;
|
|
22
|
-
exports.default = removeStyledJsxBabelConfig;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateEmotionSetup = void 0;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
async function updateEmotionSetup(host) {
|
|
6
|
-
const projects = (0, devkit_1.getProjects)(host);
|
|
7
|
-
projects.forEach((p) => {
|
|
8
|
-
let hasEmotion = false;
|
|
9
|
-
const babelrcPath = `${p.root}/.babelrc`;
|
|
10
|
-
const tsConfigPath = `${p.root}/tsconfig.json`;
|
|
11
|
-
if (host.exists(babelrcPath)) {
|
|
12
|
-
const babelrc = (0, devkit_1.readJson)(host, babelrcPath);
|
|
13
|
-
if (babelrc.presets) {
|
|
14
|
-
for (const [idx, preset] of babelrc.presets.entries()) {
|
|
15
|
-
if (Array.isArray(preset)) {
|
|
16
|
-
if (!preset[0].includes('@nrwl/next/babel'))
|
|
17
|
-
continue;
|
|
18
|
-
const emotionOptions = preset[1]['preset-react'];
|
|
19
|
-
hasEmotion = emotionOptions?.importSource === '@emotion/react';
|
|
20
|
-
break;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
if (hasEmotion && host.exists(tsConfigPath)) {
|
|
26
|
-
(0, devkit_1.updateJson)(host, tsConfigPath, (json) => {
|
|
27
|
-
json.compilerOptions.jsxImportSource = '@emotion/react';
|
|
28
|
-
return json;
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
await (0, devkit_1.formatFiles)(host);
|
|
33
|
-
}
|
|
34
|
-
exports.updateEmotionSetup = updateEmotionSetup;
|
|
35
|
-
exports.default = updateEmotionSetup;
|
|
@@ -1,28 +0,0 @@
|
|
|
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(host) {
|
|
6
|
-
const projects = (0, devkit_1.getProjects)(host);
|
|
7
|
-
let task = undefined;
|
|
8
|
-
projects.forEach((project) => {
|
|
9
|
-
const configPath = (0, devkit_1.joinPathFragments)(project.root, 'next.config.js');
|
|
10
|
-
if (!host.exists(configPath))
|
|
11
|
-
return;
|
|
12
|
-
const content = host.read(configPath).toString();
|
|
13
|
-
let updated = content.replace(/webpack5: false/, 'webpack5: true');
|
|
14
|
-
if (content.match(/@zeit\/next-less/)) {
|
|
15
|
-
updated = updated.replace('@zeit/next-less', 'next-with-less');
|
|
16
|
-
task = (0, devkit_1.addDependenciesToPackageJson)(host, { 'next-with-less': '1.0.1' }, {});
|
|
17
|
-
}
|
|
18
|
-
if (content.match(/@zeit\/next-stylus/)) {
|
|
19
|
-
updated = updated.replace('@zeit/next-stylus', '@nrwl/next/plugins/with-stylus');
|
|
20
|
-
task = (0, devkit_1.addDependenciesToPackageJson)(host, { 'stylus-loader': '6.2.0' }, {});
|
|
21
|
-
}
|
|
22
|
-
host.write(configPath, updated);
|
|
23
|
-
});
|
|
24
|
-
await (0, devkit_1.formatFiles)(host);
|
|
25
|
-
return task;
|
|
26
|
-
}
|
|
27
|
-
exports.update = update;
|
|
28
|
-
exports.default = update;
|
|
@@ -1,23 +0,0 @@
|
|
|
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(host) {
|
|
6
|
-
const projects = (0, devkit_1.getProjects)(host);
|
|
7
|
-
let task = undefined;
|
|
8
|
-
projects.forEach((project) => {
|
|
9
|
-
const configPath = (0, devkit_1.joinPathFragments)(project.root, 'next.config.js');
|
|
10
|
-
if (!host.exists(configPath))
|
|
11
|
-
return;
|
|
12
|
-
const content = host.read(configPath).toString();
|
|
13
|
-
if (content.match(/next-with-less/)) {
|
|
14
|
-
const updated = content.replace('next-with-less', '@nrwl/next/plugins/with-less');
|
|
15
|
-
task = (0, devkit_1.addDependenciesToPackageJson)(host, { 'less-loader': '10.2.0' }, {});
|
|
16
|
-
host.write(configPath, updated);
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
await (0, devkit_1.formatFiles)(host);
|
|
20
|
-
return task;
|
|
21
|
-
}
|
|
22
|
-
exports.update = update;
|
|
23
|
-
exports.default = update;
|
|
@@ -1,41 +0,0 @@
|
|
|
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(host) {
|
|
6
|
-
const projects = (0, devkit_1.getProjects)(host);
|
|
7
|
-
projects.forEach((project) => {
|
|
8
|
-
const nextConfigPath = (0, devkit_1.joinPathFragments)(project.root, 'next.config.js');
|
|
9
|
-
const jestConfigPath = (0, devkit_1.joinPathFragments)(project.root, 'jest.config.js');
|
|
10
|
-
const babelConfigPath = (0, devkit_1.joinPathFragments)(project.root, '.babelrc');
|
|
11
|
-
const storybookMainPath = (0, devkit_1.joinPathFragments)(project.root, '.storybook/main.js');
|
|
12
|
-
if (!host.exists(nextConfigPath) || !host.exists(jestConfigPath))
|
|
13
|
-
return;
|
|
14
|
-
if (host.exists(babelConfigPath)) {
|
|
15
|
-
if (customBabelConfig(host, babelConfigPath)) {
|
|
16
|
-
devkit_1.logger.info(`NX Custom .babelrc file detected, skipping deletion. You can delete this file yourself to enable SWC: ${babelConfigPath}`);
|
|
17
|
-
}
|
|
18
|
-
else if (host.exists(storybookMainPath)) {
|
|
19
|
-
devkit_1.logger.info(`NX Storybook configuration for project "${project.name}" detected, skipping deletion of .babelrc`);
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
// Deleting custom babel config enables SWC
|
|
23
|
-
host.delete(babelConfigPath);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
const content = host.read(jestConfigPath).toString();
|
|
27
|
-
if (content.match(/:\s+'babel-jest'/)) {
|
|
28
|
-
const updated = content.replace(/:\s+'babel-jest'/, `: ['babel-jest', { presets: ['@nrwl/next/babel'] }]`);
|
|
29
|
-
host.write(jestConfigPath, updated);
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
await (0, devkit_1.formatFiles)(host);
|
|
33
|
-
}
|
|
34
|
-
exports.update = update;
|
|
35
|
-
function customBabelConfig(host, configPath) {
|
|
36
|
-
const json = (0, devkit_1.readJson)(host, configPath);
|
|
37
|
-
return !(json.presets?.length === 1 &&
|
|
38
|
-
json.presets?.[0] === '@nrwl/next/babel' &&
|
|
39
|
-
(json.plugins?.length === 0 || !json.plugins));
|
|
40
|
-
}
|
|
41
|
-
exports.default = update;
|
|
@@ -1,30 +0,0 @@
|
|
|
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
|
-
projects.forEach((config, name) => {
|
|
8
|
-
let shouldUpdate = false;
|
|
9
|
-
if (config.targets?.build?.executor === '@nrwl/next:build') {
|
|
10
|
-
shouldUpdate = true;
|
|
11
|
-
config.targets.build.defaultConfiguration ??= 'production';
|
|
12
|
-
config.targets.build.configurations ??= {};
|
|
13
|
-
config.targets.build.configurations.development ??= {};
|
|
14
|
-
}
|
|
15
|
-
if (config.targets?.serve?.executor === '@nrwl/next:server') {
|
|
16
|
-
shouldUpdate = true;
|
|
17
|
-
config.targets.serve.defaultConfiguration ??= 'development';
|
|
18
|
-
config.targets.serve.configurations ??= {};
|
|
19
|
-
config.targets.serve.configurations.development ??= {
|
|
20
|
-
buildTarget: `${name}:build:development`,
|
|
21
|
-
dev: true,
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
if (shouldUpdate)
|
|
25
|
-
(0, devkit_1.updateProjectConfiguration)(tree, name, config);
|
|
26
|
-
});
|
|
27
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
28
|
-
}
|
|
29
|
-
exports.update = update;
|
|
30
|
-
exports.default = update;
|
|
@@ -1,19 +0,0 @@
|
|
|
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
|
-
projects.forEach((config, name) => {
|
|
8
|
-
if (config.targets?.build?.executor === '@nrwl/next:build') {
|
|
9
|
-
config.targets.build.configurations ??= {};
|
|
10
|
-
config.targets.build.configurations.development ??= {};
|
|
11
|
-
config.targets.build.configurations.development.outputPath ??=
|
|
12
|
-
(0, devkit_1.joinPathFragments)('tmp', config.sourceRoot);
|
|
13
|
-
(0, devkit_1.updateProjectConfiguration)(tree, name, config);
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
17
|
-
}
|
|
18
|
-
exports.update = update;
|
|
19
|
-
exports.default = update;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.update = void 0;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const add_gitignore_entry_1 = require("../../utils/add-gitignore-entry");
|
|
6
|
-
async function update(tree) {
|
|
7
|
-
(0, add_gitignore_entry_1.addGitIgnoreEntry)(tree);
|
|
8
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
9
|
-
}
|
|
10
|
-
exports.update = update;
|
|
11
|
-
exports.default = update;
|
|
@@ -1,23 +0,0 @@
|
|
|
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
|
-
projects.forEach((config, name) => {
|
|
8
|
-
if (config.targets?.build?.executor === '@nrwl/next:build') {
|
|
9
|
-
config.targets.build.configurations ??= {};
|
|
10
|
-
config.targets.build.configurations.development ??= {};
|
|
11
|
-
if (!config.targets.build.configurations.development.outputPath ||
|
|
12
|
-
config.targets.build.configurations.development.outputPath ===
|
|
13
|
-
(0, devkit_1.joinPathFragments)('tmp', config.root)) {
|
|
14
|
-
config.targets.build.configurations.development.outputPath =
|
|
15
|
-
config.root;
|
|
16
|
-
(0, devkit_1.updateProjectConfiguration)(tree, name, config);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
21
|
-
}
|
|
22
|
-
exports.update = update;
|
|
23
|
-
exports.default = update;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateNextEslint = void 0;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
async function updateNextEslint(host) {
|
|
6
|
-
const projects = (0, devkit_1.getProjects)(host);
|
|
7
|
-
projects.forEach((project) => {
|
|
8
|
-
if (project.targets?.build?.executor !== '@nrwl/next:build')
|
|
9
|
-
return;
|
|
10
|
-
const eslintPath = `${project.root}/.eslintrc.json`;
|
|
11
|
-
if (!host.exists(eslintPath))
|
|
12
|
-
return;
|
|
13
|
-
(0, devkit_1.updateJson)(host, eslintPath, (eslintConfig) => {
|
|
14
|
-
const nextIgnorePattern = '.next/**/*';
|
|
15
|
-
if (eslintConfig.ignorePatterns.indexOf(nextIgnorePattern) < 0) {
|
|
16
|
-
eslintConfig.ignorePatterns = [
|
|
17
|
-
...eslintConfig.ignorePatterns,
|
|
18
|
-
nextIgnorePattern,
|
|
19
|
-
];
|
|
20
|
-
}
|
|
21
|
-
return eslintConfig;
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
await (0, devkit_1.formatFiles)(host);
|
|
25
|
-
}
|
|
26
|
-
exports.updateNextEslint = updateNextEslint;
|
|
27
|
-
exports.default = updateNextEslint;
|