create-nx-workspace 18.1.0-beta.2 → 18.1.0-beta.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.
@@ -31,6 +31,7 @@ interface AngularArguments extends BaseArguments {
31
31
  e2eTestRunner: 'none' | 'cypress' | 'playwright';
32
32
  bundler: 'webpack' | 'esbuild';
33
33
  ssr: boolean;
34
+ prefix: string;
34
35
  }
35
36
  interface VueArguments extends BaseArguments {
36
37
  stack: 'vue';
@@ -92,6 +92,10 @@ exports.commandsObject = yargs
92
92
  .option('ssr', {
93
93
  describe: chalk.dim `Enable Server-Side Rendering (SSR) and Static Site Generation (SSG/Prerendering) for the Angular application`,
94
94
  type: 'boolean',
95
+ })
96
+ .option('prefix', {
97
+ describe: chalk.dim `Prefix to use for Angular component and directive selectors.`,
98
+ type: 'string',
95
99
  }), yargs_options_1.withNxCloud, yargs_options_1.withAllPrompts, yargs_options_1.withPackageManager, yargs_options_1.withGitOptions), async function handler(argv) {
96
100
  await main(argv).catch((error) => {
97
101
  const { version } = require('../package.json');
@@ -563,6 +567,21 @@ async function determineAngularOptions(parsedArgs) {
563
567
  let ssr = undefined;
564
568
  const standaloneApi = parsedArgs.standaloneApi;
565
569
  const routing = parsedArgs.routing;
570
+ const prefix = parsedArgs.prefix;
571
+ if (prefix) {
572
+ // https://github.com/angular/angular-cli/blob/main/packages/schematics/angular/utility/validation.ts#L11-L14
573
+ const htmlSelectorRegex = /^[a-zA-Z][.0-9a-zA-Z]*((:?-[0-9]+)*|(:?-[a-zA-Z][.0-9a-zA-Z]*(:?-[0-9]+)*)*)$/;
574
+ // validate whether component/directive selectors will be valid with the provided prefix
575
+ if (!htmlSelectorRegex.test(`${prefix}-placeholder`)) {
576
+ output_1.output.error({
577
+ title: `Failed to create a workspace.`,
578
+ bodyLines: [
579
+ `The provided "${prefix}" prefix is invalid. It must be a valid HTML selector.`,
580
+ ],
581
+ });
582
+ process.exit(1);
583
+ }
584
+ }
566
585
  if (parsedArgs.preset && parsedArgs.preset !== preset_1.Preset.Angular) {
567
586
  preset = parsedArgs.preset;
568
587
  if (preset === preset_1.Preset.AngularStandalone) {
@@ -660,6 +679,7 @@ async function determineAngularOptions(parsedArgs) {
660
679
  e2eTestRunner,
661
680
  bundler,
662
681
  ssr,
682
+ prefix,
663
683
  };
664
684
  }
665
685
  async function determineNodeOptions(parsedArgs) {
@@ -911,7 +931,7 @@ async function determineVueFramework(parsedArgs) {
911
931
  {
912
932
  name: 'none',
913
933
  message: 'None',
914
- hint: ' I only want vue',
934
+ hint: ' I only want Vue',
915
935
  },
916
936
  {
917
937
  name: 'nuxt',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-nx-workspace",
3
- "version": "18.1.0-beta.2",
3
+ "version": "18.1.0-beta.4",
4
4
  "private": false,
5
5
  "description": "Smart Monorepos · Fast CI",
6
6
  "repository": {