From f93186ba92e1fcecf6b35f381649ee03e802eed1 Mon Sep 17 00:00:00 2001 From: theoriginaljosh Date: Mon, 26 Feb 2018 09:23:24 -0500 Subject: [PATCH 1/4] adding cross-env and cross-spawn these are needed for windows compatibility. --- template/package.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/template/package.json b/template/package.json index 9b71f5b..7a8d936 100644 --- a/template/package.json +++ b/template/package.json @@ -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", From c74c9fe6e5e8712d154036d9fb617fd6fe1bed10 Mon Sep 17 00:00:00 2001 From: theoriginaljosh Date: Mon, 26 Feb 2018 09:24:28 -0500 Subject: [PATCH 2/4] updating scripts to use cross-env This allows us to set the enviroment variables regarles of the operating system. --- template/package.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/template/package.json b/template/package.json index 7a8d936..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", From d7a07bdffd9efda681e1d9af2fb7e049725c5119 Mon Sep 17 00:00:00 2001 From: theoriginaljosh Date: Mon, 26 Feb 2018 09:25:20 -0500 Subject: [PATCH 3/4] setting enviroment varilble for index.js --- template/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/index.js b/template/index.js index 03d5afa..0a2c18d 100644 --- a/template/index.js +++ b/template/index.js @@ -15,7 +15,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.'); } From 686fd64ff6cf1d77ce99fda7eada1cb0daf8930e Mon Sep 17 00:00:00 2001 From: theoriginaljosh Date: Mon, 26 Feb 2018 09:26:09 -0500 Subject: [PATCH 4/4] replacing spawn with cross-spawn this allows us to use spawn on the windows platform --- template/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/template/index.js b/template/index.js index 0a2c18d..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');