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