create-nx-workspace 17.2.8 → 17.3.0-beta.2
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/README.md +8 -3
- package/bin/create-nx-workspace.d.ts +2 -8
- package/bin/create-nx-workspace.js +49 -71
- package/package.json +2 -2
- package/src/utils/nx/nx-cloud.js +3 -3
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
|
|
|
@@ -35,13 +35,7 @@ interface VueArguments extends BaseArguments {
|
|
|
35
35
|
stack: 'vue';
|
|
36
36
|
workspaceType: 'standalone' | 'integrated';
|
|
37
37
|
appName: string;
|
|
38
|
-
|
|
39
|
-
e2eTestRunner: 'none' | 'cypress' | 'playwright';
|
|
40
|
-
}
|
|
41
|
-
interface NuxtArguments extends BaseArguments {
|
|
42
|
-
stack: 'nuxt';
|
|
43
|
-
workspaceType: 'standalone' | 'integrated';
|
|
44
|
-
appName: string;
|
|
38
|
+
framework: 'none' | 'nuxt';
|
|
45
39
|
style: string;
|
|
46
40
|
e2eTestRunner: 'none' | 'cypress' | 'playwright';
|
|
47
41
|
}
|
|
@@ -55,6 +49,6 @@ interface NodeArguments extends BaseArguments {
|
|
|
55
49
|
interface UnknownStackArguments extends BaseArguments {
|
|
56
50
|
stack: 'unknown';
|
|
57
51
|
}
|
|
58
|
-
type Arguments = NoneArguments | ReactArguments | AngularArguments | VueArguments |
|
|
52
|
+
type Arguments = NoneArguments | ReactArguments | AngularArguments | VueArguments | NodeArguments | UnknownStackArguments;
|
|
59
53
|
export declare const commandsObject: yargs.Argv<Arguments>;
|
|
60
54
|
export {};
|
|
@@ -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(katerina): Remove this option when @nx/nuxt is released.
|
|
36
|
-
.filter((p) => p !== preset_1.Preset.NuxtStandalone && p !== preset_1.Preset.Nuxt)
|
|
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',
|
|
@@ -249,10 +247,9 @@ async function determineStack(parsedArgs) {
|
|
|
249
247
|
return 'react';
|
|
250
248
|
case preset_1.Preset.VueStandalone:
|
|
251
249
|
case preset_1.Preset.VueMonorepo:
|
|
252
|
-
return 'vue';
|
|
253
|
-
case preset_1.Preset.NuxtStandalone:
|
|
254
250
|
case preset_1.Preset.Nuxt:
|
|
255
|
-
|
|
251
|
+
case preset_1.Preset.NuxtStandalone:
|
|
252
|
+
return 'vue';
|
|
256
253
|
case preset_1.Preset.Nest:
|
|
257
254
|
case preset_1.Preset.NodeStandalone:
|
|
258
255
|
case preset_1.Preset.Express:
|
|
@@ -285,7 +282,7 @@ async function determineStack(parsedArgs) {
|
|
|
285
282
|
},
|
|
286
283
|
{
|
|
287
284
|
name: `vue`,
|
|
288
|
-
message: `Vue: Configures a Vue application with
|
|
285
|
+
message: `Vue: Configures a Vue application with your framework of choice.`,
|
|
289
286
|
},
|
|
290
287
|
{
|
|
291
288
|
name: `angular`,
|
|
@@ -310,8 +307,6 @@ async function determinePresetOptions(parsedArgs) {
|
|
|
310
307
|
return determineAngularOptions(parsedArgs);
|
|
311
308
|
case 'vue':
|
|
312
309
|
return determineVueOptions(parsedArgs);
|
|
313
|
-
case 'nuxt':
|
|
314
|
-
return determineNuxtOptions(parsedArgs);
|
|
315
310
|
case 'node':
|
|
316
311
|
return determineNodeOptions(parsedArgs);
|
|
317
312
|
default:
|
|
@@ -477,79 +472,38 @@ async function determineVueOptions(parsedArgs) {
|
|
|
477
472
|
let e2eTestRunner = undefined;
|
|
478
473
|
if (parsedArgs.preset) {
|
|
479
474
|
preset = parsedArgs.preset;
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
const workspaceType = await determineStandaloneOrMonorepo();
|
|
483
|
-
if (workspaceType === 'standalone') {
|
|
484
|
-
preset = preset_1.Preset.VueStandalone;
|
|
475
|
+
if (preset === preset_1.Preset.VueStandalone || preset === preset_1.Preset.NuxtStandalone) {
|
|
476
|
+
appName = parsedArgs.appName ?? parsedArgs.name;
|
|
485
477
|
}
|
|
486
478
|
else {
|
|
487
|
-
|
|
479
|
+
appName = await determineAppName(parsedArgs);
|
|
488
480
|
}
|
|
489
481
|
}
|
|
490
|
-
if (preset === preset_1.Preset.VueStandalone) {
|
|
491
|
-
appName = parsedArgs.appName ?? parsedArgs.name;
|
|
492
|
-
}
|
|
493
|
-
else {
|
|
494
|
-
appName = await determineAppName(parsedArgs);
|
|
495
|
-
}
|
|
496
|
-
e2eTestRunner = await determineE2eTestRunner(parsedArgs);
|
|
497
|
-
if (parsedArgs.style) {
|
|
498
|
-
style = parsedArgs.style;
|
|
499
|
-
}
|
|
500
|
-
else {
|
|
501
|
-
const reply = await enquirer.prompt([
|
|
502
|
-
{
|
|
503
|
-
name: 'style',
|
|
504
|
-
message: `Default stylesheet format`,
|
|
505
|
-
initial: 'css',
|
|
506
|
-
type: 'autocomplete',
|
|
507
|
-
choices: [
|
|
508
|
-
{
|
|
509
|
-
name: 'css',
|
|
510
|
-
message: 'CSS',
|
|
511
|
-
},
|
|
512
|
-
{
|
|
513
|
-
name: 'scss',
|
|
514
|
-
message: 'SASS(.scss) [ http://sass-lang.com ]',
|
|
515
|
-
},
|
|
516
|
-
{
|
|
517
|
-
name: 'less',
|
|
518
|
-
message: 'LESS [ http://lesscss.org ]',
|
|
519
|
-
},
|
|
520
|
-
{
|
|
521
|
-
name: 'none',
|
|
522
|
-
message: 'None',
|
|
523
|
-
},
|
|
524
|
-
],
|
|
525
|
-
},
|
|
526
|
-
]);
|
|
527
|
-
style = reply.style;
|
|
528
|
-
}
|
|
529
|
-
return { preset, style, appName, e2eTestRunner };
|
|
530
|
-
}
|
|
531
|
-
async function determineNuxtOptions(parsedArgs) {
|
|
532
|
-
let preset;
|
|
533
|
-
let style = undefined;
|
|
534
|
-
let appName;
|
|
535
|
-
let e2eTestRunner = undefined;
|
|
536
|
-
if (parsedArgs.preset) {
|
|
537
|
-
preset = parsedArgs.preset;
|
|
538
|
-
}
|
|
539
482
|
else {
|
|
540
483
|
const workspaceType = await determineStandaloneOrMonorepo();
|
|
541
484
|
if (workspaceType === 'standalone') {
|
|
542
|
-
|
|
485
|
+
appName = parsedArgs.appName ?? parsedArgs.name;
|
|
543
486
|
}
|
|
544
487
|
else {
|
|
545
|
-
|
|
488
|
+
appName = await determineAppName(parsedArgs);
|
|
489
|
+
}
|
|
490
|
+
const framework = await determineVueFramework(parsedArgs);
|
|
491
|
+
if (framework === 'nuxt') {
|
|
492
|
+
if (workspaceType === 'standalone') {
|
|
493
|
+
preset = preset_1.Preset.NuxtStandalone;
|
|
494
|
+
}
|
|
495
|
+
else {
|
|
496
|
+
preset = preset_1.Preset.Nuxt;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
else {
|
|
500
|
+
if (workspaceType === 'standalone') {
|
|
501
|
+
preset = preset_1.Preset.VueStandalone;
|
|
502
|
+
}
|
|
503
|
+
else {
|
|
504
|
+
preset = preset_1.Preset.VueMonorepo;
|
|
505
|
+
}
|
|
546
506
|
}
|
|
547
|
-
}
|
|
548
|
-
if (preset === preset_1.Preset.NuxtStandalone) {
|
|
549
|
-
appName = parsedArgs.appName ?? parsedArgs.name;
|
|
550
|
-
}
|
|
551
|
-
else {
|
|
552
|
-
appName = await determineAppName(parsedArgs);
|
|
553
507
|
}
|
|
554
508
|
e2eTestRunner = await determineE2eTestRunner(parsedArgs);
|
|
555
509
|
if (parsedArgs.style) {
|
|
@@ -910,6 +864,30 @@ async function determineNextAppDir(parsedArgs) {
|
|
|
910
864
|
]);
|
|
911
865
|
return reply.nextAppDir === 'Yes';
|
|
912
866
|
}
|
|
867
|
+
async function determineVueFramework(parsedArgs) {
|
|
868
|
+
if (!!parsedArgs.framework)
|
|
869
|
+
return parsedArgs.framework;
|
|
870
|
+
const reply = await enquirer.prompt([
|
|
871
|
+
{
|
|
872
|
+
name: 'framework',
|
|
873
|
+
message: 'What framework would you like to use?',
|
|
874
|
+
type: 'autocomplete',
|
|
875
|
+
choices: [
|
|
876
|
+
{
|
|
877
|
+
name: 'none',
|
|
878
|
+
message: 'None',
|
|
879
|
+
hint: ' I only want vue',
|
|
880
|
+
},
|
|
881
|
+
{
|
|
882
|
+
name: 'nuxt',
|
|
883
|
+
message: 'Nuxt [ https://nuxt.com/ ]',
|
|
884
|
+
},
|
|
885
|
+
],
|
|
886
|
+
initial: 'none',
|
|
887
|
+
},
|
|
888
|
+
]);
|
|
889
|
+
return reply.framework;
|
|
890
|
+
}
|
|
913
891
|
async function determineNodeFramework(parsedArgs) {
|
|
914
892
|
if (parsedArgs.framework)
|
|
915
893
|
return parsedArgs.framework;
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-nx-workspace",
|
|
3
|
-
"version": "17.2
|
|
3
|
+
"version": "17.3.0-beta.2",
|
|
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",
|
package/src/utils/nx/nx-cloud.js
CHANGED
|
@@ -7,18 +7,18 @@ const output_1 = require("../output");
|
|
|
7
7
|
const package_manager_1 = require("../package-manager");
|
|
8
8
|
const error_utils_1 = require("../error-utils");
|
|
9
9
|
async function setupNxCloud(directory, packageManager) {
|
|
10
|
-
const nxCloudSpinner = ora(`Setting up
|
|
10
|
+
const nxCloudSpinner = ora(`Setting up Nx Cloud`).start();
|
|
11
11
|
try {
|
|
12
12
|
const pmc = (0, package_manager_1.getPackageManagerCommand)(packageManager);
|
|
13
13
|
const res = await (0, child_process_utils_1.execAndWait)(`${pmc.exec} nx g nx:connect-to-nx-cloud --no-interactive --quiet`, directory);
|
|
14
|
-
nxCloudSpinner.succeed('
|
|
14
|
+
nxCloudSpinner.succeed('Nx Cloud has been set up successfully');
|
|
15
15
|
return res;
|
|
16
16
|
}
|
|
17
17
|
catch (e) {
|
|
18
18
|
nxCloudSpinner.fail();
|
|
19
19
|
if (e instanceof Error) {
|
|
20
20
|
output_1.output.error({
|
|
21
|
-
title: `Failed to setup
|
|
21
|
+
title: `Failed to setup Nx Cloud`,
|
|
22
22
|
bodyLines: (0, error_utils_1.mapErrorToBodyLines)(e),
|
|
23
23
|
});
|
|
24
24
|
}
|