Skip to content

Commit

Permalink
Simplify preinstall process
Browse files Browse the repository at this point in the history
  • Loading branch information
rchipka committed Mar 31, 2023
1 parent 091bf5d commit 28bf2b8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
1 change: 0 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@ node_modules/
build/
docs/
src/*.i
vendor/libxml2/
swig.xml
.github/
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"init": "node scripts/init.js",
"init-submodules": "git submodule update --init --recursive",
"configure": "cd vendor/libxml2.config && cmake configure ../libxml2 && cd ../..",
"install": "node-pre-gyp install --loglevel http || (npm run init && npm run build)",
"preinstall": "node scripts/preinstall.js",
"install": "node-pre-gyp install --fallback-to-build --loglevel http",
"build": "node-gyp rebuild -j max",
"build-debug": "node-gyp rebuild -j max --debug",
"swig": "npm run init && bash scripts/swig.sh && node scripts/swigfix.js",
Expand All @@ -41,12 +41,11 @@
},
"dependencies": {
"@mapbox/node-pre-gyp": "^1.0.9",
"bindings": "~1.3.0",
"nan": "~2.17.0"
"bindings": "~1.3.0"
},
"devDependencies": {
"@types/bindings": "^1.5.0",
"nan": "^2.14.2",
"nan": "^2.17.0",
"nodeunit": "^0.11.3",
"tslint": "^6.1.3",
"typedoc": "^0.23.28",
Expand Down
5 changes: 5 additions & 0 deletions scripts/init.js → scripts/preinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ const fs = require("fs");
const { execSync } = require("child_process");
const packageRoot = __dirname + "/../";

if (!fs.existsSync(packageRoot + ".git")) {
console.log("Initializing git repo");
execSync("git init", { stdio: "inherit", cwd: packageRoot });
}

if (
!fs.existsSync(packageRoot + "vendor/libxml2/include/libxml/parserInternals.h") ||
!fs.existsSync(packageRoot + "vendor/libxml2/globals.c")
Expand Down

0 comments on commit 28bf2b8

Please sign in to comment.