diff --git a/template/index.js b/template/index.js index 03d5afa..bf2c411 100644 --- a/template/index.js +++ b/template/index.js @@ -1,7 +1,8 @@ const config = require('./webpack.config'); const fs = require('fs-extra'); const path = require('path'); -const {execSync, spawn} = require('child_process'); +const {execSync } = require('child_process'); +const spawn = require('cross-spawn'); const webpack = require('webpack'); const winston = require('winston-color'); @@ -15,7 +16,7 @@ if (!fs.existsSync(distPath)) { winston.info('Preparing NativeScript application from template...'); fs.ensureDirSync(distPath); fs.copySync(templatePath, distPath, {overwrite: true}); - execSync('NODE_ENV=development npm i', {cwd: 'dist'}); + execSync('cross-env NODE_ENV=development npm i', {cwd: 'dist'}); } else { winston.info('NativeScript application already prepared.'); } diff --git a/template/package.json b/template/package.json index 9b71f5b..e11838d 100644 --- a/template/package.json +++ b/template/package.json @@ -4,13 +4,13 @@ "description": "{{ description }}", "main": "index.js", "scripts": { - "build": "npm run clean && NODE_ENV=production node index.js", - "build:android": "PLATFORM=android npm run build", - "build:ios": "PLATFORM=ios npm run build", + "build": "npm run clean && cross-env NODE_ENV=production node index.js", + "build:android": "cross-env PLATFORM=android npm run build", + "build:ios": "cross-env PLATFORM=ios npm run build", "clean": "rimraf dist", "watch": "node index.js", - "watch:android": "PLATFORM=android npm run watch", - "watch:ios": "PLATFORM=ios npm run watch" + "watch:android": "cross-env PLATFORM=android npm run watch", + "watch:ios": "cross-env PLATFORM=ios npm run watch" }, "dependencies": { "nativescript-vue": "^1.2.0", @@ -20,6 +20,8 @@ "babel-core": "^6.26.0", "babel-loader": "^7.1.2", "babel-preset-env": "^1.6.1", + "cross-env": "^5.1.3", + "cross-spawn": "^6.0.4", "css-loader": "^0.28.10", "extract-text-webpack-plugin": "^3.0.2", "fs-extra": "^5.0.0",