create-nx-workspace 17.1.0-beta.2 → 17.1.0-beta.3

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.
@@ -28,6 +28,8 @@ interface AngularArguments extends BaseArguments {
28
28
  routing: boolean;
29
29
  standaloneApi: boolean;
30
30
  e2eTestRunner: 'none' | 'cypress' | 'playwright';
31
+ bundler: 'webpack' | 'esbuild';
32
+ ssr: boolean;
31
33
  }
32
34
  interface VueArguments extends BaseArguments {
33
35
  stack: 'vue';
@@ -36,6 +38,13 @@ interface VueArguments extends BaseArguments {
36
38
  style: string;
37
39
  e2eTestRunner: 'none' | 'cypress' | 'playwright';
38
40
  }
41
+ interface NuxtArguments extends BaseArguments {
42
+ stack: 'nuxt';
43
+ workspaceType: 'standalone' | 'integrated';
44
+ appName: string;
45
+ style: string;
46
+ e2eTestRunner: 'none' | 'cypress' | 'playwright';
47
+ }
39
48
  interface NodeArguments extends BaseArguments {
40
49
  stack: 'node';
41
50
  workspaceType: 'standalone' | 'integrated';
@@ -46,6 +55,6 @@ interface NodeArguments extends BaseArguments {
46
55
  interface UnknownStackArguments extends BaseArguments {
47
56
  stack: 'unknown';
48
57
  }
49
- type Arguments = NoneArguments | ReactArguments | AngularArguments | VueArguments | NodeArguments | UnknownStackArguments;
58
+ type Arguments = NoneArguments | ReactArguments | AngularArguments | VueArguments | NuxtArguments | NodeArguments | UnknownStackArguments;
50
59
  export declare const commandsObject: yargs.Argv<Arguments>;
51
60
  export {};
@@ -32,6 +32,8 @@ 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)
35
37
  .map((p) => `"${p}"`)
36
38
  .join(', ')}]. To build your own see https://nx.dev/extending-nx/recipes/create-preset`,
37
39
  type: 'string',
@@ -57,10 +59,12 @@ exports.commandsObject = yargs
57
59
  .option('standaloneApi', {
58
60
  describe: chalk.dim `Use Standalone Components if generating an Angular app`,
59
61
  type: 'boolean',
62
+ default: true,
60
63
  })
61
64
  .option('routing', {
62
65
  describe: chalk.dim `Add a routing setup for an Angular app`,
63
66
  type: 'boolean',
67
+ default: true,
64
68
  })
65
69
  .option('bundler', {
66
70
  describe: chalk.dim `Bundler to be used to build the app`,
@@ -82,6 +86,10 @@ exports.commandsObject = yargs
82
86
  describe: chalk.dim `Test runner to use for end to end (E2E) tests.`,
83
87
  choices: ['cypress', 'playwright', 'none'],
84
88
  type: 'string',
89
+ })
90
+ .option('ssr', {
91
+ describe: chalk.dim `Enable Server-Side Rendering (SSR) and Static Site Generation (SSG/Prerendering) for the Angular application`,
92
+ type: 'boolean',
85
93
  }), yargs_options_1.withNxCloud, yargs_options_1.withCI, yargs_options_1.withAllPrompts, yargs_options_1.withPackageManager, yargs_options_1.withGitOptions), async function handler(argv) {
86
94
  await main(argv).catch((error) => {
87
95
  const { version } = require('../package.json');
@@ -242,6 +250,9 @@ async function determineStack(parsedArgs) {
242
250
  case preset_1.Preset.VueStandalone:
243
251
  case preset_1.Preset.VueMonorepo:
244
252
  return 'vue';
253
+ case preset_1.Preset.NuxtStandalone:
254
+ case preset_1.Preset.Nuxt:
255
+ return 'nuxt';
245
256
  case preset_1.Preset.Nest:
246
257
  case preset_1.Preset.NodeStandalone:
247
258
  case preset_1.Preset.Express:
@@ -299,6 +310,8 @@ async function determinePresetOptions(parsedArgs) {
299
310
  return determineAngularOptions(parsedArgs);
300
311
  case 'vue':
301
312
  return determineVueOptions(parsedArgs);
313
+ case 'nuxt':
314
+ return determineNuxtOptions(parsedArgs);
302
315
  case 'node':
303
316
  return determineNodeOptions(parsedArgs);
304
317
  default:
@@ -515,33 +528,30 @@ async function determineVueOptions(parsedArgs) {
515
528
  }
516
529
  return { preset, style, appName, e2eTestRunner };
517
530
  }
518
- async function determineAngularOptions(parsedArgs) {
531
+ async function determineNuxtOptions(parsedArgs) {
519
532
  let preset;
520
- let style;
533
+ let style = undefined;
521
534
  let appName;
522
- let standaloneApi;
523
535
  let e2eTestRunner = undefined;
524
- let routing;
525
- if (parsedArgs.preset && parsedArgs.preset !== preset_1.Preset.Angular) {
536
+ if (parsedArgs.preset) {
526
537
  preset = parsedArgs.preset;
527
- if (preset === preset_1.Preset.AngularStandalone) {
528
- appName = parsedArgs.name;
529
- }
530
- else {
531
- appName = await determineAppName(parsedArgs);
532
- }
533
538
  }
534
539
  else {
535
540
  const workspaceType = await determineStandaloneOrMonorepo();
536
541
  if (workspaceType === 'standalone') {
537
- preset = preset_1.Preset.AngularStandalone;
538
- appName = parsedArgs.name;
542
+ preset = preset_1.Preset.NuxtStandalone;
539
543
  }
540
544
  else {
541
- preset = preset_1.Preset.AngularMonorepo;
542
- appName = await determineAppName(parsedArgs);
545
+ preset = preset_1.Preset.Nuxt;
543
546
  }
544
547
  }
548
+ if (preset === preset_1.Preset.NuxtStandalone) {
549
+ appName = parsedArgs.appName ?? parsedArgs.name;
550
+ }
551
+ else {
552
+ appName = await determineAppName(parsedArgs);
553
+ }
554
+ e2eTestRunner = await determineE2eTestRunner(parsedArgs);
545
555
  if (parsedArgs.style) {
546
556
  style = parsedArgs.style;
547
557
  }
@@ -565,57 +575,124 @@ async function determineAngularOptions(parsedArgs) {
565
575
  name: 'less',
566
576
  message: 'LESS [ http://lesscss.org ]',
567
577
  },
578
+ {
579
+ name: 'none',
580
+ message: 'None',
581
+ },
568
582
  ],
569
583
  },
570
584
  ]);
571
585
  style = reply.style;
572
586
  }
573
- e2eTestRunner = await determineE2eTestRunner(parsedArgs);
574
- if (parsedArgs.standaloneApi !== undefined) {
575
- standaloneApi = parsedArgs.standaloneApi;
587
+ return { preset, style, appName, e2eTestRunner };
588
+ }
589
+ async function determineAngularOptions(parsedArgs) {
590
+ let preset;
591
+ let style;
592
+ let appName;
593
+ let e2eTestRunner = undefined;
594
+ let bundler = undefined;
595
+ let ssr = undefined;
596
+ const standaloneApi = parsedArgs.standaloneApi;
597
+ const routing = parsedArgs.routing;
598
+ if (parsedArgs.preset && parsedArgs.preset !== preset_1.Preset.Angular) {
599
+ preset = parsedArgs.preset;
600
+ if (preset === preset_1.Preset.AngularStandalone) {
601
+ appName = parsedArgs.name;
602
+ }
603
+ else {
604
+ appName = await determineAppName(parsedArgs);
605
+ }
606
+ }
607
+ else {
608
+ const workspaceType = await determineStandaloneOrMonorepo();
609
+ if (workspaceType === 'standalone') {
610
+ preset = preset_1.Preset.AngularStandalone;
611
+ appName = parsedArgs.name;
612
+ }
613
+ else {
614
+ preset = preset_1.Preset.AngularMonorepo;
615
+ appName = await determineAppName(parsedArgs);
616
+ }
617
+ }
618
+ if (parsedArgs.bundler) {
619
+ bundler = parsedArgs.bundler;
576
620
  }
577
621
  else {
578
622
  const reply = await enquirer.prompt([
579
623
  {
580
- name: 'standaloneApi',
581
- message: 'Would you like to use Standalone Components in your application?',
624
+ name: 'bundler',
625
+ message: `Which bundler would you like to use?`,
582
626
  type: 'autocomplete',
583
627
  choices: [
584
628
  {
585
- name: 'No',
629
+ name: 'esbuild',
630
+ message: 'esbuild [ https://esbuild.github.io/ ]',
586
631
  },
587
632
  {
588
- name: 'Yes',
633
+ name: 'webpack',
634
+ message: 'Webpack [ https://webpack.js.org/ ]',
589
635
  },
590
636
  ],
591
- initial: 'No',
637
+ initial: 'esbuild',
592
638
  },
593
639
  ]);
594
- standaloneApi = reply.standaloneApi === 'Yes';
640
+ bundler = reply.bundler;
595
641
  }
596
- if (parsedArgs.routing !== undefined) {
597
- routing = parsedArgs.routing;
642
+ if (parsedArgs.style) {
643
+ style = parsedArgs.style;
598
644
  }
599
645
  else {
600
646
  const reply = await enquirer.prompt([
601
647
  {
602
- name: 'routing',
603
- message: 'Would you like to add routing?',
648
+ name: 'style',
649
+ message: `Default stylesheet format`,
650
+ initial: 'css',
604
651
  type: 'autocomplete',
605
652
  choices: [
606
653
  {
607
- name: 'Yes',
654
+ name: 'css',
655
+ message: 'CSS',
608
656
  },
609
657
  {
610
- name: 'No',
658
+ name: 'scss',
659
+ message: 'SASS(.scss) [ http://sass-lang.com ]',
660
+ },
661
+ {
662
+ name: 'less',
663
+ message: 'LESS [ http://lesscss.org ]',
611
664
  },
612
665
  ],
613
- initial: 'Yes',
614
666
  },
615
667
  ]);
616
- routing = reply.routing === 'Yes';
668
+ style = reply.style;
617
669
  }
618
- return { preset, style, appName, standaloneApi, routing, e2eTestRunner };
670
+ if (parsedArgs.ssr !== undefined) {
671
+ ssr = parsedArgs.ssr;
672
+ }
673
+ else {
674
+ const reply = await enquirer.prompt([
675
+ {
676
+ name: 'ssr',
677
+ message: 'Do you want to enable Server-Side Rendering (SSR) and Static Site Generation (SSG/Prerendering)?',
678
+ type: 'autocomplete',
679
+ choices: [{ name: 'Yes' }, { name: 'No' }],
680
+ initial: 'No',
681
+ },
682
+ ]);
683
+ ssr = reply.ssr === 'Yes';
684
+ }
685
+ e2eTestRunner = await determineE2eTestRunner(parsedArgs);
686
+ return {
687
+ preset,
688
+ style,
689
+ appName,
690
+ standaloneApi,
691
+ routing,
692
+ e2eTestRunner,
693
+ bundler,
694
+ ssr,
695
+ };
619
696
  }
620
697
  async function determineNodeOptions(parsedArgs) {
621
698
  let preset;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-nx-workspace",
3
- "version": "17.1.0-beta.2",
3
+ "version": "17.1.0-beta.3",
4
4
  "private": false,
5
5
  "description": "Smart, Fast and Extensible Build System",
6
6
  "repository": {
@@ -23,6 +23,10 @@ exports.presetOptions = [
23
23
  name: preset_1.Preset.VueMonorepo,
24
24
  message: 'vue [a monorepo with a single Vue application]',
25
25
  },
26
+ {
27
+ name: preset_1.Preset.Nuxt,
28
+ message: 'nuxt [a monorepo with a single Nuxt application]',
29
+ },
26
30
  {
27
31
  name: preset_1.Preset.NextJs,
28
32
  message: 'next.js [a monorepo with a single Next.js application]',
@@ -11,6 +11,8 @@ export declare enum Preset {
11
11
  ReactStandalone = "react-standalone",
12
12
  VueMonorepo = "vue-monorepo",
13
13
  VueStandalone = "vue-standalone",
14
+ Nuxt = "nuxt",
15
+ NuxtStandalone = "nuxt-standalone",
14
16
  NextJs = "next",
15
17
  NextJsStandalone = "nextjs-standalone",
16
18
  ReactNative = "react-native",
@@ -15,6 +15,8 @@ var Preset;
15
15
  Preset["ReactStandalone"] = "react-standalone";
16
16
  Preset["VueMonorepo"] = "vue-monorepo";
17
17
  Preset["VueStandalone"] = "vue-standalone";
18
+ Preset["Nuxt"] = "nuxt";
19
+ Preset["NuxtStandalone"] = "nuxt-standalone";
18
20
  Preset["NextJs"] = "next";
19
21
  Preset["NextJsStandalone"] = "nextjs-standalone";
20
22
  Preset["ReactNative"] = "react-native";