chore: let pnpm detect dependencies
This commit is contained in:
parent
bd88c3399f
commit
fc7de024c6
4 changed files with 24 additions and 69 deletions
|
@ -9,9 +9,9 @@
|
|||
"private": true,
|
||||
"scripts": {
|
||||
"rebuild": "pnpm run clean && pnpm run build",
|
||||
"build": "pnpm node ./scripts/build.mjs && pnpm run build:assets",
|
||||
"build": "pnpm --recursive --color run build && pnpm node ./scripts/copy-index.mjs && pnpm run build:assets",
|
||||
"build:assets": "pnpm node ./scripts/copy-assets.mjs",
|
||||
"build:debug": "pnpm run clean && pnpm node ./scripts/dev-build.mjs && pnpm run build:assets",
|
||||
"build:debug": "pnpm run clean && pnpm --recursive --color run build:debug && pnpm node ./scripts/copy-index-dev.mjs && pnpm run build:assets",
|
||||
"start": "pnpm --filter backend run start",
|
||||
"start:container": "pnpm run build:assets && pnpm run migrate && pnpm run start",
|
||||
"start:test": "pnpm --filter backend run start:test",
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
import fs from "node:fs";
|
||||
import path, { join } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { execa } from "execa";
|
||||
|
||||
(async () => {
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
await execa(
|
||||
"pnpm", [
|
||||
"--recursive",
|
||||
"--parallel",
|
||||
"--filter=backend-rs",
|
||||
"--filter=firefish-js",
|
||||
"run",
|
||||
"build",
|
||||
], {
|
||||
cwd: join(__dirname, "/../"),
|
||||
stdio: "inherit",
|
||||
}
|
||||
);
|
||||
|
||||
await execa(
|
||||
"pnpm", [
|
||||
"--recursive",
|
||||
"--parallel",
|
||||
"--filter=!backend-rs",
|
||||
"--filter=!firefish-js",
|
||||
"run",
|
||||
"build",
|
||||
], {
|
||||
cwd: join(__dirname, "/../"),
|
||||
stdio: "inherit",
|
||||
}
|
||||
);
|
||||
|
||||
fs.copyFileSync("packages/backend-rs/index.js", "packages/backend-rs/built/index.js");
|
||||
})();
|
|
@ -1,39 +1,15 @@
|
|||
// To mitigate this issue https://github.com/napi-rs/napi-rs/issues/1768
|
||||
|
||||
// During development, the contents of index.js/index.d.ts may change,
|
||||
// so this script only copies these files when this bug occurs
|
||||
|
||||
import path, { join } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { execa } from "execa";
|
||||
import fs from "node:fs";
|
||||
|
||||
(async () => {
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
await execa(
|
||||
"pnpm", [
|
||||
"--recursive",
|
||||
"--parallel",
|
||||
"--filter=backend-rs",
|
||||
"--filter=firefish-js",
|
||||
"run",
|
||||
"build:debug",
|
||||
], {
|
||||
cwd: join(__dirname, "/../"),
|
||||
stdio: "inherit",
|
||||
}
|
||||
);
|
||||
|
||||
await execa(
|
||||
"pnpm", [
|
||||
"--recursive",
|
||||
"--parallel",
|
||||
"--filter=!backend-rs",
|
||||
"--filter=!firefish-js",
|
||||
"run",
|
||||
"build:debug",
|
||||
], {
|
||||
cwd: join(__dirname, "/../"),
|
||||
stdio: "inherit",
|
||||
}
|
||||
);
|
||||
|
||||
if (!fs.existsSync(join(__dirname, "/../packages/backend-rs/built/index.js"))) {
|
||||
fs.copyFileSync(
|
||||
join(__dirname, "/../packages/backend-rs/index.js"),
|
||||
|
@ -46,5 +22,6 @@ import fs from "node:fs";
|
|||
join(__dirname, "/../packages/backend-rs/index.d.ts"),
|
||||
join(__dirname, "/../packages/backend-rs/built/index.d.ts"),
|
||||
);
|
||||
console.warn("backend-rs/built/index.d.ts has not been updated (https://github.com/napi-rs/napi-rs/issues/1768)");
|
||||
}
|
||||
})();
|
16
scripts/copy-index.mjs
Normal file
16
scripts/copy-index.mjs
Normal file
|
@ -0,0 +1,16 @@
|
|||
// To mitigate this issue https://github.com/napi-rs/napi-rs/issues/1768
|
||||
|
||||
// Adding index.js/index.d.ts to the repository is recommended by
|
||||
// napi-rs maintainer: https://github.com/napi-rs/napi-rs/issues/1807#issuecomment-1814510181
|
||||
|
||||
import path, { join } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import fs from "node:fs";
|
||||
|
||||
(async () => {
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
fs.copyFileSync(
|
||||
join(__dirname, "/../packages/backend-rs/index.js"),
|
||||
join(__dirname, "/../packages/backend-rs/built/index.js"),
|
||||
);
|
||||
})();
|
Loading…
Reference in a new issue