@modern-js/create 3.0.2 ā 3.0.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/run.js +1 -1
- package/dist/index.js +19 -47
- package/package.json +3 -3
- package/template/package.json.handlebars +2 -15
package/bin/run.js
CHANGED
|
@@ -9,7 +9,7 @@ const __dirname = path.dirname(__filename);
|
|
|
9
9
|
const require = createRequire(import.meta.url);
|
|
10
10
|
|
|
11
11
|
const pkgInfo = require(path.join(__dirname, '../package.json'));
|
|
12
|
-
const srcPath =
|
|
12
|
+
const srcPath = './src/index.ts';
|
|
13
13
|
const distPath = pkgInfo.main;
|
|
14
14
|
const project = path.join(__dirname, '../tsconfig.json');
|
|
15
15
|
|
package/dist/index.js
CHANGED
|
@@ -446,18 +446,11 @@ const EN_LOCALE = {
|
|
|
446
446
|
},
|
|
447
447
|
message: {
|
|
448
448
|
welcome: 'š Welcome to Modern.js',
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
step2Desc: 'š§ Initialize Git repository:',
|
|
455
|
-
step2: ' git init',
|
|
456
|
-
step3Desc: 'š„ Install dependencies:',
|
|
457
|
-
step3: ' pnpm install',
|
|
458
|
-
step4Desc: 'ā” Start the development server:',
|
|
459
|
-
step4: ' pnpm start',
|
|
460
|
-
divider: 'ā'.repeat(50)
|
|
449
|
+
success: '⨠Created successfully!',
|
|
450
|
+
nextSteps: 'š Next steps:',
|
|
451
|
+
step1: 'cd {projectName}',
|
|
452
|
+
step2: 'pnpm install',
|
|
453
|
+
step3: 'pnpm dev'
|
|
461
454
|
},
|
|
462
455
|
help: {
|
|
463
456
|
title: 'š Modern.js Project Creator',
|
|
@@ -491,18 +484,11 @@ const ZH_LOCALE = {
|
|
|
491
484
|
},
|
|
492
485
|
message: {
|
|
493
486
|
welcome: 'š 欢čæä½æēØ Modern.js',
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
step2Desc: 'š§ åå§å Git ä»åŗļ¼',
|
|
500
|
-
step2: ' git init',
|
|
501
|
-
step3Desc: 'š„ å®č£
锹ē®ä¾čµļ¼',
|
|
502
|
-
step3: ' pnpm install',
|
|
503
|
-
step4Desc: 'ā” åÆåØå¼åęå”åØļ¼',
|
|
504
|
-
step4: ' pnpm start',
|
|
505
|
-
divider: 'ā'.repeat(50)
|
|
487
|
+
success: '⨠å建ęåļ¼',
|
|
488
|
+
nextSteps: 'š äøäøę„ļ¼',
|
|
489
|
+
step1: 'cd {projectName}',
|
|
490
|
+
step2: 'pnpm install',
|
|
491
|
+
step3: 'pnpm dev'
|
|
506
492
|
},
|
|
507
493
|
help: {
|
|
508
494
|
title: 'š Modern.js 锹ē®å建巄å
·',
|
|
@@ -645,7 +631,7 @@ async function main() {
|
|
|
645
631
|
const args = process.argv.slice(2);
|
|
646
632
|
if (args.includes('--help') || args.includes('-h')) return void showHelp();
|
|
647
633
|
if (args.includes('--version') || args.includes('-v')) return void showVersion();
|
|
648
|
-
console.log(i18n.t(localeKeys.message.welcome));
|
|
634
|
+
console.log(`\n${i18n.t(localeKeys.message.welcome)}\n`);
|
|
649
635
|
const { name: projectName, useCurrentDir } = await getProjectName();
|
|
650
636
|
const targetDir = useCurrentDir ? process.cwd() : node_path.isAbsolute(projectName) ? projectName : node_path.resolve(process.cwd(), projectName);
|
|
651
637
|
if (node_fs.existsSync(targetDir)) {
|
|
@@ -660,10 +646,6 @@ async function main() {
|
|
|
660
646
|
const createPackageJson = node_path.resolve(src_dirname, '..', 'package.json');
|
|
661
647
|
const createPackage = JSON.parse(node_fs.readFileSync(createPackageJson, 'utf-8'));
|
|
662
648
|
const version = createPackage.version || 'latest';
|
|
663
|
-
console.log('');
|
|
664
|
-
console.log(i18n.t(localeKeys.message.creating, {
|
|
665
|
-
projectName
|
|
666
|
-
}));
|
|
667
649
|
const subprojectFlag = detectSubprojectFlag();
|
|
668
650
|
const isSubproject = true === subprojectFlag;
|
|
669
651
|
copyTemplate(templateDir, targetDir, {
|
|
@@ -688,25 +670,15 @@ async function main() {
|
|
|
688
670
|
}
|
|
689
671
|
}
|
|
690
672
|
node_fs.writeFileSync(targetPackageJson, `${JSON.stringify(packageJson, null, 2)}\n`);
|
|
691
|
-
|
|
673
|
+
const dim = '\x1b[2m\x1b[3m';
|
|
674
|
+
const reset = '\x1b[0m';
|
|
675
|
+
console.log(`${i18n.t(localeKeys.message.success)}\n`);
|
|
692
676
|
console.log(i18n.t(localeKeys.message.nextSteps));
|
|
693
|
-
console.log(
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
}));
|
|
699
|
-
console.log('');
|
|
700
|
-
}
|
|
701
|
-
console.log(i18n.t(localeKeys.message.step2Desc));
|
|
702
|
-
console.log(i18n.t(localeKeys.message.step2));
|
|
703
|
-
console.log('');
|
|
704
|
-
console.log(i18n.t(localeKeys.message.step3Desc));
|
|
705
|
-
console.log(i18n.t(localeKeys.message.step3));
|
|
706
|
-
console.log('');
|
|
707
|
-
console.log(i18n.t(localeKeys.message.step4Desc));
|
|
708
|
-
console.log(i18n.t(localeKeys.message.step4));
|
|
709
|
-
console.log('');
|
|
677
|
+
if (!useCurrentDir) console.log(`${dim} ${i18n.t(localeKeys.message.step1, {
|
|
678
|
+
projectName
|
|
679
|
+
})}${reset}`);
|
|
680
|
+
console.log(`${dim} ${i18n.t(localeKeys.message.step2)}${reset}`);
|
|
681
|
+
console.log(`${dim} ${i18n.t(localeKeys.message.step3)}${reset}\n`);
|
|
710
682
|
}
|
|
711
683
|
function copyTemplate(src, dest, options) {
|
|
712
684
|
node_fs.mkdirSync(dest, {
|
package/package.json
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"engines": {
|
|
20
20
|
"node": ">=20"
|
|
21
21
|
},
|
|
22
|
-
"version": "3.0.
|
|
22
|
+
"version": "3.0.3",
|
|
23
23
|
"types": "./dist/types/index.d.ts",
|
|
24
24
|
"main": "./dist/index.js",
|
|
25
25
|
"bin": {
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"bin.js"
|
|
35
35
|
],
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@rslib/core": "0.19.
|
|
37
|
+
"@rslib/core": "0.19.6",
|
|
38
38
|
"@types/node": "^20",
|
|
39
39
|
"tsx": "^4.21.0",
|
|
40
40
|
"typescript": "^5",
|
|
41
|
-
"@modern-js/i18n-utils": "3.0.
|
|
41
|
+
"@modern-js/i18n-utils": "3.0.3",
|
|
42
42
|
"@modern-js/rslib": "2.68.10"
|
|
43
43
|
},
|
|
44
44
|
"publishConfig": {
|
|
@@ -2,24 +2,14 @@
|
|
|
2
2
|
"name": "{{packageName}}",
|
|
3
3
|
"version": "0.1.0",
|
|
4
4
|
"scripts": {
|
|
5
|
-
"reset": "npx rimraf node_modules ./**/node_modules",
|
|
6
5
|
"dev": "modern dev",
|
|
7
6
|
"build": "modern build",
|
|
8
7
|
"serve": "modern serve"{{#unless isSubproject}},
|
|
9
|
-
"lint": "biome check"
|
|
10
|
-
"prepare": "simple-git-hooks"{{/unless}}
|
|
8
|
+
"lint": "biome check"{{/unless}}
|
|
11
9
|
},
|
|
12
10
|
"engines": {
|
|
13
11
|
"node": ">=20"
|
|
14
|
-
}{{#unless isSubproject}},
|
|
15
|
-
"lint-staged": {
|
|
16
|
-
"*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}": [
|
|
17
|
-
"biome check --files-ignore-unknown=true"
|
|
18
|
-
]
|
|
19
12
|
},
|
|
20
|
-
"simple-git-hooks": {
|
|
21
|
-
"pre-commit": "npx lint-staged"
|
|
22
|
-
}{{/unless}},
|
|
23
13
|
"dependencies": {
|
|
24
14
|
"@modern-js/runtime": "{{version}}",
|
|
25
15
|
"react": "^19.2.3",
|
|
@@ -32,9 +22,6 @@
|
|
|
32
22
|
"typescript": "~5.7.3",
|
|
33
23
|
"@types/node": "^20",
|
|
34
24
|
"@types/react": "^19.1.8",
|
|
35
|
-
"@types/react-dom": "^19.1.6"
|
|
36
|
-
"lint-staged": "~15.4.0",
|
|
37
|
-
"simple-git-hooks": "^2.11.1"{{/unless}},
|
|
38
|
-
"rimraf": "^6.0.1"
|
|
25
|
+
"@types/react-dom": "^19.1.6"
|
|
39
26
|
}
|
|
40
27
|
}
|