@gaias/client_node 1.0.14 → 1.0.19
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/.npmrc.example +14 -0
- package/CONFIG.md +608 -0
- package/PUBLISHING.md +170 -0
- package/config/CommonParam.yaml +2 -0
- package/config/RestClientA.yaml +5 -0
- package/config/RestClientB.yaml +8 -0
- package/eslint.config.js +141 -0
- package/package.json +8 -6
package/.npmrc.example
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# NPM Registry Configuration Example
|
|
2
|
+
# Copy this file to .npmrc and replace YOUR_GITHUB_TOKEN with your actual token
|
|
3
|
+
|
|
4
|
+
# Default registry for all packages
|
|
5
|
+
registry=https://registry.npmjs.org/
|
|
6
|
+
|
|
7
|
+
# GitHub Packages registry for @sight-saber scope
|
|
8
|
+
@sight-saber:registry=https://npm.pkg.github.com/
|
|
9
|
+
@gaias:registry=https://registry.npmjs.org/
|
|
10
|
+
|
|
11
|
+
# Authentication token for GitHub Packages
|
|
12
|
+
# Generate a personal access token at: https://github.com/settings/tokens
|
|
13
|
+
# Required scopes: read:packages, write:packages
|
|
14
|
+
//npm.pkg.github.com/:_authToken=YOUR_GITHUB_TOKEN
|
package/CONFIG.md
ADDED
|
@@ -0,0 +1,608 @@
|
|
|
1
|
+
# 项目配置文件详解
|
|
2
|
+
|
|
3
|
+
本文档详细说明 `@gaias/client_node` 项目中所有配置文件的用途和配置项。
|
|
4
|
+
|
|
5
|
+
## 📦 目录
|
|
6
|
+
|
|
7
|
+
- [package.json - 项目元数据与依赖管理](#packagejson)
|
|
8
|
+
- [tsconfig.json - TypeScript 编译配置](#tsconfigjson)
|
|
9
|
+
- [eslint.config.js - 代码质量检查配置](#eslintconfigjs)
|
|
10
|
+
- [jest.config.js - 测试框架配置](#jestconfigjs)
|
|
11
|
+
- [.prettierrc.json - 代码格式化配置](#prettierrrcjson)
|
|
12
|
+
- [.ctirc - 索引文件自动生成配置](#ctirc)
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## package.json
|
|
17
|
+
|
|
18
|
+
### 基本信息
|
|
19
|
+
|
|
20
|
+
```json
|
|
21
|
+
{
|
|
22
|
+
"name": "@gaias/client_node",
|
|
23
|
+
"version": "1.0.6",
|
|
24
|
+
"description": "store data in cookie and localstorage",
|
|
25
|
+
"main": "dist/single/index.js",
|
|
26
|
+
"types": "dist/single/index.d.ts",
|
|
27
|
+
"license": "UNLICENSED"
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
| 字段 | 说明 |
|
|
32
|
+
|------|------|
|
|
33
|
+
| `name` | NPM 包名,使用 `@gaias` 命名空间 |
|
|
34
|
+
| `version` | 当前版本号,遵循语义化版本 (Semver) |
|
|
35
|
+
| `description` | 包描述 |
|
|
36
|
+
| `main` | CommonJS 入口文件 |
|
|
37
|
+
| `types` | TypeScript 类型定义文件入口 |
|
|
38
|
+
| `license` | 许可证类型 |
|
|
39
|
+
|
|
40
|
+
### 发布配置
|
|
41
|
+
|
|
42
|
+
```json
|
|
43
|
+
{
|
|
44
|
+
"publishConfig": {
|
|
45
|
+
"access": "public",
|
|
46
|
+
"registry": "https://registry.npmjs.org/"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
- `access`: `public` - 公开发布包
|
|
52
|
+
- `registry`: NPM 官方仓库地址
|
|
53
|
+
|
|
54
|
+
### 关键词
|
|
55
|
+
|
|
56
|
+
```json
|
|
57
|
+
{
|
|
58
|
+
"keywords": [
|
|
59
|
+
"restclient",
|
|
60
|
+
"globalstorage",
|
|
61
|
+
"messageclient",
|
|
62
|
+
"configclient"
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
用于 NPM 搜索的关键词,提高包的可发现性。
|
|
68
|
+
|
|
69
|
+
### 引擎要求
|
|
70
|
+
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"engines": {
|
|
74
|
+
"node": ">=18.0.0",
|
|
75
|
+
"yarn": ">=1.22.x"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
指定项目运行所需的最低 Node.js 和 Yarn 版本。
|
|
81
|
+
|
|
82
|
+
### NPM Scripts
|
|
83
|
+
|
|
84
|
+
#### 构建相关
|
|
85
|
+
|
|
86
|
+
| Script | 命令 | 说明 |
|
|
87
|
+
|--------|------|------|
|
|
88
|
+
| `ncc:build` | `ncc build ./src/index.ts -m -o ./dist/single -e sqlite3 --no-source-map-register && ncc cache clean` | 使用 `@vercel/ncc` 将代码打包成单文件,排除 sqlite3 依赖 |
|
|
89
|
+
| `prepub` | `rimraf dist && mkdir dist && tsc && mv temp/* dist/ && rimraf temp` | 发布前准备:清理构建目录、运行 TypeScript 编译、移动产物 |
|
|
90
|
+
|
|
91
|
+
**prepub 命令详解**:
|
|
92
|
+
1. `rimraf dist` - 删除现有的 dist 目录
|
|
93
|
+
2. `mkdir dist` - 创建新的 dist 目录
|
|
94
|
+
3. `tsc` - 使用 TypeScript 编译器编译(输出到 temp 目录)
|
|
95
|
+
4. `mv temp/* dist/` - 将编译产物从 temp 移动到 dist
|
|
96
|
+
5. `rimraf temp` - 删除临时目录
|
|
97
|
+
|
|
98
|
+
#### 开发相关
|
|
99
|
+
|
|
100
|
+
| Script | 命令 | 说明 |
|
|
101
|
+
|--------|------|------|
|
|
102
|
+
| `dev` | `http-server` | 启动本地开发服务器 |
|
|
103
|
+
| `upver` | `ncu -u && yarn install` | 更新所有依赖到最新版本 |
|
|
104
|
+
| `gen:idx` | `cti create ./src` | 自动生成 src 目录的 index.ts 文件 |
|
|
105
|
+
|
|
106
|
+
#### 测试相关
|
|
107
|
+
|
|
108
|
+
| Script | 命令 | 说明 |
|
|
109
|
+
|--------|------|------|
|
|
110
|
+
| `test` | `jest` | 运行 Jest 测试套件 |
|
|
111
|
+
|
|
112
|
+
#### 代码质量
|
|
113
|
+
|
|
114
|
+
| Script | 命令 | 说明 |
|
|
115
|
+
|--------|------|------|
|
|
116
|
+
| `lint` | `tsc --noEmit && eslint . --ext .ts` | 运行类型检查和 ESLint 检查 |
|
|
117
|
+
| `lint:fix` | `eslint . --ext .ts --fix` | 自动修复 ESLint 问题 |
|
|
118
|
+
| `precommit` | `yarn lint` | 提交前运行 lint 检查 |
|
|
119
|
+
|
|
120
|
+
#### 安全审计
|
|
121
|
+
|
|
122
|
+
| Script | 命令 | 说明 |
|
|
123
|
+
|--------|------|------|
|
|
124
|
+
| `security` | `yarn audit` | 运行完整的依赖安全审计 |
|
|
125
|
+
| `security:summary` | `yarn audit --summary` | 显示安全审计摘要 |
|
|
126
|
+
| `security:json` | `yarn audit --json` | 以 JSON 格式输出审计结果 |
|
|
127
|
+
| `security:check` | `node tools/security-check.js` | 自定义安全检查脚本 |
|
|
128
|
+
|
|
129
|
+
### 依赖说明
|
|
130
|
+
|
|
131
|
+
#### 核心运行时依赖
|
|
132
|
+
|
|
133
|
+
| 依赖 | 版本 | 说明 |
|
|
134
|
+
|------|------|------|
|
|
135
|
+
| `axios` | ^1.12.2 | HTTP 客户端 |
|
|
136
|
+
| `cls-hooked` | ^4.2.2 | 异步上下文管理 |
|
|
137
|
+
| `dot-object` | ^2.1.5 | 对象路径操作工具 |
|
|
138
|
+
| `eventemitter3` | ^5.0.1 | 事件发射器 |
|
|
139
|
+
| `ioredis` | ^5.8.2 | Redis 客户端 |
|
|
140
|
+
| `js-cookie` | ^3.0.5 | Cookie 操作库 |
|
|
141
|
+
| `js-yaml` | ^4.1.0 | YAML 解析器 |
|
|
142
|
+
| `jsonata` | ^2.1.0 | JSON 查询和转换 |
|
|
143
|
+
| `lodash` | ^4.17.21 | 工具函数库 |
|
|
144
|
+
| `mustache` | ^4.2.0 | 模板引擎 |
|
|
145
|
+
| `storage-manager-js` | ^4.2.6 | 存储管理 |
|
|
146
|
+
| `store2` | ^2.14.4 | 本地存储封装 |
|
|
147
|
+
| `typedi` | ^0.10.0 | 依赖注入容器 |
|
|
148
|
+
| `whatwg-url` | ^15.1.0 | URL 解析 |
|
|
149
|
+
|
|
150
|
+
#### 开发依赖
|
|
151
|
+
|
|
152
|
+
主要包括:
|
|
153
|
+
- TypeScript 相关工具链
|
|
154
|
+
- ESLint 及插件
|
|
155
|
+
- Jest 测试框架
|
|
156
|
+
- Prettier 代码格式化
|
|
157
|
+
- @vercel/ncc 打包工具
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## tsconfig.json
|
|
162
|
+
|
|
163
|
+
TypeScript 编译器配置文件。
|
|
164
|
+
|
|
165
|
+
### 编译选项
|
|
166
|
+
|
|
167
|
+
```json
|
|
168
|
+
{
|
|
169
|
+
"compilerOptions": {
|
|
170
|
+
"outDir": "temp",
|
|
171
|
+
"target": "ES2021",
|
|
172
|
+
"module": "CommonJS"
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
#### 基础配置
|
|
178
|
+
|
|
179
|
+
| 选项 | 值 | 说明 |
|
|
180
|
+
|------|-----|------|
|
|
181
|
+
| `outDir` | `"temp"` | 编译输出目录(由 prepub 脚本移动到 dist) |
|
|
182
|
+
| `target` | `"ES2021"` | 编译目标 JavaScript 版本 |
|
|
183
|
+
| `module` | `"CommonJS"` | 模块系统类型 |
|
|
184
|
+
| `lib` | `["ES2021"]` | 可用的库文件 |
|
|
185
|
+
| `moduleResolution` | `"node"` | Node.js 风格的模块解析 |
|
|
186
|
+
|
|
187
|
+
#### 严格模式选项
|
|
188
|
+
|
|
189
|
+
| 选项 | 值 | 说明 |
|
|
190
|
+
|------|-----|------|
|
|
191
|
+
| `strict` | `true` | 启用所有严格类型检查选项 |
|
|
192
|
+
| `noImplicitAny` | `true` | 禁止隐式 any 类型 |
|
|
193
|
+
| `strictPropertyInitialization` | `false` | 关闭类属性必须初始化的检查 |
|
|
194
|
+
| `forceConsistentCasingInFileNames` | `true` | 强制文件名大小写一致 |
|
|
195
|
+
|
|
196
|
+
#### 互操作性选项
|
|
197
|
+
|
|
198
|
+
| 选项 | 值 | 说明 |
|
|
199
|
+
|------|-----|------|
|
|
200
|
+
| `esModuleInterop` | `true` | 允许 CommonJS 和 ES 模块互操作 |
|
|
201
|
+
| `allowSyntheticDefaultImports` | `true` | 允许从没有默认导出的模块导入默认值 |
|
|
202
|
+
| `resolveJsonModule` | `true` | 允许导入 JSON 文件 |
|
|
203
|
+
|
|
204
|
+
#### 装饰器支持
|
|
205
|
+
|
|
206
|
+
| 选项 | 值 | 说明 |
|
|
207
|
+
|------|-----|------|
|
|
208
|
+
| `experimentalDecorators` | `true` | 启用实验性装饰器语法 |
|
|
209
|
+
| `emitDecoratorMetadata` | `true` | 为装饰器生成元数据(TypeDI 需要) |
|
|
210
|
+
|
|
211
|
+
#### 类型声明
|
|
212
|
+
|
|
213
|
+
| 选项 | 值 | 说明 |
|
|
214
|
+
|------|-----|------|
|
|
215
|
+
| `declaration` | `true` | 生成 .d.ts 类型声明文件 |
|
|
216
|
+
| `declarationMap` | `true` | 生成声明文件的 source map |
|
|
217
|
+
|
|
218
|
+
#### 调试与优化
|
|
219
|
+
|
|
220
|
+
| 选项 | 值 | 说明 |
|
|
221
|
+
|------|-----|------|
|
|
222
|
+
| `sourceMap` | `true` | 生成 source map 文件 |
|
|
223
|
+
| `removeComments` | `true` | 移除编译后的注释 |
|
|
224
|
+
| `skipLibCheck` | `true` | 跳过声明文件的类型检查(加快编译) |
|
|
225
|
+
|
|
226
|
+
#### 路径映射
|
|
227
|
+
|
|
228
|
+
```json
|
|
229
|
+
{
|
|
230
|
+
"paths": {
|
|
231
|
+
"@/*": ["src/*"]
|
|
232
|
+
},
|
|
233
|
+
"baseUrl": "."
|
|
234
|
+
}
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
允许使用 `@/` 作为 `src/` 的别名。
|
|
238
|
+
|
|
239
|
+
#### 类型声明
|
|
240
|
+
|
|
241
|
+
```json
|
|
242
|
+
{
|
|
243
|
+
"types": ["node", "jest"]
|
|
244
|
+
}
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
包含 Node.js 和 Jest 的类型定义。
|
|
248
|
+
|
|
249
|
+
### 包含与排除
|
|
250
|
+
|
|
251
|
+
```json
|
|
252
|
+
{
|
|
253
|
+
"include": [
|
|
254
|
+
"src/**/*",
|
|
255
|
+
"example/**/*",
|
|
256
|
+
"tools/**/*"
|
|
257
|
+
],
|
|
258
|
+
"exclude": [
|
|
259
|
+
"node_modules",
|
|
260
|
+
"temp",
|
|
261
|
+
"dist",
|
|
262
|
+
"**/*.spec.ts",
|
|
263
|
+
"**/*.test.ts"
|
|
264
|
+
]
|
|
265
|
+
}
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
- **include**: 编译 src、example 和 tools 目录
|
|
269
|
+
- **exclude**: 排除 node_modules、构建产物和测试文件
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
## eslint.config.js
|
|
274
|
+
|
|
275
|
+
ESLint 9.x 新版扁平化配置格式。
|
|
276
|
+
|
|
277
|
+
### 配置结构
|
|
278
|
+
|
|
279
|
+
项目使用多配置策略,针对不同目录应用不同的规则:
|
|
280
|
+
|
|
281
|
+
#### 1. 忽略文件
|
|
282
|
+
|
|
283
|
+
```javascript
|
|
284
|
+
{
|
|
285
|
+
ignores: [
|
|
286
|
+
'**/node_modules/**',
|
|
287
|
+
'**/temp/**',
|
|
288
|
+
'**/dist/**',
|
|
289
|
+
'**/*.js',
|
|
290
|
+
'**/*.d.ts',
|
|
291
|
+
]
|
|
292
|
+
}
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
排除不需要检查的文件和目录。
|
|
296
|
+
|
|
297
|
+
#### 2. src/ 和 example/ 目录配置
|
|
298
|
+
|
|
299
|
+
**特点**: 启用类型感知的 lint 规则
|
|
300
|
+
|
|
301
|
+
```javascript
|
|
302
|
+
{
|
|
303
|
+
files: ['src/**/*.ts', 'example/**/*.ts'],
|
|
304
|
+
languageOptions: {
|
|
305
|
+
parser: tsParser,
|
|
306
|
+
parserOptions: {
|
|
307
|
+
project: './tsconfig.json' // 使用项目配置进行类型检查
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
**启用的类型感知规则**:
|
|
314
|
+
- `@typescript-eslint/no-floating-promises`: 'warn' - 警告未处理的 Promise
|
|
315
|
+
- `@typescript-eslint/await-thenable`: 'warn' - 避免 await 非 thenable 对象
|
|
316
|
+
- `@typescript-eslint/no-misused-promises`: 'warn' - Promise 误用检查
|
|
317
|
+
|
|
318
|
+
#### 3. tools/ 目录配置
|
|
319
|
+
|
|
320
|
+
**特点**: 不启用类型检查(提高性能)
|
|
321
|
+
|
|
322
|
+
```javascript
|
|
323
|
+
{
|
|
324
|
+
files: ['tools/**/*.ts'],
|
|
325
|
+
languageOptions: {
|
|
326
|
+
parserOptions: {
|
|
327
|
+
// ✅ 不使用 project,避免解析错误
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
#### 4. __tests__ 目录配置
|
|
334
|
+
|
|
335
|
+
**特点**: 测试文件专用配置
|
|
336
|
+
|
|
337
|
+
### 通用规则设置
|
|
338
|
+
|
|
339
|
+
| 规则 | 设置 | 说明 |
|
|
340
|
+
|------|------|------|
|
|
341
|
+
| `@typescript-eslint/no-require-imports` | off | 允许使用 require() |
|
|
342
|
+
| `@typescript-eslint/no-var-requires` | off | 允许 require 赋值给变量 |
|
|
343
|
+
| `@typescript-eslint/explicit-function-return-type` | off | 不强制函数返回类型声明 |
|
|
344
|
+
| `@typescript-eslint/no-explicit-any` | off | 允许使用 any 类型 |
|
|
345
|
+
| `@typescript-eslint/no-unused-vars` | off | 不检查未使用变量 |
|
|
346
|
+
| `no-console` | off | 允许使用 console |
|
|
347
|
+
| `lines-between-class-members` | warn | 类成员之间需要空行 |
|
|
348
|
+
|
|
349
|
+
---
|
|
350
|
+
|
|
351
|
+
## jest.config.js
|
|
352
|
+
|
|
353
|
+
Jest 测试框架配置。
|
|
354
|
+
|
|
355
|
+
```javascript
|
|
356
|
+
module.exports = {
|
|
357
|
+
preset: 'ts-jest',
|
|
358
|
+
testEnvironment: 'node',
|
|
359
|
+
setupFiles: ['reflect-metadata'],
|
|
360
|
+
};
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
### 配置说明
|
|
364
|
+
|
|
365
|
+
| 选项 | 值 | 说明 |
|
|
366
|
+
|------|-----|------|
|
|
367
|
+
| `preset` | `'ts-jest'` | 使用 ts-jest 预设,支持 TypeScript |
|
|
368
|
+
| `testEnvironment` | `'node'` | 在 Node.js 环境中运行测试 |
|
|
369
|
+
| `setupFiles` | `['reflect-metadata']` | 测试前加载 reflect-metadata(装饰器元数据支持) |
|
|
370
|
+
|
|
371
|
+
### 使用方式
|
|
372
|
+
|
|
373
|
+
```bash
|
|
374
|
+
# 运行所有测试
|
|
375
|
+
yarn test
|
|
376
|
+
|
|
377
|
+
# 运行特定测试文件
|
|
378
|
+
yarn test path/to/test.spec.ts
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
---
|
|
382
|
+
|
|
383
|
+
## .prettierrc.json
|
|
384
|
+
|
|
385
|
+
Prettier 代码格式化配置。
|
|
386
|
+
|
|
387
|
+
```json
|
|
388
|
+
{
|
|
389
|
+
"semi": true,
|
|
390
|
+
"trailingComma": "all",
|
|
391
|
+
"singleQuote": true,
|
|
392
|
+
"printWidth": 220,
|
|
393
|
+
"tabWidth": 4,
|
|
394
|
+
"arrowParens": "always"
|
|
395
|
+
}
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
### 配置说明
|
|
399
|
+
|
|
400
|
+
| 选项 | 值 | 说明 |
|
|
401
|
+
|------|-----|------|
|
|
402
|
+
| `semi` | `true` | 语句末尾添加分号 |
|
|
403
|
+
| `trailingComma` | `"all"` | 在所有可能的地方添加尾随逗号 |
|
|
404
|
+
| `singleQuote` | `true` | 使用单引号而非双引号 |
|
|
405
|
+
| `printWidth` | `220` | 单行最大字符数(较宽) |
|
|
406
|
+
| `tabWidth` | `4` | 缩进宽度为 4 个空格 |
|
|
407
|
+
| `arrowParens` | `"always"` | 箭头函数参数始终使用括号 |
|
|
408
|
+
|
|
409
|
+
### 格式化示例
|
|
410
|
+
|
|
411
|
+
**Before:**
|
|
412
|
+
```typescript
|
|
413
|
+
const foo = (x) => {return x + 1}
|
|
414
|
+
const obj = {a: 1, b: 2}
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
**After:**
|
|
418
|
+
```typescript
|
|
419
|
+
const foo = (x) => {
|
|
420
|
+
return x + 1;
|
|
421
|
+
};
|
|
422
|
+
const obj = { a: 1, b: 2 };
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
---
|
|
426
|
+
|
|
427
|
+
## .ctirc
|
|
428
|
+
|
|
429
|
+
`create-ts-index` (cti) 工具配置,用于自动生成 TypeScript 索引文件。
|
|
430
|
+
|
|
431
|
+
### 配置说明
|
|
432
|
+
|
|
433
|
+
```json
|
|
434
|
+
{
|
|
435
|
+
"fileFirst": false,
|
|
436
|
+
"addNewline": true,
|
|
437
|
+
"useSemicolon": true,
|
|
438
|
+
"useTimestamp": false,
|
|
439
|
+
"includeCWD": true,
|
|
440
|
+
"excludes": ["__test__", "__tests__", "node_modules", "tools"],
|
|
441
|
+
"fileExcludePatterns": ["*excludeme.ts"],
|
|
442
|
+
"targetExts": ["ts", "tsx"],
|
|
443
|
+
"withoutBackupFile": true,
|
|
444
|
+
"quote": "'",
|
|
445
|
+
"verbose": false
|
|
446
|
+
}
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
| 选项 | 值 | 说明 |
|
|
450
|
+
|------|-----|------|
|
|
451
|
+
| `fileFirst` | `false` | 不优先导出文件 |
|
|
452
|
+
| `addNewline` | `true` | 文件末尾添加换行符 |
|
|
453
|
+
| `useSemicolon` | `true` | 导出语句添加分号 |
|
|
454
|
+
| `useTimestamp` | `false` | 不在注释中添加时间戳 |
|
|
455
|
+
| `includeCWD` | `true` | 包含当前工作目录 |
|
|
456
|
+
| `excludes` | `[...]` | 排除的目录 |
|
|
457
|
+
| `targetExts` | `["ts", "tsx"]` | 目标文件扩展名 |
|
|
458
|
+
| `withoutBackupFile` | `true` | 不创建备份文件 |
|
|
459
|
+
| `quote` | `"'"` | 使用单引号 |
|
|
460
|
+
| `verbose` | `false` | 不显示详细日志 |
|
|
461
|
+
|
|
462
|
+
### 使用方式
|
|
463
|
+
|
|
464
|
+
```bash
|
|
465
|
+
# 生成 src 目录的 index.ts
|
|
466
|
+
yarn gen:idx
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
### 生成示例
|
|
470
|
+
|
|
471
|
+
对于目录结构:
|
|
472
|
+
```
|
|
473
|
+
src/
|
|
474
|
+
├── foo.ts
|
|
475
|
+
├── bar.ts
|
|
476
|
+
└── utils/
|
|
477
|
+
└── helper.ts
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
生成的 `src/index.ts`:
|
|
481
|
+
```typescript
|
|
482
|
+
export * from './foo';
|
|
483
|
+
export * from './bar';
|
|
484
|
+
export * from './utils/helper';
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
---
|
|
488
|
+
|
|
489
|
+
## 构建流程
|
|
490
|
+
|
|
491
|
+
### 完整发布流程
|
|
492
|
+
|
|
493
|
+
1. **清理旧构建**: `rimraf dist`
|
|
494
|
+
2. **创建目录**: `mkdir dist`
|
|
495
|
+
3. **TypeScript 编译**: `tsc` (输出到 temp)
|
|
496
|
+
4. **移动产物**: `mv temp/* dist/`
|
|
497
|
+
5. **清理临时文件**: `rimraf temp`
|
|
498
|
+
6. **单文件打包**: `yarn ncc:build` (可选)
|
|
499
|
+
|
|
500
|
+
### 输出结构
|
|
501
|
+
|
|
502
|
+
```
|
|
503
|
+
dist/
|
|
504
|
+
├── index.js # CommonJS 主入口
|
|
505
|
+
├── index.d.ts # 类型定义
|
|
506
|
+
├── index.d.ts.map # 类型定义 source map
|
|
507
|
+
└── ... # 其他编译产物
|
|
508
|
+
|
|
509
|
+
dist/single/
|
|
510
|
+
└── index.js # NCC 打包的单文件 (包含所有依赖)
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
---
|
|
514
|
+
|
|
515
|
+
## 最佳实践
|
|
516
|
+
|
|
517
|
+
### 开发工作流
|
|
518
|
+
|
|
519
|
+
1. **启动开发**: `yarn dev`
|
|
520
|
+
2. **自动生成索引**: `yarn gen:idx`
|
|
521
|
+
3. **代码检查**: `yarn lint`
|
|
522
|
+
4. **运行测试**: `yarn test`
|
|
523
|
+
5. **发布前构建**: `yarn prepub`
|
|
524
|
+
|
|
525
|
+
### 版本发布
|
|
526
|
+
|
|
527
|
+
```bash
|
|
528
|
+
# 1. 更新版本号
|
|
529
|
+
npm version patch # 或 minor/major
|
|
530
|
+
|
|
531
|
+
# 2. 构建
|
|
532
|
+
yarn prepub
|
|
533
|
+
|
|
534
|
+
# 3. 发布到 NPM
|
|
535
|
+
npm publish --access public
|
|
536
|
+
|
|
537
|
+
# 4. 推送标签
|
|
538
|
+
git push origin main --follow-tags
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
详细发布流程请参考 [PUBLISHING.md](./PUBLISHING.md)。
|
|
542
|
+
|
|
543
|
+
### 依赖更新
|
|
544
|
+
|
|
545
|
+
```bash
|
|
546
|
+
# 检查可更新的依赖
|
|
547
|
+
ncu
|
|
548
|
+
|
|
549
|
+
# 更新所有依赖
|
|
550
|
+
yarn upver
|
|
551
|
+
|
|
552
|
+
# 安全审计
|
|
553
|
+
yarn security
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+
---
|
|
557
|
+
|
|
558
|
+
## 故障排除
|
|
559
|
+
|
|
560
|
+
### TypeScript 编译错误
|
|
561
|
+
|
|
562
|
+
```bash
|
|
563
|
+
# 只进行类型检查,不生成文件
|
|
564
|
+
yarn lint
|
|
565
|
+
|
|
566
|
+
# 查看详细错误信息
|
|
567
|
+
tsc --noEmit
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
### ESLint 配置问题
|
|
571
|
+
|
|
572
|
+
- **错误**: "Parsing error: Cannot read file 'tsconfig.json'"
|
|
573
|
+
- **解决**: 确保 `tsconfig.json` 在项目根目录
|
|
574
|
+
- **说明**: tools 和 __tests__ 目录不需要 project 配置
|
|
575
|
+
|
|
576
|
+
### 构建产物问题
|
|
577
|
+
|
|
578
|
+
```bash
|
|
579
|
+
# 清理所有构建产物
|
|
580
|
+
rimraf dist temp
|
|
581
|
+
|
|
582
|
+
# 重新构建
|
|
583
|
+
yarn prepub
|
|
584
|
+
```
|
|
585
|
+
|
|
586
|
+
### Jest 测试失败
|
|
587
|
+
|
|
588
|
+
- **错误**: "Cannot find module 'reflect-metadata'"
|
|
589
|
+
- **解决**: 确保 `setupFiles` 包含 'reflect-metadata'
|
|
590
|
+
- **说明**: TypeDI 装饰器需要元数据反射支持
|
|
591
|
+
|
|
592
|
+
---
|
|
593
|
+
|
|
594
|
+
## 相关文档
|
|
595
|
+
|
|
596
|
+
- [发布指南](./PUBLISHING.md)
|
|
597
|
+
- [TypeScript 官方文档](https://www.typescriptlang.org/tsconfig)
|
|
598
|
+
- [ESLint 配置文档](https://eslint.org/docs/latest/use/configure/)
|
|
599
|
+
- [Jest 配置文档](https://jestjs.io/docs/configuration)
|
|
600
|
+
- [Prettier 配置文档](https://prettier.io/docs/en/options.html)
|
|
601
|
+
|
|
602
|
+
---
|
|
603
|
+
|
|
604
|
+
## 更新日志
|
|
605
|
+
|
|
606
|
+
| 日期 | 版本 | 说明 |
|
|
607
|
+
|------|------|------|
|
|
608
|
+
| 2025-10-23 | 1.0.0 | 初始版本 |
|
package/PUBLISHING.md
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# 发布指南 / Publishing Guide
|
|
2
|
+
|
|
3
|
+
本文档说明如何将 `@gaias/client_node` 包发布到 npmjs.org 和 GitHub Packages。
|
|
4
|
+
|
|
5
|
+
## 前置要求
|
|
6
|
+
|
|
7
|
+
### 1. npmjs.org 配置
|
|
8
|
+
|
|
9
|
+
1. 在 npmjs.org 注册账号并创建访问令牌:
|
|
10
|
+
- 访问 https://www.npmjs.com/settings/[你的用户名]/tokens
|
|
11
|
+
- 点击 "Generate New Token" → "Classic Token"
|
|
12
|
+
- 选择 "Automation" 类型
|
|
13
|
+
- 复制生成的 token
|
|
14
|
+
|
|
15
|
+
2. 在 GitHub 仓库中添加 Secret:
|
|
16
|
+
- 进入仓库的 Settings → Secrets and variables → Actions
|
|
17
|
+
- 点击 "New repository secret"
|
|
18
|
+
- Name: `NPM_TOKEN`
|
|
19
|
+
- Value: 粘贴你的 npm token
|
|
20
|
+
- 点击 "Add secret"
|
|
21
|
+
|
|
22
|
+
### 2. GitHub Packages 配置
|
|
23
|
+
|
|
24
|
+
GitHub Packages 使用仓库的 `GITHUB_TOKEN`,这个 token 会自动提供给 GitHub Actions,无需手动配置。
|
|
25
|
+
|
|
26
|
+
## 自动发布流程
|
|
27
|
+
|
|
28
|
+
### 触发方式
|
|
29
|
+
|
|
30
|
+
工作流会在以下情况下自动触发:
|
|
31
|
+
|
|
32
|
+
1. **推送到 main 分支**
|
|
33
|
+
```bash
|
|
34
|
+
git push origin main
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
2. **创建版本标签**
|
|
38
|
+
```bash
|
|
39
|
+
git tag v1.0.2
|
|
40
|
+
git push origin v1.0.2
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
3. **发布 Release**
|
|
44
|
+
- 在 GitHub 仓库页面创建新的 Release
|
|
45
|
+
|
|
46
|
+
4. **手动触发**
|
|
47
|
+
- 进入 Actions 标签页
|
|
48
|
+
- 选择 "Publish npm Package" 工作流
|
|
49
|
+
- 点击 "Run workflow"
|
|
50
|
+
|
|
51
|
+
### 发布步骤
|
|
52
|
+
|
|
53
|
+
工作流会自动执行以下步骤:
|
|
54
|
+
|
|
55
|
+
1. 检出代码
|
|
56
|
+
2. 安装依赖
|
|
57
|
+
3. 运行 linter(可选)
|
|
58
|
+
4. 运行测试(可选)
|
|
59
|
+
5. 构建包(`yarn ncc:build` 和 `yarn prepub`)
|
|
60
|
+
6. 发布到 npmjs.org(使用 `@gaias/client_node` 包名)
|
|
61
|
+
7. 发布到 GitHub Packages(使用 `@sight-saber/client_node` 包名)
|
|
62
|
+
|
|
63
|
+
## 包版本管理
|
|
64
|
+
|
|
65
|
+
在发布前,请更新 `package.json` 中的版本号:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# 补丁版本(bug 修复)
|
|
69
|
+
npm version patch # 1.0.1 → 1.0.2
|
|
70
|
+
|
|
71
|
+
# 次要版本(新功能)
|
|
72
|
+
npm version minor # 1.0.2 → 1.1.0
|
|
73
|
+
|
|
74
|
+
# 主要版本(破坏性更改)
|
|
75
|
+
npm version major # 1.1.0 → 2.0.0
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
然后推送更改和标签:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
git push origin main --follow-tags
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## 安装已发布的包
|
|
85
|
+
|
|
86
|
+
### 从 npmjs.org 安装
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
npm install @gaias/client_node
|
|
90
|
+
# 或
|
|
91
|
+
yarn add @gaias/client_node
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### 从 GitHub Packages 安装
|
|
95
|
+
|
|
96
|
+
1. 创建或编辑 `.npmrc` 文件(参考 `.npmrc.example`):
|
|
97
|
+
```
|
|
98
|
+
@sight-saber:registry=https://npm.pkg.github.com
|
|
99
|
+
//npm.pkg.github.com/:_authToken=YOUR_GITHUB_TOKEN
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
2. 安装包:
|
|
103
|
+
```bash
|
|
104
|
+
npm install @sight-saber/client_node
|
|
105
|
+
# 或
|
|
106
|
+
yarn add @sight-saber/client_node
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## 本地测试发布
|
|
110
|
+
|
|
111
|
+
在推送之前,可以本地测试构建流程:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
# 运行 linter
|
|
115
|
+
yarn lint
|
|
116
|
+
|
|
117
|
+
# 运行测试
|
|
118
|
+
yarn test
|
|
119
|
+
|
|
120
|
+
# 构建包
|
|
121
|
+
yarn ncc:build
|
|
122
|
+
yarn prepub
|
|
123
|
+
|
|
124
|
+
# 检查构建产物
|
|
125
|
+
ls -la dist/
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## 故障排除
|
|
129
|
+
|
|
130
|
+
### NPM_TOKEN 无效
|
|
131
|
+
|
|
132
|
+
- 确认 token 类型为 "Automation"
|
|
133
|
+
- 确认 token 有 "Publish" 权限
|
|
134
|
+
- 在 GitHub Secrets 中重新设置 token
|
|
135
|
+
|
|
136
|
+
### GitHub Packages 发布失败
|
|
137
|
+
|
|
138
|
+
- 确认仓库 owner 是 `sight-saber`
|
|
139
|
+
- 确认工作流有 `packages: write` 权限
|
|
140
|
+
- 检查 package.json 中的包名 scope 是否正确
|
|
141
|
+
|
|
142
|
+
### 构建失败
|
|
143
|
+
|
|
144
|
+
- 检查 linter 错误:`yarn lint`
|
|
145
|
+
- 检查测试失败:`yarn test`
|
|
146
|
+
- 检查构建错误:`yarn ncc:build` 和 `yarn prepub`
|
|
147
|
+
|
|
148
|
+
## 手动发布(不推荐)
|
|
149
|
+
|
|
150
|
+
如果需要手动发布,可以使用以下命令:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
# 构建
|
|
154
|
+
yarn ncc:build
|
|
155
|
+
yarn prepub
|
|
156
|
+
|
|
157
|
+
# 发布到 npmjs.org
|
|
158
|
+
npm publish --access public
|
|
159
|
+
|
|
160
|
+
# 发布到 GitHub Packages(需要先设置 .npmrc)
|
|
161
|
+
npm publish --registry=https://npm.pkg.github.com
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## 相关链接
|
|
165
|
+
|
|
166
|
+
- [npmjs.org 包页面](https://www.npmjs.com/package/@gaias/client_node)
|
|
167
|
+
- [GitHub Packages](https://github.com/sight-saber/client_node/packages)
|
|
168
|
+
- [GitHub Actions 工作流](.github/workflows/npm-publish-github-packages.yml)
|
|
169
|
+
- [npm 文档](https://docs.npmjs.com/)
|
|
170
|
+
- [GitHub Packages 文档](https://docs.github.com/en/packages)
|
package/eslint.config.js
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
// eslint.config.js
|
|
2
|
+
const js = require('@eslint/js');
|
|
3
|
+
const tsPlugin = require('@typescript-eslint/eslint-plugin');
|
|
4
|
+
const tsParser = require('@typescript-eslint/parser');
|
|
5
|
+
const globals = require('globals');
|
|
6
|
+
|
|
7
|
+
module.exports = [
|
|
8
|
+
{
|
|
9
|
+
ignores: [
|
|
10
|
+
'**/node_modules/**',
|
|
11
|
+
'**/temp/**',
|
|
12
|
+
'**/dist/**',
|
|
13
|
+
'**/*.js',
|
|
14
|
+
'**/*.d.ts',
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
js.configs.recommended,
|
|
19
|
+
|
|
20
|
+
// 配置 1: src/ 和 example/ 目录(需要类型检查)
|
|
21
|
+
{
|
|
22
|
+
files: ['src/**/*.ts', 'example/**/*.ts'],
|
|
23
|
+
languageOptions: {
|
|
24
|
+
parser: tsParser,
|
|
25
|
+
parserOptions: {
|
|
26
|
+
ecmaVersion: 2018,
|
|
27
|
+
sourceType: 'module',
|
|
28
|
+
project: './tsconfig.json', // 使用项目配置
|
|
29
|
+
},
|
|
30
|
+
globals: {
|
|
31
|
+
...globals.node,
|
|
32
|
+
...globals.es6,
|
|
33
|
+
NodeJS: 'readonly',
|
|
34
|
+
Atomics: 'readonly',
|
|
35
|
+
SharedArrayBuffer: 'readonly',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
plugins: {
|
|
39
|
+
'@typescript-eslint': tsPlugin,
|
|
40
|
+
},
|
|
41
|
+
rules: {
|
|
42
|
+
...tsPlugin.configs.recommended.rules,
|
|
43
|
+
'@typescript-eslint/no-require-imports': 'off',
|
|
44
|
+
'@typescript-eslint/no-var-requires': 'off',
|
|
45
|
+
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
46
|
+
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
47
|
+
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
48
|
+
'@typescript-eslint/ban-types': 'off',
|
|
49
|
+
'@typescript-eslint/no-empty-function': 'off',
|
|
50
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
51
|
+
'@typescript-eslint/no-unused-vars': 'off',
|
|
52
|
+
// 新增推荐规则 / New recommended rules
|
|
53
|
+
'@typescript-eslint/no-floating-promises': 'warn', // 警告未处理的 Promise
|
|
54
|
+
'@typescript-eslint/await-thenable': 'warn', // 避免 await 非 thenable
|
|
55
|
+
'@typescript-eslint/no-misused-promises': 'warn', // Promise 误用检查
|
|
56
|
+
'no-console': 'off', // 允许使用 console(生产环境可以考虑启用)
|
|
57
|
+
'lines-between-class-members': ['warn', 'always'],
|
|
58
|
+
'no-undef': 'off',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
// 配置 2: tools/ 目录(不需要类型检查)
|
|
63
|
+
{
|
|
64
|
+
files: ['tools/**/*.ts'],
|
|
65
|
+
languageOptions: {
|
|
66
|
+
parser: tsParser,
|
|
67
|
+
parserOptions: {
|
|
68
|
+
ecmaVersion: 2018,
|
|
69
|
+
sourceType: 'module',
|
|
70
|
+
// ✅ 不使用 project,避免解析错误
|
|
71
|
+
},
|
|
72
|
+
globals: {
|
|
73
|
+
...globals.node,
|
|
74
|
+
...globals.es6,
|
|
75
|
+
NodeJS: 'readonly',
|
|
76
|
+
Atomics: 'readonly',
|
|
77
|
+
SharedArrayBuffer: 'readonly',
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
plugins: {
|
|
81
|
+
'@typescript-eslint': tsPlugin,
|
|
82
|
+
},
|
|
83
|
+
rules: {
|
|
84
|
+
...tsPlugin.configs.recommended.rules,
|
|
85
|
+
'@typescript-eslint/no-require-imports': 'off',
|
|
86
|
+
'@typescript-eslint/no-var-requires': 'off',
|
|
87
|
+
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
88
|
+
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
89
|
+
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
90
|
+
'@typescript-eslint/ban-types': 'off',
|
|
91
|
+
'@typescript-eslint/no-empty-function': 'off',
|
|
92
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
93
|
+
'@typescript-eslint/no-unused-vars': 'off',
|
|
94
|
+
// 注意:tools/ 目录不启用需要类型信息的规则
|
|
95
|
+
// Note: Type-aware rules are not enabled for tools/ directory
|
|
96
|
+
'no-console': 'off', // tools 目录允许使用 console
|
|
97
|
+
'lines-between-class-members': ['warn', 'always'],
|
|
98
|
+
'no-undef': 'off',
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
// 配置 3: __tests__ 目录(不需要类型检查)
|
|
103
|
+
{
|
|
104
|
+
files: ['__tests__/**/*.ts'],
|
|
105
|
+
languageOptions: {
|
|
106
|
+
parser: tsParser,
|
|
107
|
+
parserOptions: {
|
|
108
|
+
ecmaVersion: 2018,
|
|
109
|
+
sourceType: 'module',
|
|
110
|
+
// ✅ 不使用 project,避免解析错误
|
|
111
|
+
},
|
|
112
|
+
globals: {
|
|
113
|
+
...globals.node,
|
|
114
|
+
...globals.es6,
|
|
115
|
+
NodeJS: 'readonly',
|
|
116
|
+
Atomics: 'readonly',
|
|
117
|
+
SharedArrayBuffer: 'readonly',
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
plugins: {
|
|
121
|
+
'@typescript-eslint': tsPlugin,
|
|
122
|
+
},
|
|
123
|
+
rules: {
|
|
124
|
+
...tsPlugin.configs.recommended.rules,
|
|
125
|
+
'@typescript-eslint/no-require-imports': 'off',
|
|
126
|
+
'@typescript-eslint/no-var-requires': 'off',
|
|
127
|
+
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
128
|
+
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
129
|
+
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
130
|
+
'@typescript-eslint/ban-types': 'off',
|
|
131
|
+
'@typescript-eslint/no-empty-function': 'off',
|
|
132
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
133
|
+
'@typescript-eslint/no-unused-vars': 'off',
|
|
134
|
+
// 注意:测试目录不启用需要类型信息的规则
|
|
135
|
+
// Note: Type-aware rules are not enabled for test directory
|
|
136
|
+
'no-console': 'off', // 测试目录允许使用 console
|
|
137
|
+
'lines-between-class-members': ['warn', 'always'],
|
|
138
|
+
'no-undef': 'off',
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
];
|
package/package.json
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gaias/client_node",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.19",
|
|
4
4
|
"description": "store data in cookie and localstorage",
|
|
5
5
|
"main": "dist/single/index.js",
|
|
6
6
|
"types": "dist/single/index.d.ts",
|
|
7
7
|
"license": "UNLICENSED",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/sight-saber/client_node.git"
|
|
11
|
+
},
|
|
8
12
|
"publishConfig": {
|
|
9
13
|
"access": "public",
|
|
10
14
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -19,10 +23,6 @@
|
|
|
19
23
|
"node": ">=18.0.0",
|
|
20
24
|
"yarn": ">=1.22.x"
|
|
21
25
|
},
|
|
22
|
-
"files": [
|
|
23
|
-
"dist",
|
|
24
|
-
"README.md"
|
|
25
|
-
],
|
|
26
26
|
"scripts": {
|
|
27
27
|
"//===ncc build===": "",
|
|
28
28
|
"ncc:build": "ncc build ./src/index.ts -m -o ./dist/single -e sqlite3 --no-source-map-register && ncc cache clean",
|
|
@@ -42,7 +42,9 @@
|
|
|
42
42
|
"security:summary": "yarn audit --summary",
|
|
43
43
|
"security:json": "yarn audit --json",
|
|
44
44
|
"security:check": "node tools/security-check.js",
|
|
45
|
-
"
|
|
45
|
+
"//===publish===": "",
|
|
46
|
+
"precommit": "yarn lint",
|
|
47
|
+
"build:publish": "npm run gen:idx && rimraf dist && mkdir dist && tsc && mv temp/* dist/ && rimraf temp"
|
|
46
48
|
},
|
|
47
49
|
"devDependencies": {
|
|
48
50
|
"@eslint/js": "^9.38.0",
|