build: fix win compat for collective build and embark-solo cli

This commit is contained in:
Michael Bradley, Jr 2019-10-02 16:14:23 -05:00 committed by Michael Bradley
parent 7ea9aa417d
commit 3f4ce3b549
5 changed files with 14 additions and 13 deletions

View File

@ -3,7 +3,7 @@
const cloneDeep = require('lodash.clonedeep'); const cloneDeep = require('lodash.clonedeep');
const {copySync, ensureDirSync} = require('fs-extra'); const {copySync, ensureDirSync} = require('fs-extra');
const glob = require('glob'); const glob = require('glob');
const {dirname, join, relative} = require('path'); const {dirname, join, normalize, relative, sep} = require('path');
// @babel/cli v7's --copy-files option does not work well together with // @babel/cli v7's --copy-files option does not work well together with
// config-specified ignore paths, and that's a problem for embark-collective // config-specified ignore paths, and that's a problem for embark-collective
@ -27,9 +27,9 @@ function copyFiles (ignored) {
]} ]}
).map(path => relative(__dirname, path)); ).map(path => relative(__dirname, path));
ignored = ignored.concat(others); ignored = ignored.concat(others).map(normalize);
ignored ignored
.map(path => path.replace('src/', 'dist/')) .map(path => path.replace(`src${sep}`, `dist${sep}`))
.forEach((dest, index) => { .forEach((dest, index) => {
ensureDirSync(dirname(join(__dirname, dest))); ensureDirSync(dirname(join(__dirname, dest)));
const source = ignored[index]; const source = ignored[index];

View File

@ -3,7 +3,7 @@
const cloneDeep = require('lodash.clonedeep'); const cloneDeep = require('lodash.clonedeep');
const {copySync, ensureDirSync} = require('fs-extra'); const {copySync, ensureDirSync} = require('fs-extra');
const glob = require('glob'); const glob = require('glob');
const {dirname, join, relative} = require('path'); const {dirname, join, normalize, relative, sep} = require('path');
// @babel/cli v7's --copy-files option does not work well together with // @babel/cli v7's --copy-files option does not work well together with
// config-specified ignore paths, and that's a problem for embark-collective // config-specified ignore paths, and that's a problem for embark-collective
@ -25,9 +25,9 @@ function copyFiles (ignored) {
]} ]}
).map(path => relative(__dirname, path)); ).map(path => relative(__dirname, path));
ignored = ignored.concat(others); ignored = ignored.concat(others).map(normalize);
ignored ignored
.map(path => path.replace('src/', 'dist/')) .map(path => path.replace(`src${sep}`, `dist${sep}`))
.forEach((dest, index) => { .forEach((dest, index) => {
ensureDirSync(dirname(join(__dirname, dest))); ensureDirSync(dirname(join(__dirname, dest)));
const source = ignored[index]; const source = ignored[index];

View File

@ -3,7 +3,7 @@
const cloneDeep = require('lodash.clonedeep'); const cloneDeep = require('lodash.clonedeep');
const {copySync, ensureDirSync} = require('fs-extra'); const {copySync, ensureDirSync} = require('fs-extra');
const glob = require('glob'); const glob = require('glob');
const {dirname, join, relative} = require('path'); const {dirname, join, normalize, relative, sep} = require('path');
// @babel/cli v7's --copy-files option does not work well together with // @babel/cli v7's --copy-files option does not work well together with
// config-specified ignore paths, and that's a problem for embark-collective // config-specified ignore paths, and that's a problem for embark-collective
@ -25,9 +25,9 @@ function copyFiles (ignored) {
]} ]}
).map(path => relative(__dirname, path)); ).map(path => relative(__dirname, path));
ignored = ignored.concat(others); ignored = ignored.concat(others).map(normalize);
ignored ignored
.map(path => path.replace('src/', 'dist/')) .map(path => path.replace(`src${sep}`, `dist${sep}`))
.forEach((dest, index) => { .forEach((dest, index) => {
ensureDirSync(dirname(join(__dirname, dest))); ensureDirSync(dirname(join(__dirname, dest)));
const source = ignored[index]; const source = ignored[index];

View File

@ -3,7 +3,7 @@
const cloneDeep = require('lodash.clonedeep'); const cloneDeep = require('lodash.clonedeep');
const {copySync, ensureDirSync} = require('fs-extra'); const {copySync, ensureDirSync} = require('fs-extra');
const glob = require('glob'); const glob = require('glob');
const {dirname, join, relative} = require('path'); const {dirname, join, normalize, relative, sep} = require('path');
// @babel/cli v7's --copy-files option does not work well together with // @babel/cli v7's --copy-files option does not work well together with
// config-specified ignore paths, and that's a problem for embark-collective // config-specified ignore paths, and that's a problem for embark-collective
@ -25,9 +25,9 @@ function copyFiles (ignored) {
]} ]}
).map(path => relative(__dirname, path)); ).map(path => relative(__dirname, path));
ignored = ignored.concat(others); ignored = ignored.concat(others).map(normalize);
ignored ignored
.map(path => path.replace('src/', 'dist/')) .map(path => path.replace(`src${sep}`, `dist${sep}`))
.forEach((dest, index) => { .forEach((dest, index) => {
ensureDirSync(dirname(join(__dirname, dest))); ensureDirSync(dirname(join(__dirname, dest)));
const source = ignored[index]; const source = ignored[index];

View File

@ -24,6 +24,7 @@ module.exports = function (cliArgs) {
join(embarkCollectivePath, 'package.json') join(embarkCollectivePath, 'package.json')
); );
const npxCmd = process.platform === 'win32' ? 'npx.cmd': 'npx';
process.chdir(embarkCollectivePath); process.chdir(embarkCollectivePath);
spawn('npm', ['run', '--', ...cliArgs], {stdio: 'inherit'}); spawn(npxCmd, ['run', '--', ...cliArgs], {stdio: 'inherit'});
}; };