create-nx-workspace 17.0.2 → 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.
- package/LICENSE +1 -1
- package/README.md +8 -3
- package/bin/create-nx-workspace.d.ts +6 -1
- package/bin/create-nx-workspace.js +206 -79
- package/package.json +3 -3
- package/src/create-preset.js +1 -1
- package/src/create-workspace-options.d.ts +2 -7
- package/src/create-workspace.js +8 -8
- package/src/internal-utils/prompts.d.ts +3 -7
- package/src/internal-utils/prompts.js +23 -58
- package/src/internal-utils/yargs-options.d.ts +1 -4
- package/src/internal-utils/yargs-options.js +6 -13
- package/src/utils/nx/ab-testing.d.ts +59 -9
- package/src/utils/nx/ab-testing.js +43 -11
- package/src/utils/nx/nx-cloud.d.ts +2 -1
- package/src/utils/nx/nx-cloud.js +22 -10
- package/src/utils/nx/show-nx-warning.js +4 -2
- package/src/utils/output.d.ts +0 -1
- package/src/utils/output.js +6 -7
- package/src/utils/package-manager.d.ts +1 -0
- package/src/utils/package-manager.js +3 -0
- package/src/utils/preset/point-to-tutorial-and-course.js +1 -1
- package/src/utils/preset/preset-options.js +4 -0
- package/src/utils/preset/preset.d.ts +7 -2
- package/src/utils/preset/preset.js +5 -0
- package/src/utils/ci/ci-list.d.ts +0 -2
- package/src/utils/ci/ci-list.js +0 -10
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
<p style="text-align: center;"
|
|
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>
|
|
2
7
|
|
|
3
8
|
<div style="text-align: center;">
|
|
4
9
|
|
|
@@ -17,7 +22,7 @@
|
|
|
17
22
|
|
|
18
23
|
# `> npx create-nx-workspace`
|
|
19
24
|
|
|
20
|
-
Nx is a
|
|
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.
|
|
21
26
|
|
|
22
27
|
{{getting-started}}
|
|
23
28
|
|
|
@@ -63,5 +68,5 @@ npx nx@latest init
|
|
|
63
68
|
- [Blog Posts About Nx](https://blog.nrwl.io/nx/home)
|
|
64
69
|
|
|
65
70
|
<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"
|
|
66
|
-
width="100%" alt="Nx - Smart
|
|
71
|
+
width="100%" alt="Nx - Smart Monorepos · Fast CI"></a></p>
|
|
67
72
|
|
|
@@ -14,10 +14,11 @@ interface ReactArguments extends BaseArguments {
|
|
|
14
14
|
stack: 'react';
|
|
15
15
|
workspaceType: 'standalone' | 'integrated';
|
|
16
16
|
appName: string;
|
|
17
|
-
framework: 'none' | 'next';
|
|
17
|
+
framework: 'none' | 'next' | 'remix';
|
|
18
18
|
style: string;
|
|
19
19
|
bundler: 'webpack' | 'vite' | 'rspack';
|
|
20
20
|
nextAppDir: boolean;
|
|
21
|
+
nextSrcDir: boolean;
|
|
21
22
|
e2eTestRunner: 'none' | 'cypress' | 'playwright';
|
|
22
23
|
}
|
|
23
24
|
interface AngularArguments extends BaseArguments {
|
|
@@ -28,11 +29,15 @@ interface AngularArguments extends BaseArguments {
|
|
|
28
29
|
routing: boolean;
|
|
29
30
|
standaloneApi: boolean;
|
|
30
31
|
e2eTestRunner: 'none' | 'cypress' | 'playwright';
|
|
32
|
+
bundler: 'webpack' | 'esbuild';
|
|
33
|
+
ssr: boolean;
|
|
34
|
+
prefix: string;
|
|
31
35
|
}
|
|
32
36
|
interface VueArguments extends BaseArguments {
|
|
33
37
|
stack: 'vue';
|
|
34
38
|
workspaceType: 'standalone' | 'integrated';
|
|
35
39
|
appName: string;
|
|
40
|
+
framework: 'none' | 'nuxt';
|
|
36
41
|
style: string;
|
|
37
42
|
e2eTestRunner: 'none' | 'cypress' | 'playwright';
|
|
38
43
|
}
|
|
@@ -32,8 +32,6 @@ exports.commandsObject = yargs
|
|
|
32
32
|
})
|
|
33
33
|
.option('preset', {
|
|
34
34
|
describe: chalk.dim `Customizes the initial content of your workspace. Default presets include: [${Object.values(preset_1.Preset)
|
|
35
|
-
// TODO(v17): Remove this option when @nx/vue is released.
|
|
36
|
-
.filter((p) => p !== preset_1.Preset.VueStandalone && p !== preset_1.Preset.VueMonorepo)
|
|
37
35
|
.map((p) => `"${p}"`)
|
|
38
36
|
.join(', ')}]. To build your own see https://nx.dev/extending-nx/recipes/create-preset`,
|
|
39
37
|
type: 'string',
|
|
@@ -59,10 +57,12 @@ exports.commandsObject = yargs
|
|
|
59
57
|
.option('standaloneApi', {
|
|
60
58
|
describe: chalk.dim `Use Standalone Components if generating an Angular app`,
|
|
61
59
|
type: 'boolean',
|
|
60
|
+
default: true,
|
|
62
61
|
})
|
|
63
62
|
.option('routing', {
|
|
64
63
|
describe: chalk.dim `Add a routing setup for an Angular app`,
|
|
65
64
|
type: 'boolean',
|
|
65
|
+
default: true,
|
|
66
66
|
})
|
|
67
67
|
.option('bundler', {
|
|
68
68
|
describe: chalk.dim `Bundler to be used to build the app`,
|
|
@@ -79,12 +79,24 @@ exports.commandsObject = yargs
|
|
|
79
79
|
.option('nextAppDir', {
|
|
80
80
|
describe: chalk.dim `Enable the App Router for Next.js`,
|
|
81
81
|
type: 'boolean',
|
|
82
|
+
})
|
|
83
|
+
.option('nextSrcDir', {
|
|
84
|
+
describe: chalk.dim `Generate a 'src/' directory for Next.js`,
|
|
85
|
+
type: 'boolean',
|
|
82
86
|
})
|
|
83
87
|
.option('e2eTestRunner', {
|
|
84
88
|
describe: chalk.dim `Test runner to use for end to end (E2E) tests.`,
|
|
85
89
|
choices: ['cypress', 'playwright', 'none'],
|
|
86
90
|
type: 'string',
|
|
87
|
-
})
|
|
91
|
+
})
|
|
92
|
+
.option('ssr', {
|
|
93
|
+
describe: chalk.dim `Enable Server-Side Rendering (SSR) and Static Site Generation (SSG/Prerendering) for the Angular application`,
|
|
94
|
+
type: 'boolean',
|
|
95
|
+
})
|
|
96
|
+
.option('prefix', {
|
|
97
|
+
describe: chalk.dim `Prefix to use for Angular component and directive selectors.`,
|
|
98
|
+
type: 'string',
|
|
99
|
+
}), yargs_options_1.withNxCloud, yargs_options_1.withAllPrompts, yargs_options_1.withPackageManager, yargs_options_1.withGitOptions), async function handler(argv) {
|
|
88
100
|
await main(argv).catch((error) => {
|
|
89
101
|
const { version } = require('../package.json');
|
|
90
102
|
output_1.output.error({
|
|
@@ -95,7 +107,7 @@ exports.commandsObject = yargs
|
|
|
95
107
|
}, [
|
|
96
108
|
normalizeArgsMiddleware,
|
|
97
109
|
normalizeAndWarnOnDeprecatedPreset({
|
|
98
|
-
// TODO(
|
|
110
|
+
// TODO(v19): Remove Empty and Core presets
|
|
99
111
|
[preset_1.Preset.Core]: preset_1.Preset.NPM,
|
|
100
112
|
[preset_1.Preset.Empty]: preset_1.Preset.Apps,
|
|
101
113
|
}),
|
|
@@ -106,18 +118,17 @@ exports.commandsObject = yargs
|
|
|
106
118
|
async function main(parsedArgs) {
|
|
107
119
|
output_1.output.log({
|
|
108
120
|
title: `Creating your v${nx_version_1.nxVersion} workspace.`,
|
|
109
|
-
bodyLines: [
|
|
110
|
-
'To make sure the command works reliably in all environments, and that the preset is applied correctly,',
|
|
111
|
-
`Nx will run "${parsedArgs.packageManager} install" several times. Please wait.`,
|
|
112
|
-
],
|
|
113
121
|
});
|
|
114
122
|
const workspaceInfo = await (0, create_workspace_1.createWorkspace)(parsedArgs.preset, parsedArgs);
|
|
115
123
|
(0, show_nx_warning_1.showNxWarning)(parsedArgs.name);
|
|
116
124
|
await (0, ab_testing_1.recordStat)({
|
|
117
125
|
nxVersion: nx_version_1.nxVersion,
|
|
118
126
|
command: 'create-nx-workspace',
|
|
119
|
-
useCloud: parsedArgs.nxCloud,
|
|
120
|
-
meta:
|
|
127
|
+
useCloud: parsedArgs.nxCloud !== 'skip',
|
|
128
|
+
meta: [
|
|
129
|
+
ab_testing_1.messages.codeOfSelectedPromptMessage('setupCI'),
|
|
130
|
+
ab_testing_1.messages.codeOfSelectedPromptMessage('setupNxCloud'),
|
|
131
|
+
],
|
|
121
132
|
});
|
|
122
133
|
if (parsedArgs.nxCloud && workspaceInfo.nxCloudInfo) {
|
|
123
134
|
(0, nx_cloud_1.printNxCloudSuccessMessage)(workspaceInfo.nxCloudInfo);
|
|
@@ -136,7 +147,6 @@ function normalizeAndWarnOnDeprecatedPreset(deprecatedPresets) {
|
|
|
136
147
|
if (!args.preset)
|
|
137
148
|
return;
|
|
138
149
|
if (deprecatedPresets[args.preset]) {
|
|
139
|
-
args.preset = deprecatedPresets[args.preset];
|
|
140
150
|
output_1.output.addVerticalSeparator();
|
|
141
151
|
output_1.output.note({
|
|
142
152
|
title: `The "${args.preset}" preset is deprecated.`,
|
|
@@ -144,6 +154,7 @@ function normalizeAndWarnOnDeprecatedPreset(deprecatedPresets) {
|
|
|
144
154
|
`The "${args.preset}" preset will be removed in a future Nx release. Use the "${deprecatedPresets[args.preset]}" preset instead.`,
|
|
145
155
|
],
|
|
146
156
|
});
|
|
157
|
+
args.preset = deprecatedPresets[args.preset];
|
|
147
158
|
}
|
|
148
159
|
};
|
|
149
160
|
}
|
|
@@ -159,8 +170,6 @@ async function normalizeArgsMiddleware(argv) {
|
|
|
159
170
|
});
|
|
160
171
|
try {
|
|
161
172
|
let thirdPartyPreset;
|
|
162
|
-
// Node options
|
|
163
|
-
let docker;
|
|
164
173
|
try {
|
|
165
174
|
thirdPartyPreset = await (0, get_third_party_preset_1.getThirdPartyPreset)(argv.preset);
|
|
166
175
|
}
|
|
@@ -186,12 +195,10 @@ async function normalizeArgsMiddleware(argv) {
|
|
|
186
195
|
const packageManager = await (0, prompts_1.determinePackageManager)(argv);
|
|
187
196
|
const defaultBase = await (0, prompts_1.determineDefaultBase)(argv);
|
|
188
197
|
const nxCloud = await (0, prompts_1.determineNxCloud)(argv);
|
|
189
|
-
const ci = await (0, prompts_1.determineCI)(argv, nxCloud);
|
|
190
198
|
Object.assign(argv, {
|
|
191
199
|
nxCloud,
|
|
192
200
|
packageManager,
|
|
193
201
|
defaultBase,
|
|
194
|
-
ci,
|
|
195
202
|
});
|
|
196
203
|
}
|
|
197
204
|
catch (e) {
|
|
@@ -240,9 +247,14 @@ async function determineStack(parsedArgs) {
|
|
|
240
247
|
case preset_1.Preset.ReactMonorepo:
|
|
241
248
|
case preset_1.Preset.NextJs:
|
|
242
249
|
case preset_1.Preset.NextJsStandalone:
|
|
250
|
+
case preset_1.Preset.RemixStandalone:
|
|
251
|
+
case preset_1.Preset.RemixMonorepo:
|
|
243
252
|
return 'react';
|
|
253
|
+
case preset_1.Preset.Vue:
|
|
244
254
|
case preset_1.Preset.VueStandalone:
|
|
245
255
|
case preset_1.Preset.VueMonorepo:
|
|
256
|
+
case preset_1.Preset.Nuxt:
|
|
257
|
+
case preset_1.Preset.NuxtStandalone:
|
|
246
258
|
return 'vue';
|
|
247
259
|
case preset_1.Preset.Nest:
|
|
248
260
|
case preset_1.Preset.NodeStandalone:
|
|
@@ -276,7 +288,7 @@ async function determineStack(parsedArgs) {
|
|
|
276
288
|
},
|
|
277
289
|
{
|
|
278
290
|
name: `vue`,
|
|
279
|
-
message: `Vue: Configures a Vue application with
|
|
291
|
+
message: `Vue: Configures a Vue application with your framework of choice.`,
|
|
280
292
|
},
|
|
281
293
|
{
|
|
282
294
|
name: `angular`,
|
|
@@ -346,7 +358,7 @@ async function determineNoneOptions(parsedArgs) {
|
|
|
346
358
|
name: 'No',
|
|
347
359
|
},
|
|
348
360
|
],
|
|
349
|
-
initial:
|
|
361
|
+
initial: 0,
|
|
350
362
|
},
|
|
351
363
|
]);
|
|
352
364
|
js = reply.ts === 'No';
|
|
@@ -360,10 +372,12 @@ async function determineReactOptions(parsedArgs) {
|
|
|
360
372
|
let bundler = undefined;
|
|
361
373
|
let e2eTestRunner = undefined;
|
|
362
374
|
let nextAppDir = false;
|
|
375
|
+
let nextSrcDir = false;
|
|
363
376
|
if (parsedArgs.preset && parsedArgs.preset !== preset_1.Preset.React) {
|
|
364
377
|
preset = parsedArgs.preset;
|
|
365
378
|
if (preset === preset_1.Preset.ReactStandalone ||
|
|
366
|
-
preset === preset_1.Preset.NextJsStandalone
|
|
379
|
+
preset === preset_1.Preset.NextJsStandalone ||
|
|
380
|
+
preset === preset_1.Preset.RemixStandalone) {
|
|
367
381
|
appName = parsedArgs.appName ?? parsedArgs.name;
|
|
368
382
|
}
|
|
369
383
|
else {
|
|
@@ -391,6 +405,14 @@ async function determineReactOptions(parsedArgs) {
|
|
|
391
405
|
preset = preset_1.Preset.NextJs;
|
|
392
406
|
}
|
|
393
407
|
}
|
|
408
|
+
else if (framework === 'remix') {
|
|
409
|
+
if (workspaceType === 'standalone') {
|
|
410
|
+
preset = preset_1.Preset.RemixStandalone;
|
|
411
|
+
}
|
|
412
|
+
else {
|
|
413
|
+
preset = preset_1.Preset.RemixMonorepo;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
394
416
|
else if (framework === 'react-native') {
|
|
395
417
|
preset = preset_1.Preset.ReactNative;
|
|
396
418
|
}
|
|
@@ -412,6 +434,11 @@ async function determineReactOptions(parsedArgs) {
|
|
|
412
434
|
}
|
|
413
435
|
else if (preset === preset_1.Preset.NextJs || preset === preset_1.Preset.NextJsStandalone) {
|
|
414
436
|
nextAppDir = await determineNextAppDir(parsedArgs);
|
|
437
|
+
nextSrcDir = await determineNextSrcDir(parsedArgs);
|
|
438
|
+
e2eTestRunner = await determineE2eTestRunner(parsedArgs);
|
|
439
|
+
}
|
|
440
|
+
else if (preset === preset_1.Preset.RemixMonorepo ||
|
|
441
|
+
preset === preset_1.Preset.RemixStandalone) {
|
|
415
442
|
e2eTestRunner = await determineE2eTestRunner(parsedArgs);
|
|
416
443
|
}
|
|
417
444
|
if (parsedArgs.style) {
|
|
@@ -425,7 +452,7 @@ async function determineReactOptions(parsedArgs) {
|
|
|
425
452
|
{
|
|
426
453
|
name: 'style',
|
|
427
454
|
message: `Default stylesheet format`,
|
|
428
|
-
initial:
|
|
455
|
+
initial: 0,
|
|
429
456
|
type: 'autocomplete',
|
|
430
457
|
choices: [
|
|
431
458
|
{
|
|
@@ -434,11 +461,15 @@ async function determineReactOptions(parsedArgs) {
|
|
|
434
461
|
},
|
|
435
462
|
{
|
|
436
463
|
name: 'scss',
|
|
437
|
-
message: 'SASS(.scss) [
|
|
464
|
+
message: 'SASS(.scss) [ https://sass-lang.com ]',
|
|
438
465
|
},
|
|
439
466
|
{
|
|
440
467
|
name: 'less',
|
|
441
|
-
message: 'LESS [
|
|
468
|
+
message: 'LESS [ https://lesscss.org ]',
|
|
469
|
+
},
|
|
470
|
+
{
|
|
471
|
+
name: 'tailwind',
|
|
472
|
+
message: 'tailwind [ https://tailwindcss.com ]',
|
|
442
473
|
},
|
|
443
474
|
{
|
|
444
475
|
name: 'styled-components',
|
|
@@ -457,30 +488,55 @@ async function determineReactOptions(parsedArgs) {
|
|
|
457
488
|
]);
|
|
458
489
|
style = reply.style;
|
|
459
490
|
}
|
|
460
|
-
return {
|
|
491
|
+
return {
|
|
492
|
+
preset,
|
|
493
|
+
style,
|
|
494
|
+
appName,
|
|
495
|
+
bundler,
|
|
496
|
+
nextAppDir,
|
|
497
|
+
nextSrcDir,
|
|
498
|
+
e2eTestRunner,
|
|
499
|
+
};
|
|
461
500
|
}
|
|
462
501
|
async function determineVueOptions(parsedArgs) {
|
|
463
502
|
let preset;
|
|
464
503
|
let style = undefined;
|
|
465
504
|
let appName;
|
|
466
505
|
let e2eTestRunner = undefined;
|
|
467
|
-
if (parsedArgs.preset) {
|
|
506
|
+
if (parsedArgs.preset && parsedArgs.preset !== preset_1.Preset.Vue) {
|
|
468
507
|
preset = parsedArgs.preset;
|
|
508
|
+
if (preset === preset_1.Preset.VueStandalone || preset === preset_1.Preset.NuxtStandalone) {
|
|
509
|
+
appName = parsedArgs.appName ?? parsedArgs.name;
|
|
510
|
+
}
|
|
511
|
+
else {
|
|
512
|
+
appName = await determineAppName(parsedArgs);
|
|
513
|
+
}
|
|
469
514
|
}
|
|
470
515
|
else {
|
|
516
|
+
const framework = await determineVueFramework(parsedArgs);
|
|
471
517
|
const workspaceType = await determineStandaloneOrMonorepo();
|
|
472
518
|
if (workspaceType === 'standalone') {
|
|
473
|
-
|
|
519
|
+
appName = parsedArgs.appName ?? parsedArgs.name;
|
|
474
520
|
}
|
|
475
521
|
else {
|
|
476
|
-
|
|
522
|
+
appName = await determineAppName(parsedArgs);
|
|
523
|
+
}
|
|
524
|
+
if (framework === 'nuxt') {
|
|
525
|
+
if (workspaceType === 'standalone') {
|
|
526
|
+
preset = preset_1.Preset.NuxtStandalone;
|
|
527
|
+
}
|
|
528
|
+
else {
|
|
529
|
+
preset = preset_1.Preset.Nuxt;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
else {
|
|
533
|
+
if (workspaceType === 'standalone') {
|
|
534
|
+
preset = preset_1.Preset.VueStandalone;
|
|
535
|
+
}
|
|
536
|
+
else {
|
|
537
|
+
preset = preset_1.Preset.VueMonorepo;
|
|
538
|
+
}
|
|
477
539
|
}
|
|
478
|
-
}
|
|
479
|
-
if (preset === preset_1.Preset.VueStandalone) {
|
|
480
|
-
appName = parsedArgs.appName ?? parsedArgs.name;
|
|
481
|
-
}
|
|
482
|
-
else {
|
|
483
|
-
appName = await determineAppName(parsedArgs);
|
|
484
540
|
}
|
|
485
541
|
e2eTestRunner = await determineE2eTestRunner(parsedArgs);
|
|
486
542
|
if (parsedArgs.style) {
|
|
@@ -491,7 +547,7 @@ async function determineVueOptions(parsedArgs) {
|
|
|
491
547
|
{
|
|
492
548
|
name: 'style',
|
|
493
549
|
message: `Default stylesheet format`,
|
|
494
|
-
initial:
|
|
550
|
+
initial: 0,
|
|
495
551
|
type: 'autocomplete',
|
|
496
552
|
choices: [
|
|
497
553
|
{
|
|
@@ -500,11 +556,11 @@ async function determineVueOptions(parsedArgs) {
|
|
|
500
556
|
},
|
|
501
557
|
{
|
|
502
558
|
name: 'scss',
|
|
503
|
-
message: 'SASS(.scss) [
|
|
559
|
+
message: 'SASS(.scss) [ https://sass-lang.com ]',
|
|
504
560
|
},
|
|
505
561
|
{
|
|
506
562
|
name: 'less',
|
|
507
|
-
message: 'LESS [
|
|
563
|
+
message: 'LESS [ https://lesscss.org ]',
|
|
508
564
|
},
|
|
509
565
|
{
|
|
510
566
|
name: 'none',
|
|
@@ -521,9 +577,26 @@ async function determineAngularOptions(parsedArgs) {
|
|
|
521
577
|
let preset;
|
|
522
578
|
let style;
|
|
523
579
|
let appName;
|
|
524
|
-
let standaloneApi;
|
|
525
580
|
let e2eTestRunner = undefined;
|
|
526
|
-
let
|
|
581
|
+
let bundler = undefined;
|
|
582
|
+
let ssr = undefined;
|
|
583
|
+
const standaloneApi = parsedArgs.standaloneApi;
|
|
584
|
+
const routing = parsedArgs.routing;
|
|
585
|
+
const prefix = parsedArgs.prefix;
|
|
586
|
+
if (prefix) {
|
|
587
|
+
// https://github.com/angular/angular-cli/blob/main/packages/schematics/angular/utility/validation.ts#L11-L14
|
|
588
|
+
const htmlSelectorRegex = /^[a-zA-Z][.0-9a-zA-Z]*((:?-[0-9]+)*|(:?-[a-zA-Z][.0-9a-zA-Z]*(:?-[0-9]+)*)*)$/;
|
|
589
|
+
// validate whether component/directive selectors will be valid with the provided prefix
|
|
590
|
+
if (!htmlSelectorRegex.test(`${prefix}-placeholder`)) {
|
|
591
|
+
output_1.output.error({
|
|
592
|
+
title: `Failed to create a workspace.`,
|
|
593
|
+
bodyLines: [
|
|
594
|
+
`The provided "${prefix}" prefix is invalid. It must be a valid HTML selector.`,
|
|
595
|
+
],
|
|
596
|
+
});
|
|
597
|
+
process.exit(1);
|
|
598
|
+
}
|
|
599
|
+
}
|
|
527
600
|
if (parsedArgs.preset && parsedArgs.preset !== preset_1.Preset.Angular) {
|
|
528
601
|
preset = parsedArgs.preset;
|
|
529
602
|
if (preset === preset_1.Preset.AngularStandalone) {
|
|
@@ -544,80 +617,85 @@ async function determineAngularOptions(parsedArgs) {
|
|
|
544
617
|
appName = await determineAppName(parsedArgs);
|
|
545
618
|
}
|
|
546
619
|
}
|
|
547
|
-
if (parsedArgs.
|
|
548
|
-
|
|
620
|
+
if (parsedArgs.bundler) {
|
|
621
|
+
bundler = parsedArgs.bundler;
|
|
549
622
|
}
|
|
550
623
|
else {
|
|
551
624
|
const reply = await enquirer.prompt([
|
|
552
625
|
{
|
|
553
|
-
name: '
|
|
554
|
-
message: `
|
|
555
|
-
initial: 'css',
|
|
626
|
+
name: 'bundler',
|
|
627
|
+
message: `Which bundler would you like to use?`,
|
|
556
628
|
type: 'autocomplete',
|
|
557
629
|
choices: [
|
|
558
630
|
{
|
|
559
|
-
name: '
|
|
560
|
-
message: '
|
|
561
|
-
},
|
|
562
|
-
{
|
|
563
|
-
name: 'scss',
|
|
564
|
-
message: 'SASS(.scss) [ http://sass-lang.com ]',
|
|
631
|
+
name: 'esbuild',
|
|
632
|
+
message: 'esbuild [ https://esbuild.github.io/ ]',
|
|
565
633
|
},
|
|
566
634
|
{
|
|
567
|
-
name: '
|
|
568
|
-
message: '
|
|
635
|
+
name: 'webpack',
|
|
636
|
+
message: 'Webpack [ https://webpack.js.org/ ]',
|
|
569
637
|
},
|
|
570
638
|
],
|
|
639
|
+
initial: 0,
|
|
571
640
|
},
|
|
572
641
|
]);
|
|
573
|
-
|
|
642
|
+
bundler = reply.bundler;
|
|
574
643
|
}
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
standaloneApi = parsedArgs.standaloneApi;
|
|
644
|
+
if (parsedArgs.style) {
|
|
645
|
+
style = parsedArgs.style;
|
|
578
646
|
}
|
|
579
647
|
else {
|
|
580
648
|
const reply = await enquirer.prompt([
|
|
581
649
|
{
|
|
582
|
-
name: '
|
|
583
|
-
message:
|
|
650
|
+
name: 'style',
|
|
651
|
+
message: `Default stylesheet format`,
|
|
652
|
+
initial: 0,
|
|
584
653
|
type: 'autocomplete',
|
|
585
654
|
choices: [
|
|
586
655
|
{
|
|
587
|
-
name: '
|
|
656
|
+
name: 'css',
|
|
657
|
+
message: 'CSS',
|
|
588
658
|
},
|
|
589
659
|
{
|
|
590
|
-
name: '
|
|
660
|
+
name: 'scss',
|
|
661
|
+
message: 'SASS(.scss) [ https://sass-lang.com ]',
|
|
662
|
+
},
|
|
663
|
+
{
|
|
664
|
+
name: 'less',
|
|
665
|
+
message: 'LESS [ https://lesscss.org ]',
|
|
591
666
|
},
|
|
592
667
|
],
|
|
593
|
-
initial: 'No',
|
|
594
668
|
},
|
|
595
669
|
]);
|
|
596
|
-
|
|
670
|
+
style = reply.style;
|
|
597
671
|
}
|
|
598
|
-
if (parsedArgs.
|
|
599
|
-
|
|
672
|
+
if (parsedArgs.ssr !== undefined) {
|
|
673
|
+
ssr = parsedArgs.ssr;
|
|
600
674
|
}
|
|
601
675
|
else {
|
|
602
676
|
const reply = await enquirer.prompt([
|
|
603
677
|
{
|
|
604
|
-
name: '
|
|
605
|
-
message: '
|
|
678
|
+
name: 'ssr',
|
|
679
|
+
message: 'Do you want to enable Server-Side Rendering (SSR) and Static Site Generation (SSG/Prerendering)?',
|
|
606
680
|
type: 'autocomplete',
|
|
607
|
-
choices: [
|
|
608
|
-
|
|
609
|
-
name: 'Yes',
|
|
610
|
-
},
|
|
611
|
-
{
|
|
612
|
-
name: 'No',
|
|
613
|
-
},
|
|
614
|
-
],
|
|
615
|
-
initial: 'Yes',
|
|
681
|
+
choices: [{ name: 'Yes' }, { name: 'No' }],
|
|
682
|
+
initial: 1,
|
|
616
683
|
},
|
|
617
684
|
]);
|
|
618
|
-
|
|
685
|
+
ssr = reply.ssr === 'Yes';
|
|
619
686
|
}
|
|
620
|
-
|
|
687
|
+
e2eTestRunner = await determineE2eTestRunner(parsedArgs);
|
|
688
|
+
return {
|
|
689
|
+
preset,
|
|
690
|
+
style,
|
|
691
|
+
appName,
|
|
692
|
+
standaloneApi,
|
|
693
|
+
routing,
|
|
694
|
+
e2eTestRunner,
|
|
695
|
+
bundler,
|
|
696
|
+
ssr,
|
|
697
|
+
prefix,
|
|
698
|
+
};
|
|
621
699
|
}
|
|
622
700
|
async function determineNodeOptions(parsedArgs) {
|
|
623
701
|
let preset;
|
|
@@ -671,7 +749,7 @@ async function determineNodeOptions(parsedArgs) {
|
|
|
671
749
|
name: 'No',
|
|
672
750
|
},
|
|
673
751
|
],
|
|
674
|
-
initial:
|
|
752
|
+
initial: 1,
|
|
675
753
|
},
|
|
676
754
|
]);
|
|
677
755
|
docker = reply.docker === 'Yes';
|
|
@@ -689,7 +767,7 @@ async function determinePackageBasedOrIntegratedOrStandalone() {
|
|
|
689
767
|
type: 'autocomplete',
|
|
690
768
|
name: 'workspaceType',
|
|
691
769
|
message: `Package-based monorepo, integrated monorepo, or standalone project?`,
|
|
692
|
-
initial:
|
|
770
|
+
initial: 0,
|
|
693
771
|
choices: [
|
|
694
772
|
{
|
|
695
773
|
name: 'package-based',
|
|
@@ -720,7 +798,7 @@ async function determineStandaloneOrMonorepo() {
|
|
|
720
798
|
type: 'autocomplete',
|
|
721
799
|
name: 'workspaceType',
|
|
722
800
|
message: `Integrated monorepo, or standalone project?`,
|
|
723
|
-
initial:
|
|
801
|
+
initial: 1,
|
|
724
802
|
choices: [
|
|
725
803
|
{
|
|
726
804
|
name: 'integrated',
|
|
@@ -774,6 +852,10 @@ async function determineReactFramework(parsedArgs) {
|
|
|
774
852
|
name: 'nextjs',
|
|
775
853
|
message: 'Next.js [ https://nextjs.org/ ]',
|
|
776
854
|
},
|
|
855
|
+
{
|
|
856
|
+
name: 'remix',
|
|
857
|
+
message: 'Remix [ https://remix.run/ ]',
|
|
858
|
+
},
|
|
777
859
|
{
|
|
778
860
|
name: 'expo',
|
|
779
861
|
message: 'Expo [ https://expo.io/ ]',
|
|
@@ -783,7 +865,7 @@ async function determineReactFramework(parsedArgs) {
|
|
|
783
865
|
message: 'React Native [ https://reactnative.dev/ ]',
|
|
784
866
|
},
|
|
785
867
|
],
|
|
786
|
-
initial:
|
|
868
|
+
initial: 0,
|
|
787
869
|
},
|
|
788
870
|
]);
|
|
789
871
|
return reply.framework;
|
|
@@ -830,11 +912,56 @@ async function determineNextAppDir(parsedArgs) {
|
|
|
830
912
|
name: 'No',
|
|
831
913
|
},
|
|
832
914
|
],
|
|
833
|
-
initial:
|
|
915
|
+
initial: 0,
|
|
834
916
|
},
|
|
835
917
|
]);
|
|
836
918
|
return reply.nextAppDir === 'Yes';
|
|
837
919
|
}
|
|
920
|
+
async function determineNextSrcDir(parsedArgs) {
|
|
921
|
+
if (parsedArgs.nextSrcDir !== undefined)
|
|
922
|
+
return parsedArgs.nextSrcDir;
|
|
923
|
+
const reply = await enquirer.prompt([
|
|
924
|
+
{
|
|
925
|
+
name: 'nextSrcDir',
|
|
926
|
+
message: 'Would you like to use the src/ directory?',
|
|
927
|
+
type: 'autocomplete',
|
|
928
|
+
choices: [
|
|
929
|
+
{
|
|
930
|
+
name: 'Yes',
|
|
931
|
+
},
|
|
932
|
+
{
|
|
933
|
+
name: 'No',
|
|
934
|
+
},
|
|
935
|
+
],
|
|
936
|
+
initial: 0,
|
|
937
|
+
},
|
|
938
|
+
]);
|
|
939
|
+
return reply.nextSrcDir === 'Yes';
|
|
940
|
+
}
|
|
941
|
+
async function determineVueFramework(parsedArgs) {
|
|
942
|
+
if (!!parsedArgs.framework)
|
|
943
|
+
return parsedArgs.framework;
|
|
944
|
+
const reply = await enquirer.prompt([
|
|
945
|
+
{
|
|
946
|
+
name: 'framework',
|
|
947
|
+
message: 'What framework would you like to use?',
|
|
948
|
+
type: 'autocomplete',
|
|
949
|
+
choices: [
|
|
950
|
+
{
|
|
951
|
+
name: 'none',
|
|
952
|
+
message: 'None',
|
|
953
|
+
hint: ' I only want Vue',
|
|
954
|
+
},
|
|
955
|
+
{
|
|
956
|
+
name: 'nuxt',
|
|
957
|
+
message: 'Nuxt [ https://nuxt.com/ ]',
|
|
958
|
+
},
|
|
959
|
+
],
|
|
960
|
+
initial: 0,
|
|
961
|
+
},
|
|
962
|
+
]);
|
|
963
|
+
return reply.framework;
|
|
964
|
+
}
|
|
838
965
|
async function determineNodeFramework(parsedArgs) {
|
|
839
966
|
if (parsedArgs.framework)
|
|
840
967
|
return parsedArgs.framework;
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-nx-workspace",
|
|
3
|
-
"version": "17.0.
|
|
3
|
+
"version": "17.0.4",
|
|
4
4
|
"private": false,
|
|
5
|
-
"description": "Smart
|
|
5
|
+
"description": "Smart Monorepos · Fast CI",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://github.com/nrwl/nx.git",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"tmp": "~0.2.1",
|
|
37
37
|
"tslib": "^2.3.0",
|
|
38
38
|
"yargs": "^17.6.2",
|
|
39
|
-
"axios": "^1.
|
|
39
|
+
"axios": "^1.6.0"
|
|
40
40
|
},
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"access": "public"
|
package/src/create-preset.js
CHANGED
|
@@ -6,7 +6,7 @@ const package_manager_1 = require("./utils/package-manager");
|
|
|
6
6
|
const child_process_utils_1 = require("./utils/child-process-utils");
|
|
7
7
|
const unparse_1 = require("./utils/unparse");
|
|
8
8
|
async function createPreset(preset, parsedArgs, packageManager, directory) {
|
|
9
|
-
const { skipGit,
|
|
9
|
+
const { skipGit, commit, nxCloud, ...restArgs } = parsedArgs;
|
|
10
10
|
let args = (0, unparse_1.unparse)({
|
|
11
11
|
interactive: true,
|
|
12
12
|
...restArgs,
|
|
@@ -1,19 +1,14 @@
|
|
|
1
|
+
import { NxCloud } from './utils/nx/nx-cloud';
|
|
1
2
|
import { PackageManager } from './utils/package-manager';
|
|
2
|
-
import { CI } from './utils/ci/ci-list';
|
|
3
3
|
export interface CreateWorkspaceOptions {
|
|
4
4
|
name: string;
|
|
5
5
|
packageManager: PackageManager;
|
|
6
|
-
nxCloud:
|
|
6
|
+
nxCloud: NxCloud;
|
|
7
7
|
/**
|
|
8
8
|
* @description Enable interactive mode with presets
|
|
9
9
|
* @default true
|
|
10
10
|
*/
|
|
11
11
|
interactive?: boolean;
|
|
12
|
-
/**
|
|
13
|
-
* @description Generate a CI workflow file
|
|
14
|
-
* @default ''
|
|
15
|
-
*/
|
|
16
|
-
ci?: CI;
|
|
17
12
|
/**
|
|
18
13
|
* @description Default base to use for new projects. e.g. main, master
|
|
19
14
|
* @default 'main'
|