Skip to content

Commit

Permalink
move checking for argument into wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
saintsebastian committed Jul 25, 2017
1 parent b2cab46 commit b9174fd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
9 changes: 9 additions & 0 deletions bin/create-webextension
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
#!/usr/bin/env node
const chalk = require("chalk");

const USAGE_MSG = `Usage: create-webextension project_dir_name`;

if (!process.argv[2]) {
console.error(`${chalk.red("Missing project dir name.")}\n`);
console.log(USAGE_MSG);
process.exit(1);
}

require("..").main(process.argv[2]);
6 changes: 1 addition & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ const chalk = require("chalk");
const fs = require("mz/fs");
const stripAnsi = require("strip-ansi");

const USAGE_MSG = `Usage: create-webextension project_dir_name`;

const README = `
This project contains a blank WebExtension addon, a "white canvas" for your new experiment of
extending and remixing the Web.
Expand Down Expand Up @@ -89,9 +87,7 @@ function getProjectManifest(projectDirName) {

exports.main = function main(dirPath) {
if (!dirPath) {
console.error(`${chalk.red("Missing project dir name.")}\n`);
console.log(USAGE_MSG);
process.exit(1);
throw Error("Project directory name is a compulsory argument");
}

const projectPath = path.resolve(dirPath);
Expand Down

0 comments on commit b9174fd

Please sign in to comment.