Skip to content
2 changes: 1 addition & 1 deletion bin/create-webextension
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env node

require("..").main();
require("..").main(process.argv[2]);
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,14 @@ function getProjectManifest(projectDirName) {
};
}

exports.main = function main() {
if (!process.argv[2]) {
exports.main = function main(dirPath) {
if (!dirPath) {
console.error(`${chalk.red("Missing project dir name.")}\n`);
console.log(USAGE_MSG);
process.exit(1);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@saintsebastian a process.exit(...) when using this package as a library is super annoying (as well as logging on the console), we can throw an Error instance from here and move the process.exit(...) and the logging in the CLI wrapper that we have in "bin/create-webextension", how that sounds to you?

}

const projectPath = path.resolve(process.argv[2]);
const projectPath = path.resolve(dirPath);
const projectDirName = path.basename(projectPath);

return fs.mkdir(projectPath).then(() => {
Expand Down