Skip to content

Commit

Permalink
feat(all): Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jpnelson committed May 17, 2016
0 parents commit 4f0cbd3
Show file tree
Hide file tree
Showing 6 changed files with 124 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["es2015"]
}
29 changes: 29 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules

lib
18 changes: 18 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
sudo: false
language: node_js
cache:
directories:
- node_modules
notifications:
email: false
node_js:
- '4'
before_install:
- npm i -g npm@^2.0.0
before_script:
- npm prune
after_success:
- npm run semantic-release
branches:
only:
- master
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# cz-conventional-changelog

Status:
[![npm version](https://img.shields.io/npm/v/cz-conventional-changelog.svg?style=flat-square)](https://www.npmjs.org/package/cz-conventional-changelog)
[![npm downloads](https://img.shields.io/npm/dm/cz-conventional-changelog.svg?style=flat-square)](http://npm-stat.com/charts.html?package=cz-conventional-changelog&from=2015-08-01)
[![Build Status](https://img.shields.io/travis/commitizen/cz-conventional-changelog.svg?style=flat-square)](https://travis-ci.org/commitizen/cz-conventional-changelog)

Part of the [commitizen](https://github.com/commitizen/cz-cli) family. Prompts for [conventional changelog](https://github.com/stevemao/conventional-changelog-angular/blob/master/index.js) standard.
33 changes: 33 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "cz-lerna-changelog",
"version": "0.0.0-semantically-released.0",
"description": "Commitizen adapter following the conventional-changelog format.",
"main": "lib/index.js",
"scripts": {
"build": "babel src -d lib",
"commit": "git-cz",
"test": "echo 'Tests need to be setup!'",
"prepublish": "npm run build",
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
},
"repository": {
"type": "git",
"url": "https://github.com/jpnelson/cz-lerna-changelog.git"
},
"author": "Joshua Nelson <[email protected]>",
"dependencies": {
"cz-conventional-changelog": "jpnelson/cz-conventional-changelog#fe629d0f",
"lerna": "jpnelson/lerna#8c0e5a44"
},
"devDependencies": {
"babel-cli": "6.8.0",
"babel-preset-es2015": "6.6.0",
"commitizen": "1.0.5",
"semantic-release": "^4.3.5"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
}
}
33 changes: 33 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import prompt from 'cz-conventional-changelog/prompt';

import UpdatedCommand from 'lerna/lib/commands/UpdatedCommand';
import PackageUtilities from 'lerna/lib/PackageUtilities';

module.exports = {
prompter: function(cz, commit) {
const updatedCommand = new UpdatedCommand([], {});

// We can't use updatedCommand.run() as this will exit TODO: PR to add an option to run specifying whether it'd exit
updatedCommand.runValidations();
updatedCommand.runPreparations();
updatedCommand.initialize(() => {
updatedCommand.execute(() => {
const updatedPackages = updatedCommand.updates.map((update) => update.package.name);
const defaults = {
packages: updatedPackages.join(',')
};

//var packages = answers.packages.trim();
//packages = packages ? '[' + packages + ']' : '';

prompt(cz, (head, body, footer) => {
var packages = answers.packages.trim();
packages = packages ? '[' + packages + ']' : '';

commit(head + '\n\n' + body + '\n\n' + footer);

});
});
});
}
};

0 comments on commit 4f0cbd3

Please sign in to comment.