create-nx-workspace 18.1.0-beta.0 → 18.1.0-beta.10

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');
@@ -448,6 +452,10 @@ async function determineReactOptions(parsedArgs) {
448
452
  name: 'less',
449
453
  message: 'LESS [ https://lesscss.org ]',
450
454
  },
455
+ {
456
+ name: 'tailwind',
457
+ message: 'tailwind [ https://tailwindcss.com ]',
458
+ },
451
459
  {
452
460
  name: 'styled-components',
453
461
  message: 'styled-components [ https://styled-components.com ]',
@@ -559,6 +567,21 @@ async function determineAngularOptions(parsedArgs) {
559
567
  let ssr = undefined;
560
568
  const standaloneApi = parsedArgs.standaloneApi;
561
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
+ }
562
585
  if (parsedArgs.preset && parsedArgs.preset !== preset_1.Preset.Angular) {
563
586
  preset = parsedArgs.preset;
564
587
  if (preset === preset_1.Preset.AngularStandalone) {
@@ -656,6 +679,7 @@ async function determineAngularOptions(parsedArgs) {
656
679
  e2eTestRunner,
657
680
  bundler,
658
681
  ssr,
682
+ prefix,
659
683
  };
660
684
  }
661
685
  async function determineNodeOptions(parsedArgs) {
@@ -907,7 +931,7 @@ async function determineVueFramework(parsedArgs) {
907
931
  {
908
932
  name: 'none',
909
933
  message: 'None',
910
- hint: ' I only want vue',
934
+ hint: ' I only want Vue',
911
935
  },
912
936
  {
913
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.0",
3
+ "version": "18.1.0-beta.10",
4
4
  "private": false,
5
5
  "description": "Smart Monorepos · Fast CI",
6
6
  "repository": {
@@ -39,7 +39,7 @@ async function setupNxCloud(directory, packageManager, nxCloud) {
39
39
  exports.setupNxCloud = setupNxCloud;
40
40
  function printNxCloudSuccessMessage(nxCloudOut) {
41
41
  // remove leading Nx carret and any new lines
42
- const logContent = nxCloudOut.split('> NX ')[1];
42
+ const logContent = nxCloudOut.split('NX ')[1];
43
43
  const indexOfTitleEnd = logContent.indexOf('\n');
44
44
  const title = logContent.slice(0, logContent.indexOf('\n')).trim();
45
45
  const bodyLines = logContent
@@ -16,7 +16,6 @@ export interface CLISuccessMessageConfig {
16
16
  bodyLines?: string[];
17
17
  }
18
18
  declare class CLIOutput {
19
- readonly X_PADDING = " ";
20
19
  /**
21
20
  * Longer dash character which forms more of a continuous line when place side to side
22
21
  * with itself, unlike the standard dash character
@@ -16,7 +16,6 @@ if ((0, is_ci_1.isCI)()) {
16
16
  }
17
17
  class CLIOutput {
18
18
  constructor() {
19
- this.X_PADDING = ' ';
20
19
  /**
21
20
  * Expose some color and other utility functions so that other parts of the codebase that need
22
21
  * more fine-grained control of message bodies are still using a centralized
@@ -40,7 +39,7 @@ class CLIOutput {
40
39
  */
41
40
  get VERTICAL_SEPARATOR() {
42
41
  let divider = '';
43
- for (let i = 0; i < process.stdout.columns - this.X_PADDING.length * 2; i++) {
42
+ for (let i = 0; i < process.stdout.columns - 1; i++) {
44
43
  divider += '\u2014';
45
44
  }
46
45
  return divider;
@@ -49,14 +48,14 @@ class CLIOutput {
49
48
  process.stdout.write(str);
50
49
  }
51
50
  writeOutputTitle({ color, title, }) {
52
- this.writeToStdOut(` ${this.applyCLIPrefix(color, title)}${os_1.EOL}`);
51
+ this.writeToStdOut(`${this.applyCLIPrefix(color, title)}${os_1.EOL}`);
53
52
  }
54
53
  writeOptionalOutputBody(bodyLines) {
55
54
  if (!bodyLines) {
56
55
  return;
57
56
  }
58
57
  this.addNewline();
59
- bodyLines.forEach((bodyLine) => this.writeToStdOut(` ${bodyLine}${os_1.EOL}`));
58
+ bodyLines.forEach((bodyLine) => this.writeToStdOut(`${bodyLine}${os_1.EOL}`));
60
59
  }
61
60
  setCliName(name) {
62
61
  this.cliName = name;
@@ -64,10 +63,10 @@ class CLIOutput {
64
63
  applyCLIPrefix(color = 'cyan', text) {
65
64
  let cliPrefix = '';
66
65
  if (chalk[color]) {
67
- cliPrefix = `${chalk[color]('>')} ${chalk.reset.inverse.bold[color](` ${this.cliName} `)}`;
66
+ cliPrefix = chalk.reset.inverse.bold[color](` ${this.cliName} `);
68
67
  }
69
68
  else {
70
- cliPrefix = `${chalk.keyword(color)('>')} ${chalk.reset.inverse.bold.keyword(color)(` ${this.cliName} `)}`;
69
+ cliPrefix = chalk.reset.inverse.bold.keyword(color)(` ${this.cliName} `);
71
70
  }
72
71
  return `${cliPrefix} ${text}`;
73
72
  }
@@ -80,7 +79,7 @@ class CLIOutput {
80
79
  this.addNewline();
81
80
  }
82
81
  addVerticalSeparatorWithoutNewLines(color = 'gray') {
83
- this.writeToStdOut(`${this.X_PADDING}${chalk.dim[color](this.VERTICAL_SEPARATOR)}${os_1.EOL}`);
82
+ this.writeToStdOut(`${chalk.dim[color](this.VERTICAL_SEPARATOR)}${os_1.EOL}`);
84
83
  }
85
84
  error({ title, bodyLines }) {
86
85
  this.addNewline();
@@ -12,7 +12,7 @@ function pointToTutorialAndCourse(preset) {
12
12
  output_1.output.note({
13
13
  title,
14
14
  bodyLines: [
15
- `https://nx.dev/getting-started/tutorials/package-based-repo-tutorial`,
15
+ `https://nx.dev/getting-started/tutorials/npm-workspaces-tutorial`,
16
16
  ],
17
17
  });
18
18
  break;