create-unisphere-project 2.9.0 → 2.10.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,11 @@
1
1
  # create-unisphere-project
2
2
 
3
+ ## 2.10.0
4
+
5
+ ### Minor Changes
6
+
7
+ - improve communication of errors
8
+
3
9
  ## 2.9.0
4
10
 
5
11
  ### 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.10.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,33 @@
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
8
+ program
9
+ .name('create-unisphere-project')
10
+ .description('Create a new Unisphere project from template')
11
+ .version(require('../package.json').version || '1.0.0');
12
+ // Add the subcommand
13
+ (0, create_unisphere_repo_command_1.createCreateUnisphereRepoCommand)(program);
14
+ // Parse arguments
15
+ program.parse(process.argv);
16
+ // If no subcommand provided, show help
17
+ if (program.args.length === 0 && process.argv.length <= 2) {
18
+ console.log('');
19
+ console.log('Usage: npx @unisphere/create-unisphere-project create-unisphere-repo [options]');
20
+ console.log('');
21
+ console.log('Required options:');
22
+ console.log(' --company-name <name> Your company name (letters, hyphens, spaces)');
23
+ console.log(' --experience-name <name> Experience name (letters, hyphens, spaces)');
24
+ console.log(' --is-internal-product <bool> Is internal product (true or false)');
25
+ console.log('');
26
+ console.log('Example:');
27
+ console.log(' $ npx @unisphere/create-unisphere-project create-unisphere-repo \\');
28
+ console.log(' --company-name=acme \\');
29
+ console.log(' --experience-name=video \\');
30
+ console.log(' --is-internal-product=false');
31
+ console.log('');
32
+ console.log('For more information, run:');
33
+ console.log(' $ npx @unisphere/create-unisphere-project create-unisphere-repo --help');
34
+ console.log('');
35
+ }
@@ -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,OAkXF,CAAC"}
@@ -44,32 +44,52 @@ const createCreateUnisphereRepoCommand = (parentCommand) => {
44
44
  command
45
45
  .description('create a new unisphere repository from template')
46
46
  .option('--cwd <path>', 'The working directory', process.cwd())
47
- .option('--company-name <name>', 'The company name (letters, hyphens, and spaces only)')
47
+ .option('--company-name <name>', '[REQUIRED] The company name (letters, hyphens, and spaces only)')
48
48
  .addOption(nxpluginPathOption)
49
49
  .addOption(clipathOption)
50
50
  .addOption(skipTypesPackagesOption)
51
- .option('--experience-name <name>', 'The experience name (any format)')
52
- .option('--is-internal-product <boolean>', 'Is internal product')
51
+ .option('--experience-name <name>', '[REQUIRED] The experience name (letters, hyphens, and spaces only)')
52
+ .option('--is-internal-product <boolean>', '[REQUIRED] Is internal product (true or false)')
53
53
  .option('--verbose', 'Output debug logs', false)
54
+ .addHelpText('after', `
55
+ Examples:
56
+ $ npx @unisphere/create-unisphere-project --company-name=acme --experience-name=video --is-internal-product=false
57
+ $ npx @unisphere/create-unisphere-project --company-name="Acme Corp" --experience-name="Video Player" --is-internal-product=true
58
+
59
+ All three options (--company-name, --experience-name, --is-internal-product) are required.
60
+ `)
54
61
  .hook('preAction', utils_1.printVerboseHook)
55
62
  .action(async (options) => {
56
63
  const cwd = (0, path_1.resolve)(options.cwd || process.cwd());
57
64
  // Validate required options
58
65
  if (!options.companyName || !options.companyName.trim()) {
59
- throw new Error('--company-name is required');
66
+ throw new Error(`Missing required option: --company-name\n` +
67
+ ` Description: Your company name (letters, hyphens, and spaces only)\n` +
68
+ ` Example: npx @unisphere/create-unisphere-project --company-name=acme --experience-name=video --is-internal-product=false`);
60
69
  }
61
70
  if (!options.experienceName || !options.experienceName.trim()) {
62
- throw new Error('--experience-name is required');
71
+ throw new Error(`Missing required option: --experience-name\n` +
72
+ ` Description: The experience name for your project (letters, hyphens, and spaces only)\n` +
73
+ ` Example: npx @unisphere/create-unisphere-project --company-name=acme --experience-name=video --is-internal-product=false`);
63
74
  }
64
75
  if (typeof options.isInternalProduct === 'undefined') {
65
- throw new Error('--is-internal-product is required');
76
+ throw new Error(`Missing required option: --is-internal-product\n` +
77
+ ` Description: Whether this is an internal product (true or false)\n` +
78
+ ` Allowed values: true, false\n` +
79
+ ` Example: npx @unisphere/create-unisphere-project --company-name=acme --experience-name=video --is-internal-product=false`);
66
80
  }
67
81
  // Validate input formats
68
82
  if (!validateInput(options.companyName.trim())) {
69
- throw new Error('Company name can only contain letters, hyphens, and spaces');
83
+ throw new Error(`Invalid value for --company-name: '${options.companyName}'\n` +
84
+ ` Allowed format: letters, hyphens, and spaces only\n` +
85
+ ` Received: ${options.companyName}\n` +
86
+ ` Example: --company-name=acme or --company-name="Acme Corp"`);
70
87
  }
71
88
  if (!validateInput(options.experienceName.trim())) {
72
- throw new Error('Experience name can only contain letters, hyphens, and spaces');
89
+ throw new Error(`Invalid value for --experience-name: '${options.experienceName}'\n` +
90
+ ` Allowed format: letters, hyphens, and spaces only\n` +
91
+ ` Received: ${options.experienceName}\n` +
92
+ ` Example: --experience-name=video or --experience-name="Video Player"`);
73
93
  }
74
94
  // Assign validated values
75
95
  const _companyName = options.companyName;
@@ -202,7 +222,7 @@ legacy-peer-deps=true`);
202
222
  },
203
223
  {
204
224
  title: 'Create types package',
205
- skip: () => options.skipPackagesCreation,
225
+ skip: () => !!options.skipPackagesCreation,
206
226
  task: async (ctx, task) => {
207
227
  const packageName = options.nxpluginPath || '@unisphere/nx';
208
228
  const createTypesCommand = `npx nx g ${packageName}:add-package --packageName="types" --scope="${_isInternalProduct ? 'kaltura-corp' : 'unisphere'}" --no-interactive`;
@@ -232,7 +252,7 @@ legacy-peer-deps=true`);
232
252
  },
233
253
  {
234
254
  title: 'Create documentation site',
235
- skip: () => options.skipPackagesCreation,
255
+ skip: () => !!options.skipPackagesCreation,
236
256
  task: async (ctx, task) => {
237
257
  const packageName = options.nxpluginPath || '@unisphere/nx';
238
258
  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.10.0",
4
4
  "private": false,
5
5
  "main": "./dist/src/index.js",
6
6
  "types": "./dist/src/index.d.ts",