Skip to content

Commit 97d8532

Browse files
NothingEverHappensjamesdaniels
authored andcommitted
fix(build): Make the build work on windows (#2231)
As suggested in #1799 (comment)
1 parent 6eb1551 commit 97d8532

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"karma": "karma start",
1212
"test:universal": "npm run build && cp -R dist/packages-dist test/universal-test/node_modules/angularfire2 && cd test/universal-test && npm run prerender",
1313
"delayed_karma": "sleep 10 && karma start",
14-
"build": "rm -rf dist && node tools/build.js && npm pack ./dist/packages-dist",
14+
"build": "rimraf dist && node tools/build.js && npm pack ./dist/packages-dist",
1515
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 1",
1616
"build:wrapper": "npm i --prefix wrapper && npm run --prefix wrapper build && npm pack ./dist/wrapper-dist"
1717
},

tools/build.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const { switchMap, switchMapTo, tap } = require('rxjs/operators');
55
const { copy, readFileSync, writeFile, writeFileSync, statSync } = require('fs-extra');
66
const { prettySize } = require('pretty-size');
77
const gzipSize = require('gzip-size');
8+
const path = require('path');
89
const resolve = require('rollup-plugin-node-resolve');
910
const pkg = require(`${process.cwd()}/package.json`);
1011

@@ -124,8 +125,10 @@ const DEST_PKG_PATHS = {
124125
};
125126

126127
// Constants for running typescript commands
127-
const TSC = 'node_modules/.bin/tsc';
128-
const NGC = 'node_modules/.bin/ngc';
128+
const binSuffix = process.platform === "win32" ? '.cmd' : '';
129+
const TSC = path.normalize('node_modules/.bin/tsc' + binSuffix);
130+
const NGC = path.normalize('node_modules/.bin/ngc' + binSuffix);
131+
129132
const TSC_ARGS = (name, config = 'build') => [`-p`, `${process.cwd()}/src/${name}/tsconfig-${config}.json`];
130133
const TSC_TEST_ARGS = [`-p`, `${process.cwd()}/src/tsconfig-test.json`];
131134

@@ -408,4 +411,4 @@ database-deprecated.umd.js - ${dbdepStats.size}, ${dbdepStats.gzip}
408411
}));
409412
}
410413

411-
buildLibrary(GLOBALS).subscribe(() => { }, err => { console.error(err) });
414+
buildLibrary(GLOBALS).subscribe(() => { }, err => { console.error(err) });

0 commit comments

Comments
 (0)