Fix Windows native bundle dependency staging
This commit is contained in:
@@ -6,6 +6,7 @@ import { spawnSync } from "node:child_process";
|
|||||||
const appRoot = resolve(import.meta.dirname, "..");
|
const appRoot = resolve(import.meta.dirname, "..");
|
||||||
const packageJson = JSON.parse(readFileSync(resolve(appRoot, "package.json"), "utf8"));
|
const packageJson = JSON.parse(readFileSync(resolve(appRoot, "package.json"), "utf8"));
|
||||||
const packageLockPath = resolve(appRoot, "package-lock.json");
|
const packageLockPath = resolve(appRoot, "package-lock.json");
|
||||||
|
const rootNodeModulesPath = resolve(appRoot, "node_modules");
|
||||||
const bundledNodeVersion = process.env.FEYNMAN_BUNDLED_NODE_VERSION ?? process.version.slice(1);
|
const bundledNodeVersion = process.env.FEYNMAN_BUNDLED_NODE_VERSION ?? process.version.slice(1);
|
||||||
|
|
||||||
function fail(message) {
|
function fail(message) {
|
||||||
@@ -120,6 +121,18 @@ function copyPackageFiles(appDir) {
|
|||||||
cpSync(packageLockPath, resolve(appDir, "package-lock.json"));
|
cpSync(packageLockPath, resolve(appDir, "package-lock.json"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function installAppDependencies(appDir) {
|
||||||
|
if (existsSync(rootNodeModulesPath)) {
|
||||||
|
cpSync(rootNodeModulesPath, resolve(appDir, "node_modules"), { recursive: true });
|
||||||
|
run("npm", ["prune", "--omit=dev", "--ignore-scripts", "--no-audit", "--no-fund", "--loglevel", "error"], {
|
||||||
|
cwd: appDir,
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
run("npm", ["ci", "--omit=dev", "--ignore-scripts", "--no-audit", "--no-fund", "--loglevel", "error"], { cwd: appDir });
|
||||||
|
}
|
||||||
|
|
||||||
function extractTarball(archivePath, destination, compressionFlag) {
|
function extractTarball(archivePath, destination, compressionFlag) {
|
||||||
run("tar", [compressionFlag, archivePath, "-C", destination]);
|
run("tar", [compressionFlag, archivePath, "-C", destination]);
|
||||||
}
|
}
|
||||||
@@ -253,7 +266,7 @@ function main() {
|
|||||||
|
|
||||||
ensureBundledWorkspace();
|
ensureBundledWorkspace();
|
||||||
copyPackageFiles(appDir);
|
copyPackageFiles(appDir);
|
||||||
run("npm", ["ci", "--omit=dev", "--ignore-scripts", "--no-audit", "--no-fund", "--loglevel", "error"], { cwd: appDir });
|
installAppDependencies(appDir);
|
||||||
|
|
||||||
const appFeynmanDir = resolve(appDir, ".feynman");
|
const appFeynmanDir = resolve(appDir, ".feynman");
|
||||||
extractTarball(resolve(appFeynmanDir, "runtime-workspace.tgz"), appFeynmanDir, "-xzf");
|
extractTarball(resolve(appFeynmanDir, "runtime-workspace.tgz"), appFeynmanDir, "-xzf");
|
||||||
|
|||||||
Reference in New Issue
Block a user