create-nx-workspace 17.0.3 → 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 +205 -76
- 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
|
}
|
|
@@ -57,10 +57,12 @@ exports.commandsObject = yargs
|
|
|
57
57
|
.option('standaloneApi', {
|
|
58
58
|
describe: chalk.dim `Use Standalone Components if generating an Angular app`,
|
|
59
59
|
type: 'boolean',
|
|
60
|
+
default: true,
|
|
60
61
|
})
|
|
61
62
|
.option('routing', {
|
|
62
63
|
describe: chalk.dim `Add a routing setup for an Angular app`,
|
|
63
64
|
type: 'boolean',
|
|
65
|
+
default: true,
|
|
64
66
|
})
|
|
65
67
|
.option('bundler', {
|
|
66
68
|
describe: chalk.dim `Bundler to be used to build the app`,
|
|
@@ -77,12 +79,24 @@ exports.commandsObject = yargs
|
|
|
77
79
|
.option('nextAppDir', {
|
|
78
80
|
describe: chalk.dim `Enable the App Router for Next.js`,
|
|
79
81
|
type: 'boolean',
|
|
82
|
+
})
|
|
83
|
+
.option('nextSrcDir', {
|
|
84
|
+
describe: chalk.dim `Generate a 'src/' directory for Next.js`,
|
|
85
|
+
type: 'boolean',
|
|
80
86
|
})
|
|
81
87
|
.option('e2eTestRunner', {
|
|
82
88
|
describe: chalk.dim `Test runner to use for end to end (E2E) tests.`,
|
|
83
89
|
choices: ['cypress', 'playwright', 'none'],
|
|
84
90
|
type: 'string',
|
|
85
|
-
})
|
|
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) {
|
|
86
100
|
await main(argv).catch((error) => {
|
|
87
101
|
const { version } = require('../package.json');
|
|
88
102
|
output_1.output.error({
|
|
@@ -93,7 +107,7 @@ exports.commandsObject = yargs
|
|
|
93
107
|
}, [
|
|
94
108
|
normalizeArgsMiddleware,
|
|
95
109
|
normalizeAndWarnOnDeprecatedPreset({
|
|
96
|
-
// TODO(
|
|
110
|
+
// TODO(v19): Remove Empty and Core presets
|
|
97
111
|
[preset_1.Preset.Core]: preset_1.Preset.NPM,
|
|
98
112
|
[preset_1.Preset.Empty]: preset_1.Preset.Apps,
|
|
99
113
|
}),
|
|
@@ -104,18 +118,17 @@ exports.commandsObject = yargs
|
|
|
104
118
|
async function main(parsedArgs) {
|
|
105
119
|
output_1.output.log({
|
|
106
120
|
title: `Creating your v${nx_version_1.nxVersion} workspace.`,
|
|
107
|
-
bodyLines: [
|
|
108
|
-
'To make sure the command works reliably in all environments, and that the preset is applied correctly,',
|
|
109
|
-
`Nx will run "${parsedArgs.packageManager} install" several times. Please wait.`,
|
|
110
|
-
],
|
|
111
121
|
});
|
|
112
122
|
const workspaceInfo = await (0, create_workspace_1.createWorkspace)(parsedArgs.preset, parsedArgs);
|
|
113
123
|
(0, show_nx_warning_1.showNxWarning)(parsedArgs.name);
|
|
114
124
|
await (0, ab_testing_1.recordStat)({
|
|
115
125
|
nxVersion: nx_version_1.nxVersion,
|
|
116
126
|
command: 'create-nx-workspace',
|
|
117
|
-
useCloud: parsedArgs.nxCloud,
|
|
118
|
-
meta:
|
|
127
|
+
useCloud: parsedArgs.nxCloud !== 'skip',
|
|
128
|
+
meta: [
|
|
129
|
+
ab_testing_1.messages.codeOfSelectedPromptMessage('setupCI'),
|
|
130
|
+
ab_testing_1.messages.codeOfSelectedPromptMessage('setupNxCloud'),
|
|
131
|
+
],
|
|
119
132
|
});
|
|
120
133
|
if (parsedArgs.nxCloud && workspaceInfo.nxCloudInfo) {
|
|
121
134
|
(0, nx_cloud_1.printNxCloudSuccessMessage)(workspaceInfo.nxCloudInfo);
|
|
@@ -157,8 +170,6 @@ async function normalizeArgsMiddleware(argv) {
|
|
|
157
170
|
});
|
|
158
171
|
try {
|
|
159
172
|
let thirdPartyPreset;
|
|
160
|
-
// Node options
|
|
161
|
-
let docker;
|
|
162
173
|
try {
|
|
163
174
|
thirdPartyPreset = await (0, get_third_party_preset_1.getThirdPartyPreset)(argv.preset);
|
|
164
175
|
}
|
|
@@ -184,12 +195,10 @@ async function normalizeArgsMiddleware(argv) {
|
|
|
184
195
|
const packageManager = await (0, prompts_1.determinePackageManager)(argv);
|
|
185
196
|
const defaultBase = await (0, prompts_1.determineDefaultBase)(argv);
|
|
186
197
|
const nxCloud = await (0, prompts_1.determineNxCloud)(argv);
|
|
187
|
-
const ci = await (0, prompts_1.determineCI)(argv, nxCloud);
|
|
188
198
|
Object.assign(argv, {
|
|
189
199
|
nxCloud,
|
|
190
200
|
packageManager,
|
|
191
201
|
defaultBase,
|
|
192
|
-
ci,
|
|
193
202
|
});
|
|
194
203
|
}
|
|
195
204
|
catch (e) {
|
|
@@ -238,9 +247,14 @@ async function determineStack(parsedArgs) {
|
|
|
238
247
|
case preset_1.Preset.ReactMonorepo:
|
|
239
248
|
case preset_1.Preset.NextJs:
|
|
240
249
|
case preset_1.Preset.NextJsStandalone:
|
|
250
|
+
case preset_1.Preset.RemixStandalone:
|
|
251
|
+
case preset_1.Preset.RemixMonorepo:
|
|
241
252
|
return 'react';
|
|
253
|
+
case preset_1.Preset.Vue:
|
|
242
254
|
case preset_1.Preset.VueStandalone:
|
|
243
255
|
case preset_1.Preset.VueMonorepo:
|
|
256
|
+
case preset_1.Preset.Nuxt:
|
|
257
|
+
case preset_1.Preset.NuxtStandalone:
|
|
244
258
|
return 'vue';
|
|
245
259
|
case preset_1.Preset.Nest:
|
|
246
260
|
case preset_1.Preset.NodeStandalone:
|
|
@@ -274,7 +288,7 @@ async function determineStack(parsedArgs) {
|
|
|
274
288
|
},
|
|
275
289
|
{
|
|
276
290
|
name: `vue`,
|
|
277
|
-
message: `Vue: Configures a Vue application with
|
|
291
|
+
message: `Vue: Configures a Vue application with your framework of choice.`,
|
|
278
292
|
},
|
|
279
293
|
{
|
|
280
294
|
name: `angular`,
|
|
@@ -344,7 +358,7 @@ async function determineNoneOptions(parsedArgs) {
|
|
|
344
358
|
name: 'No',
|
|
345
359
|
},
|
|
346
360
|
],
|
|
347
|
-
initial:
|
|
361
|
+
initial: 0,
|
|
348
362
|
},
|
|
349
363
|
]);
|
|
350
364
|
js = reply.ts === 'No';
|
|
@@ -358,10 +372,12 @@ async function determineReactOptions(parsedArgs) {
|
|
|
358
372
|
let bundler = undefined;
|
|
359
373
|
let e2eTestRunner = undefined;
|
|
360
374
|
let nextAppDir = false;
|
|
375
|
+
let nextSrcDir = false;
|
|
361
376
|
if (parsedArgs.preset && parsedArgs.preset !== preset_1.Preset.React) {
|
|
362
377
|
preset = parsedArgs.preset;
|
|
363
378
|
if (preset === preset_1.Preset.ReactStandalone ||
|
|
364
|
-
preset === preset_1.Preset.NextJsStandalone
|
|
379
|
+
preset === preset_1.Preset.NextJsStandalone ||
|
|
380
|
+
preset === preset_1.Preset.RemixStandalone) {
|
|
365
381
|
appName = parsedArgs.appName ?? parsedArgs.name;
|
|
366
382
|
}
|
|
367
383
|
else {
|
|
@@ -389,6 +405,14 @@ async function determineReactOptions(parsedArgs) {
|
|
|
389
405
|
preset = preset_1.Preset.NextJs;
|
|
390
406
|
}
|
|
391
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
|
+
}
|
|
392
416
|
else if (framework === 'react-native') {
|
|
393
417
|
preset = preset_1.Preset.ReactNative;
|
|
394
418
|
}
|
|
@@ -410,6 +434,11 @@ async function determineReactOptions(parsedArgs) {
|
|
|
410
434
|
}
|
|
411
435
|
else if (preset === preset_1.Preset.NextJs || preset === preset_1.Preset.NextJsStandalone) {
|
|
412
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) {
|
|
413
442
|
e2eTestRunner = await determineE2eTestRunner(parsedArgs);
|
|
414
443
|
}
|
|
415
444
|
if (parsedArgs.style) {
|
|
@@ -423,7 +452,7 @@ async function determineReactOptions(parsedArgs) {
|
|
|
423
452
|
{
|
|
424
453
|
name: 'style',
|
|
425
454
|
message: `Default stylesheet format`,
|
|
426
|
-
initial:
|
|
455
|
+
initial: 0,
|
|
427
456
|
type: 'autocomplete',
|
|
428
457
|
choices: [
|
|
429
458
|
{
|
|
@@ -432,11 +461,15 @@ async function determineReactOptions(parsedArgs) {
|
|
|
432
461
|
},
|
|
433
462
|
{
|
|
434
463
|
name: 'scss',
|
|
435
|
-
message: 'SASS(.scss) [
|
|
464
|
+
message: 'SASS(.scss) [ https://sass-lang.com ]',
|
|
436
465
|
},
|
|
437
466
|
{
|
|
438
467
|
name: 'less',
|
|
439
|
-
message: 'LESS [
|
|
468
|
+
message: 'LESS [ https://lesscss.org ]',
|
|
469
|
+
},
|
|
470
|
+
{
|
|
471
|
+
name: 'tailwind',
|
|
472
|
+
message: 'tailwind [ https://tailwindcss.com ]',
|
|
440
473
|
},
|
|
441
474
|
{
|
|
442
475
|
name: 'styled-components',
|
|
@@ -455,30 +488,55 @@ async function determineReactOptions(parsedArgs) {
|
|
|
455
488
|
]);
|
|
456
489
|
style = reply.style;
|
|
457
490
|
}
|
|
458
|
-
return {
|
|
491
|
+
return {
|
|
492
|
+
preset,
|
|
493
|
+
style,
|
|
494
|
+
appName,
|
|
495
|
+
bundler,
|
|
496
|
+
nextAppDir,
|
|
497
|
+
nextSrcDir,
|
|
498
|
+
e2eTestRunner,
|
|
499
|
+
};
|
|
459
500
|
}
|
|
460
501
|
async function determineVueOptions(parsedArgs) {
|
|
461
502
|
let preset;
|
|
462
503
|
let style = undefined;
|
|
463
504
|
let appName;
|
|
464
505
|
let e2eTestRunner = undefined;
|
|
465
|
-
if (parsedArgs.preset) {
|
|
506
|
+
if (parsedArgs.preset && parsedArgs.preset !== preset_1.Preset.Vue) {
|
|
466
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
|
+
}
|
|
467
514
|
}
|
|
468
515
|
else {
|
|
516
|
+
const framework = await determineVueFramework(parsedArgs);
|
|
469
517
|
const workspaceType = await determineStandaloneOrMonorepo();
|
|
470
518
|
if (workspaceType === 'standalone') {
|
|
471
|
-
|
|
519
|
+
appName = parsedArgs.appName ?? parsedArgs.name;
|
|
472
520
|
}
|
|
473
521
|
else {
|
|
474
|
-
|
|
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
|
+
}
|
|
475
539
|
}
|
|
476
|
-
}
|
|
477
|
-
if (preset === preset_1.Preset.VueStandalone) {
|
|
478
|
-
appName = parsedArgs.appName ?? parsedArgs.name;
|
|
479
|
-
}
|
|
480
|
-
else {
|
|
481
|
-
appName = await determineAppName(parsedArgs);
|
|
482
540
|
}
|
|
483
541
|
e2eTestRunner = await determineE2eTestRunner(parsedArgs);
|
|
484
542
|
if (parsedArgs.style) {
|
|
@@ -489,7 +547,7 @@ async function determineVueOptions(parsedArgs) {
|
|
|
489
547
|
{
|
|
490
548
|
name: 'style',
|
|
491
549
|
message: `Default stylesheet format`,
|
|
492
|
-
initial:
|
|
550
|
+
initial: 0,
|
|
493
551
|
type: 'autocomplete',
|
|
494
552
|
choices: [
|
|
495
553
|
{
|
|
@@ -498,11 +556,11 @@ async function determineVueOptions(parsedArgs) {
|
|
|
498
556
|
},
|
|
499
557
|
{
|
|
500
558
|
name: 'scss',
|
|
501
|
-
message: 'SASS(.scss) [
|
|
559
|
+
message: 'SASS(.scss) [ https://sass-lang.com ]',
|
|
502
560
|
},
|
|
503
561
|
{
|
|
504
562
|
name: 'less',
|
|
505
|
-
message: 'LESS [
|
|
563
|
+
message: 'LESS [ https://lesscss.org ]',
|
|
506
564
|
},
|
|
507
565
|
{
|
|
508
566
|
name: 'none',
|
|
@@ -519,9 +577,26 @@ async function determineAngularOptions(parsedArgs) {
|
|
|
519
577
|
let preset;
|
|
520
578
|
let style;
|
|
521
579
|
let appName;
|
|
522
|
-
let standaloneApi;
|
|
523
580
|
let e2eTestRunner = undefined;
|
|
524
|
-
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
|
+
}
|
|
525
600
|
if (parsedArgs.preset && parsedArgs.preset !== preset_1.Preset.Angular) {
|
|
526
601
|
preset = parsedArgs.preset;
|
|
527
602
|
if (preset === preset_1.Preset.AngularStandalone) {
|
|
@@ -542,80 +617,85 @@ async function determineAngularOptions(parsedArgs) {
|
|
|
542
617
|
appName = await determineAppName(parsedArgs);
|
|
543
618
|
}
|
|
544
619
|
}
|
|
545
|
-
if (parsedArgs.
|
|
546
|
-
|
|
620
|
+
if (parsedArgs.bundler) {
|
|
621
|
+
bundler = parsedArgs.bundler;
|
|
547
622
|
}
|
|
548
623
|
else {
|
|
549
624
|
const reply = await enquirer.prompt([
|
|
550
625
|
{
|
|
551
|
-
name: '
|
|
552
|
-
message: `
|
|
553
|
-
initial: 'css',
|
|
626
|
+
name: 'bundler',
|
|
627
|
+
message: `Which bundler would you like to use?`,
|
|
554
628
|
type: 'autocomplete',
|
|
555
629
|
choices: [
|
|
556
630
|
{
|
|
557
|
-
name: '
|
|
558
|
-
message: '
|
|
559
|
-
},
|
|
560
|
-
{
|
|
561
|
-
name: 'scss',
|
|
562
|
-
message: 'SASS(.scss) [ http://sass-lang.com ]',
|
|
631
|
+
name: 'esbuild',
|
|
632
|
+
message: 'esbuild [ https://esbuild.github.io/ ]',
|
|
563
633
|
},
|
|
564
634
|
{
|
|
565
|
-
name: '
|
|
566
|
-
message: '
|
|
635
|
+
name: 'webpack',
|
|
636
|
+
message: 'Webpack [ https://webpack.js.org/ ]',
|
|
567
637
|
},
|
|
568
638
|
],
|
|
639
|
+
initial: 0,
|
|
569
640
|
},
|
|
570
641
|
]);
|
|
571
|
-
|
|
642
|
+
bundler = reply.bundler;
|
|
572
643
|
}
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
standaloneApi = parsedArgs.standaloneApi;
|
|
644
|
+
if (parsedArgs.style) {
|
|
645
|
+
style = parsedArgs.style;
|
|
576
646
|
}
|
|
577
647
|
else {
|
|
578
648
|
const reply = await enquirer.prompt([
|
|
579
649
|
{
|
|
580
|
-
name: '
|
|
581
|
-
message:
|
|
650
|
+
name: 'style',
|
|
651
|
+
message: `Default stylesheet format`,
|
|
652
|
+
initial: 0,
|
|
582
653
|
type: 'autocomplete',
|
|
583
654
|
choices: [
|
|
584
655
|
{
|
|
585
|
-
name: '
|
|
656
|
+
name: 'css',
|
|
657
|
+
message: 'CSS',
|
|
586
658
|
},
|
|
587
659
|
{
|
|
588
|
-
name: '
|
|
660
|
+
name: 'scss',
|
|
661
|
+
message: 'SASS(.scss) [ https://sass-lang.com ]',
|
|
662
|
+
},
|
|
663
|
+
{
|
|
664
|
+
name: 'less',
|
|
665
|
+
message: 'LESS [ https://lesscss.org ]',
|
|
589
666
|
},
|
|
590
667
|
],
|
|
591
|
-
initial: 'No',
|
|
592
668
|
},
|
|
593
669
|
]);
|
|
594
|
-
|
|
670
|
+
style = reply.style;
|
|
595
671
|
}
|
|
596
|
-
if (parsedArgs.
|
|
597
|
-
|
|
672
|
+
if (parsedArgs.ssr !== undefined) {
|
|
673
|
+
ssr = parsedArgs.ssr;
|
|
598
674
|
}
|
|
599
675
|
else {
|
|
600
676
|
const reply = await enquirer.prompt([
|
|
601
677
|
{
|
|
602
|
-
name: '
|
|
603
|
-
message: '
|
|
678
|
+
name: 'ssr',
|
|
679
|
+
message: 'Do you want to enable Server-Side Rendering (SSR) and Static Site Generation (SSG/Prerendering)?',
|
|
604
680
|
type: 'autocomplete',
|
|
605
|
-
choices: [
|
|
606
|
-
|
|
607
|
-
name: 'Yes',
|
|
608
|
-
},
|
|
609
|
-
{
|
|
610
|
-
name: 'No',
|
|
611
|
-
},
|
|
612
|
-
],
|
|
613
|
-
initial: 'Yes',
|
|
681
|
+
choices: [{ name: 'Yes' }, { name: 'No' }],
|
|
682
|
+
initial: 1,
|
|
614
683
|
},
|
|
615
684
|
]);
|
|
616
|
-
|
|
685
|
+
ssr = reply.ssr === 'Yes';
|
|
617
686
|
}
|
|
618
|
-
|
|
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
|
+
};
|
|
619
699
|
}
|
|
620
700
|
async function determineNodeOptions(parsedArgs) {
|
|
621
701
|
let preset;
|
|
@@ -669,7 +749,7 @@ async function determineNodeOptions(parsedArgs) {
|
|
|
669
749
|
name: 'No',
|
|
670
750
|
},
|
|
671
751
|
],
|
|
672
|
-
initial:
|
|
752
|
+
initial: 1,
|
|
673
753
|
},
|
|
674
754
|
]);
|
|
675
755
|
docker = reply.docker === 'Yes';
|
|
@@ -687,7 +767,7 @@ async function determinePackageBasedOrIntegratedOrStandalone() {
|
|
|
687
767
|
type: 'autocomplete',
|
|
688
768
|
name: 'workspaceType',
|
|
689
769
|
message: `Package-based monorepo, integrated monorepo, or standalone project?`,
|
|
690
|
-
initial:
|
|
770
|
+
initial: 0,
|
|
691
771
|
choices: [
|
|
692
772
|
{
|
|
693
773
|
name: 'package-based',
|
|
@@ -718,7 +798,7 @@ async function determineStandaloneOrMonorepo() {
|
|
|
718
798
|
type: 'autocomplete',
|
|
719
799
|
name: 'workspaceType',
|
|
720
800
|
message: `Integrated monorepo, or standalone project?`,
|
|
721
|
-
initial:
|
|
801
|
+
initial: 1,
|
|
722
802
|
choices: [
|
|
723
803
|
{
|
|
724
804
|
name: 'integrated',
|
|
@@ -772,6 +852,10 @@ async function determineReactFramework(parsedArgs) {
|
|
|
772
852
|
name: 'nextjs',
|
|
773
853
|
message: 'Next.js [ https://nextjs.org/ ]',
|
|
774
854
|
},
|
|
855
|
+
{
|
|
856
|
+
name: 'remix',
|
|
857
|
+
message: 'Remix [ https://remix.run/ ]',
|
|
858
|
+
},
|
|
775
859
|
{
|
|
776
860
|
name: 'expo',
|
|
777
861
|
message: 'Expo [ https://expo.io/ ]',
|
|
@@ -781,7 +865,7 @@ async function determineReactFramework(parsedArgs) {
|
|
|
781
865
|
message: 'React Native [ https://reactnative.dev/ ]',
|
|
782
866
|
},
|
|
783
867
|
],
|
|
784
|
-
initial:
|
|
868
|
+
initial: 0,
|
|
785
869
|
},
|
|
786
870
|
]);
|
|
787
871
|
return reply.framework;
|
|
@@ -828,11 +912,56 @@ async function determineNextAppDir(parsedArgs) {
|
|
|
828
912
|
name: 'No',
|
|
829
913
|
},
|
|
830
914
|
],
|
|
831
|
-
initial:
|
|
915
|
+
initial: 0,
|
|
832
916
|
},
|
|
833
917
|
]);
|
|
834
918
|
return reply.nextAppDir === 'Yes';
|
|
835
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
|
+
}
|
|
836
965
|
async function determineNodeFramework(parsedArgs) {
|
|
837
966
|
if (parsedArgs.framework)
|
|
838
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'
|