Skip to content

Commit 8fc68d6

Browse files
committed
Add temporary gulp shim for testing
1 parent 1eeba39 commit 8fc68d6

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

Gulpfile.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
throw new Error("Do not use; run hereby instead.");

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
"which": "^2.0.2"
8181
},
8282
"scripts": {
83+
"prepare": "node ./scripts/installGulpShim.mjs",
8384
"test": "hereby runtests-parallel --light=false",
8485
"test:eslint-rules": "hereby run-eslint-rules-tests",
8586
"build": "npm run build:compiler && npm run build:tests",

scripts/installGulpShim.mjs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import fs from "fs";
2+
3+
await fs.promises.mkdir("node_modules/gulp", { recursive: true });
4+
5+
await fs.promises.writeFile("node_modules/gulp/package.json", JSON.stringify({
6+
name: "gulp",
7+
version: "4.0.2",
8+
bin: "index.js",
9+
}));
10+
11+
await fs.promises.writeFile("node_modules/gulp/index.js", `
12+
const cp = require("child_process");
13+
const path = require("path");
14+
const chalk = require("chalk");
15+
16+
console.error(chalk.red("Warning: using gulp shim; please run hereby instead."));
17+
18+
const args = [
19+
...process.execArgv,
20+
path.join(__dirname, "..", "hereby", "bin", "hereby.js"),
21+
...process.argv.slice(2),
22+
];
23+
24+
const { status } = cp.spawnSync(process.execPath, args, { stdio: "inherit" });
25+
process.exit(status ?? 1);
26+
`);

0 commit comments

Comments
 (0)