Skip to content

Commit

Permalink
Change option flag to custom-name to avoid namespace clash
Browse files Browse the repository at this point in the history
  • Loading branch information
tamsingreen committed Sep 13, 2016
1 parent 72f17e1 commit 26f8a68
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,10 @@ speculate --release=7

### Custom Name

By default speculate will set the name from `package.json`, if you want to override this you can do so by using the `--name` flag:
By default speculate will set the name from `package.json`, if you want to override this you can do so by using the `--custom-name` flag:

```sh
speculate --name=my-cool-api
speculate --custom-name=my-cool-api
```

This is useful if you are using private NPM packages which start with an `@`.
7 changes: 4 additions & 3 deletions bin/speculate.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,17 @@ if (!isValid) {
}

var projectPkg = require(path.resolve(cwd, './package.json'));
var name = projectPkg.name;

program
.version(commandPkg.version)
.option('-r --release <release>', 'Specify release number of package')
.option('-n --name <name>', 'Specify custom name for package')
.option('-c --custom-name <custom-name>', 'Specify custom name for package')
.parse(process.argv);

var name = program.customName || projectPkg.name;

clean(cwd, projectPkg);
generate(cwd, projectPkg, program.release, program.name, function (err) {
generate(cwd, projectPkg, program.release, program.customName, function (err) {
if (err) {
console.error('Error:', err.message);
process.exit(1);
Expand Down
1 change: 0 additions & 1 deletion lib/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ function addCustomFieldsToPackage(pkg, customName) {
}

module.exports = function (root, pkg, release, customName, cb) {

var customPackage = addCustomFieldsToPackage(pkg, customName);
var specsDirectory = files.specsDirectory(root);
var sourcesDirectory = files.sourcesDirectory(root);
Expand Down

0 comments on commit 26f8a68

Please sign in to comment.