-
-
Notifications
You must be signed in to change notification settings - Fork 111
fix(config): use ROUTER.md as scaffold completeness marker #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,8 +20,8 @@ export function findConfig(startDir?: string): MexConfig { | |
| const projectRoot = gitRoot ?? dir; | ||
|
|
||
| const mexDir = resolve(projectRoot, ".mex"); | ||
| if (existsSync(mexDir) && !existsSync(resolve(mexDir, "setup.sh"))) { | ||
| throw new Error("Scaffold directory exists but looks incomplete. Run: bash .mex/setup.sh"); | ||
| if (existsSync(mexDir) && !existsSync(resolve(mexDir, "ROUTER.md"))) { | ||
| throw new Error("Scaffold directory exists but looks incomplete. Run: mex setup"); | ||
| } | ||
|
|
||
| const scaffoldRoot = findScaffoldRoot(projectRoot); | ||
|
|
@@ -31,7 +31,7 @@ export function findConfig(startDir?: string): MexConfig { | |
| } | ||
|
|
||
| throw new Error( | ||
| "No .mex/ scaffold found. Run: git clone https://github.com/theDakshJaitly/mex.git .mex && bash .mex/setup.sh" | ||
| "No .mex/ scaffold found. Run: mex setup" | ||
| ); | ||
|
Comment on lines
33
to
35
|
||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,13 +33,13 @@ describe("findConfig", () => { | |
|
|
||
| it("throws when no .mex/ scaffold found at all", () => { | ||
| mkdirSync(join(tmpDir, ".git")); | ||
| expect(() => findConfig(tmpDir)).toThrow("No .mex/ scaffold found. Run: git clone"); | ||
| expect(() => findConfig(tmpDir)).toThrow("No .mex/ scaffold found. Run: mex setup"); | ||
| }); | ||
|
Comment on lines
34
to
37
|
||
|
|
||
| it("works without .git if a complete scaffold exists", () => { | ||
| const mexPath = join(tmpDir, ".mex"); | ||
| mkdirSync(mexPath); | ||
| writeFileSync(join(mexPath, "setup.sh"), ""); | ||
| writeFileSync(join(mexPath, "ROUTER.md"), ""); | ||
|
|
||
| const config = findConfig(tmpDir); | ||
| expect(config.projectRoot).toBe(tmpDir); | ||
|
|
@@ -58,7 +58,7 @@ describe("findConfig", () => { | |
| mkdirSync(join(tmpDir, ".git")); | ||
| const mexPath = join(tmpDir, ".mex"); | ||
| mkdirSync(mexPath); | ||
| writeFileSync(join(mexPath, "setup.sh"), ""); | ||
| writeFileSync(join(mexPath, "ROUTER.md"), ""); | ||
| mkdirSync(join(tmpDir, "context")); | ||
| const config = findConfig(tmpDir); | ||
| expect(config.scaffoldRoot).toBe(mexPath); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The suggested recovery command
npx mex initis likely incorrect/misleading. In this repo, scaffold creation is done via thesetupcommand (seesrc/cli.tswheresetupis "First-time setup — create .mex/ scaffold"), whileinitrequires an existing scaffold. Consider updating the message to point tomex setup(ornpx promexeus setupfor non-global installs) so users can actually recover from an incomplete scaffold.