@oinone/cli 7.2.1 ā 7.2.3
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/bin/cli.js +33 -32
- package/package.json +7 -3
- package/template-7.2.0-community/packages/ss-admin-widget/rollup.config.js +2 -0
- package/template-7.2.0-community/packages/ss-oinone/rollup.config.js +2 -0
- package/template-7.2.0-community/packages/ss-project/rollup.config.js +2 -0
- package/template-7.2.0-enterprise/packages/ss-admin-widget/rollup.config.js +2 -0
- package/template-7.2.0-enterprise/packages/ss-oinone/rollup.config.js +2 -0
- package/template-7.2.0-enterprise/packages/ss-project/rollup.config.js +2 -0
package/bin/cli.js
CHANGED
|
@@ -33,7 +33,7 @@ const downloadAndExtractZip = (url, targetDir) => {
|
|
|
33
33
|
const cachedZipPath = path.join(cacheDir, `static-resources-${etag}.zip`);
|
|
34
34
|
|
|
35
35
|
if (fs.existsSync(cachedZipPath)) {
|
|
36
|
-
console.log(chalk.cyan('Using cached static resources...'));
|
|
36
|
+
console.log(chalk.cyan('ā” Zap! Using cached static resources...'));
|
|
37
37
|
try {
|
|
38
38
|
const zip = new AdmZip(cachedZipPath);
|
|
39
39
|
zip.extractAllTo(targetDir, true);
|
|
@@ -70,7 +70,7 @@ const downloadAndExtractZip = (url, targetDir) => {
|
|
|
70
70
|
let startTime = Date.now();
|
|
71
71
|
|
|
72
72
|
const progressBar = new cliProgress.SingleBar({
|
|
73
|
-
format: chalk.cyan('
|
|
73
|
+
format: chalk.cyan('š Fetching awesomeness ') + `[{bar}] {percentage}% | ā³ {eta}s left | š¦ {value}/{total} ${unit} | šØ {speed} {speedUnit}/s`,
|
|
74
74
|
barCompleteChar: '\u2588',
|
|
75
75
|
barIncompleteChar: '\u2591',
|
|
76
76
|
hideCursor: true,
|
|
@@ -155,9 +155,9 @@ cacheCmd
|
|
|
155
155
|
const cacheDir = path.join(os.tmpdir(), 'oinone-cli-cache');
|
|
156
156
|
if (fs.existsSync(cacheDir)) {
|
|
157
157
|
fs.removeSync(cacheDir);
|
|
158
|
-
console.log(chalk.green(
|
|
158
|
+
console.log(chalk.green(`⨠Whoosh! Cache swept clean at ${cacheDir}`));
|
|
159
159
|
} else {
|
|
160
|
-
console.log(chalk.yellow(
|
|
160
|
+
console.log(chalk.yellow(`𤷠Cache directory already vanished (or never existed): ${cacheDir}`));
|
|
161
161
|
}
|
|
162
162
|
});
|
|
163
163
|
|
|
@@ -166,13 +166,13 @@ cacheCmd
|
|
|
166
166
|
.description('Print cache directory information')
|
|
167
167
|
.action(async () => {
|
|
168
168
|
const cacheDir = path.join(os.tmpdir(), 'oinone-cli-cache');
|
|
169
|
-
console.log(chalk.cyan('Cache Directory: ') + cacheDir);
|
|
169
|
+
console.log(chalk.cyan('š Cache Directory: ') + cacheDir);
|
|
170
170
|
|
|
171
171
|
if (fs.existsSync(cacheDir)) {
|
|
172
172
|
const files = await fs.readdir(cacheDir);
|
|
173
173
|
let totalSize = 0;
|
|
174
174
|
|
|
175
|
-
console.log(chalk.cyan('Cached Files:'));
|
|
175
|
+
console.log(chalk.cyan('š¦ Cached Files:'));
|
|
176
176
|
for (const file of files) {
|
|
177
177
|
const filePath = path.join(cacheDir, file);
|
|
178
178
|
const stat = await fs.stat(filePath);
|
|
@@ -185,7 +185,7 @@ cacheCmd
|
|
|
185
185
|
displaySize = `${Math.round(stat.size / 1024)} KB`;
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
-
console.log(` - ${file} (${displaySize})`);
|
|
188
|
+
console.log(` - š ${file} (${displaySize})`);
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
let totalDisplaySize = '';
|
|
@@ -195,9 +195,9 @@ cacheCmd
|
|
|
195
195
|
totalDisplaySize = `${Math.round(totalSize / 1024)} KB`;
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
-
console.log(chalk.cyan(
|
|
198
|
+
console.log(chalk.cyan(`\nš Total Cache Size: `) + totalDisplaySize);
|
|
199
199
|
} else {
|
|
200
|
-
console.log(chalk.yellow('Cache is currently empty.'));
|
|
200
|
+
console.log(chalk.yellow('š Cache is currently as empty as space.'));
|
|
201
201
|
}
|
|
202
202
|
});
|
|
203
203
|
|
|
@@ -238,47 +238,47 @@ program
|
|
|
238
238
|
{
|
|
239
239
|
type: 'input',
|
|
240
240
|
name: 'companyName',
|
|
241
|
-
message: '
|
|
241
|
+
message: 'š¢ What is your awesome company/org name? (e.g. ss):',
|
|
242
242
|
default: 'ss',
|
|
243
243
|
validate: (input) => {
|
|
244
|
-
if (input.trim() === '') return 'Company name cannot be empty
|
|
244
|
+
if (input.trim() === '') return 'Oops! Company name cannot be empty š';
|
|
245
245
|
return true;
|
|
246
246
|
},
|
|
247
247
|
},
|
|
248
248
|
{
|
|
249
249
|
type: 'input',
|
|
250
250
|
name: 'projectName',
|
|
251
|
-
message: '
|
|
251
|
+
message: 'š Name your epic project (e.g. oms):',
|
|
252
252
|
default: 'oms',
|
|
253
253
|
validate: (input) => {
|
|
254
|
-
if (input.trim() === '') return 'Project name cannot be empty
|
|
254
|
+
if (input.trim() === '') return 'Hold on! Project name cannot be empty š';
|
|
255
255
|
return true;
|
|
256
256
|
},
|
|
257
257
|
},
|
|
258
258
|
{
|
|
259
259
|
type: 'list',
|
|
260
260
|
name: 'edition',
|
|
261
|
-
message: '
|
|
261
|
+
message: 'š Choose your Oinone flavor:',
|
|
262
262
|
choices: [
|
|
263
|
-
{ name: 'Community Edition (Default)', value: 'community' },
|
|
264
|
-
{ name: 'Enterprise Edition', value: 'enterprise' }
|
|
263
|
+
{ name: 'š± Community Edition (Default)', value: 'community' },
|
|
264
|
+
{ name: 'š Enterprise Edition', value: 'enterprise' }
|
|
265
265
|
],
|
|
266
266
|
default: 'community'
|
|
267
267
|
},
|
|
268
268
|
{
|
|
269
269
|
type: 'list',
|
|
270
270
|
name: 'oinoneVersion',
|
|
271
|
-
message: '
|
|
271
|
+
message: 'š¦ Which Oinone version are we rocking today?',
|
|
272
272
|
choices: [
|
|
273
|
-
{ name: '7.2.0 (Default)', value: '~7.2.0' },
|
|
274
|
-
{ name: '6.4.0', value: '~6.4.0' }
|
|
273
|
+
{ name: '⨠7.2.0 (Default)', value: '~7.2.0' },
|
|
274
|
+
{ name: 'š°ļø 6.4.0', value: '~6.4.0' }
|
|
275
275
|
],
|
|
276
276
|
default: '~7.2.0'
|
|
277
277
|
},
|
|
278
278
|
{
|
|
279
279
|
type: 'confirm',
|
|
280
280
|
name: 'downloadStaticResources',
|
|
281
|
-
message: '
|
|
281
|
+
message: 'š„ Shall we fetch the latest static resources for you? (Highly recommended! š)',
|
|
282
282
|
default: true
|
|
283
283
|
}
|
|
284
284
|
]);
|
|
@@ -293,17 +293,17 @@ program
|
|
|
293
293
|
const targetPath = path.resolve(process.cwd(), fullProjectName);
|
|
294
294
|
|
|
295
295
|
if (fs.existsSync(targetPath)) {
|
|
296
|
-
console.log(chalk.red(`\
|
|
296
|
+
console.log(chalk.red(`\nš« Yikes! The directory ${fullProjectName} already exists. Try a different name or clear the path.\n`));
|
|
297
297
|
process.exit(1);
|
|
298
298
|
}
|
|
299
299
|
|
|
300
|
-
const spinner = ora('
|
|
300
|
+
const spinner = ora('⨠Weaving magic to create your project...').start();
|
|
301
301
|
|
|
302
302
|
const versionDir = oinoneVersion.replace(/[^0-9.]/g, ''); // Extract '7.2.0' or '6.4.0'
|
|
303
303
|
const templatePath = path.resolve(__dirname, `../template-${versionDir}-${edition}`);
|
|
304
304
|
|
|
305
305
|
if (!fs.existsSync(templatePath)) {
|
|
306
|
-
spinner.fail(chalk.red(
|
|
306
|
+
spinner.fail(chalk.red(`š¢ Uh-oh! Template for version ${oinoneVersion} (${edition} edition) went missing in action.`));
|
|
307
307
|
process.exit(1);
|
|
308
308
|
}
|
|
309
309
|
|
|
@@ -394,34 +394,35 @@ program
|
|
|
394
394
|
}
|
|
395
395
|
|
|
396
396
|
if (downloadStaticResources) {
|
|
397
|
-
spinner.succeed(chalk.green('Project structure
|
|
398
|
-
console.log(chalk.cyan('
|
|
397
|
+
spinner.succeed(chalk.green('š Boom! Project structure is ready!'));
|
|
398
|
+
console.log(chalk.cyan('š Hauling in the static resources...'));
|
|
399
399
|
try {
|
|
400
400
|
const ossDir = path.join(targetPath, 'packages', `${prefix}-boot`, 'public', 'oss');
|
|
401
401
|
await fs.ensureDir(ossDir);
|
|
402
402
|
await downloadAndExtractZip('https://pamirs.oss-cn-hangzhou.aliyuncs.com/oinone/installer/static-resources.zip', ossDir);
|
|
403
|
-
console.log(chalk.green('
|
|
403
|
+
console.log(chalk.green('šÆ Bullseye! Static resources downloaded and ready to roll!'));
|
|
404
404
|
} catch (err) {
|
|
405
|
-
console.log(chalk.yellow(`ā ļø
|
|
405
|
+
console.log(chalk.yellow(`ā ļø Project is ready, but the static resources had a hiccup: ${err.message}`));
|
|
406
406
|
}
|
|
407
407
|
} else {
|
|
408
|
-
spinner.succeed(chalk.green('Project created successfully!'));
|
|
408
|
+
spinner.succeed(chalk.green('š Boom! Project created successfully!'));
|
|
409
409
|
const relativeOssDir = `packages/${prefix}-boot/public/oss`;
|
|
410
|
-
console.log(chalk.yellow(`\nā ļø You chose
|
|
411
|
-
console.log(chalk.yellow(`
|
|
410
|
+
console.log(chalk.yellow(`\nā ļø You chose to skip the static resources download.`));
|
|
411
|
+
console.log(chalk.yellow(`Don't forget to grab them manually before you fire up the project:`));
|
|
412
412
|
console.log(chalk.cyan(` mkdir -p ${fullProjectName}/${relativeOssDir}`));
|
|
413
413
|
console.log(chalk.cyan(` curl -L https://pamirs.oss-cn-hangzhou.aliyuncs.com/oinone/installer/static-resources.zip -o static-resources.zip`));
|
|
414
414
|
console.log(chalk.cyan(` unzip static-resources.zip -d ${fullProjectName}/${relativeOssDir}`));
|
|
415
415
|
console.log(chalk.cyan(` rm static-resources.zip`));
|
|
416
416
|
}
|
|
417
417
|
|
|
418
|
-
console.log(`\
|
|
418
|
+
console.log(`\nš Let's get this party started:\n`);
|
|
419
419
|
console.log(chalk.cyan(` cd ${fullProjectName}`));
|
|
420
420
|
console.log(chalk.cyan(` pnpm install`));
|
|
421
421
|
console.log(chalk.cyan(` pnpm run dev\n`));
|
|
422
|
+
console.log(chalk.magenta(`Happy coding! š»ā\n`));
|
|
422
423
|
|
|
423
424
|
} catch (error) {
|
|
424
|
-
console.error(chalk.red(`\
|
|
425
|
+
console.error(chalk.red(`\nš„ Oops! Something broke: ${error.message}\n`));
|
|
425
426
|
process.exit(1);
|
|
426
427
|
}
|
|
427
428
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oinone/cli",
|
|
3
|
-
"version": "7.2.
|
|
3
|
+
"version": "7.2.3",
|
|
4
4
|
"description": "CLI tool to generate Oinone Frontend Template",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -9,8 +9,12 @@
|
|
|
9
9
|
"scripts": {
|
|
10
10
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
11
11
|
},
|
|
12
|
-
"keywords": [
|
|
13
|
-
|
|
12
|
+
"keywords": [
|
|
13
|
+
"oinone",
|
|
14
|
+
"oinone-frontend",
|
|
15
|
+
"cli"
|
|
16
|
+
],
|
|
17
|
+
"author": "oinone",
|
|
14
18
|
"license": "ISC",
|
|
15
19
|
"dependencies": {
|
|
16
20
|
"adm-zip": "^0.5.17",
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import pkg from './package.json' with { type: 'json' };
|
|
1
2
|
import CompileConfigBuilder from '@oinone/kunlun-compile';
|
|
2
3
|
|
|
3
4
|
export default CompileConfigBuilder.config()
|
|
4
5
|
.setLibraryName('ss-admin-widget')
|
|
6
|
+
.externalPkg(pkg)
|
|
5
7
|
.singleModule()
|
|
6
8
|
.replace()
|
|
7
9
|
.nodeResolve()
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import pkg from './package.json' with { type: 'json' };
|
|
1
2
|
import CompileConfigBuilder from '@oinone/kunlun-compile';
|
|
2
3
|
|
|
3
4
|
export default CompileConfigBuilder.config()
|
|
4
5
|
.setLibraryName('ss-oinone')
|
|
6
|
+
.externalPkg(pkg)
|
|
5
7
|
.singleModule()
|
|
6
8
|
.replace()
|
|
7
9
|
.nodeResolve()
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import pkg from './package.json' with { type: 'json' };
|
|
1
2
|
import CompileConfigBuilder from '@oinone/kunlun-compile';
|
|
2
3
|
|
|
3
4
|
export default CompileConfigBuilder.config()
|
|
4
5
|
.setLibraryName('ss-project')
|
|
6
|
+
.externalPkg(pkg)
|
|
5
7
|
.singleModule()
|
|
6
8
|
.replace()
|
|
7
9
|
.nodeResolve()
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import pkg from './package.json' with { type: 'json' };
|
|
1
2
|
import CompileConfigBuilder from '@oinone/kunlun-compile';
|
|
2
3
|
|
|
3
4
|
export default CompileConfigBuilder.config()
|
|
4
5
|
.setLibraryName('ss-admin-widget')
|
|
6
|
+
.externalPkg(pkg)
|
|
5
7
|
.singleModule()
|
|
6
8
|
.replace()
|
|
7
9
|
.nodeResolve()
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import pkg from './package.json' with { type: 'json' };
|
|
1
2
|
import CompileConfigBuilder from '@oinone/kunlun-compile';
|
|
2
3
|
|
|
3
4
|
export default CompileConfigBuilder.config()
|
|
4
5
|
.setLibraryName('ss-oinone')
|
|
6
|
+
.externalPkg(pkg)
|
|
5
7
|
.singleModule()
|
|
6
8
|
.replace()
|
|
7
9
|
.nodeResolve()
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import pkg from './package.json' with { type: 'json' };
|
|
1
2
|
import CompileConfigBuilder from '@oinone/kunlun-compile';
|
|
2
3
|
|
|
3
4
|
export default CompileConfigBuilder.config()
|
|
4
5
|
.setLibraryName('ss-project')
|
|
6
|
+
.externalPkg(pkg)
|
|
5
7
|
.singleModule()
|
|
6
8
|
.replace()
|
|
7
9
|
.nodeResolve()
|