@ghini/xstart 26.1.3144738 → 26.1.5151627
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 +4 -16
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/index.d.ts +2 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +2 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/start.d.ts +3 -0
- package/dist/lib/start.d.ts.map +1 -0
- package/dist/lib/start.js +5 -0
- package/dist/lib/start.js.map +1 -0
- package/dist/main.d.ts +4 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +6 -0
- package/dist/main.js.map +1 -0
- package/dist/start.d.ts +3 -0
- package/dist/start.d.ts.map +1 -0
- package/dist/start.js +6 -0
- package/dist/start.js.map +1 -0
- package/package.json +11 -7
- package/.clinerules +0 -2
- package/build.js +0 -61
- package/test/0.js +0 -3
- package/tsconfig.json +0 -24
package/README.md
CHANGED
|
@@ -1,27 +1,14 @@
|
|
|
1
1
|
# 一个标准 TypeScript 2026 的 npm 库脚手架
|
|
2
2
|
|
|
3
|
-
### 开发
|
|
4
|
-
|
|
5
|
-
```bash
|
|
6
|
-
pnpm tsc --watch
|
|
7
|
-
pnpm type-check # 类型检查(不生成文件)
|
|
8
|
-
pnpm build # 编译 TypeScript + 打包 + 更新版本号
|
|
9
|
-
```
|
|
10
|
-
|
|
11
3
|
### 发布
|
|
12
4
|
|
|
13
5
|
```bash
|
|
6
|
+
pnpm build # 编译 TypeScript + 打包 + 更新版本号
|
|
7
|
+
pnpm checkpub # 检查发布内容
|
|
14
8
|
pnpm pub # 构建 + 发布到 npm + 提交 git
|
|
15
9
|
```
|
|
16
10
|
|
|
17
|
-
## 🔧
|
|
18
|
-
|
|
19
|
-
- `moduleResolution: "bundler"` - 2025 最新模块解析策略
|
|
20
|
-
- `verbatimModuleSyntax: true` - 严格 ESM 语法
|
|
21
|
-
- `strict: true` - 全部严格类型检查
|
|
22
|
-
- `declaration: true` - 自动生成类型声明
|
|
23
|
-
|
|
24
|
-
如果需要 pnpm 迁移:
|
|
11
|
+
## 🔧 如果需要 pnpm 迁移:
|
|
25
12
|
|
|
26
13
|
```ps1
|
|
27
14
|
pnpm import
|
|
@@ -36,6 +23,7 @@ pnpm tsc --watch
|
|
|
36
23
|
全文件替换 `xstart` 为新库名:
|
|
37
24
|
|
|
38
25
|
```bash
|
|
26
|
+
rm -rf .git
|
|
39
27
|
Remove-Item -Recurse -Force .git
|
|
40
28
|
git init
|
|
41
29
|
git add .
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../src/lib/start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,CAAC;AAEjB,iBAAS,KAAK,IAAI,IAAI,CAErB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start.js","sourceRoot":"","sources":["../../src/lib/start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,CAAC;AAEjB,SAAS,KAAK;IACZ,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;AACpC,CAAC"}
|
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";AACA,wBAEC;AACD,cAAc,gBAAgB,CAAC"}
|
package/dist/main.js
ADDED
package/dist/main.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AACxC,eAAe;IACb,GAAG,KAAK;CACT,CAAA;AACD,cAAc,gBAAgB,CAAC"}
|
package/dist/start.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../src/start.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,CAAC;AAEjB,iBAAS,KAAK,IAAI,IAAI,CAErB"}
|
package/dist/start.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start.js","sourceRoot":"","sources":["../src/start.ts"],"names":[],"mappings":"AAAA,WAAW;AACX,OAAO,EAAE,KAAK,EAAE,CAAC;AAEjB,SAAS,KAAK;IACZ,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;AACpC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,25 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ghini/xstart",
|
|
3
|
-
"version": "26.1.
|
|
3
|
+
"version": "26.1.5151627",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"author": "Ghini",
|
|
6
|
+
"license": "MIT",
|
|
4
7
|
"exports": {
|
|
5
8
|
".": {
|
|
6
|
-
"
|
|
7
|
-
"
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.js"
|
|
8
11
|
}
|
|
9
12
|
},
|
|
10
|
-
"type": "module",
|
|
11
|
-
"author": "Ghini",
|
|
12
|
-
"license": "MIT",
|
|
13
13
|
"publishConfig": {
|
|
14
14
|
"access": "public"
|
|
15
15
|
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"src"
|
|
19
|
+
],
|
|
16
20
|
"devDependencies": {
|
|
17
21
|
"@types/node": "^25.0.3",
|
|
18
22
|
"typescript": "^5.9.3"
|
|
19
23
|
},
|
|
20
24
|
"scripts": {
|
|
21
|
-
"type-check": "tsc --noEmit",
|
|
22
25
|
"build": "node ./build.js",
|
|
26
|
+
"checkpub": "pnpm pack --dry-run",
|
|
23
27
|
"pub": "pnpm build && pnpm publish --no-git-checks && git add . && git commit -m 'update' && git push"
|
|
24
28
|
}
|
|
25
29
|
}
|
package/.clinerules
DELETED
package/build.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
// build.js
|
|
2
|
-
import fs from 'fs';
|
|
3
|
-
import {execSync} from 'child_process';
|
|
4
|
-
const devDir = './dev';
|
|
5
|
-
const distDir = './dist';
|
|
6
|
-
const packageJsonPath = './package.json';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* 根据当前日期生成版本号。
|
|
10
|
-
* 格式:年.月.日时分秒 (例如: 25.7.3111405)
|
|
11
|
-
* @returns {string} 新的版本号。
|
|
12
|
-
*/
|
|
13
|
-
function generateVersionFromDate() {
|
|
14
|
-
const now = new Date();
|
|
15
|
-
const year = now.getFullYear().toString().slice(-2); // 获取年份后两位
|
|
16
|
-
const month = (now.getMonth() + 1).toString(); // 月份(1-12)
|
|
17
|
-
const day = now.getDate().toString(); // 日(1-31)
|
|
18
|
-
const hours = now.getHours().toString().padStart(2, '0'); // 小时(00-23)
|
|
19
|
-
const minutes = now.getMinutes().toString().padStart(2, '0'); // 分钟(00-59)
|
|
20
|
-
const seconds = now.getSeconds().toString().padStart(2, '0'); // 秒(00-59)
|
|
21
|
-
return `${year}.${month}.${day}${hours}${minutes}${seconds}`;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// --- 主要构建流程 ---
|
|
25
|
-
try {
|
|
26
|
-
console.log('🚀 开始执行构建流程...');
|
|
27
|
-
|
|
28
|
-
// 步骤 1: 清理旧的 'dist' 和 'dev' 目录
|
|
29
|
-
if (fs.existsSync(distDir)) {
|
|
30
|
-
console.log(`[1/3] 正在删除旧目录: ${distDir}`);
|
|
31
|
-
fs.rmSync(distDir, {recursive: true, force: true});
|
|
32
|
-
}
|
|
33
|
-
if (fs.existsSync(devDir)) {
|
|
34
|
-
console.log(`[1/3] 正在删除旧目录: ${devDir}`);
|
|
35
|
-
fs.rmSync(devDir, {recursive: true, force: true});
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// 步骤 2: 运行 TypeScript 编译
|
|
39
|
-
console.log(`[2/3] 正在编译 TypeScript...`);
|
|
40
|
-
execSync('pnpm tsc', {stdio: 'inherit'});
|
|
41
|
-
console.log('...TypeScript 编译完成。');
|
|
42
|
-
|
|
43
|
-
// 步骤 3: 更新 package.json 中的版本号
|
|
44
|
-
console.log(`[3/3] 正在更新 ${packageJsonPath} 中的版本号...`);
|
|
45
|
-
const packageJsonContent = fs.readFileSync(packageJsonPath, 'utf8');
|
|
46
|
-
const packageJson = JSON.parse(packageJsonContent);
|
|
47
|
-
|
|
48
|
-
const oldVersion = packageJson.version;
|
|
49
|
-
const newVersion = generateVersionFromDate();
|
|
50
|
-
packageJson.version = newVersion;
|
|
51
|
-
|
|
52
|
-
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
|
|
53
|
-
console.log(`...版本号已从 ${oldVersion} 更新为 ${newVersion}。`);
|
|
54
|
-
|
|
55
|
-
console.log('\n✅ 构建流程成功完成!');
|
|
56
|
-
} catch (error) {
|
|
57
|
-
console.error('\n❌ 构建流程失败:');
|
|
58
|
-
console.error(error.message);
|
|
59
|
-
// 以错误码退出,表示构建失败
|
|
60
|
-
process.exit(1);
|
|
61
|
-
}
|
package/test/0.js
DELETED
package/tsconfig.json
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"module": "ESNext",
|
|
5
|
-
"moduleResolution": "bundler",
|
|
6
|
-
"verbatimModuleSyntax": true,
|
|
7
|
-
"lib": ["ES2022"],
|
|
8
|
-
"types": ["node"],
|
|
9
|
-
"declaration": true,
|
|
10
|
-
"declarationMap": true,
|
|
11
|
-
"sourceMap": true,
|
|
12
|
-
"outDir": "./dist",
|
|
13
|
-
"rootDir": "./src",
|
|
14
|
-
"strict": true,
|
|
15
|
-
"esModuleInterop": true,
|
|
16
|
-
"skipLibCheck": true,
|
|
17
|
-
"forceConsistentCasingInFileNames": true,
|
|
18
|
-
"resolveJsonModule": true,
|
|
19
|
-
"isolatedModules": true,
|
|
20
|
-
"allowSyntheticDefaultImports": true
|
|
21
|
-
},
|
|
22
|
-
"include": ["src/**/*"],
|
|
23
|
-
"exclude": ["node_modules", "dist", "dev"]
|
|
24
|
-
}
|