Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New CLI options, custom tags range and tests. #31

Merged
merged 13 commits into from
Jan 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"presets": ["es2015"]
"presets": ["es2015"],
"plugins": ["transform-object-rest-spread"]
}
2 changes: 2 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
"indent": ["error", 2]
},
"env": {
"es6": true,
"jest": true,
Copy link
Contributor

Choose a reason for hiding this comment

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

for the eslint config we should just use https://github.com/babel/eslint-config-babel. I would do this in a new pr after this is merged so its easier to review

"node": true
}
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
lib
node_modules
*.swp
coverage
.changelog
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
src
**/__mocks__/**
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,28 @@ You'll need a GitHub API [personal access token](https://github.com/settings/tok
- `repo`: Your "org/repo" on GitHub
- `cacheDir` [optional]: A place to stash GitHub API responses to avoid throttling
- `labels`: GitHub issue/PR labels mapped to changelog section headers
- `ignoreCommitters` [optional]: list of commiters to ignore (exact or partial match). Useful for example to ignore commits from bot agents

## CLI

```bash
$ lerna-changelog
Usage: lerna-changelog [options]

Options:
--tag-from A git tag that determines the lower bound of the range of commits
(defaults to last available) [string]
--tag-to A git tag that determines the upper bound of the range of commits
[string]
--version Show version number [boolean]
--help Show help [boolean]

Examples:
lerna-changelog create a changelog for the changes
after the latest available tag
lerna-changelog --tag-from 0.1.0 create a changelog for the changes
--tag-to 0.3.0 in all tags within the given range
```

[lerna-homepage]: https://lernajs.io
[hzoo-profile]: https://github.com/hzoo
Expand Down
30 changes: 26 additions & 4 deletions cli.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,35 @@
#!/usr/bin/env node

var chalk = require("chalk");
var lib = require(".");
var Changelog = require(".").Changelog;
var ConfigurationError = require(".").ConfigurationError;

var Changelog = lib.Changelog;
var ConfigurationError = lib.ConfigurationError;
var argv = require("yargs")
.usage("Usage: lerna-changelog [options]")
.options({
"tag-from": {
type: "string",
desc: "A git tag that determines the lower bound of the range of commits (defaults to last available)"
},
"tag-to": {
type: "string",
desc: "A git tag that determines the upper bound of the range of commits"
}
})
.example(
"lerna-changelog",
"create a changelog for the changes after the latest available tag"
)
.example(
"lerna-changelog --tag-from 0.1.0 --tag-to 0.3.0",
"create a changelog for the changes in all tags within the given range"
)
.version()
.help()
.argv;

try {
console.log((new Changelog()).createMarkdown());
console.log((new Changelog(argv)).createMarkdown());
} catch (e) {
if (e instanceof ConfigurationError) {
console.log(chalk.red(e.message));
Expand Down
21 changes: 14 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
"lerna-changelog": "cli.js"
},
"scripts": {
"build": "babel src -d lib",
"build": "npm run clean && babel src --out-dir lib --ignore src/__mocks__",
"clean": "rimraf lib",
"test": "eslint index.js cli.js src/",
"lint": "eslint index.js cli.js src",
"test": "jest",
"prepublish": "npm run build"
},
"repository": {
Expand All @@ -27,16 +28,22 @@
},
"homepage": "https://github.com/lerna/lerna-changelog#readme",
"devDependencies": {
"babel-cli": "^6.9.0",
"babel-preset-es2015": "^6.9.0",
"eslint": "^2.10.2",
"rimraf": "^2.5.2"
"babel-cli": "^6.18.0",
"babel-eslint": "^7.1.1",
"babel-jest": "^18.0.0",
"babel-plugin-transform-object-rest-spread": "6.20.2",
"babel-preset-es2015": "^6.18.0",
"eslint": "^3.13.1",
"jest": "^18.1.0",
"lerna": "^2.0.0-beta.32",
"rimraf": "^2.5.4"
},
"peerDependencies": {
"lerna": "^2.0.0-beta.8"
},
"dependencies": {
"chalk": "^1.1.3",
"mkdirp": "^0.5.1"
"mkdirp": "^0.5.1",
"yargs": "^6.6.0"
}
}