Skip to content
This repository was archived by the owner on Apr 30, 2018. It is now read-only.

Commit cf2ca60

Browse files
author
Kent C. Dodds
committed
chore(scripts): True support for windows machines
We're now using special process.argv flags to set environment variables in the config getters. Should work for windows too!
1 parent b2939ac commit cf2ca60

File tree

5 files changed

+17
-10
lines changed

5 files changed

+17
-10
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ before_install:
1717
before_script:
1818
- npm prune
1919
script:
20-
- npm run test:ci
20+
- npm run test
2121
- npm run check-coverage
2222
after_success:
2323
- npm run report-coverage

other/karma.conf.es6.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/* eslint-env node */
2+
require('./set-env')(process.argv);
23
const path = require('path');
34

45
process.env.NODE_ENV = process.env.NODE_ENV || 'test';

other/set-env.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module.exports = setEnv;
2+
const prefix = '--set-env-';
3+
4+
function setEnv(argv = []) {
5+
argv
6+
.filter(a => a.indexOf(prefix) === 0)
7+
.map(a => a.substring(prefix.length).split('='))
8+
.forEach(a => process.env[a[0]] = a[1]);
9+
}

other/webpack.config.es6.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/* eslint-env node */
2+
require('./set-env')(process.argv);
23
const packageJson = require('../package.json');
34

45
const here = require('path-here');
@@ -103,7 +104,6 @@ function getProdConfig() {
103104
function getTestConfig() {
104105
const coverage = process.env.COVERAGE === 'true';
105106
const ci = process.env.CI === 'true';
106-
console.log(process.env.CI);
107107
return {
108108
entry: './index.test.js',
109109
module: {

package.json

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,12 @@
2424
"main": "dist/formly.js",
2525
"license": "MIT",
2626
"scripts": {
27-
"build:dist": "cross-env NODE_ENV=development webpack --progress --colors",
28-
"build:prod": "cross-env NODE_ENV=production webpack --progress --colors",
27+
"build:dist": "webpack --progress --colors --set-env-NODE_ENV=development",
28+
"build:prod": "webpack --progress --colors --set-env-NODE_ENV=production",
2929
"build": "npm run build:dist & npm run build:prod",
30-
"test": "cross-env COVERAGE=true NODE_ENV=test karma start --single-run",
31-
"test:ci": "CI=true COVERAGE=true NODE_ENV=test karma start --single-run",
32-
"test:watch": "cross-env COVERAGE=true NODE_ENV=test karma start",
33-
"test:debug": "cross-env NODE_ENV=test karma start --browsers Chrome",
34-
"start:mac": "npm run test:mac",
30+
"test": "karma start --single-run --set-env-COVERAGE=true --set-env-NODE_ENV=test",
31+
"test:watch": "karma start --set-env-COVERAGE=true --set-env-NODE_ENV=test",
32+
"test:debug": "karma start --browsers Chrome --set-env-NODE_ENV=test",
3533
"start": "npm run test:watch",
3634
"check-coverage": "istanbul check-coverage --statements 93 --branches 89 --functions 92 --lines 92",
3735
"report-coverage": "cat ./coverage/lcov.info | node_modules/.bin/codecov",
@@ -61,7 +59,6 @@
6159
"codecov.io": "0.1.6",
6260
"commitizen": "2.0.2",
6361
"cracks": "3.1.1",
64-
"cross-env": "1.0.1",
6562
"cz-conventional-changelog": "1.1.4",
6663
"deindent": "0.1.0",
6764
"eslint": "1.6.0",

0 commit comments

Comments
 (0)