@ranger1/dx 0.1.87 → 0.1.89

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.
@@ -97,6 +97,7 @@ export function resolveBackendDeployConfig({ cli, targetConfig, environment, fla
97
97
  const startupMode = String(startupConfig.mode || 'pm2').trim()
98
98
  const prismaGenerate = runConfig.prismaGenerate !== false
99
99
  const prismaMigrateDeploy = runConfig.prismaMigrateDeploy !== false
100
+ const prismaSeed = runConfig.prismaSeed === true
100
101
 
101
102
  const normalized = {
102
103
  projectRoot: cli.projectRoot,
@@ -153,6 +154,7 @@ export function resolveBackendDeployConfig({ cli, targetConfig, environment, fla
153
154
  ),
154
155
  prismaGenerate,
155
156
  prismaMigrateDeploy,
157
+ prismaSeed,
156
158
  skipMigration: Boolean(flags.skipMigration),
157
159
  },
158
160
  verify: resolveVerifyConfig(verifyConfig),
@@ -168,7 +170,7 @@ export function resolveBackendDeployConfig({ cli, targetConfig, environment, fla
168
170
  requireString(normalized.startup.entry, 'startup.entry')
169
171
  }
170
172
 
171
- if (normalized.deploy.prismaGenerate || normalized.deploy.prismaMigrateDeploy) {
173
+ if (normalized.deploy.prismaGenerate || normalized.deploy.prismaMigrateDeploy || normalized.deploy.prismaSeed) {
172
174
  requireString(normalized.runtime.prismaSchemaDir, 'runtime.prismaSchemaDir')
173
175
  requireString(normalized.runtime.prismaConfig, 'runtime.prismaConfig')
174
176
  }
@@ -30,6 +30,7 @@ export function buildRemoteDeployScript(phaseModel = []) {
30
30
  const keepReleases = Number(deploy.keepReleases || 5)
31
31
  const shouldGenerate = deploy.prismaGenerate !== false
32
32
  const shouldMigrate = deploy.prismaMigrateDeploy !== false && deploy.skipMigration !== true
33
+ const shouldSeed = deploy.prismaSeed === true
33
34
  const healthCheckUrl = healthCheck?.url ? String(healthCheck.url) : ''
34
35
  const healthCheckTimeoutSeconds = Number(healthCheck?.timeoutSeconds || 10)
35
36
  const healthCheckMaxWaitSeconds = Number(healthCheck?.maxWaitSeconds || 24)
@@ -62,6 +63,7 @@ HEALTHCHECK_RETRY_DELAY_SECONDS=${healthCheckRetryIntervalSeconds}
62
63
  KEEP_RELEASES=${keepReleases}
63
64
  SHOULD_GENERATE=${shouldGenerate ? '1' : '0'}
64
65
  SHOULD_MIGRATE=${shouldMigrate ? '1' : '0'}
66
+ SHOULD_SEED=${shouldSeed ? '1' : '0'}
65
67
 
66
68
  LOCK_FILE="$APP_ROOT/.deploy.lock"
67
69
  LOCK_DIR="$APP_ROOT/.deploy.lock.d"
@@ -345,6 +347,17 @@ if [[ "$SHOULD_MIGRATE" == "1" ]]; then
345
347
  MIGRATION_EXECUTED=1
346
348
  fi
347
349
 
350
+ if [[ "$SHOULD_SEED" == "1" ]]; then
351
+ CURRENT_PHASE="prisma-seed"
352
+ echo "DX_REMOTE_PHASE=prisma-seed"
353
+ PRISMA_BIN="$RELEASE_DIR/node_modules/.bin/prisma"
354
+ if [[ ! -x "$PRISMA_BIN" ]]; then
355
+ echo "缺少可执行文件: $PRISMA_BIN" >&2
356
+ exit 1
357
+ fi
358
+ run_with_env "$RELEASE_DIR" "$PRISMA_BIN" db seed --schema="$PRISMA_SCHEMA" --config="$PRISMA_CONFIG"
359
+ fi
360
+
348
361
  CURRENT_PHASE="switch-current"
349
362
  echo "DX_REMOTE_PHASE=switch-current"
350
363
  ln -sfn "$RELEASE_DIR" "$CURRENT_LINK"
@@ -38,6 +38,8 @@ class PM2StackManager {
38
38
  ? options.services.map(item => String(item).trim()).filter(Boolean)
39
39
  : [...DEFAULT_SERVICES]
40
40
 
41
+ this.urls = options.urls && typeof options.urls === 'object' ? options.urls : {}
42
+
41
43
  const incomingPreflight = options.preflight && typeof options.preflight === 'object'
42
44
  ? options.preflight
43
45
  : {}
@@ -211,6 +213,19 @@ class PM2StackManager {
211
213
  logger.warn(stderr)
212
214
  }
213
215
  logger.success('服务启动成功')
216
+ this.printServiceUrls()
217
+ }
218
+
219
+ printServiceUrls() {
220
+ const entries = Object.entries(this.urls)
221
+ if (entries.length === 0) return
222
+
223
+ console.log('')
224
+ logger.info('服务访问链接:')
225
+ for (const [service, url] of entries) {
226
+ console.log(` ${service.padEnd(12)} → ${url}`)
227
+ }
228
+ console.log('')
214
229
  }
215
230
 
216
231
  async showStatus() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ranger1/dx",
3
- "version": "0.1.87",
3
+ "version": "0.1.89",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {