Merge pull request #109 from samuelthomas2774/add-unix-node-sass-build-scripts
Add node-sass build scripts for macOS and Linux
This commit is contained in:
commit
1db9ad3425
|
@ -33,6 +33,7 @@
|
||||||
"gulp-watch": "^5.0.0",
|
"gulp-watch": "^5.0.0",
|
||||||
"jquery": "^3.2.1",
|
"jquery": "^3.2.1",
|
||||||
"lodash": "^4.17.4",
|
"lodash": "^4.17.4",
|
||||||
|
"node-gyp": "^3.6.2",
|
||||||
"node-sass": "^4.7.2",
|
"node-sass": "^4.7.2",
|
||||||
"pump": "^2.0.0",
|
"pump": "^2.0.0",
|
||||||
"sass-loader": "^6.0.6",
|
"sass-loader": "^6.0.6",
|
||||||
|
@ -49,6 +50,7 @@
|
||||||
"watch_client": "npm run watch --prefix client",
|
"watch_client": "npm run watch --prefix client",
|
||||||
"watch_core": "npm run watch --prefix core",
|
"watch_core": "npm run watch --prefix core",
|
||||||
"lint": "eslint -f unix client/src core/src csseditor/src",
|
"lint": "eslint -f unix client/src core/src csseditor/src",
|
||||||
"test": "npm run build && npm run lint"
|
"test": "npm run build && npm run lint",
|
||||||
|
"build_node-sass": "node scripts/build-node-sass.js"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
PLATFORM="darwin"
|
||||||
|
ARCH="x64"
|
||||||
|
NODE_API_VERSION="53"
|
||||||
|
ELECTRON_VERSION="1.6.15"
|
||||||
|
|
||||||
|
scripts/build-node-sass.sh $PLATFORM $ARCH $NODE_API_VERSION $ELECTRON_VERSION
|
|
@ -0,0 +1,8 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
PLATFORM="linux"
|
||||||
|
ARCH="x64"
|
||||||
|
NODE_API_VERSION="53"
|
||||||
|
ELECTRON_VERSION="1.6.15"
|
||||||
|
|
||||||
|
scripts/build-node-sass.sh $PLATFORM $ARCH $NODE_API_VERSION $ELECTRON_VERSION
|
|
@ -0,0 +1,19 @@
|
||||||
|
const process = require('process');
|
||||||
|
const child_process = require('child_process');
|
||||||
|
|
||||||
|
switch (process.platform) {
|
||||||
|
case 'darwin':
|
||||||
|
case 'linux':
|
||||||
|
child_process.execSync(`scripts/build-node-sass-${process.platform}.sh`, {
|
||||||
|
stdio: 'inherit'
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'win32':
|
||||||
|
child_process.execSync(`scripts/rebuild-node-sass.bat`, {
|
||||||
|
stdio: 'inherit'
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
console.log(`Unknown platform ${process.platform}`);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
PLATFORM="$1"
|
||||||
|
ARCH="$2"
|
||||||
|
NODE_API_VERSION="$3"
|
||||||
|
ELECTRON_VERSION="$4"
|
||||||
|
ELECTRON_URL="https://atom.io/download/electron"
|
||||||
|
|
||||||
|
DIRECTORY="vendor/$PLATFORM-$ARCH-$NODE_API_VERSION"
|
||||||
|
|
||||||
|
if [ `node -p 'process.platform'` != "$PLATFORM" ]; then
|
||||||
|
echo "You must be running on $PLATFORM to build node-sass for it."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd node_modules/node-sass
|
||||||
|
|
||||||
|
if [ -f $DIRECTORY/binding.node ]; then
|
||||||
|
echo "A binding already exists at $DIRECTORY/binding.node - deleting it"
|
||||||
|
rm $DIRECTORY/binding.node
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Build the node-sass binding
|
||||||
|
# This will be placed at build/Release/binding.node
|
||||||
|
echo "Building node-sass for $PLATFORM-$ARCH with Node.js API version $NODE_API_VERSION for Electron $ELECTRON_VERSION"
|
||||||
|
../.bin/node-gyp rebuild --target=$ELECTRON_VERSION --arch $ARCH --dist-url=$ELECTRON_URL
|
||||||
|
|
||||||
|
# Move it to the right place
|
||||||
|
echo "Moving binding.node to $DIRECTORY"
|
||||||
|
mkdir -p $DIRECTORY
|
||||||
|
cp build/Release/binding.node $DIRECTORY/binding.node
|
||||||
|
rm -rf build
|
Loading…
Reference in New Issue