@lovrozagar/grunt 0.11.0 → 0.11.1
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/cli/init.mjs +3 -1
- package/cli/init.test.ts +11 -0
- package/package.json +1 -1
package/cli/init.mjs
CHANGED
|
@@ -371,8 +371,10 @@ export function mergeClaudeSettings(destRoot, pkgRoot) {
|
|
|
371
371
|
fs.writeFileSync(destPath, `${JSON.stringify(destSettings, null, 2)}\n`)
|
|
372
372
|
}
|
|
373
373
|
|
|
374
|
+
// A command grunt wrote: one of its scripts, or a run of a grunt: script. Not any `bun run`, which a
|
|
375
|
+
// repo's own `bun run build && …` would match, and its script would be taken over as grunt's.
|
|
374
376
|
function looksGruntOwnedPrefix(prefix) {
|
|
375
|
-
return /rulesync|sync:globals|^(?:npm|yarn|pnpm|bun) run
|
|
377
|
+
return /rulesync|sync:globals|^(?:npm|yarn|pnpm|bun) run grunt:|guarded-roots\.mjs|hooks-union\.mjs|doctor\.mjs|sync-global-settings\.mjs|check-globals\.mjs|purge-global-mcps\.mjs/.test(
|
|
376
378
|
prefix,
|
|
377
379
|
)
|
|
378
380
|
}
|
package/cli/init.test.ts
CHANGED
|
@@ -1794,6 +1794,17 @@ describe("mergePackageJson", () => {
|
|
|
1794
1794
|
expect(out.scripts["grunt:test:e2e"]).toBe("vitest run -c vitest.e2e.config.ts");
|
|
1795
1795
|
});
|
|
1796
1796
|
|
|
1797
|
+
it("leaves a repo's own test:e2e alone when it runs grunt's command after one of its own", () => {
|
|
1798
|
+
const dest = tmp("pj-e2e-own-");
|
|
1799
|
+
const own = "bun run build && vitest run -c vitest.e2e.config.ts";
|
|
1800
|
+
fs.writeFileSync(path.join(dest, "package.json"), JSON.stringify({ name: "app", scripts: { "test:e2e": own } }));
|
|
1801
|
+
fs.writeFileSync(path.join(dest, E2E_VITEST_CONFIGS[0]), "export default {}\n");
|
|
1802
|
+
mergePackageJson(dest, PKG_ROOT);
|
|
1803
|
+
const out = JSON.parse(fs.readFileSync(path.join(dest, "package.json"), "utf8"));
|
|
1804
|
+
expect(out.scripts["test:e2e"]).toBe(own);
|
|
1805
|
+
expect(out.scripts["grunt:test:e2e"]).toBe("vitest run -c vitest.e2e.config.ts");
|
|
1806
|
+
});
|
|
1807
|
+
|
|
1797
1808
|
it("keeps an existing grunt:test:e2e even without an e2e config", () => {
|
|
1798
1809
|
const dest = tmp("pj-e2e-keep-");
|
|
1799
1810
|
fs.writeFileSync(
|
package/package.json
CHANGED