Skip to content

Commit c2d832a

Browse files
sokraevenstensberg
authored andcommitted
fix(output): fix #227 (#232)
output must be a separate argument add test remove incorrectly committed generated files
1 parent 896cd57 commit c2d832a

File tree

24 files changed

+29
-816
lines changed

24 files changed

+29
-816
lines changed

bin/config-yargs.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,12 @@ module.exports = function(yargs) {
123123
group: MODULE_GROUP,
124124
requiresArg: true
125125
},
126+
output: {
127+
alias: "o",
128+
describe: "The output path and file for compilation assets",
129+
group: OUTPUT_GROUP,
130+
requiresArg: true
131+
},
126132
"output-path": {
127133
type: "string",
128134
describe: "The output path for compilation assets",
@@ -131,7 +137,6 @@ module.exports = function(yargs) {
131137
requiresArg: true
132138
},
133139
"output-filename": {
134-
alias: "o",
135140
type: "string",
136141
describe: "The output filename of the bundle",
137142
group: OUTPUT_GROUP,

bin/convert-argv.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,6 @@ var prepareOptions = require("./prepareOptions");
66
module.exports = function(yargs, argv, convertOptions) {
77
var options = [];
88
// Shortcuts
9-
if (argv.o) {
10-
argv["output-filename"] = path.basename(argv.o);
11-
12-
if (!path.isAbsolute(argv.o)) {
13-
argv["output-path"] = path.resolve(process.cwd(), path.dirname(argv.o));
14-
}
15-
}
16-
179
if (argv.d) {
1810
argv.debug = true;
1911
argv["output-pathinfo"] = true;
@@ -33,6 +25,16 @@ module.exports = function(yargs, argv, convertOptions) {
3325
argv.mode = "production";
3426
}
3527
}
28+
29+
if (argv.output) {
30+
let output = argv.output;
31+
if (!path.isAbsolute(argv.o)) {
32+
output = path.resolve(process.cwd(), output);
33+
}
34+
argv["output-filename"] = path.basename(output);
35+
argv["output-path"] = path.dirname(output);
36+
}
37+
3638
var configFileLoaded = false;
3739
var configFiles = [];
3840
var extensions = Object.keys(interpret.extensions).sort(function(a, b) {
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = "index";
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
"use strict";
2+
3+
module.exports = function testAssertions(code, stdout, stderr) {
4+
expect(code).toBe(0);
5+
expect(stdout).toEqual(expect.anything());
6+
expect(stdout[4]).toContain("bundle.js");
7+
expect(stdout[5]).toMatch(/index\.js.*\{0\}/);
8+
expect(stderr).toHaveLength(0);
9+
};
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
./index.js
2+
-o ../../../js/bin/output/output-argument/bundle.js
3+
--target async-node

test/js/bin/config-name/found-many/main.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

test/js/bin/config-name/found-one/main.js

Lines changed: 0 additions & 85 deletions
This file was deleted.

test/js/bin/configFile/profile/null.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

test/js/bin/entry/multi-file/null.js

Lines changed: 0 additions & 100 deletions
This file was deleted.

test/js/bin/entry/named-entry/foo.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)