also looking at this
umbrella: pet-store storefront fixes (rolling)
#3
586 files
+38082
-7487
Review threads live on the whole diff, not on one commit, so none are shown here - a thread's line means something in the branch's final form, and painting it into an intermediate step would put it on code it is not about.
| @@ -1,13 +1,30 @@ | ||
| 1 | 1 | import { $ } from 'bun' |
| 2 | 2 | import { existsSync, readFileSync, statSync } from 'node:fs' |
| 3 | import { basename } from 'node:path' | |
| 3 | 4 | import process from 'node:process' |
| 4 | 5 | import { dim, italic, log } from '@stacksjs/cli' |
| 6 | import { feature } from '@stacksjs/config' | |
| 5 | 7 | import { corePath } from '@stacksjs/path' |
| 6 | 8 | import { glob } from '@stacksjs/storage' |
| 7 | 9 | import { ExitCode } from '@stacksjs/types' |
| 8 | 10 | |
| 9 | 11 | log.info('Building core packages') |
| 10 | 12 | |
| 13 | // Feature-gated core packages. Each entry maps a core package directory | |
| 14 | // name to the feature flag (in config/features.ts) that controls it. | |
| 15 | // When the flag is off, the package is skipped — apps that never install | |
| 16 | // `commerce` or `realtime` don't pay the build cost for them. | |
| 17 | // | |
| 18 | // Dashboard / marketing / monitoring don't ship as their own core packages | |
| 19 | // (they're framework default routes + actions), so they don't appear here | |
| 20 | // even though they're feature flags. | |
| 21 | const FEATURE_GATED_PACKAGES: Record<string, string> = { | |
| 22 | cms: 'cms', | |
| 23 | commerce: 'commerce', | |
| 24 | queue: 'queue', | |
| 25 | realtime: 'realtime', | |
| 26 | } | |
| 27 | ||
| 11 | 28 | const allEntries = (await glob([corePath('*')], { onlyFiles: false })).sort() |
| 12 | 29 | const dirs = allEntries.filter((entry) => { |
| 13 | 30 | if (!existsSync(entry) || !statSync(entry).isDirectory()) |
| @@ -17,6 +34,17 @@ const dirs = allEntries.filter((entry) => { | ||
| 17 | 34 | if (!existsSync(pkgPath)) |
| 18 | 35 | return false |
| 19 | 36 | |
| 37 | // Skip feature-gated packages whose flag is off. `feature()` reads | |
| 38 | // config/features.ts (with env-aware overrides), so flipping the flag | |
| 39 | // via `./buddy <feature>:install` is enough to pull a package back | |
| 40 | // into the build. | |
| 41 | const name = basename(entry) | |
| 42 | const gate = FEATURE_GATED_PACKAGES[name] | |
| 43 | if (gate && !feature(gate)) { | |
| 44 | log.info(`Skipping ${italic(dim(entry))} — feature '${gate}' is disabled`) | |
| 45 | return false | |
| 46 | } | |
| 47 | ||
| 20 | 48 | try { |
| 21 | 49 | const pkg = JSON.parse(readFileSync(pkgPath, 'utf8')) as { scripts?: Record<string, string> } |
| 22 | 50 | return typeof pkg.scripts?.build === 'string' |