@ghini/xstart 25.12.29103740 → 25.12.29104833
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 +5 -5
- package/build.js +0 -30
- package/package.json +2 -3
package/README.md
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
# 一个标准 TypeScript
|
|
1
|
+
# 一个标准 TypeScript 2026 的 npm 库脚手架
|
|
2
2
|
|
|
3
3
|
### 开发
|
|
4
4
|
```bash
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
pnpm tsc --watch
|
|
6
|
+
pnpm type-check # 类型检查(不生成文件)
|
|
7
|
+
pnpm build # 编译 TypeScript + 打包 + 更新版本号
|
|
8
8
|
```
|
|
9
9
|
|
|
10
10
|
### 发布
|
|
11
11
|
```bash
|
|
12
|
-
|
|
12
|
+
pnpm pub # 构建 + 发布到 npm + 提交 git
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
## 🔧 TypeScript 配置亮点
|
package/build.js
CHANGED
|
@@ -1,39 +1,9 @@
|
|
|
1
1
|
// build.js
|
|
2
2
|
import fs from 'fs';
|
|
3
|
-
import path from 'path';
|
|
4
3
|
import { execSync } from 'child_process';
|
|
5
|
-
const srcDir = './src';
|
|
6
4
|
const devDir = './dev';
|
|
7
5
|
const distDir = './dist';
|
|
8
6
|
const packageJsonPath = './package.json';
|
|
9
|
-
/**
|
|
10
|
-
* 递归地复制一个目录及其所有内容。
|
|
11
|
-
* @param {string} src 源目录路径。
|
|
12
|
-
* @param {string} dest 目标目录路径。
|
|
13
|
-
*/
|
|
14
|
-
function copyDirRecursive(src, dest) {
|
|
15
|
-
const exists = fs.existsSync(src);
|
|
16
|
-
if (!exists) {
|
|
17
|
-
console.error(`错误:源目录 "${src}" 不存在。`);
|
|
18
|
-
throw new Error(`源目录 ${src} 未找到。`);
|
|
19
|
-
}
|
|
20
|
-
const stats = fs.statSync(src);
|
|
21
|
-
const isDirectory = stats.isDirectory();
|
|
22
|
-
if (isDirectory) {
|
|
23
|
-
// 如果是目录,创建目标目录
|
|
24
|
-
fs.mkdirSync(dest, { recursive: true });
|
|
25
|
-
// 读取源目录中的所有项,并对每一项进行递归调用
|
|
26
|
-
fs.readdirSync(src).forEach(childItemName => {
|
|
27
|
-
copyDirRecursive(
|
|
28
|
-
path.join(src, childItemName),
|
|
29
|
-
path.join(dest, childItemName)
|
|
30
|
-
);
|
|
31
|
-
});
|
|
32
|
-
} else {
|
|
33
|
-
// 如果是文件,直接复制
|
|
34
|
-
fs.copyFileSync(src, dest);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
7
|
|
|
38
8
|
/**
|
|
39
9
|
* 根据当前日期生成版本号。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ghini/xstart",
|
|
3
|
-
"version": "25.12.
|
|
3
|
+
"version": "25.12.29104833",
|
|
4
4
|
"exports": {
|
|
5
5
|
".": {
|
|
6
6
|
"import": "./dist/index.js",
|
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
"scripts": {
|
|
21
21
|
"type-check": "tsc --noEmit",
|
|
22
22
|
"build": "node ./build.js",
|
|
23
|
-
"pub": "pnpm build && pnpm publish --no-git-checks && git add . && git commit -m 'update' && git push"
|
|
24
|
-
"update": "pnpm update"
|
|
23
|
+
"pub": "pnpm build && pnpm publish --no-git-checks && git add . && git commit -m 'update' && git push"
|
|
25
24
|
}
|
|
26
25
|
}
|