ReviewOS

also looking at this

stacks/pet-store

umbrella: pet-store storefront fixes (rolling)

#3
Merged glennmichael123 wants to merge umbrella/pet-store into main
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.

storage/framework/core/actions/src/build/core.tsmodified+28-0
Changes to storage/framework/core/actions/src/build/core.ts
@@ -1,13 +1,30 @@
11import { $ } from 'bun'
22import { existsSync, readFileSync, statSync } from 'node:fs'
3import { basename } from 'node:path'
34import process from 'node:process'
45import { dim, italic, log } from '@stacksjs/cli'
6import { feature } from '@stacksjs/config'
57import { corePath } from '@stacksjs/path'
68import { glob } from '@stacksjs/storage'
79import { ExitCode } from '@stacksjs/types'
810
911log.info('Building core packages')
1012
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.
21const FEATURE_GATED_PACKAGES: Record<string, string> = {
22 cms: 'cms',
23 commerce: 'commerce',
24 queue: 'queue',
25 realtime: 'realtime',
26}
27
1128const allEntries = (await glob([corePath('*')], { onlyFiles: false })).sort()
1229const dirs = allEntries.filter((entry) => {
1330 if (!existsSync(entry) || !statSync(entry).isDirectory())
@@ -17,6 +34,17 @@ const dirs = allEntries.filter((entry) => {
1734 if (!existsSync(pkgPath))
1835 return false
1936
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
2048 try {
2149 const pkg = JSON.parse(readFileSync(pkgPath, 'utf8')) as { scripts?: Record<string, string> }
2250 return typeof pkg.scripts?.build === 'string'