后端迁移开发脚本

This commit is contained in:
yml
2026-05-21 17:37:31 +08:00
parent 78e9d1d5c5
commit 3a2f89e233
5 changed files with 23 additions and 10 deletions
+3 -3
View File
@@ -6,9 +6,9 @@
"scripts": { "scripts": {
"browser:install": "playwright install chromium", "browser:install": "playwright install chromium",
"browser:install:linux": "playwright install --with-deps chromium", "browser:install:linux": "playwright install --with-deps chromium",
"agiso:auto-delivery:test": "tsx scripts/test-agiso-auto-delivery.js", "agiso:auto-delivery:test": "tsx scripts/test-agiso-auto-delivery.ts",
"cleanup:dev-data": "tsx scripts/cleanup-dev-data.js", "cleanup:dev-data": "tsx scripts/cleanup-dev-data.ts",
"seed:dev-data": "tsx scripts/seed-dev-data.js", "seed:dev-data": "tsx scripts/seed-dev-data.ts",
"build": "tsc -p tsconfig.build.json && rm -rf dist/db/migrations && mkdir -p dist/db && cp -R src/db/migrations dist/db/migrations", "build": "tsc -p tsconfig.build.json && rm -rf dist/db/migrations && mkdir -p dist/db && cp -R src/db/migrations dist/db/migrations",
"db:migrate": "tsx src/db/migrate.ts", "db:migrate": "tsx src/db/migrate.ts",
"dev": "tsx watch --clear-screen=false --include config src/index.ts", "dev": "tsx watch --clear-screen=false --include config src/index.ts",
@@ -70,7 +70,7 @@ function parseArgs(argv) {
function printHelp() { function printHelp() {
console.log(` console.log(`
: :
node scripts/cleanup-dev-data.js [--apply] npm run cleanup:dev-data -- [--apply]
: :
PostgreSQL fulfillment schema PostgreSQL fulfillment schema
@@ -177,7 +177,7 @@ async function ensureSeedBindings() {
enabled: true, enabled: true,
priority: binding.priority, priority: binding.priority,
configJson: JSON.stringify({ configJson: JSON.stringify({
seededBy: 'scripts/seed-dev-data.js', seededBy: 'scripts/seed-dev-data.ts',
scenario: binding.skuCode, scenario: binding.skuCode,
}), }),
createdAt: timestamp, createdAt: timestamp,
@@ -458,7 +458,7 @@ function parseArgs(argv) {
function printHelp() { function printHelp() {
console.log(` console.log(`
: :
node scripts/seed-dev-data.js [--apply] [--reset] npm run seed:dev-data -- [--apply] [--reset]
: :
PostgreSQL fulfillment schema PostgreSQL fulfillment schema
@@ -260,16 +260,16 @@ function printJson(title, value) {
function printHelp() { function printHelp() {
process.stdout.write(`用法: process.stdout.write(`用法:
node scripts/test-agiso-auto-delivery.js <订单号> [--shop-id <店铺ID>] [--poll 0,3,10] npm run agiso:auto-delivery:test -- <订单号> [--shop-id <店铺ID>] [--poll 0,3,10]
: :
1. DummySend 1. DummySend
2. Order/Detail DummySend poll 2. Order/Detail DummySend poll
: :
node scripts/test-agiso-auto-delivery.js 4502285714045005830 npm run agiso:auto-delivery:test -- 4502285714045005830
node scripts/test-agiso-auto-delivery.js 4502285714045005830 --poll 0,5,15 npm run agiso:auto-delivery:test -- 4502285714045005830 --poll 0,5,15
node scripts/test-agiso-auto-delivery.js 4502285714045005830 --shop-id 2209880145223 npm run agiso:auto-delivery:test -- 4502285714045005830 --shop-id 2209880145223
`) `)
} }
+13
View File
@@ -873,6 +873,19 @@
- `npm run build` - `npm run build`
- `npm test` 共 139 个用例通过 - `npm test` 共 139 个用例通过
233. `apps/backend/src` 目录下非测试 `.js` 文件已全部迁移为 `.ts` 233. `apps/backend/src` 目录下非测试 `.js` 文件已全部迁移为 `.ts`
234. 后端开发脚本迁移到 `.ts`
- `scripts/cleanup-dev-data.ts`
- `scripts/seed-dev-data.ts`
- `scripts/test-agiso-auto-delivery.ts`
235. `package.json``cleanup:dev-data``seed:dev-data``agiso:auto-delivery:test` 已指向 `.ts` 脚本;脚本帮助文案同步改为 npm script 形式
236. Docker 内验证通过:
- `npm run cleanup:dev-data -- --help`
- `npm run seed:dev-data -- --help`
- `npm run agiso:auto-delivery:test -- --help`
- `npm run typecheck`
- `npm run build`
- `npm test` 共 139 个用例通过
237.`dist``node_modules` 和测试文件外,`apps/backend` 目录下非测试 `.js` 文件已全部迁移为 `.ts`
## 下一步建议 ## 下一步建议