create-unisphere-project 2.8.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/README.md +176 -0
- package/dist/CHANGELOG.md +13 -0
- package/dist/README.md +176 -0
- package/dist/_templates/unisphere-project/package-lock.json +38705 -0
- package/dist/_templates/unisphere-project/package.json +1 -1
- package/dist/package.json +1 -1
- package/dist/src/index.js +30 -2
- package/dist/src/lib/create-unisphere-repo-command.d.ts.map +1 -1
- package/dist/src/lib/create-unisphere-repo-command.js +41 -61
- package/package.json +1 -1
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@types/react-dom": "19.2.3",
|
|
43
43
|
"@typescript-eslint/eslint-plugin": "^7.3.0",
|
|
44
44
|
"@typescript-eslint/parser": "^7.3.0",
|
|
45
|
-
"@unisphere/nx": "3.
|
|
45
|
+
"@unisphere/nx": "3.24.0",
|
|
46
46
|
"@vitejs/plugin-react": "4.7.0",
|
|
47
47
|
"@vitest/coverage-v8": "^1.0.4",
|
|
48
48
|
"@vitest/ui": "^1.3.1",
|
package/dist/package.json
CHANGED
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
|
|
7
|
-
command
|
|
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;
|
|
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"}
|
|
@@ -11,7 +11,6 @@ const path_1 = require("path");
|
|
|
11
11
|
const fs_1 = require("fs");
|
|
12
12
|
const fs_extra_1 = require("fs-extra");
|
|
13
13
|
const overwrite_placeholders_1 = require("./overwrite-placeholders");
|
|
14
|
-
const inquirer = require("inquirer");
|
|
15
14
|
const child_process_1 = require("child_process");
|
|
16
15
|
const debug = (0, debug_1.default)('unisphere:template:create-unisphere-repo');
|
|
17
16
|
// Path to the local template directory (copied to dist during build)
|
|
@@ -45,76 +44,57 @@ const createCreateUnisphereRepoCommand = (parentCommand) => {
|
|
|
45
44
|
command
|
|
46
45
|
.description('create a new unisphere repository from template')
|
|
47
46
|
.option('--cwd <path>', 'The working directory', process.cwd())
|
|
48
|
-
.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)')
|
|
49
48
|
.addOption(nxpluginPathOption)
|
|
50
49
|
.addOption(clipathOption)
|
|
51
50
|
.addOption(skipTypesPackagesOption)
|
|
52
|
-
.option('--experience-name <name>', 'The experience name (
|
|
53
|
-
.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)')
|
|
54
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
|
+
`)
|
|
55
61
|
.hook('preAction', utils_1.printVerboseHook)
|
|
56
62
|
.action(async (options) => {
|
|
57
63
|
const cwd = (0, path_1.resolve)(options.cwd || process.cwd());
|
|
58
|
-
//
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const questions = [];
|
|
64
|
-
if (!_companyName) {
|
|
65
|
-
questions.push({
|
|
66
|
-
type: 'input',
|
|
67
|
-
name: 'companyName',
|
|
68
|
-
message: 'Enter company name:',
|
|
69
|
-
validate: (input) => {
|
|
70
|
-
if (!input || !input.trim()) {
|
|
71
|
-
return 'Company name is required';
|
|
72
|
-
}
|
|
73
|
-
if (!validateInput(input.trim())) {
|
|
74
|
-
return 'Company name can only contain letters, hyphens, and spaces';
|
|
75
|
-
}
|
|
76
|
-
return true;
|
|
77
|
-
},
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
if (typeof _isInternalProduct === 'undefined') {
|
|
81
|
-
questions.push({
|
|
82
|
-
type: 'confirm',
|
|
83
|
-
name: 'isInternalProduct',
|
|
84
|
-
message: 'Is this an internal product? (if you are not sure, select true)',
|
|
85
|
-
default: true,
|
|
86
|
-
});
|
|
64
|
+
// Validate required options
|
|
65
|
+
if (!options.companyName || !options.companyName.trim()) {
|
|
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`);
|
|
87
69
|
}
|
|
88
|
-
if (!
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
message: 'Enter experience name (unique name to be used in the unisphere marketplace):',
|
|
93
|
-
validate: (input) => {
|
|
94
|
-
if (!input || !input.trim()) {
|
|
95
|
-
return 'Experience name is required';
|
|
96
|
-
}
|
|
97
|
-
if (!validateInput(input.trim())) {
|
|
98
|
-
return 'Experience name can only contain letters, hyphens, and spaces';
|
|
99
|
-
}
|
|
100
|
-
return true;
|
|
101
|
-
},
|
|
102
|
-
});
|
|
70
|
+
if (!options.experienceName || !options.experienceName.trim()) {
|
|
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`);
|
|
103
74
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
_isInternalProduct = _isInternalProduct || answers.isInternalProduct;
|
|
75
|
+
if (typeof options.isInternalProduct === 'undefined') {
|
|
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`);
|
|
110
80
|
}
|
|
111
|
-
// Validate
|
|
112
|
-
if (
|
|
113
|
-
throw new Error(
|
|
81
|
+
// Validate input formats
|
|
82
|
+
if (!validateInput(options.companyName.trim())) {
|
|
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"`);
|
|
114
87
|
}
|
|
115
|
-
if (
|
|
116
|
-
throw new Error(
|
|
88
|
+
if (!validateInput(options.experienceName.trim())) {
|
|
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"`);
|
|
117
93
|
}
|
|
94
|
+
// Assign validated values
|
|
95
|
+
const _companyName = options.companyName;
|
|
96
|
+
const _experienceName = options.experienceName;
|
|
97
|
+
const _isInternalProduct = options.isInternalProduct;
|
|
118
98
|
const originalCompanyNameValue = _companyName;
|
|
119
99
|
debug(`Company name: ${_companyName}`);
|
|
120
100
|
debug(`Experience name: ${_experienceName}`);
|
|
@@ -242,7 +222,7 @@ legacy-peer-deps=true`);
|
|
|
242
222
|
},
|
|
243
223
|
{
|
|
244
224
|
title: 'Create types package',
|
|
245
|
-
skip: () => options.skipPackagesCreation,
|
|
225
|
+
skip: () => !!options.skipPackagesCreation,
|
|
246
226
|
task: async (ctx, task) => {
|
|
247
227
|
const packageName = options.nxpluginPath || '@unisphere/nx';
|
|
248
228
|
const createTypesCommand = `npx nx g ${packageName}:add-package --packageName="types" --scope="${_isInternalProduct ? 'kaltura-corp' : 'unisphere'}" --no-interactive`;
|
|
@@ -272,7 +252,7 @@ legacy-peer-deps=true`);
|
|
|
272
252
|
},
|
|
273
253
|
{
|
|
274
254
|
title: 'Create documentation site',
|
|
275
|
-
skip: () => options.skipPackagesCreation,
|
|
255
|
+
skip: () => !!options.skipPackagesCreation,
|
|
276
256
|
task: async (ctx, task) => {
|
|
277
257
|
const packageName = options.nxpluginPath || '@unisphere/nx';
|
|
278
258
|
const createDocumentationCommand = `npx nx g ${packageName}:add-documentation --isExperienceLevel --skipInstall --no-interactive`;
|