Parcourir la source

Use powershell to run `package.sh` on Windows

All other systems still use bash to invoke the build script.
Tim Riemann il y a 7 ans
Parent
commit
8d46eb9beb
2 fichiers modifiés avec 16 ajouts et 1 suppressions
  1. 15 0
      dist/build-package.js
  2. 1 1
      package.json

+ 15 - 0
dist/build-package.js

@@ -0,0 +1,15 @@
+var exec = require('child_process').exec;
+function puts(error, stdout, stderr) { console.log(stdout) }
+
+var os = require('os');
+//control OS
+//then run command depengin on the OS
+
+if (os.type() === 'Linux') 
+   exec("dist/package.sh", puts); 
+else if (os.type() === 'Darwin') 
+   exec("dist/package.sh", puts); 
+else if (os.type() === 'Windows_NT') 
+   exec("powershell dist/package.sh", puts);
+else
+   throw new Error("Unsupported OS found: " + os.type());

+ 1 - 1
package.json

@@ -7,7 +7,7 @@
     "build:js": "browserify -p tsify src/app.ts -t [ babelify --presets [ es2015 ] --extensions .ts ] -p [ browserify-header --file header.js ] -o dist/app.js",
     "build:css": "node-sass -o public/css/ --output-style compressed src/sass/",
     "build:css:watch": "node-sass -w -r --source-map true --source-map-embed true -o public/css/ --output-style compressed src/sass/",
-    "dist": "npm run build && echo \"\" && dist/package.sh",
+    "dist": "npm run build && echo \"\" && node dist/build-package.js",
     "serve": "npm run build:css && budo src/app.ts:dist/app.js -- -d -p tsify -t [ babelify --presets [ es2015 ] --extensions .ts ]",
     "serve:live": "npm run build:css && concurrently --kill-others --names \"css,server\" -p name \"npm run build:css:watch\" \"budo src/app.ts:dist/app.js -d . -d public -d src --live -- -d -p tsify -t [ babelify --presets [ es2015 ] --extensions .ts ]\"",
     "test": "karma start --single-run --log-level=debug --colors",