后端迁移开发脚本
This commit is contained in:
@@ -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 生成一组可重复验证的开发种子数据。
|
||||||
+4
-4
@@ -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
|
||||||
`)
|
`)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -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`
|
||||||
|
|
||||||
## 下一步建议
|
## 下一步建议
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user