tcdona_unilib 1.0.3 → 1.0.5
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 +9 -8
- package/hotkeys-js.ts +2 -2
- package/package.json +8 -2
- package/pinyin-pro.ts +2 -16
- package/tc.pub.ts +71 -0
- package/tinypool.ts +2 -27
- package/tsconfig.json +0 -27
package/README.md
CHANGED
|
@@ -37,13 +37,13 @@ import * as tcdona_unilib from "tcdona_unilib"
|
|
|
37
37
|
|
|
38
38
|
## 支持的库
|
|
39
39
|
|
|
40
|
-
| 库名
|
|
41
|
-
|
|
|
42
|
-
| neverthrow
|
|
43
|
-
| zx
|
|
44
|
-
| dayjs
|
|
45
|
-
| big.js
|
|
46
|
-
| es-toolkit
|
|
40
|
+
| 库名 | 导入方式 | 用途 |
|
|
41
|
+
| ---------- | -------------------------- | ---------- |
|
|
42
|
+
| neverthrow | `tcdona_unilib/neverthrow` | 错误处理 |
|
|
43
|
+
| zx | `tcdona_unilib/zx` | Shell 脚本 |
|
|
44
|
+
| dayjs | `tcdona_unilib/dayjs` | 日期时间 |
|
|
45
|
+
| big.js | `tcdona_unilib/big.js` | 精确算术 |
|
|
46
|
+
| es-toolkit | `tcdona_unilib/estk` | ES 工具集 |
|
|
47
47
|
|
|
48
48
|
## 项目结构
|
|
49
49
|
|
|
@@ -72,8 +72,9 @@ tcdona_unilib/
|
|
|
72
72
|
2. 在 `exports` 中添加路径映射
|
|
73
73
|
3. 创建对应的 `*.ts` 转发文件:
|
|
74
74
|
```typescript
|
|
75
|
-
export
|
|
75
|
+
export { method } from "your-library"
|
|
76
76
|
```
|
|
77
|
+
禁止用 `export *`
|
|
77
78
|
4. 在 `index.ts` 中添加导出行
|
|
78
79
|
|
|
79
80
|
## 版本管理
|
package/hotkeys-js.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default
|
|
2
|
-
export type { HotkeysEvent, KeyHandler } from
|
|
1
|
+
export { default } from 'hotkeys-js';
|
|
2
|
+
export type { HotkeysEvent, KeyHandler } from 'hotkeys-js';
|
package/package.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tcdona_unilib",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Unified dependency aggregation layer for shared libraries",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
+
"files": [
|
|
8
|
+
"*.ts",
|
|
9
|
+
"staticMeta/"
|
|
10
|
+
],
|
|
7
11
|
"exports": {
|
|
8
12
|
"./astgrep": "./@ast-grep.ts",
|
|
9
13
|
"./staticMeta/eff": "./staticMeta/eff.ts",
|
|
@@ -11,6 +15,7 @@
|
|
|
11
15
|
"./staticMeta/path": "./staticMeta/path.init.ts",
|
|
12
16
|
"./staticMeta/string": "./staticMeta/string.nanoid.ts",
|
|
13
17
|
"./staticMeta/url": "./staticMeta/url.ts",
|
|
18
|
+
"./staticMeta/enum.api": "./staticMeta/enum.api.ts",
|
|
14
19
|
"./staticMeta/iduniq": "./staticMeta/iduniq.ts",
|
|
15
20
|
"./staticMeta/idupdate": "./staticMeta/idupdate.ts",
|
|
16
21
|
"./staticMeta/pkgjson": "./staticMeta/pkg.json.ts",
|
|
@@ -42,7 +47,8 @@
|
|
|
42
47
|
"./inquirer": "./inquirer.ts"
|
|
43
48
|
},
|
|
44
49
|
"scripts": {
|
|
45
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
50
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
51
|
+
"pub": "bun run ./tc.pub.ts"
|
|
46
52
|
},
|
|
47
53
|
"keywords": [],
|
|
48
54
|
"author": "",
|
package/pinyin-pro.ts
CHANGED
|
@@ -1,16 +1,2 @@
|
|
|
1
|
-
export {
|
|
2
|
-
|
|
3
|
-
getFinalParts,
|
|
4
|
-
getNumOfTone,
|
|
5
|
-
pinyin,
|
|
6
|
-
customPinyin,
|
|
7
|
-
clearCustomDict,
|
|
8
|
-
addDict,
|
|
9
|
-
removeDict,
|
|
10
|
-
match,
|
|
11
|
-
html,
|
|
12
|
-
polyphonic,
|
|
13
|
-
convert,
|
|
14
|
-
segment,
|
|
15
|
-
OutputFormat,
|
|
16
|
-
} from "pinyin-pro"
|
|
1
|
+
export { getInitialAndFinal, getFinalParts, getNumOfTone, pinyin, customPinyin, clearCustomDict, addDict, removeDict, match, html, polyphonic, convert, segment } from 'pinyin-pro';
|
|
2
|
+
export type { OutputFormat } from 'pinyin-pro';
|
package/tc.pub.ts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync } from 'fs';
|
|
2
|
+
import { resolve } from 'path';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 自动更新 package.json 版本号
|
|
6
|
+
* 支持三种版本更新类型:major | minor | patch
|
|
7
|
+
* 用法: tsx tc.publish.ts [type]
|
|
8
|
+
* 例如: tsx tc.publish.ts minor
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
function parseVersion(versionString: string): [number, number, number] {
|
|
12
|
+
const parts = versionString.split('.');
|
|
13
|
+
return [
|
|
14
|
+
parseInt(parts[0], 10),
|
|
15
|
+
parseInt(parts[1], 10),
|
|
16
|
+
parseInt(parts[2], 10),
|
|
17
|
+
];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function formatVersion(major: number, minor: number, patch: number): string {
|
|
21
|
+
return `${major}.${minor}.${patch}`;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function updateVersion(
|
|
25
|
+
currentVersion: string,
|
|
26
|
+
type: 'major' | 'minor' | 'patch'
|
|
27
|
+
): string {
|
|
28
|
+
const [major, minor, patch] = parseVersion(currentVersion);
|
|
29
|
+
|
|
30
|
+
switch (type) {
|
|
31
|
+
case 'major':
|
|
32
|
+
return formatVersion(major + 1, 0, 0);
|
|
33
|
+
case 'minor':
|
|
34
|
+
return formatVersion(major, minor + 1, 0);
|
|
35
|
+
case 'patch':
|
|
36
|
+
return formatVersion(major, minor, patch + 1);
|
|
37
|
+
default:
|
|
38
|
+
throw new Error(`Unknown version type: ${type}`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async function main() {
|
|
43
|
+
const type = (process.argv[2] || 'patch') as 'major' | 'minor' | 'patch' ?? 'patch';
|
|
44
|
+
|
|
45
|
+
try {
|
|
46
|
+
const packageJsonPath = resolve(process.cwd(), 'package.json');
|
|
47
|
+
const packageJsonContent = readFileSync(packageJsonPath, 'utf-8');
|
|
48
|
+
const packageJson = JSON.parse(packageJsonContent);
|
|
49
|
+
|
|
50
|
+
const currentVersion = packageJson.version;
|
|
51
|
+
const newVersion = updateVersion(currentVersion, type);
|
|
52
|
+
|
|
53
|
+
packageJson.version = newVersion;
|
|
54
|
+
|
|
55
|
+
writeFileSync(
|
|
56
|
+
packageJsonPath,
|
|
57
|
+
JSON.stringify(packageJson, null, 2) + '\n'
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
console.log(`✅ Version updated: ${currentVersion} → ${newVersion}`);
|
|
61
|
+
} catch (error) {
|
|
62
|
+
if (error instanceof Error) {
|
|
63
|
+
console.error(`❌ Error: ${error.message}`);
|
|
64
|
+
} else {
|
|
65
|
+
console.error('❌ Unknown error occurred');
|
|
66
|
+
}
|
|
67
|
+
process.exit(1);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
main();
|
package/tinypool.ts
CHANGED
|
@@ -1,27 +1,2 @@
|
|
|
1
|
-
export {
|
|
2
|
-
|
|
3
|
-
isTransferable,
|
|
4
|
-
isMovable,
|
|
5
|
-
markMovable,
|
|
6
|
-
isTaskQueue,
|
|
7
|
-
kTransferable,
|
|
8
|
-
kValue,
|
|
9
|
-
kQueueOptions,
|
|
10
|
-
kRequestCountField,
|
|
11
|
-
kResponseCountField,
|
|
12
|
-
kFieldCount,
|
|
13
|
-
} from "tinypool"
|
|
14
|
-
export type {
|
|
15
|
-
Options,
|
|
16
|
-
Task,
|
|
17
|
-
TaskQueue,
|
|
18
|
-
Transferable,
|
|
19
|
-
TinypoolChannel,
|
|
20
|
-
TinypoolWorker,
|
|
21
|
-
TinypoolData,
|
|
22
|
-
TinypoolPrivateData,
|
|
23
|
-
TinypoolWorkerMessage,
|
|
24
|
-
StartupMessage,
|
|
25
|
-
RequestMessage,
|
|
26
|
-
ResponseMessage,
|
|
27
|
-
} from "tinypool"
|
|
1
|
+
export { isMovable, isTaskQueue, isTransferable, kFieldCount, kQueueOptions, kRequestCountField, kResponseCountField, kTransferable, kValue, markMovable, workerId } from 'tinypool';
|
|
2
|
+
export type { Options, ReadyMessage, RequestMessage, ResponseMessage, StartupMessage, Task, TaskQueue, Tinypool, TinypoolChannel, TinypoolData, TinypoolPrivateData, TinypoolWorker, TinypoolWorkerMessage, Transferable } from 'tinypool';
|
package/tsconfig.json
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2020",
|
|
4
|
-
"module": "ESNext",
|
|
5
|
-
"moduleResolution": "bundler",
|
|
6
|
-
"lib": ["ES2020"],
|
|
7
|
-
"declaration": true,
|
|
8
|
-
"declarationMap": true,
|
|
9
|
-
"sourceMap": true,
|
|
10
|
-
"outDir": "./dist",
|
|
11
|
-
"rootDir": "./",
|
|
12
|
-
"strict": true,
|
|
13
|
-
"esModuleInterop": true,
|
|
14
|
-
"skipLibCheck": true,
|
|
15
|
-
"forceConsistentCasingInFileNames": true,
|
|
16
|
-
"resolveJsonModule": true,
|
|
17
|
-
"isolatedModules": true,
|
|
18
|
-
"noEmit": false,
|
|
19
|
-
},
|
|
20
|
-
"include": [
|
|
21
|
-
"*.ts"
|
|
22
|
-
],
|
|
23
|
-
"exclude": [
|
|
24
|
-
"node_modules",
|
|
25
|
-
"dist"
|
|
26
|
-
]
|
|
27
|
-
}
|