Skip to content

Commit

Permalink
fix(build): preserve --outDir path as relative to CWD
Browse files Browse the repository at this point in the history
  • Loading branch information
bajtos committed Oct 4, 2018
1 parent df8c64c commit 0e72ab9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions packages/build/bin/compile-package.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ function run(argv, options) {

var outDir;

if (!isOutDirSet) {
if (isOutDirSet) {
const outDirIx = compilerOpts.indexOf('--outDir');
outDir = path.resolve(process.cwd(), compilerOpts[outDirIx + 1]);
compilerOpts.splice(outDirIx, 2);
} else {
outDir = path.join(packageDir, utils.getDistribution(target));
}

Expand Down Expand Up @@ -121,7 +125,7 @@ function run(argv, options) {
}

if (outDir) {
args.push('--outDir', outDir);
args.push('--outDir', path.relative(cwd, outDir));

// Since outDir is set, ts files are compiled into that directory.
// If ignore-resources flag is not passed, copy resources (non-ts files)
Expand Down
2 changes: 1 addition & 1 deletion packages/build/test/integration/scripts.integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ describe('build', function() {
true,
);
assert(
command.indexOf('--outDir ./dist') !== -1,
command.indexOf('--outDir dist') !== -1,
'--outDir should be honored',
);
});
Expand Down

0 comments on commit 0e72ab9

Please sign in to comment.