create-unisphere-project 2.9.0 → 2.11.0

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/dist/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # create-unisphere-project
2
2
 
3
+ ## 2.11.0
4
+
5
+ ### Minor Changes
6
+
7
+ - release
8
+
9
+ ## 2.10.1
10
+
11
+ ### Patch Changes
12
+
13
+ - improved behavior
14
+
15
+ ## 2.10.0
16
+
17
+ ### Minor Changes
18
+
19
+ - improve communication of errors
20
+
3
21
  ## 2.9.0
4
22
 
5
23
  ### Minor Changes
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-unisphere-project",
3
- "version": "2.9.0",
3
+ "version": "2.11.0",
4
4
  "private": false,
5
5
  "main": "./dist/src/index.js",
6
6
  "types": "./dist/src/index.d.ts",
package/dist/src/index.js CHANGED
@@ -3,5 +3,8 @@
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  const create_unisphere_repo_command_1 = require("./lib/create-unisphere-repo-command");
5
5
  const commander_1 = require("commander");
6
- const command = (0, create_unisphere_repo_command_1.createCreateUnisphereRepoCommand)(new commander_1.Command());
7
- command.parse(process.argv);
6
+ const program = new commander_1.Command();
7
+ // Set up the main command with all options
8
+ (0, create_unisphere_repo_command_1.createCreateUnisphereRepoCommand)(program);
9
+ // Parse arguments
10
+ program.parse(process.argv);
@@ -1 +1 @@
1
- {"version":3,"file":"create-unisphere-repo-command.d.ts","sourceRoot":"","sources":["../../../src/lib/create-unisphere-repo-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AAqC5C,eAAO,MAAM,gCAAgC,GAC3C,eAAe,OAAO,KACrB,OA+UF,CAAC"}
1
+ {"version":3,"file":"create-unisphere-repo-command.d.ts","sourceRoot":"","sources":["../../../src/lib/create-unisphere-repo-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AAqC5C,eAAO,MAAM,gCAAgC,GAC3C,eAAe,OAAO,KACrB,OAqXF,CAAC"}
@@ -34,7 +34,8 @@ const validateInput = (name) => {
34
34
  return /^[a-zA-Z\s-]+$/.test(name);
35
35
  };
36
36
  const createCreateUnisphereRepoCommand = (parentCommand) => {
37
- const command = parentCommand.command('create-unisphere-repo');
37
+ // Configure the parent command directly
38
+ const command = parentCommand;
38
39
  const nxpluginPathOption = new commander_1.Option('--nxplugin-path <path>', 'path to local @unisphere/nx plugin for testing');
39
40
  nxpluginPathOption.hidden = true;
40
41
  const clipathOption = new commander_1.Option('--cli-path <path>', 'path to local @unisphere/cli package for testing');
@@ -42,34 +43,56 @@ const createCreateUnisphereRepoCommand = (parentCommand) => {
42
43
  const skipTypesPackagesOption = new commander_1.Option('--skip-packages-creation', 'skip types packages creation');
43
44
  skipTypesPackagesOption.hidden = true;
44
45
  command
45
- .description('create a new unisphere repository from template')
46
+ .name('create-unisphere-project')
47
+ .description('Scaffold a new Unisphere Nx monorepo with company and experience configuration')
48
+ .version(require('../../package.json').version || '1.0.0', '-v, --version', 'output the version number')
46
49
  .option('--cwd <path>', 'The working directory', process.cwd())
47
- .option('--company-name <name>', 'The company name (letters, hyphens, and spaces only)')
50
+ .option('--company-name <name>', '[REQUIRED] The company name (letters, hyphens, and spaces only)')
48
51
  .addOption(nxpluginPathOption)
49
52
  .addOption(clipathOption)
50
53
  .addOption(skipTypesPackagesOption)
51
- .option('--experience-name <name>', 'The experience name (any format)')
52
- .option('--is-internal-product <boolean>', 'Is internal product')
54
+ .option('--experience-name <name>', '[REQUIRED] The experience name (letters, hyphens, and spaces only)')
55
+ .option('--is-internal-product <boolean>', '[REQUIRED] Is internal product (true or false)')
53
56
  .option('--verbose', 'Output debug logs', false)
57
+ .addHelpText('after', `
58
+ Examples:
59
+ $ npx create-unisphere-project --company-name=acme --experience-name=video --is-internal-product=false
60
+ $ npx create-unisphere-project --company-name="Acme Corp" --experience-name="Video Player" --is-internal-product=true
61
+
62
+ All three options (--company-name, --experience-name, --is-internal-product) are required.
63
+ `)
54
64
  .hook('preAction', utils_1.printVerboseHook)
55
65
  .action(async (options) => {
56
66
  const cwd = (0, path_1.resolve)(options.cwd || process.cwd());
57
67
  // Validate required options
58
68
  if (!options.companyName || !options.companyName.trim()) {
59
- throw new Error('--company-name is required');
69
+ throw new Error(`Missing required option: --company-name\n` +
70
+ ` Description: Your company name (letters, hyphens, and spaces only)\n` +
71
+ ` Example: npx @unisphere/create-unisphere-project --company-name=acme --experience-name=video --is-internal-product=false`);
60
72
  }
61
73
  if (!options.experienceName || !options.experienceName.trim()) {
62
- throw new Error('--experience-name is required');
74
+ throw new Error(`Missing required option: --experience-name\n` +
75
+ ` Description: The experience name for your project (letters, hyphens, and spaces only)\n` +
76
+ ` Example: npx @unisphere/create-unisphere-project --company-name=acme --experience-name=video --is-internal-product=false`);
63
77
  }
64
78
  if (typeof options.isInternalProduct === 'undefined') {
65
- throw new Error('--is-internal-product is required');
79
+ throw new Error(`Missing required option: --is-internal-product\n` +
80
+ ` Description: Whether this is an internal product (true or false)\n` +
81
+ ` Allowed values: true, false\n` +
82
+ ` Example: npx @unisphere/create-unisphere-project --company-name=acme --experience-name=video --is-internal-product=false`);
66
83
  }
67
84
  // Validate input formats
68
85
  if (!validateInput(options.companyName.trim())) {
69
- throw new Error('Company name can only contain letters, hyphens, and spaces');
86
+ throw new Error(`Invalid value for --company-name: '${options.companyName}'\n` +
87
+ ` Allowed format: letters, hyphens, and spaces only\n` +
88
+ ` Received: ${options.companyName}\n` +
89
+ ` Example: --company-name=acme or --company-name="Acme Corp"`);
70
90
  }
71
91
  if (!validateInput(options.experienceName.trim())) {
72
- throw new Error('Experience name can only contain letters, hyphens, and spaces');
92
+ throw new Error(`Invalid value for --experience-name: '${options.experienceName}'\n` +
93
+ ` Allowed format: letters, hyphens, and spaces only\n` +
94
+ ` Received: ${options.experienceName}\n` +
95
+ ` Example: --experience-name=video or --experience-name="Video Player"`);
73
96
  }
74
97
  // Assign validated values
75
98
  const _companyName = options.companyName;
@@ -202,7 +225,7 @@ legacy-peer-deps=true`);
202
225
  },
203
226
  {
204
227
  title: 'Create types package',
205
- skip: () => options.skipPackagesCreation,
228
+ skip: () => !!options.skipPackagesCreation,
206
229
  task: async (ctx, task) => {
207
230
  const packageName = options.nxpluginPath || '@unisphere/nx';
208
231
  const createTypesCommand = `npx nx g ${packageName}:add-package --packageName="types" --scope="${_isInternalProduct ? 'kaltura-corp' : 'unisphere'}" --no-interactive`;
@@ -232,7 +255,7 @@ legacy-peer-deps=true`);
232
255
  },
233
256
  {
234
257
  title: 'Create documentation site',
235
- skip: () => options.skipPackagesCreation,
258
+ skip: () => !!options.skipPackagesCreation,
236
259
  task: async (ctx, task) => {
237
260
  const packageName = options.nxpluginPath || '@unisphere/nx';
238
261
  const createDocumentationCommand = `npx nx g ${packageName}:add-documentation --isExperienceLevel --skipInstall --no-interactive`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-unisphere-project",
3
- "version": "2.9.0",
3
+ "version": "2.11.0",
4
4
  "private": false,
5
5
  "main": "./dist/src/index.js",
6
6
  "types": "./dist/src/index.d.ts",