fix(loader): fall back to src/resources when SF-WORKFLOW.md missing from dist
Build sometimes copies dist/resources/extensions/ without the top-level markdown files (observed: SF-WORKFLOW.md absent in dist/resources/ while extensions/ was present). existsSync(distRes) was true either way, so SF_WORKFLOW_PATH pointed at a non-existent path and /sf failed with ENOENT. Check for the specific file instead of the directory.
This commit is contained in:
parent
bf96faf99b
commit
0f94341b43
1 changed files with 4 additions and 1 deletions
|
|
@ -145,9 +145,12 @@ process.env.SF_BIN_PATH = process.env.SF_BIN_PATH || process.argv[1]
|
|||
// SF_WORKFLOW_PATH — absolute path to bundled SF-WORKFLOW.md, used by patched sf extension
|
||||
// when dispatching workflow prompts. Prefers dist/resources/ (stable, set at build time)
|
||||
// over src/resources/ (live working tree) — see resource-loader.ts for rationale.
|
||||
// Guard: the build sometimes copies dist/resources/extensions/ without the root-level
|
||||
// markdown files, leaving existsSync(distRes)=true but SF-WORKFLOW.md missing. Fall
|
||||
// back to src/resources/ when the file itself isn't present in dist.
|
||||
const distRes = join(sfRootDir, 'dist', 'resources')
|
||||
const srcRes = join(sfRootDir, 'src', 'resources')
|
||||
const resourcesDir = existsSync(distRes) ? distRes : srcRes
|
||||
const resourcesDir = existsSync(join(distRes, 'SF-WORKFLOW.md')) ? distRes : srcRes
|
||||
process.env.SF_WORKFLOW_PATH = join(resourcesDir, 'SF-WORKFLOW.md')
|
||||
|
||||
// SF_BUNDLED_EXTENSION_PATHS — dynamically discovered bundled extension entry points.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue