Add a script to copy the node sass bindings on install

This commit is contained in:
Samuel Elliott 2018-08-23 18:20:34 +01:00
parent 1e9b1618f1
commit 1f971c7490
No known key found for this signature in database
GPG Key ID: 8420C7CDE43DC4D6
3 changed files with 61 additions and 24 deletions

65
package-lock.json generated
View File

@ -3323,6 +3323,28 @@
"sumchecker": "1.3.1"
},
"dependencies": {
"fs-extra": {
"version": "0.30.0",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz",
"integrity": "sha1-8jP/zAjU2n1DLapEl3aYnbHfk/A=",
"dev": true,
"requires": {
"graceful-fs": "4.1.11",
"jsonfile": "2.4.0",
"klaw": "1.3.1",
"path-is-absolute": "1.0.1",
"rimraf": "2.6.2"
}
},
"jsonfile": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz",
"integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=",
"dev": true,
"requires": {
"graceful-fs": "4.1.11"
}
},
"minimist": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
@ -4431,16 +4453,13 @@
}
},
"fs-extra": {
"version": "0.30.0",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz",
"integrity": "sha1-8jP/zAjU2n1DLapEl3aYnbHfk/A=",
"dev": true,
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.0.tgz",
"integrity": "sha512-EglNDLRpmaTWiD/qraZn6HREAEAHJcJOmxNEYwq6xeMKnVMAy3GUcFB+wXt2C6k4CNvB/mP1y/U3dzvKKj5OtQ==",
"requires": {
"graceful-fs": "4.1.11",
"jsonfile": "2.4.0",
"klaw": "1.3.1",
"path-is-absolute": "1.0.1",
"rimraf": "2.6.2"
"jsonfile": "4.0.0",
"universalify": "0.1.2"
}
},
"fs-mkdirp-stream": {
@ -4811,9 +4830,9 @@
"dev": true,
"optional": true,
"requires": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.5",
"mime-types": "^2.1.12"
"asynckit": "0.4.0",
"combined-stream": "1.0.5",
"mime-types": "2.1.15"
}
},
"fs.realpath": {
@ -4916,8 +4935,8 @@
"dev": true,
"optional": true,
"requires": {
"ajv": "^4.9.1",
"har-schema": "^1.0.5"
"ajv": "4.11.8",
"har-schema": "1.0.5"
}
},
"has-unicode": {
@ -4986,7 +5005,7 @@
"integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
"dev": true,
"requires": {
"number-is-nan": "^1.0.0"
"number-is-nan": "1.0.1"
}
},
"is-typedarray": {
@ -5091,7 +5110,7 @@
"integrity": "sha1-pOv1BkCUVpI3uM9wBGd20J/JKu0=",
"dev": true,
"requires": {
"mime-db": "~1.27.0"
"mime-db": "1.27.0"
}
},
"minimatch": {
@ -5100,7 +5119,7 @@
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
"dev": true,
"requires": {
"brace-expansion": "^1.1.7"
"brace-expansion": "1.1.7"
}
},
"minimist": {
@ -5219,8 +5238,8 @@
"dev": true,
"optional": true,
"requires": {
"os-homedir": "^1.0.0",
"os-tmpdir": "^1.0.0"
"os-homedir": "1.0.2",
"os-tmpdir": "1.0.2"
}
},
"path-is-absolute": {
@ -7727,10 +7746,9 @@
"dev": true
},
"jsonfile": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz",
"integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=",
"dev": true,
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",
"integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=",
"requires": {
"graceful-fs": "4.1.11"
}
@ -13367,8 +13385,7 @@
"universalify": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",
"integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==",
"dev": true
"integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg=="
},
"unset-value": {
"version": "1.0.0",

View File

@ -18,6 +18,7 @@
"dependencies": {
"csp-parse": "github:macropodhq/csp-parse",
"deepmerge": "^2.1.1",
"fs-extra": "^7.0.0",
"nedb": "^1.8.0",
"node-sass": "^4.9.2"
},
@ -69,6 +70,7 @@
"webpack": "^3.12.0"
},
"scripts": {
"install": "node scripts/install.js",
"build": "npm run build --prefix client && npm run build --prefix core && npm run build --prefix csseditor && npm run build --prefix installer",
"build_client": "npm run build --prefix client",
"watch_client": "npm run watch --prefix client",

18
scripts/install.js Normal file
View File

@ -0,0 +1,18 @@
const process = require('process');
const fs = require('fs-extra');
const path = require('path');
// Copy the node-sass bindings to node_modules/node-sass/vendor
const node_sass_path = path.resolve(require.resolve('node-sass'), '..', '..');
const prebuilt_node_sass_bindings_path = path.resolve(__dirname, '..', 'other', 'node_sass_bindings');
for (const node_sass_binding_name of fs.readdirSync(prebuilt_node_sass_bindings_path)) {
const binding_path = path.join(prebuilt_node_sass_bindings_path, node_sass_binding_name);
const installation_path = path.join(node_sass_path, 'vendor', node_sass_binding_name);
if (fs.existsSync(installation_path)) continue;
console.log('Copying node-sass binding from', binding_path, 'to', installation_path);
fs.copySync(binding_path, installation_path);
}