@open-mercato/starter 0.8.1-develop.7297.1.67605e74f9 → 0.9.0
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/package.json +2 -3
- package/src/__tests__/starter.test.mjs +24 -1
- package/src/steps.mjs +15 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-mercato/starter",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "One-command, cross-platform bootstrap for Open Mercato dev environments: prerequisite doctor, corporate TLS trust, idempotent setup steps, and a supervised hybrid or fully containerized stack.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -23,6 +23,5 @@
|
|
|
23
23
|
"type": "git",
|
|
24
24
|
"url": "https://github.com/open-mercato/open-mercato",
|
|
25
25
|
"directory": "packages/starter"
|
|
26
|
-
}
|
|
27
|
-
"stableVersion": "0.8.0"
|
|
26
|
+
}
|
|
28
27
|
}
|
|
@@ -11,7 +11,7 @@ import { DEFAULT_OPENCODE_BASE_IMAGE, DEFAULT_PORTS, resolveStackPorts } from '.
|
|
|
11
11
|
import { addEnvValue, readEnvValue, setEnvValue } from '../env-file.mjs'
|
|
12
12
|
import { ensureLlmProvider, syncProviderConfigToAppEnv } from '../providers.mjs'
|
|
13
13
|
import { ensureWindowsUtf8Console, resolveSpawnCommand } from '../spawn.mjs'
|
|
14
|
-
import { StepBlocked, buildToolchainStep, clearConvergenceState, databaseIsInitialized, listMigrationModules, migrationsFingerprint, probePostgresCredentials, readAppliedMigrationModules, resolveOpencodeBaseImage, runSteps } from '../steps.mjs'
|
|
14
|
+
import { StepBlocked, buildToolchainStep, clearConvergenceState, databaseIsInitialized, listMigrationModules, migrationsFingerprint, probePostgresCredentials, readAppliedMigrationModules, resolveOpencodeBaseImage, runSteps, workspaceBuildStep } from '../steps.mjs'
|
|
15
15
|
import { ensureEnvFiles } from '../env-setup.mjs'
|
|
16
16
|
import { removeLeftoverComposeResources } from '../infra.mjs'
|
|
17
17
|
import { checkBuildToolchain, defenderExclusionCovers, detectHostGateway, hostIpCandidates } from '../doctor.mjs'
|
|
@@ -360,6 +360,29 @@ test('buildToolchainStep warns instead of blocking when the workspace install al
|
|
|
360
360
|
await assert.rejects(() => buildToolchainStep.check(ctx), (error) => error instanceof StepBlocked)
|
|
361
361
|
})
|
|
362
362
|
|
|
363
|
+
test('workspaceBuildStep rebuilds packages after generate, like the root yarn build', async () => {
|
|
364
|
+
const calls = []
|
|
365
|
+
await workspaceBuildStep.apply({ repoRoot: makeFakeRepo(), runYarnImpl: (_ctx, args) => calls.push(args.join(' ')) })
|
|
366
|
+
assert.deepEqual(calls, ['build:packages', 'generate', 'build:packages'])
|
|
367
|
+
})
|
|
368
|
+
|
|
369
|
+
test('workspaceBuildStep only converges once core dist/generated exists, not just the cli binary', async () => {
|
|
370
|
+
const repo = makeFakeRepo()
|
|
371
|
+
const ctx = { repoRoot: repo }
|
|
372
|
+
const writeArtifact = (...segments) => {
|
|
373
|
+
fs.mkdirSync(path.join(repo, ...segments.slice(0, -1)), { recursive: true })
|
|
374
|
+
fs.writeFileSync(path.join(repo, ...segments), '')
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
writeArtifact('packages', 'cli', 'dist', 'bin.js')
|
|
378
|
+
assert.equal((await workspaceBuildStep.check(ctx)).ok, false)
|
|
379
|
+
|
|
380
|
+
writeArtifact('packages', 'core', 'dist', 'generated', 'entities.ids.generated.js')
|
|
381
|
+
assert.equal((await workspaceBuildStep.check(ctx)).ok, true)
|
|
382
|
+
|
|
383
|
+
assert.equal((await workspaceBuildStep.check({ ...ctx, installChanged: true })).ok, false)
|
|
384
|
+
})
|
|
385
|
+
|
|
363
386
|
test('removeLeftoverComposeResources sweeps fixed-name containers and volumes down cannot see', () => {
|
|
364
387
|
const calls = []
|
|
365
388
|
const runComposeImpl = () => ({
|
package/src/steps.mjs
CHANGED
|
@@ -440,6 +440,11 @@ export const workspaceInstallStep = {
|
|
|
440
440
|
},
|
|
441
441
|
}
|
|
442
442
|
|
|
443
|
+
const WORKSPACE_BUILD_ARTIFACTS = [
|
|
444
|
+
['packages', 'cli', 'dist', 'bin.js'],
|
|
445
|
+
['packages', 'core', 'dist', 'generated', 'entities.ids.generated.js'],
|
|
446
|
+
]
|
|
447
|
+
|
|
443
448
|
export const workspaceBuildStep = {
|
|
444
449
|
id: 'workspace-build',
|
|
445
450
|
expectation: '1-3 minutes on the first run, cached by turbo afterwards',
|
|
@@ -448,12 +453,18 @@ export const workspaceBuildStep = {
|
|
|
448
453
|
// The database step shells out to the `mercato` CLI, which only exists
|
|
449
454
|
// after packages are built (turbo's db:migrate task declares no build
|
|
450
455
|
// dependency) — so this must converge before any DB work on a fresh clone.
|
|
451
|
-
|
|
452
|
-
|
|
456
|
+
// core's dist/generated only exists once `generate` ran AND packages were
|
|
457
|
+
// rebuilt afterwards, so it proves the whole sequence converged.
|
|
458
|
+
const built = WORKSPACE_BUILD_ARTIFACTS.every((segments) => fs.existsSync(path.join(ctx.repoRoot, ...segments)))
|
|
459
|
+
return { ok: built && !ctx.installChanged, detail: built && !ctx.installChanged ? 'packages built, dependencies unchanged' : 'building (turbo caches make re-runs fast)' }
|
|
453
460
|
},
|
|
454
461
|
async apply(ctx) {
|
|
455
|
-
|
|
456
|
-
|
|
462
|
+
// Mirrors the root `yarn build`: core only compiles `generated/**` into
|
|
463
|
+
// dist/generated when it exists, which on a fresh clone is after `generate`.
|
|
464
|
+
const run = ctx.runYarnImpl ?? runYarn
|
|
465
|
+
run(ctx, ['build:packages'])
|
|
466
|
+
run(ctx, ['generate'])
|
|
467
|
+
run(ctx, ['build:packages'])
|
|
457
468
|
},
|
|
458
469
|
}
|
|
459
470
|
|