Skip to content

自动下单脚本

快速使用

bash
pnpm order

交互两步即可:

? Site  › techconsult.site
         technologyconsult.org

? Env   › Local  (localhost:5173)
         Online (production)

选完自动打开浏览器,跑完整下单流程。

新增域名支持

编辑 scripts/order.mjs,在 choices 里追加:

js
const site = await select({
  message: 'Site',
  choices: [
    { name: 'techconsult.site',      value: 'techconsult' },
    { name: 'technologyconsult.org', value: 'technologyconsult' },
    { name: 'newdomain.pk',          value: 'newdomain' },   // ← 加这行
  ],
})

urlMap 里加对应线上地址:

js
const urlMap = {
  techconsult:      'https://techconsult.site/contact',
  technologyconsult:'https://technologyconsult.org/contact',
  newdomain:        'https://newdomain.pk/contact',           // ← 加这行
}

同时在 scripts/place-order.mjssiteDefinitions 里加站点定义:

js
newdomain: {
  fallbackUrl: 'http://localhost:5173/contact',
  markers: [
    'newdomain.pk | Your Site Title',
    'Your Order Form Heading',
  ],
}

无头模式(CI/脚本调用)

bash
# 直接调 place-order.mjs,跳过 inquirer
node scripts/place-order.mjs \
  --site techconsult \
  --url https://techconsult.site/contact \
  --json

输出 JSON,方便 CI 捕获结果。

PK 电商站群内部台账