Skip to content

Commit

Permalink
setup: ignore scripts during bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
thecodrr committed Mar 6, 2024
1 parent 58db265 commit d9ed61a
Showing 1 changed file with 26 additions and 7 deletions.
33 changes: 26 additions & 7 deletions scripts/bootstrap.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,11 @@ import os from "os";
import parser from "yargs-parser";
import { fdir } from "fdir";
import Listr from "listr";
import { existsSync } from "fs";

const args = parser(process.argv, { alias: { scope: ["s"], offline: ["o"] } });
const IS_CI = process.env.CI;
const THREADS = IS_CI
? 1
: Math.max(4, process.env.THREADS || os.cpus().length / 2);
const THREADS = Math.max(4, process.env.THREADS || os.cpus().length / 2);
const scopes = {
mobile: "apps/mobile",
web: "apps/web",
Expand Down Expand Up @@ -98,11 +97,14 @@ async function bootstrapPackages(dependencies) {
}

function bootstrapPackage(cwd, outputs) {
const cmd = `npm ${
IS_CI ? "ci" : "i"
} --legacy-peer-deps --no-audit --no-fund ${
args.offline ? "--offline" : "--prefer-offline"
} --progress=false --ignore-scripts`;
return new Promise((resolve, reject) =>
exec(
`npm ${IS_CI ? "ci" : "i"} --legacy-peer-deps --no-audit --no-fund ${
args.offline ? "--offline" : "--prefer-offline"
} --progress=false`,
cmd,
{
cwd,
env: process.env,
Expand All @@ -115,7 +117,24 @@ function bootstrapPackage(cwd, outputs) {
outputs.stdout.push(stdout);
outputs.stderr.push(stderr);

resolve();
if (!existsSync(path.join(cwd, "patches"))) return resolve();

exec(
`npx patch-package`,
{
cwd,
env: process.env,
stdio: "inherit"
},
(err, stdout, stderr) => {
if (err) return reject(err);

outputs.stdout.push(stdout);
outputs.stderr.push(stderr);

resolve();
}
);
}
)
);
Expand Down

0 comments on commit d9ed61a

Please sign in to comment.