Compare commits

..
77 Commits
Author SHA1 Message Date
Stephan Bönnemann adc65e4950 Merge pull request #171 from jrwebdev/caribou
feat(post): Adds GitHub Enterprise support
2016-01-18 23:11:56 +01:00
jrwebdev 2644badeec feat(post): Adds GitHub Enterprise support
Adds githubApiPathPrefix option for GitHub Enterprise APIs. Removes parse-github-repo-url check from
verify to support custom GitHub URLs

closes #146
2016-01-18 18:29:15 +13:00
Stephan Bönnemann 6492693489 Merge pull request #169 from semantic-release/greenkeeper-lodash-4.0.0
Update lodash to version 4.0.0 🚀
2016-01-13 09:29:30 +01:00
Stephan Bönnemann 045909e7e5 Merge branch 'caribou' into greenkeeper-lodash-4.0.0 2016-01-13 09:22:36 +01:00
Gleb BahmutovandStephan Bönnemann 66454e7e46 feat(verify): added support for parsing hosted gitlab and other repo urls
Closes #114
2016-01-13 09:04:35 +01:00
greenkeeperio-bot 5e73831e6e chore(package): update lodash to version 4.0.0
http://greenkeeper.io/
2016-01-13 00:16:27 +01:00
Stephan Bönnemann 8491deb5c6 Merge pull request #167 from semantic-release/greenkeeper-nock-5.2.1
Update nock to version 5.2.1 🚀
2016-01-09 19:28:39 +01:00
greenkeeperio-bot e03ecfe0b4 chore(package): update nock to version 5.2.1
http://greenkeeper.io/
2016-01-08 10:49:35 +01:00
Stephan Bönnemann a1ab8ee34e Merge pull request #162 from semantic-release/greenkeeper-tap-5.0.0
Update tap to version 5.0.0 🚀
2016-01-04 12:03:46 +01:00
Stephan Bönnemann b1130efc5a Merge branch 'caribou' into greenkeeper-tap-5.0.0 2016-01-04 11:35:38 +01:00
Stephan Bönnemann 3ee0945995 Merge pull request #163 from semantic-release/greenkeeper-nock-4.0.0
Update nock to version 4.0.0 🚀
2016-01-04 11:33:03 +01:00
greenkeeperio-bot c76a8c8f2d chore(package): update nock to version 4.0.0
http://greenkeeper.io/
2016-01-04 10:45:43 +01:00
greenkeeperio-bot 7bd9e74aa7 chore(package): update tap to version 5.0.0
http://greenkeeper.io/
2016-01-04 08:57:57 +01:00
Stephan Bönnemann 6f5c9f0890 Merge pull request #159 from semantic-release/greenkeeper-tap-4.0.0
Update tap to version 4.0.0 🚀
2015-12-31 15:23:21 +01:00
Stephan Bönnemann bb63f9de41 Merge branch 'caribou' into greenkeeper-tap-4.0.0 2015-12-31 15:16:38 +01:00
Stephan Bönnemann 032b493696 Merge pull request #160 from semantic-release/chore-remove-babel
chore: remove babel, fix integration tests
2015-12-31 15:16:27 +01:00
Stephan Bönnemann 5cdc732b68 chore: remove babel, fix integration tests
This commit removes babel/es6 from all source and test files, because it was introducing a lot of overhead and only little gain.
This commit fixes and enables integration tests on Travis.
This commit fixes #153 and #151 along the way.

_Originally this commit should have only removed babel, but without working tests that's a bit too hairy._
_I only realized that half way into removing babel/es6, so things are all over the place now._

Closes #153, Closes #151
2015-12-31 15:11:54 +01:00
greenkeeperio-bot c8ec292e39 chore(package): update tap to version 4.0.0
http://greenkeeper.io/
2015-12-31 02:05:33 +01:00
Stephan Bönnemann 88334523e4 Merge pull request #144 from semantic-release/greenkeeper-nyc-5.0.0
Update nyc to version 5.0.0 🚀
2015-12-10 10:11:32 +01:00
greenkeeperio-bot 224c8048ac chore(package): update nyc to version 5.0.0
http://greenkeeper.io/
2015-12-10 08:08:55 +01:00
Christoph Witzko c5dd9121f7 Merge pull request #142 from Starefossen/patch-1
Run Travis tests under Node.js v4 (argon) and v5 (latest)
2015-12-04 13:38:57 +01:00
Hans Kristian Flaatten 07d2a1907a chore(travis): run tests under Node.js v4 (argon) and v5 (latest) 2015-12-04 10:40:04 +01:00
Stephan Bönnemann 006213b9ca Merge pull request #119 from hawkrives/normalize-package-metadata
Use normalize-package-metadata to normalize package.json info
2015-11-26 13:43:57 +01:00
Hawken Rives 9baeddf712 use normalize-package-metadata to normalize pkgs 2015-11-21 19:42:18 -06:00
Stephan Bönnemann ace79e745a Merge pull request #133 from semantic-release/greenkeeper-nock-3.0.0
Update nock to version 3.0.0 🚀
2015-11-16 21:02:43 +01:00
greenkeeperio-bot 877514799b chore(package): update nock to version 3.0.0
http://greenkeeper.io/
2015-11-16 10:36:07 +01:00
Stephan Bönnemann 8d7b787e4a Merge pull request #125 from semantic-release/greenkeeper-npmlog-2.0.0
Update npmlog to version 2.0.0 🚀
2015-11-05 10:25:51 +01:00
greenkeeperio-bot 3648cd21e1 chore(package): update npmlog to version 2.0.0
http://greenkeeper.io/
2015-11-05 08:19:25 +01:00
Matteo RonchiandStephan Bönnemann de4bd7750e docs(readme): update link to deprecated npm cli tag command 2015-10-13 12:03:30 +02:00
Stephan Bönnemann 143987d070 chore(package): consistently use carets again 2015-10-10 13:37:02 +02:00
Christoph Witzko 02c4992440 Merge pull request #113 from semantic-release/greenkeeper-rimraf-2.4.3
Update rimraf to version 2.4.3 🚀
2015-10-10 13:34:28 +02:00
greenkeeperio-botandStephan Bönnemann abe4da1aa3 chore(package): update rimraf to version 2.4.3
http://greenkeeper.io/
2015-10-10 01:03:06 +02:00
Stephan Bönnemann f2a94e50f1 Merge pull request #112 from semantic-release/greenkeeper-tap-2.1.1
Update tap to version 2.1.1 🚀
2015-10-09 16:23:10 +02:00
greenkeeperio-botandStephan Bönnemann 3c14c5747f chore(package): update tap to version 2.1.1
http://greenkeeper.io/
2015-10-09 15:07:36 +02:00
Stephan Bönnemann 8cc6e0ced9 Merge pull request #110 from semantic-release/greenkeeper-cz-conventional-changelog-1.1.4
Update cz-conventional-changelog to version 1.1.4 🚀
2015-10-08 21:04:54 +02:00
greenkeeperio-botandStephan Bönnemann 2613d5df91 chore(package): update cz-conventional-changelog to version 1.1.4
http://greenkeeper.io/
2015-10-08 20:04:25 +02:00
Stephan Bönnemann ce04093b12 Merge pull request #107 from semantic-release/greenkeeper-proxyquire-1.7.3
Updated proxyquire to version 1.7.3
2015-10-05 20:50:36 +02:00
greenkeeperio-botandStephan Bönnemann fea11ef155 chore(package): update proxyquire to version 1.7.3
http://greenkeeper.io/
2015-10-05 16:36:14 +02:00
Stephan Bönnemann 6702531770 Merge pull request #105 from semantic-release/greenkeeper-nock-2.13.0
Updated nock to version 2.13.0
2015-10-02 17:26:16 +02:00
greenkeeperio-botandStephan Bönnemann 3f64ee625e chore(package): update nock to version 2.13.0
http://greenkeeper.io/
2015-10-02 17:18:19 +02:00
Stephan Bönnemann 1b8a01472e Merge pull request #103 from semantic-release/greenkeeper-coveralls-2.11.4
Updated coveralls to version 2.11.4
2015-10-01 16:32:46 +02:00
greenkeeperio-botandStephan Bönnemann c1c3848d0b chore(package): update coveralls to version 2.11.4
http://greenkeeper.io/
2015-10-01 14:01:19 +02:00
Stephan Bönnemann 1a0b702002 Merge pull request #102 from semantic-release/greenkeeper-cz-conventional-changelog-1.1.2
Updated cz-conventional-changelog to version 1.1.2
2015-09-29 21:51:06 +02:00
Stephan Bönnemann 066e1dd4d1 Merge branch 'caribou' into greenkeeper-cz-conventional-changelog-1.1.2 2015-09-29 21:45:49 +02:00
Stephan Bönnemann e900d5eae7 Merge pull request #94 from semantic-release/greenkeeper-lodash-3.10.1
Updated lodash to version 3.10.1
2015-09-29 21:45:39 +02:00
greenkeeperio-botandStephan Bönnemann f4f783ba6f chore(package): update cz-conventional-changelog to version 1.1.2
http://greenkeeper.io/
2015-09-29 18:01:19 +02:00
Stephan Bönnemann 9eba8bf7c7 Merge branch 'caribou' into greenkeeper-lodash-3.10.1 2015-09-29 10:04:49 +02:00
Stephan Bönnemann 754ef3b12b Merge pull request #100 from semantic-release/greenkeeper-semver-5.0.3
Updated semver to version 5.0.3
2015-09-28 21:01:31 +02:00
greenkeeperio-botandStephan Bönnemann a1eb9a25bb chore(package): update semver to version 5.0.3
http://greenkeeper.io/
2015-09-28 20:53:41 +02:00
Stephan Bönnemann 268d5f37bf Merge pull request #96 from semantic-release/docs-readme
docs(README): fix mistake in headline
2015-09-27 12:27:06 +02:00
Stephan Bönnemann 269fb519bf docs(README): fix mistake in headline
Closes #95
2015-09-27 12:22:33 +02:00
greenkeeperio-botandStephan Bönnemann 172718df54 chore(package): updated lodash to version 3.10.1
http://greenkeeper.io/
2015-09-27 06:32:32 +02:00
Stephan Bönnemann 19150d84fb Merge pull request #93 from semantic-release/greenkeeper-pin
Pinned all dependencies
2015-09-26 20:38:47 +02:00
Stephan Bönnemann 26e2afc152 test: end tests properly 2015-09-26 20:22:11 +02:00
Stephan Bönnemann 927e930bb9 style(standard): fix ternaries 2015-09-26 12:45:11 +02:00
greenkeeperio-botandStephan Bönnemann 785140f80c chore(package): pinned dependencies
http://greenkeeper.io/
2015-09-25 13:17:54 +02:00
Stephan Bönnemann e19b1952d1 Merge pull request #90 from gr2m/patch-1
use correct condition-travis version
2015-09-21 23:19:43 +02:00
Gregor Martynus ef872e38fb fix(package): use correct condition-travis version 2015-09-21 19:24:36 +02:00
Stephan Bönnemann ba40ffe70d Merge pull request #88 from semantic-release/docs-commitizen-link
Docs commitizen link
2015-09-18 12:27:59 +02:00
Stephan Bönnemann c614fe4a74 docs(README): add example commits 2015-09-18 11:41:58 +02:00
Kent C. DoddsandStephan Bönnemann 81de8ae19b docs(readme): add convention links
Link to commitizen and validate-commit-msg for project maintainers to simplify contributing.
2015-09-18 11:24:55 +02:00
Stephan Bönnemann df5f8337e8 Merge pull request #85 from semantic-release/fix-git-contains
Fix git contains
2015-09-16 09:56:36 +02:00
Stephan Bönnemann cb3992595e fix(commits): handle failing git command correctly and show meaningful error
Closes #83
2015-09-16 09:52:09 +02:00
Stephan Bönnemann a3f561d1d1 test(mocks): correctly fail git command when ref not in history 2015-09-16 09:51:26 +02:00
Stephan Bönnemann 143457e03d docs(README): smaller fixes and clarifications 2015-09-16 09:25:04 +02:00
Stephan Bönnemann 2c17773c75 docs(README): add egghead.io tutorial 2015-09-08 10:07:39 +01:00
Stephan Bönnemann 0a17e8e780 chore: make repo "commitizen friendly"
Closes #74
2015-08-28 10:29:48 +02:00
Stephan Bönnemann a7270bb84c fix: write version to shrinkwrap if existent
Closes #11
2015-08-24 15:56:55 +02:00
Stephan Bönnemann 0e013c2dea docs(README): fix badge links 2015-08-24 14:59:24 +02:00
Stephan Bönnemann e1baf1892a chore: setup release branch 2015-08-24 12:00:59 +02:00
Stephan Bönnemann ef1623210b docs: breaking change
BREAKING CHANGE: If you run travis_after_all and travis-after-all at the same
time they'll keep waiting for each other until forever. You have to apply
this patch to your `.travis.yml`.

```diff
---
 .travis.yml | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index a5fbddb..c76091b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -14,9 +14,6 @@ before_install:
 - npm i -g npm@^2.0.0
 before_script:
 - npm prune
-- curl -Lo travis_after_all.py https://git.io/vLSON
 after_success:
-- python travis_after_all.py
-- export $(cat .to_export_back)
 - npm run semantic-release
--
```
2015-08-23 22:42:55 +02:00
Stephan Bönnemann ad9501540e docs(README): use equally sized, optimized talk thumbnails 2015-08-23 14:26:47 +02:00
Stephan Bönnemann 7af30f0ad4 docs(README): list plugins and more talks 2015-08-23 14:16:09 +02:00
Stephan Bönnemann 4aa908804c fix(condition-travis): remove need for python script travis_after_all 2015-08-23 00:53:04 +02:00
Stephan Bönnemann 451378117d fix(registry): be better at using the correct registry (relevant for npme)
Closes #53
2015-08-22 23:32:49 +02:00
Stephan Bönnemann 23221cc044 chore(package): update last-release-npm to 1.2.1 2015-08-22 21:48:00 +02:00
Stephan Bönnemann 7a4c89f131 feat: add fallbackTag functionality and map "next" to "latest"
You can now map dist-tags onto "fallbackTags". E.g. if you want a
development channel like "next" and no version is currently published as "next"
semantic-release will fallback to "latest" to determine the new "next" version.
This is now the default for "next" -> "latest", but you can specify your own
mappings by adding "fallbackTags" to your `package.json`'s "release" field.

BREAKING CHANGE: In cases where you pushed a new commit with a "dist-tag"
configuration of "next" and no version was previously published as "next",
semanitc-release failed and did not publish a new version. It will now
automatically fall back to to "latest".
2015-08-22 21:36:11 +02:00
29 changed files with 606 additions and 538 deletions
+1 -6
View File
@@ -1,14 +1,9 @@
# common
coverage
node_modules
test/registry/couch
test/registry/data
test/tmp
*.log
*.dump
.DS_Store
.nyc_output
.test
.tmp
# build-artifacts
dist
-18
View File
@@ -1,18 +0,0 @@
# common
coverage
node_modules
test/registry/couch
test/registry/data
*.log
*.dump
.DS_Store
.nyc_output
.test
.tmp
# source/config
src
*.yml
.gitignore
.editorconfig
.npmrc
+5 -5
View File
@@ -6,17 +6,17 @@ cache:
notifications:
email: false
node_js:
- iojs-v2
- iojs-v1
- 5
- 4
- iojs
- '0.12'
- '0.10'
before_install:
- npm i -g npm@^2.0.0
before_script:
- npm prune
- curl -Lo travis_after_all.py https://git.io/vLSON
after_success:
- python travis_after_all.py
- export $(cat .to_export_back)
- npm run coverage:upload
- npm run semantic-release
services:
- couchdb
+73 -34
View File
@@ -1,16 +1,21 @@
# semantic-release
# :package::rocket: semantic-release
> **fully automated, semver-compliant package publishing**
**fully automated package publishing**
> **Trust us, this will change your workflow for the better.**
> [egghead.io](https://egghead.io/lessons/javascript-how-to-write-a-javascript-library-automating-releases-with-semantic-release)
[![Join the chat at https://gitter.im/semantic-release/semantic-release](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/semantic-release/semantic-release?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
[![Dependency Status](https://david-dm.org/semantic-release/semantic-release/badger.svg)](https://david-dm.org/semantic-release/semantic-release/badger)
[![devDependency Status](https://david-dm.org/semantic-release/semantic-release/badger/dev-status.svg)](https://david-dm.org/semantic-release/semantic-release/badger#info=devDependencies)
[![Dependency Status](https://david-dm.org/semantic-release/semantic-release/caribou.svg)](https://david-dm.org/semantic-release/semantic-release/caribou)
[![devDependency Status](https://david-dm.org/semantic-release/semantic-release/caribou/dev-status.svg)](https://david-dm.org/semantic-release/semantic-release/caribou#info=devDependencies)
[![Build Status](https://travis-ci.org/semantic-release/semantic-release.svg?branch=badger)](https://travis-ci.org/semantic-release/semantic-release)
[![Coverage Status](https://coveralls.io/repos/semantic-release/semantic-release/badge.svg?branch=badger&service=github)](https://coveralls.io/github/semantic-release/semantic-release?branch=badger)
[![Build Status](https://travis-ci.org/semantic-release/semantic-release.svg?branch=caribou)](https://travis-ci.org/semantic-release/semantic-release)
[![Coverage Status](https://coveralls.io/repos/semantic-release/semantic-release/badge.svg?branch=caribou&service=github)](https://coveralls.io/github/semantic-release/semantic-release?branch=caribou)
Out of the box this is just about _commit-messages_, but you can do so much more.
@@ -23,12 +28,27 @@ Out of the box this is just about _commit-messages_, but you can do so much more
  | Commands | Comment
--- | --- | ---
| **manual** | <pre><code><div>npm version major</div><div>git push origin master --tags</div><div>npm publish</div></code></pre> | You **manually decide** what the **next version** is. You have to remember what major, minor and patch means. You have to remember to push both commits and tags. You have to wait for the CI to pass. |
| **semantic-release** | <pre><code><div>git commit -m "fix: &lt;message&gt;"</div><div>git push</div></code></pre> | You **describe the changes** youve made. A new version is automatically published with the correct version number.
| **manual/before** | <pre><code><div>npm version major</div><div>git push origin master --tags</div><div>npm publish</div></code></pre> | You **manually decide** what the **next version** is. You have to remember what major, minor and patch means. You have to remember to push both commits and tags. You have to wait for the CI to pass. |
| **semantic-release/after** | <pre><code><div>git commit -m "fix: &lt;message&gt;"</div><div>git push</div></code></pre> | You **describe the changes** youve made. A new version is automatically published with the correct version number.
This removes the immediate connection between human emotions and version numbers, so strictly following the [SemVer](http://semver.org/) spec is not a problem anymore and thats ultimately `semantic-release`s goal.
This removes the immediate connection between human emotions and version numbers, so strictly following the [SemVer](http://semver.org/) spec is not a problem anymore  and thats ultimately `semantic-release`s goal.
<table>
<tr>
<th colspan="2">
“How to Write a JavaScript Library - Automating Releases with semantic-release”  egghead.io
</th>
</tr>
<tr>
<td colspan="2">
<a href="https://egghead.io/lessons/javascript-how-to-write-a-javascript-library-automating-releases-with-semantic-release"><img src="https://cloud.githubusercontent.com/assets/908178/9730739/7b1da5d8-5610-11e5-88b6-5c75fdda7ee2.png" alt="egghead.io session"></a>
</td>
</tr>
<tr>
<td colspan="2">
A free egghead.io tutorial series on how to write an open source library featuring semantic-release.
</td>
</tr>
<tr>
<th>
“We fail to follow SemVer and why it neednt matter”
@@ -59,26 +79,9 @@ This removes the immediate connection between human emotions and version numbers
Instead of writing [meaningless commit messages](http://whatthecommit.com/), we can take our time to think about the changes in the codebase and write them down. Following formalized conventions it this then possible to generate a helpful changelog and to derive the next semantic version number from them.
_Note: This module ships with the [AngularJS Commit Message Conventions](https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit) and changelog generator, but you can [define your own](#plugins) style_.
> ### Commit Message Format
> Each commit message consists of a **header**, a **body** and a **footer**. The header has a special
format that includes a **type**, a **scope** and a **subject**:
> ```
<type>(<scope>): <subject>
<BLANK LINE>
<body>
<BLANK LINE>
<footer>
```
> [Full explanation](https://github.com/ajoslin/conventional-changelog/blob/master/conventions/angular.md)
When `semantic-release` got setup it will do that after every successful continuous integration build of your master branch (or any other branch you specify) and publish the new version for you. That way no human is directly involved in the release process and your releases are guaranteed to be [unromantic and unsentimental](http://sentimentalversioning.org/).
If you fear the loss of control over timing and marketing implications of software releases you should know that `semantic-release` supports [release channels](https://github.com/npm/npm/issues/2718) using `npm`s [dist-tags](https://docs.npmjs.com/cli/tag). This way you can keep control over what your users end up using by default, you can decide when to promote an automatically released version to the stable channel and you can choose which versions to write blogposts and tweets about. You can use the same mechanism to support older versions of your software, for example with important security fixes.
If you fear the loss of control over timing and marketing implications of software releases you should know that `semantic-release` supports [release channels](https://github.com/npm/npm/issues/2718) using `npm`s [dist-tags](https://docs.npmjs.com/cli/dist-tag). This way you can keep control over what your users end up using by default, you can decide when to promote an automatically released version to the stable channel and you can choose which versions to write blogposts and tweets about. You can use the same mechanism to [support older versions of your software](https://gist.github.com/boennemann/54042374e49c7ade8910), for example with important security fixes.
This is what happens in series:
@@ -88,6 +91,43 @@ This is what happens in series:
_Note:_ The current release/tag implementation is tied to GitHub, but could be opened up to Bitbucket, GitLab, et al. Feel free to send PRs for these services.
## Default Commit Message Format
This module ships with the [AngularJS Commit Message Conventions](https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit) and changelog generator, but you can [define your own](#plugins) style.
Each commit message consists of a **header**, a **body** and a **footer**. The header has a special
format that includes a **type**, a **scope** and a **subject** ([full explanation](https://github.com/ajoslin/conventional-changelog/blob/master/conventions/angular.md)):
```
<type>(<scope>): <subject>
<BLANK LINE>
<body>
<BLANK LINE>
<footer>
```
You can simplify using this convention for yourself and contributors by using [commitizen](https://github.com/commitizen/cz-cli) and [validate-commit-msg](https://github.com/kentcdodds/validate-commit-msg).
### Patch Release
```
fix(pencil): stop graphite breaking when too much pressure applied
```
### ~~Minor~~ Feature Release
```
feat(pencil): add 'graphiteWidth' option
```
### ~~Major~~ Breaking Release
```
perf(pencil): remove graphiteWidth option
BREAKING CHANGE: The graphiteWidth option has been removed. The default graphite width of 10mm is always used for performance reason.
```
## Setup
[![NPM](https://nodei.co/npm/semantic-release.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/semantic-release/)
@@ -113,17 +153,18 @@ You can pass options either via command line (in [kebab-case](https://lodash.com
These options are currently available:
- `branch`: The branch on which releases should happen. Default: `master`
- `branch`: The branch on which releases should happen. Default: `'master'`
- `debug`: If true doesnt actually publish to npm or write things to file. Default: `!process.env.CI`
- `githubToken`: The token used to authenticate with GitHub. Default: `process.env.GH_TOKEN`
- `githubUrl`: Optional. Pass your GitHub Enterprise endpoint.
- `githubApiPathPrefix`: Optional. The path prefix for your GitHub Enterprise API.
_A few notes on `npm` config_:
1. The `npm` token can only be defined in the environment as `NPM_TOKEN`, because thats where `npm` itself is going to read it from.
2. In order to publish to a different `npm` registry you can just configure that how you would usually do it and `semantic-release` will respect that setting.
2. In order to publish to a different `npm` registry you can specify that inside the `package.json`s [`publishConfig`](https://docs.npmjs.com/files/package.json#publishconfig) field.
3. If you want to use another dist-tag for your publishes than `latest` you can specify that inside the `package.json`s [`publishConfig`](https://docs.npmjs.com/files/package.json#publishconfig) field.
3. If you want to use another dist-tag for your publishes than `'latest'` you can specify that inside the `package.json`s [`publishConfig`](https://docs.npmjs.com/files/package.json#publishconfig) field.
4. `semantic-release` generally tries to orientate itself towards `npm` it inherits the loglevel for example.
@@ -217,9 +258,7 @@ It is indeed a great idea because it _forces_ you to follow best practices. If y
### Why should I trust `semantic-release` with my releases?
`semantic-release` has a full unit- and integration-test-suite that tests _actual_ `npm` publishes against the [npm-registry-couchapp](https://github.com/npm/npm-registry-couchapp/) on node.js `^0.10`, `^0.12` and io.js `^1`, `^2`. A new version wont get published if it doesnt pass on all these engines.
Note: Currently integration-tests dont run on Travis CI. If you know stuff about npm/Travis/Couch: Please help!
`semantic-release` has a full unit- and integration-test-suite that tests _actual_ `npm` publishes against the [npm-registry-couchapp](https://github.com/npm/npm-registry-couchapp/) on all major node.js versions from `^0.10` on. A new version wont get published if it doesnt pass on all these engines.
## Badge
@@ -248,4 +287,4 @@ Use this in one of your projects? Include one of these badges in your README.md
MIT License
2015 © Stephan Bönnemann and [contributors](https://github.com/semantic-release/semantic-release/graphs/contributors)
![https://twitter.com/trodrigues/status/509301317467373571](https://cloud.githubusercontent.com/assets/908178/6091690/cc86f58c-aeb8-11e4-94cb-15f15f486cde.png)
[![](https://cloud.githubusercontent.com/assets/908178/6091690/cc86f58c-aeb8-11e4-94cb-15f15f486cde.png)](https://twitter.com/trodrigues/status/509301317467373571)
+160 -10
View File
@@ -1,13 +1,163 @@
#!/usr/bin/env node
/* istanbul ignore next */
try {
require('../dist')
} catch (err) {
if (err.code === 'MODULE_NOT_FOUND') {
require('babel/register')
require('../src')
} else {
console.log(err)
}
var fs = require('fs')
var path = require('path')
var url = require('url')
var _ = require('lodash')
var log = require('npmlog')
var nopt = require('nopt')
var npmconf = require('npmconf')
var normalizeData = require('normalize-package-data')
log.heading = 'semantic-release'
var env = process.env
var pkg = JSON.parse(fs.readFileSync('./package.json'))
normalizeData(pkg)
var knownOptions = {
branch: String,
debug: Boolean,
'github-token': String,
'github-url': String,
'analyze-commits': [path, String],
'generate-notes': [path, String],
'verify-conditions': [path, String],
'verify-release': [path, String]
}
var options = _.defaults(
_.mapKeys(nopt(knownOptions), function (value, key) {
return _.camelCase(key)
}),
pkg.release,
{
branch: 'master',
fallbackTags: {
next: 'latest'
},
debug: !env.CI,
githubToken: env.GH_TOKEN || env.GITHUB_TOKEN,
githubUrl: env.GH_URL
}
)
var plugins = require('../src/lib/plugins')(options)
npmconf.load({}, function (err, conf) {
if (err) {
log.error('init', 'Failed to load npm config.', err)
process.exit(1)
}
var npm = {
auth: {
token: env.NPM_TOKEN
},
loglevel: conf.get('loglevel'),
registry: require('../src/lib/get-registry')(pkg, conf),
tag: (pkg.publishConfig || {}).tag || conf.get('tag') || 'latest'
}
// normalize trailing slash
npm.registry = url.format(url.parse(npm.registry))
log.level = npm.loglevel
var config = {
env: env,
pkg: pkg,
options: options,
plugins: plugins,
npm: npm
}
var hide = {}
if (options.githubToken) hide.githubToken = '***'
log.verbose('init', 'options:', _.assign({}, options, hide))
log.verbose('init', 'Verifying config.')
var errors = require('../src/lib/verify')(config)
errors.forEach(function (err) {
log.error('init', err.message + ' ' + err.code)
})
if (errors.length) process.exit(1)
if (options.argv.remain[0] === 'pre') {
log.verbose('pre', 'Running pre-script.')
log.verbose('pre', 'Veriying conditions.')
plugins.verifyConditions(config, function (err) {
if (err) {
log[options.debug ? 'warn' : 'error']('pre', err.message)
if (!options.debug) process.exit(1)
}
var nerfDart = require('nerf-dart')(npm.registry)
var wroteNpmRc = false
if (env.NPM_OLD_TOKEN && env.NPM_EMAIL) {
// Using the old auth token format is not considered part of the public API
// This might go away anytime (i.e. once we have a better testing strategy)
conf.set('_auth', '${NPM_OLD_TOKEN}', 'project')
conf.set('email', '${NPM_EMAIL}', 'project')
wroteNpmRc = true
} else if (env.NPM_TOKEN) {
conf.set(nerfDart + ':_authToken', '${NPM_TOKEN}', 'project')
wroteNpmRc = true
}
conf.save('project', function (err) {
if (err) return log.error('pre', 'Failed to save npm config.', err)
if (wroteNpmRc) log.verbose('pre', 'Wrote authToken to .npmrc.')
require('../src/pre')(config, function (err, release) {
if (err) {
log.error('pre', 'Failed to determine new version.')
var args = ['pre', (err.code ? err.code + ' ' : '') + err.message]
if (err.stack) args.push(err.stack)
log.error.apply(log, args)
process.exit(1)
}
var message = 'Determined version ' + release.version + ' as "' + npm.tag + '".'
log.verbose('pre', message)
if (options.debug) {
log.error('pre', message + ' Not publishing in debug mode.', release)
process.exit(1)
}
try {
var shrinkwrap = JSON.parse(fs.readFileSync('./npm-shrinkwrap.json'))
shrinkwrap.version = release.version
fs.writeFileSync('./npm-shrinkwrap.json', JSON.stringify(shrinkwrap, null, 2))
log.verbose('pre', 'Wrote version ' + release.version + 'to npm-shrinkwrap.json.')
} catch (e) {
log.silly('pre', 'Couldn\'t find npm-shrinkwrap.json.')
}
fs.writeFileSync('./package.json', JSON.stringify(_.assign(pkg, {
version: release.version
}), null, 2))
log.verbose('pre', 'Wrote version ' + release.version + ' to package.json.')
})
})
})
} else if (options.argv.remain[0] === 'post') {
log.verbose('post', 'Running post-script.')
require('../src/post')(config, function (err, published, release) {
if (err) {
log.error('post', 'Failed to publish release notes.', err)
process.exit(1)
}
log.verbose('post', (published ? 'Published' : 'Generated') + ' release notes.', release)
})
} else {
log.error('post', 'Command "' + options.argv.remain[0] + '" not recognized. User either "pre" or "post"')
}
})
+40 -41
View File
@@ -1,56 +1,53 @@
{
"name": "semantic-release",
"description": "automated semver compliant package publishing",
"version": "0.0.0-placeholder",
"author": "Stephan Bönnemann <stephan@boennemann.me> (http://boennemann.me)",
"bin": {
"semantic-release": "./bin/semantic-release.js"
"semantic-release": "bin/semantic-release.js"
},
"bugs": {
"url": "https://github.com/semantic-release/semantic-release/issues"
},
"engines": {
"node": ">=0.10",
"npm": ">=2"
},
"config": {
"nyc": {
"exclude": [
".test",
"node_modules"
]
}
"czConfig": {
"path": "node_modules/cz-conventional-changelog/"
},
"dependencies": {
"@bahmutov/parse-github-repo-url": "^0.1.0",
"@semantic-release/commit-analyzer": "^2.0.0",
"@semantic-release/condition-travis": "^4.1.2",
"@semantic-release/condition-travis": "^5.0.0",
"@semantic-release/error": "^1.0.0",
"@semantic-release/last-release-npm": "^1.2.1",
"@semantic-release/release-notes-generator": "^2.0.0",
"git-head": "^1.2.1",
"github": "^0.2.4",
"lodash": "^3.9.3",
"lodash": "^4.0.0",
"nerf-dart": "^1.0.0",
"nopt": "^3.0.3",
"normalize-package-data": "^2.3.4",
"npmconf": "^2.1.2",
"npmlog": "^1.2.1",
"parse-github-repo-url": "^1.0.0",
"npmlog": "^2.0.0",
"require-relative": "^0.8.7",
"run-auto": "^1.1.2",
"run-series": "^1.1.2",
"semver": "^5.0.1"
"run-series": "^1.1.3",
"semver": "^5.0.3"
},
"devDependencies": {
"babel": "^5.5.8",
"coveralls": "^2.11.2",
"coveralls": "^2.11.4",
"cz-conventional-changelog": "^1.1.4",
"mkdirp": "^0.5.1",
"nixt": "^0.4.1",
"nock": "^2.5.0",
"nock": "^5.2.1",
"npm-registry-couchapp": "^2.6.11",
"nyc": "^3.0.0",
"proxyquire": "^1.5.0",
"rimraf": "^2.4.0",
"standard": "^5.0.2",
"tap": "^1.3.1"
"nyc": "^5.0.0",
"proxyquire": "^1.7.3",
"rimraf": "^2.5.0",
"standard": "^5.3.0",
"tap": "^5.0.0"
},
"engines": {
"node": ">=0.10",
"npm": ">=2"
},
"homepage": "https://github.com/semantic-release/semantic-release/tree/next#readme",
"keywords": [
@@ -65,26 +62,28 @@
"version"
],
"license": "MIT",
"main": "dist/index.js",
"main": "bin/semantic-release.js",
"files": [
"bin",
"src"
],
"publishConfig": {
"tag": "next"
},
"release": {
"branch": "caribou"
},
"repository": {
"type": "git",
"url": "git+https://github.com/semantic-release/semantic-release.git"
},
"release": {
"branch": "badger"
},
"scripts": {
"build": "rimraf dist && mkdirp dist && babel src --out-dir dist",
"coverage": "nyc report",
"coverage:upload": "npm run coverage -- --reporter=lcovonly && coveralls < coverage/lcov.info",
"prepublish": "npm run build",
"pretest:integration": "npm run build && npm run test:build",
"pretest:unit": "npm run build && npm run test:build",
"semantic-release": "./bin/semantic-release.js pre && npm dedupe && npm publish && ./bin/semantic-release.js post",
"test": "npm run test:style && npm run test:unit",
"test:build": "rimraf .test && mkdirp .test && babel test --out-dir .test",
"test:integration": "tap --no-cov .test/scenarios/*.js",
"test:style": "standard",
"test:unit": "nyc tap --no-cov .test/specs/*.js"
"coverage:upload": "npm run coverage -s -- --reporter=text-lcov | coveralls",
"pretest": "standard",
"semantic-release": "./bin/semantic-release.js pre && npm publish && ./bin/semantic-release.js post",
"test": "npm run test:unit && npm run test:integration",
"test:integration": "tap --no-cov test/scenarios/*.js",
"test:unit": "nyc tap --no-cov test/specs/*.js"
}
}
-146
View File
@@ -1,146 +0,0 @@
const { readFileSync, writeFileSync } = require('fs')
const path = require('path')
const url = require('url')
const _ = require('lodash')
const log = require('npmlog')
const nopt = require('nopt')
const npmconf = require('npmconf')
log.heading = 'semantic-release'
const env = process.env
const pkg = JSON.parse(readFileSync('./package.json'))
const knownOptions = {
branch: String,
debug: Boolean,
'github-token': String,
'github-url': String,
'analyze-commits': [path, String],
'generate-notes': [path, String],
'verify-conditions': [path, String],
'verify-release': [path, String]
}
const options = _.defaults(
_.mapKeys(nopt(knownOptions), (value, key) => _.camelCase(key)),
pkg.release,
{
branch: 'master',
debug: !env.CI,
githubToken: env.GH_TOKEN || env.GITHUB_TOKEN,
githubUrl: env.GH_URL
}
)
const plugins = require('./lib/plugins')(options)
npmconf.load({}, (err, conf) => {
if (err) {
log.error('init', 'Failed to load npm config.', err)
process.exit(1)
}
let npm = {
auth: {
token: env.NPM_TOKEN
},
loglevel: conf.get('loglevel'),
registry: require('./lib/get-registry')(pkg, conf),
tag: (pkg.publishConfig || {}).tag || conf.get('tag') || 'latest'
}
// normalize trailing slash
npm.registry = url.format(url.parse(npm.registry))
log.level = npm.loglevel
const config = {env, pkg, options, plugins, npm}
let hide = {}
if (options.githubToken) hide.githubToken = '***'
log.verbose('init', 'options:', _.assign({}, options, hide))
log.verbose('init', 'Verifying config.')
const errors = require('./lib/verify')(config)
errors.forEach((err) => log.error('init', `${err.message} ${err.code}`))
if (errors.length) process.exit(1)
if (options.argv.remain[0] === 'pre') {
log.verbose('pre', 'Running pre-script.')
log.verbose('pre', 'Veriying conditions.')
plugins.verifyConditions(config, (err) => {
if (err) {
log[options.debug ? 'warn' : 'error']('pre', err.message)
if (!options.debug) process.exit(1)
}
const nerfDart = require('nerf-dart')(npm.registry)
let wroteNpmRc = false
if (env.NPM_TOKEN) {
conf.set(`${nerfDart}:_authToken`, '${NPM_TOKEN}', 'project')
wroteNpmRc = true
} else if (env.NPM_OLD_TOKEN && env.NPM_EMAIL) {
// Using the old auth token format is not considered part of the public API
// This might go away anytime (i.e. once we have a better testing strategy)
conf.set('_auth', '${NPM_OLD_TOKEN}', 'project')
conf.set('email', '${NPM_EMAIL}', 'project')
wroteNpmRc = true
}
conf.save('project', (err) => {
if (err) return log.error('pre', 'Failed to save npm config.', err)
if (wroteNpmRc) log.verbose('pre', 'Wrote authToken to .npmrc.')
require('./pre')(config, (err, release) => {
if (err) {
log.error('pre', 'Failed to determine new version.')
const args = ['pre', (err.code ? `${err.code} ` : '') + err.message]
if (err.stack) args.push(err.stack)
log.error(...args)
process.exit(1)
}
const message = `Determined version ${release.version} as "${npm.tag}".`
log.verbose('pre', message)
if (options.debug) {
log.error('pre', `${message} Not publishing in debug mode.`, release)
process.exit(1)
}
try {
let shrinkwrap = JSON.parse(readFileSync('./npm-shrinkwrap.json'))
shrinkwrap.version = release.version
writeFileSync('./npm-shrinkwrap.json', JSON.stringify(shrinkwrap, null, 2))
log.verbose('pre', `Wrote version ${release.version} to npm-shrinkwrap.json.`)
} catch (e) {
log.silly('pre', `Couldn't find npm-shrinkwrap.json.`)
}
writeFileSync('./package.json', JSON.stringify(_.assign(pkg, {
version: release.version
}), null, 2))
log.verbose('pre', `Wrote version ${release.version} to package.json.`)
})
})
})
} else if (options.argv.remain[0] === 'post') {
log.verbose('post', 'Running post-script.')
require('./post')(config, (err, published, release) => {
if (err) {
log.error('post', 'Failed to publish release notes.', err)
process.exit(1)
}
log.verbose('post', `${published ? 'Published' : 'Generated'} release notes.`, release)
})
} else {
log.error('post', `Command "${options.argv.remain[0]}" not recognized. User either "pre" or "post"`)
}
})
+38 -32
View File
@@ -1,40 +1,44 @@
const { exec } = require('child_process')
var exec = require('child_process').exec
const log = require('npmlog')
var log = require('npmlog')
const SemanticReleaseError = require('@semantic-release/error')
var SemanticReleaseError = require('@semantic-release/error')
module.exports = function ({lastRelease, options}, cb) {
const branch = options.branch
const from = lastRelease.gitHead
const range = (from ? from + '..' : '') + 'HEAD'
module.exports = function (config, cb) {
var lastRelease = config.lastRelease
var options = config.options
var branch = options.branch
var from = lastRelease.gitHead
var range = (from ? from + '..' : '') + 'HEAD'
if (!from) return extract()
exec(`git branch --contains ${from}`, (err, stdout) => {
if (err) return cb(err)
let inHistory = false
exec('git branch --contains ' + from, function (err, stdout) {
var inHistory = false
var branches
const branches = stdout.split('\n')
.map((result) => {
if (branch === result.replace('*', '').trim()) {
inHistory = true
return null
}
return result.trim()
})
.filter(branch => !!branch)
if (!err && stdout) {
branches = stdout.split('\n')
.map(function (result) {
if (branch === result.replace('*', '').trim()) {
inHistory = true
return null
}
return result.trim()
})
.filter(function (branch) {
return !!branch
})
}
if (!inHistory) {
log.error('commits',
`The commit the last release of this package was derived from is no longer
in the direct history of the "${branch}" branch.
This means semantic-release can not extract the commits between now and then.
This is usually caused by force pushing or releasing from an unrelated branch.
You can recover from this error by publishing manually or restoring
the commit "${from}".` + (branches.length ?
`\nHere is a list of branches that still contain the commit in question: \n * ${branches.join('\n * ')}` :
''
'The commit the last release of this package was derived from is not in the direct history of the "' + branch + '" branch.\n' +
'This means semantic-release can not extract the commits between now and then.\n' +
'This is usually caused by force pushing, releasing from an unrelated branch, or using an already existing package name.\n' +
'You can recover from this error by publishing manually or restoring the commit "' + from + '".' + (branches && branches.length
? '\nHere is a list of branches that still contain the commit in question: \n * ' + branches.join('\n * ')
: ''
))
return cb(new SemanticReleaseError('Commit not in history', 'ENOTINHISTORY'))
}
@@ -44,16 +48,18 @@ the commit "${from}".` + (branches.length ?
function extract () {
exec(
`git log -E --format=%H==SPLIT==%B==END== ${range}`,
(err, stdout) => {
'git log -E --format=%H==SPLIT==%B==END== ' + range,
function (err, stdout) {
if (err) return cb(err)
cb(null, String(stdout).split('==END==\n')
.filter((raw) => !!raw.trim())
.filter(function (raw) {
return !!raw.trim()
})
.map((raw) => {
const data = raw.split('==SPLIT==')
.map(function (raw) {
var data = raw.split('==SPLIT==')
return {
hash: data[0],
message: data[1]
+2 -2
View File
@@ -3,8 +3,8 @@ module.exports = function (pkg, conf) {
if (pkg.name[0] !== '@') return conf.get('registry') || 'https://registry.npmjs.org/'
const scope = pkg.name.split('/')[0]
const scopedRegistry = conf.get(`${scope}/registry`)
var scope = pkg.name.split('/')[0]
var scopedRegistry = conf.get(scope + '/registry')
if (scopedRegistry) return scopedRegistry
+8 -8
View File
@@ -1,26 +1,26 @@
const relative = require('require-relative')
const series = require('run-series')
var relative = require('require-relative')
var series = require('run-series')
let exports = module.exports = function (options) {
var exports = module.exports = function (options) {
var plugins = {
analyzeCommits: exports.normalize(options.analyzeCommits, '@semantic-release/commit-analyzer'),
generateNotes: exports.normalize(options.generateNotes, '@semantic-release/release-notes-generator'),
getLastRelease: exports.normalize(options.getLastRelease, '@semantic-release/last-release-npm')
}
;['verifyConditions', 'verifyRelease'].forEach((plugin) => {
;['verifyConditions', 'verifyRelease'].forEach(function (plugin) {
if (!Array.isArray(options[plugin])) {
plugins[plugin] = exports.normalize(
options[plugin],
plugin === 'verifyConditions' ?
'@semantic-release/condition-travis' :
'./plugin-noop'
plugin === 'verifyConditions'
? '@semantic-release/condition-travis'
: './plugin-noop'
)
return
}
plugins[plugin] = function (pluginOptions, cb) {
var tasks = options[plugin].map((step) => {
var tasks = options[plugin].map(function (step) {
return exports.normalize(step, './plugin-noop').bind(null, pluginOptions)
})
+4 -3
View File
@@ -1,9 +1,10 @@
const SemanticReleaseError = require('@semantic-release/error')
var SemanticReleaseError = require('@semantic-release/error')
module.exports = function (config, cb) {
const { plugins, lastRelease } = config
var plugins = config.plugins
var lastRelease = config.lastRelease
plugins.analyzeCommits(config, (err, type) => {
plugins.analyzeCommits(config, function (err, type) {
if (err) return cb(err)
if (!type) {
+6 -10
View File
@@ -1,9 +1,10 @@
const parseSlug = require('parse-github-repo-url')
var SemanticReleaseError = require('@semantic-release/error')
const SemanticReleaseError = require('@semantic-release/error')
module.exports = function ({pkg, options, env}) {
let errors = []
module.exports = function (config) {
var pkg = config.pkg
var options = config.options
var env = config.env
var errors = []
if (!pkg.name) {
errors.push(new SemanticReleaseError(
@@ -17,11 +18,6 @@ module.exports = function ({pkg, options, env}) {
'No "repository" found in package.json.',
'ENOPKGREPO'
))
} else if (!parseSlug(pkg.repository.url)) {
errors.push(new SemanticReleaseError(
'The "repository" field in the package.json is malformed.',
'EMALFORMEDPKGREPO'
))
}
if (options.debug) return errors
+18 -15
View File
@@ -1,32 +1,35 @@
const url = require('url')
var url = require('url')
const gitHead = require('git-head')
const GitHubApi = require('github')
const parseSlug = require('parse-github-repo-url')
var gitHead = require('git-head')
var GitHubApi = require('github')
var parseSlug = require('@bahmutov/parse-github-repo-url')
module.exports = function (config, cb) {
const { pkg, options, plugins } = config
const ghConfig = options.githubUrl ? url.parse(options.githubUrl) : {}
var pkg = config.pkg
var options = config.options
var plugins = config.plugins
var ghConfig = options.githubUrl ? url.parse(options.githubUrl) : {}
const github = new GitHubApi({
var github = new GitHubApi({
version: '3.0.0',
port: ghConfig.port,
protocol: (ghConfig.protocol || '').split(':')[0] || null,
host: ghConfig.hostname
host: ghConfig.hostname,
pathPrefix: options.githubApiPathPrefix || null
})
plugins.generateNotes(config, (err, log) => {
plugins.generateNotes(config, function (err, log) {
if (err) return cb(err)
gitHead((err, hash) => {
gitHead(function (err, hash) {
if (err) return cb(err)
const ghRepo = parseSlug(pkg.repository.url)
const release = {
var ghRepo = parseSlug(pkg.repository.url)
var release = {
owner: ghRepo[0],
repo: ghRepo[1],
name: `v${pkg.version}`,
tag_name: `v${pkg.version}`,
name: 'v' + pkg.version,
tag_name: 'v' + pkg.version,
target_commitish: hash,
draft: !!options.debug,
body: log
@@ -41,7 +44,7 @@ module.exports = function (config, cb) {
token: options.githubToken
})
github.releases.createRelease(release, (err) => {
github.releases.createRelease(release, function (err) {
if (err) return cb(err)
cb(null, true, release)
+15 -15
View File
@@ -1,43 +1,43 @@
const _ = require('lodash')
const auto = require('run-auto')
const semver = require('semver')
var _ = require('lodash')
var auto = require('run-auto')
var semver = require('semver')
const getCommits = require('./lib/commits')
const getType = require('./lib/type')
var getCommits = require('./lib/commits')
var getType = require('./lib/type')
module.exports = function (config, cb) {
const { plugins } = config
var plugins = config.plugins
auto({
lastRelease: plugins.getLastRelease.bind(null, config),
commits: ['lastRelease', (cb, results) => {
commits: ['lastRelease', function (cb, results) {
getCommits(_.assign({
lastRelease: results.lastRelease
}, config),
cb)
}],
type: ['commits', 'lastRelease', (cb, results) => {
type: ['commits', 'lastRelease', function (cb, results) {
getType(_.assign({
commits: results.commits,
lastRelease: results.lastRelease
}, config),
cb)
}]
}, (err, results) => {
}, function (err, results) {
if (err) return cb(err)
const nextRelease = {
var nextRelease = {
type: results.type,
version: results.type === 'initial' ?
'1.0.0' :
semver.inc(results.lastRelease.version, results.type)
version: results.type === 'initial'
? '1.0.0'
: semver.inc(results.lastRelease.version, results.type)
}
plugins.verifyRelease(_.assign({
commits: results.commits,
lastRelease: results.lastRelease,
nextRelease
}, config), (err) => {
nextRelease: nextRelease
}, config), function (err) {
if (err) return cb(err)
cb(null, nextRelease)
})
+1 -3
View File
@@ -1,4 +1,4 @@
const nixt = require('nixt')
var nixt = require('nixt')
module.exports = function (cwd, uri) {
return nixt()
@@ -7,8 +7,6 @@ module.exports = function (cwd, uri) {
.env('NPM_EMAIL', 'integration@test.com')
.env('GH_TOKEN', 'ghtoken')
.env('CI', 'true')
.env('TRAVIS', 'true')
.env('TRAVIS_BRANCH', 'master')
.env('npm_config_registry', uri)
.clone()
}
+17 -26
View File
@@ -1,40 +1,31 @@
const { exec } = require('child_process')
const { join } = require('path')
const { writeFileSync } = require('fs')
var exec = require('child_process').exec
var join = require('path').join
var writeFileSync = require('fs').writeFileSync
const mkdirp = require('mkdirp')
var mkdirp = require('mkdirp')
module.exports = function (name, cb) {
const cwd = join(__dirname, '../tmp', name)
module.exports = function (name, registry, cb) {
var cwd = join(__dirname, '../tmp', name)
mkdirp.sync(cwd)
writeFileSync(join(cwd, '.npmrc'), `
//localhost:1337/registry/_design/app/_rewrite/:username=integration
//localhost:1337/registry/_design/app/_rewrite/:email=integration@test.com`, null, 2)
writeFileSync(join(cwd, 'package.json'), JSON.stringify({
name,
name: name,
repository: {
url: 'git+https://github.com/semantic-release/test'
},
_npmUser: {
name: 'integration',
email: 'integration@test.com'
},
maintainers: [{
name: 'integration',
email: 'integration@test.com'
}]
release: {
verifyConditions: '../../../src/lib/plugin-noop'
}
}, null, 2))
exec(`
git init &&
git config user.email "integration@test" &&
git config user.name "Integration Test" &&
git add . &&
git commit -m "chore: root"`
, {cwd}, (err, stdout, stderr) => {
exec(
'git init && ' +
'git config user.email "integration@test" && ' +
'git config user.name "Integration Test" && ' +
'git add . && ' +
'git commit -m "chore: root"'
, {cwd: cwd}, function (err, stdout, stderr) {
if (err) {
console.log(stdout, stderr)
return cb(err)
+6 -5
View File
@@ -4,16 +4,17 @@ const rawCommits = [
]
module.exports = {
exec: (command, cb) => {
exec: function (command, cb) {
if (/contains/.test(command)) {
return cb(null, `whatever\nmaster\n`)
if (/notinhistory/.test(command)) return cb(new Error())
return cb(null, 'whatever\nmaster\n')
}
cb(
null,
/\.\.HEAD/.test(command) ?
rawCommits[0] :
rawCommits.join()
/\.\.HEAD/.test(command)
? rawCommits[0]
: rawCommits.join()
)
},
'@noCallThru': true
+11 -5
View File
@@ -1,6 +1,12 @@
module.exports = () => ({
authenticate: () => true,
releases: {
createRelease: (release, cb) => cb(null)
module.exports = function () {
return {
authenticate: function () {
return true
},
releases: {
createRelease: function (release, cb) {
cb(null)
}
}
}
})
}
+4 -5
View File
@@ -1,12 +1,11 @@
const { exec } = require('child_process')
const { join } = require('path')
var exec = require('child_process').exec
const opts = {
cwd: join(__dirname, '../../test/registry')
var opts = {
cwd: __dirname
}
module.exports = {
start: exec.bind(null, './start.sh', opts),
stop: exec.bind(null, './stop.sh', opts),
uri: 'http://localhost:15986/registry/_design/app/_rewrite/'
uri: 'http://localhost:' + (process.env.TRAVIS === 'true' ? 5984 : 15986) + '/registry/_design/app/_rewrite/'
}
+13 -9
View File
@@ -7,25 +7,29 @@ cd $(dirname $0)
mkdir -p couch
# start couchdb as a background process, load local config, specify writable logfiles
if [[ $TRAVIS = true ]]
then
echo 'starting couch with sudo'
sudo couchdb -b -a local.ini -p couch/pid -o couch/stdout.log -e couch/stderr.log
COUCH=http://admin:password@127.0.0.1:5984
curl -X PUT http://127.0.0.1:5984/_config/admins/admin -d '"password"'
curl -X PUT $COUCH/_config/couchdb/delayed_commits -d '"false"'
curl -X PUT $COUCH/_config/couch_httpd_auth/users_db_public -d '"true"'
curl -X PUT $COUCH/_config/couch_httpd_auth/public_fields -d '"appdotnet, avatar, avatarMedium, avatarLarge, date, email, fields, freenode, fullname, github, homepage, name, roles, twitter, type, _id, _rev"'
curl -X PUT $COUCH/_config/httpd/secure_rewrites -d '"false"'
else
COUCH=http://admin:password@127.0.0.1:15986
couchdb -b -a local.ini -p couch/pid -o couch/stdout.log -e couch/stderr.log
# wait for couch to start
sleep 1
fi
# wait for couch to start
sleep 5
COUCH=http://admin:password@127.0.0.1:15986
# create "registry" database
curl -X PUT $COUCH/registry
# create sample npm user
curl -X PUT $COUCH/_users/org.couchdb.user:integration -H Content-Type:application/json --data-binary '{"_id": "org.couchdb.user:integration","name": "integration","roles": [],"type": "user","password": "suchsecure","email": "integration@test.com"}'
curl -X PUT $COUCH/_users/org.couchdb.user:integration -H Content-Type:application/json --data-binary '{"_id": "org.couchdb.user:integration", "name": "integration", "roles": [], "type": "user", "password": "suchsecure", "email": "integration@test.com"}'
# npm-registry-couchpp needs this variable set to run
export DEPLOY_VERSION=nope
+1
View File
@@ -8,5 +8,6 @@ cd $(dirname $0)
cat couch/{couch,stdout,stderr}.log
cat couch/pid | xargs kill
rm -rf couch
rm -rf data
+22 -24
View File
@@ -1,30 +1,27 @@
const { join } = require('path')
var join = require('path').join
const { test, tearDown } = require('tap')
const rimraf = require('rimraf')
var tap = require('tap')
var rimraf = require('rimraf')
const registry = require('../registry')
const testModule = require('../lib/test-module')
const baseScenario = require('../lib/base-scenario')
var registry = require('../registry')
var testModule = require('../lib/test-module')
var baseScenario = require('../lib/base-scenario')
test('change version', (t) => {
var tearDown = tap.tearDown
var test = tap.test
test('change version', {bail: process.env.TRAVIS === 'true'}, function (t) {
t.plan(7)
registry.start((err) => {
registry.start(function (err, stdout, stderr) {
t.error(err, 'registry started')
if (err) {
t.end()
t.bailout('registry not started')
}
if (err) return t.end()
testModule('change-version', (err, cwd) => {
testModule('change-version', registry.uri, function (err, cwd) {
t.error(err, 'test-module created')
if (err) {
t.end()
t.bailout('test-module not created')
}
if (err) return t.end()
t.test('no version', (tt) => {
t.test('no version', function (tt) {
tt.plan(1)
baseScenario(cwd, registry.uri)
@@ -35,7 +32,7 @@ test('change version', (t) => {
.end(tt.error)
})
t.test('initial version', (tt) => {
t.test('initial version', function (tt) {
tt.plan(1)
baseScenario(cwd, registry.uri)
@@ -47,7 +44,7 @@ test('change version', (t) => {
.end(tt.error)
})
t.test('patch version', (tt) => {
t.test('patch version', function (tt) {
tt.plan(1)
baseScenario(cwd, registry.uri)
@@ -59,7 +56,7 @@ test('change version', (t) => {
.end(tt.error)
})
t.test('feature version', (tt) => {
t.test('feature version', function (tt) {
tt.plan(1)
baseScenario(cwd, registry.uri)
@@ -71,7 +68,7 @@ test('change version', (t) => {
.end(tt.error)
})
t.test('breaking version', (tt) => {
t.test('breaking version', function (tt) {
tt.plan(1)
baseScenario(cwd, registry.uri)
@@ -86,10 +83,11 @@ test('change version', (t) => {
})
})
tearDown(() => {
tearDown(function () {
if (process.env.TRAVIS === 'true') return
function cb (err, stdout, stderr) {
if (err) console.log(err)
if (stdout) console.log(stdout)
if (stderr) console.log(stderr)
}
+13 -10
View File
@@ -1,13 +1,16 @@
const test = require('tap').test
const proxyquire = require('proxyquire')
var test = require('tap').test
var proxyquire = require('proxyquire')
const commits = proxyquire('../../dist/lib/commits', {
var commits = proxyquire('../../src/lib/commits', {
'npmlog': {
error: function () {}
},
'child_process': require('../mocks/child-process')
})
test('commits since last release', (t) => {
t.test('get all commits', (tt) => {
commits({lastRelease: {}, options: {branch: 'master'}}, (err, commits) => {
test('commits since last release', function (t) {
t.test('get all commits', function (tt) {
commits({lastRelease: {}, options: {branch: 'master'}}, function (err, commits) {
tt.error(err)
tt.is(commits.length, 2, 'all commits')
tt.is(commits[0].hash, 'hash-one', 'parsed hash')
@@ -17,8 +20,8 @@ test('commits since last release', (t) => {
})
})
t.test('get commits since hash', (tt) => {
commits({lastRelease: {gitHead: 'hash'}, options: {branch: 'master'}}, (err, commits) => {
t.test('get commits since hash', function (tt) {
commits({lastRelease: {gitHead: 'hash'}, options: {branch: 'master'}}, function (err, commits) {
tt.error(err)
tt.is(commits.length, 1, 'specified commits')
tt.is(commits[0].hash, 'hash-one', 'parsed hash')
@@ -28,8 +31,8 @@ test('commits since last release', (t) => {
})
})
t.test('get commits since hash', (tt) => {
commits({lastRelease: {gitHead: 'notinhistory'}, options: {branch: 'notmaster'}}, (err, commits) => {
t.test('get commits since hash', function (tt) {
commits({lastRelease: {gitHead: 'notinhistory'}, options: {branch: 'notmaster'}}, function (err, commits) {
tt.ok(err)
tt.is(err.code, 'ENOTINHISTORY')
tt.end()
+21 -7
View File
@@ -1,8 +1,8 @@
const test = require('tap').test
const getRegistry = require('../../dist/lib/get-registry')
const getRegistry = require('../../src/lib/get-registry')
test('get correct registry', (t) => {
test('get correct registry', function (t) {
t.is(getRegistry({
name: 'publish-config',
publishConfig: {
@@ -10,20 +10,34 @@ test('get correct registry', (t) => {
}},
{}), 'a')
t.is(getRegistry({name: 'normal'}, {get: () => 'b'}), 'b')
t.is(getRegistry({name: 'normal'}, {
get: function () {
return 'b'
}
}), 'b')
t.is(getRegistry({name: 'normal'}, {get: () => null}), 'https://registry.npmjs.org/')
t.is(getRegistry({name: 'normal'}, {
get: function () {
return null
}
}), 'https://registry.npmjs.org/')
t.is(getRegistry({name: '@scoped/foo'}, {
get: (input) => input === '@scoped/registry' ? 'c' : 'd'
get: function (input) {
return input === '@scoped/registry' ? 'c' : 'd'
}
}), 'c')
t.is(getRegistry({name: '@scoped/bar'}, {
get: () => 'e'
get: function () {
return 'e'
}
}), 'e')
t.is(getRegistry({name: '@scoped/baz'}, {
get: () => null
get: function () {
return null
}
}), 'https://registry.npmjs.org/')
t.end()
+34 -33
View File
@@ -1,11 +1,11 @@
const test = require('tap').test
var test = require('tap').test
const plugins = require('../../dist/lib/plugins')
var plugins = require('../../src/lib/plugins')
test('export plugins', (t) => {
test('export plugins', function (t) {
t.plan(5)
const defaultPlugins = plugins({})
var defaultPlugins = plugins({})
t.is(typeof defaultPlugins.analyzeCommits, 'function')
t.is(typeof defaultPlugins.generateNotes, 'function')
@@ -14,51 +14,51 @@ test('export plugins', (t) => {
t.is(typeof defaultPlugins.getLastRelease, 'function')
})
test('plugin pipelines', (t) => {
test('plugin pipelines', function (t) {
t.plan(3)
t.test('get all results', (tt) => {
const pipelinePlugins = plugins({
t.test('get all results', function (tt) {
var pipelinePlugins = plugins({
verifyRelease: [
'./dist/lib/plugin-noop',
'./.test/mocks/plugin-result-a',
'./.test/mocks/plugin-result-b'
'./src/lib/plugin-noop',
'./test/mocks/plugin-result-a',
'./test/mocks/plugin-result-b'
]
})
pipelinePlugins.verifyRelease({}, (err, results) => {
pipelinePlugins.verifyRelease({}, function (err, results) {
tt.error(err)
tt.same(results, [undefined, 'a', 'b'])
tt.end()
})
})
t.test('get first error', (tt) => {
const pipelinePlugins = plugins({
t.test('get first error', function (tt) {
var pipelinePlugins = plugins({
verifyConditions: [
'./dist/lib/plugin-noop',
'./.test/mocks/plugin-error-a',
'./.test/mocks/plugin-error-b'
'./src/lib/plugin-noop',
'./test/mocks/plugin-error-a',
'./test/mocks/plugin-error-b'
]
})
pipelinePlugins.verifyConditions({}, (err) => {
pipelinePlugins.verifyConditions({}, function (err) {
tt.is(err.message, 'a')
tt.end()
})
})
t.test('get error and only results before', (tt) => {
const pipelinePlugins = plugins({
t.test('get error and only results before', function (tt) {
var pipelinePlugins = plugins({
verifyRelease: [
'./dist/lib/plugin-noop',
'./.test/mocks/plugin-result-a',
'./.test/mocks/plugin-error-b',
'./.test/mocks/plugin-result-b'
'./src/lib/plugin-noop',
'./test/mocks/plugin-result-a',
'./test/mocks/plugin-error-b',
'./test/mocks/plugin-result-b'
]
})
pipelinePlugins.verifyRelease({}, (err, results) => {
pipelinePlugins.verifyRelease({}, function (err, results) {
tt.is(err.message, 'b')
tt.same(results, [undefined, 'a', undefined])
tt.end()
@@ -66,19 +66,18 @@ test('plugin pipelines', (t) => {
})
})
test('normalize and load plugin', (t) => {
t.test('load from string', (tt) => {
const plugin = plugins.normalize('./dist/lib/plugin-noop')
test('normalize and load plugin', function (t) {
t.test('load from string', function (tt) {
var plugin = plugins.normalize('./src/lib/plugin-noop')
tt.is(typeof plugin, 'function')
tt.end()
})
t.test('load from object', (tt) => {
const plugin = plugins.normalize({
path: './dist/lib/plugin-noop'
t.test('load from object', function (tt) {
var plugin = plugins.normalize({
path: './src/lib/plugin-noop'
})
tt.is(typeof plugin, 'function')
@@ -86,11 +85,13 @@ test('normalize and load plugin', (t) => {
tt.end()
})
t.test('load from object', (tt) => {
const plugin = plugins.normalize(null, '../../dist/lib/plugin-noop')
t.test('load from fallback', function (tt) {
var plugin = plugins.normalize(null, '../../src/lib/plugin-noop')
tt.is(typeof plugin, 'function')
tt.end()
})
t.end()
})
+26 -20
View File
@@ -1,20 +1,24 @@
const { defaults } = require('lodash')
const test = require('tap').test
const proxyquire = require('proxyquire')
var defaults = require('lodash').defaults
var test = require('tap').test
var proxyquire = require('proxyquire')
const post = proxyquire('../../dist/post', {
var post = proxyquire('../../src/post', {
'git-head': require('../mocks/git-head'),
github: require('../mocks/github')
})
const pkg = {
var pkg = {
version: '1.0.0',
repository: {url: 'http://github.com/whats/up.git'}
}
const plugins = {generateNotes: (pkg, cb) => cb(null, 'the log')}
var plugins = {
generateNotes: function (pkg, cb) {
cb(null, 'the log')
}
}
const defaultRelease = {
var defaultRelease = {
owner: 'whats',
repo: 'up',
name: 'v1.0.0',
@@ -23,13 +27,13 @@ const defaultRelease = {
body: 'the log'
}
test('full post run', (t) => {
t.test('in debug mode w/o token', (tt) => {
test('full post run', function (t) {
t.test('in debug mode w/o token', function (tt) {
post({
options: {debug: true},
pkg,
plugins
}, (err, published, release) => {
pkg: pkg,
plugins: plugins
}, function (err, published, release) {
tt.error(err)
tt.is(published, false)
tt.match(release, defaults({draft: true}, defaultRelease))
@@ -38,12 +42,12 @@ test('full post run', (t) => {
})
})
t.test('in debug mode w/token', (tt) => {
t.test('in debug mode w/token', function (tt) {
post({
options: {debug: true, githubToken: 'yo'},
pkg,
plugins
}, (err, published, release) => {
pkg: pkg,
plugins: plugins
}, function (err, published, release) {
tt.error(err)
tt.is(published, true)
tt.match(release, defaults({draft: true}, defaultRelease))
@@ -52,12 +56,12 @@ test('full post run', (t) => {
})
})
t.test('production', (tt) => {
t.test('production', function (tt) {
post({
options: {githubToken: 'yo'},
pkg,
plugins
}, (err, published, release) => {
pkg: pkg,
plugins: plugins
}, function (err, published, release) {
tt.error(err)
tt.is(published, true)
tt.match(release, defaultRelease)
@@ -65,4 +69,6 @@ test('full post run', (t) => {
tt.end()
})
})
t.end()
})
+24 -20
View File
@@ -1,55 +1,59 @@
const test = require('tap').test
const proxyquire = require('proxyquire')
var test = require('tap').test
var proxyquire = require('proxyquire')
require('../mocks/registry')
const pre = proxyquire('../../dist/pre', {
'./lib/commits': proxyquire('../../dist/lib/commits', {
var pre = proxyquire('../../src/pre', {
'./lib/commits': proxyquire('../../src/lib/commits', {
'child_process': require('../mocks/child-process')
})
})
const versions = {
var versions = {
available: '1.0.0'
}
const plugins = {
verifyRelease: (release, cb) => cb(null, release),
analyzeCommits: (commits, cb) => cb(null, 'major'),
getLastRelease: ({ pkg }, cb) => {
cb(null, {version: versions[pkg.name] || null, gitHead: 'HEAD'})
var plugins = {
verifyRelease: function (release, cb) {
cb(null, release)
},
analyzeCommits: function (commits, cb) {
cb(null, 'major')
},
getLastRelease: function (config, cb) {
cb(null, {version: versions[config.pkg.name] || null, gitHead: 'HEAD'})
}
}
const npm = {
var npm = {
registry: 'http://registry.npmjs.org/',
tag: 'latest'
}
test('full pre run', (t) => {
t.test('increase version', (tt) => {
test('full pre run', function (t) {
t.test('increase version', function (tt) {
tt.plan(3)
pre({
options: {branch: 'master'},
npm,
npm: npm,
pkg: {name: 'available'},
plugins
}, (err, release) => {
plugins: plugins
}, function (err, release) {
tt.error(err)
tt.is(release.type, 'major')
tt.is(release.version, '2.0.0')
})
})
t.test('increase version', (tt) => {
t.test('increase version', function (tt) {
tt.plan(3)
pre({
options: {branch: 'master'},
npm,
npm: npm,
pkg: {name: 'unavailable'},
plugins
}, (err, release) => {
plugins: plugins
}, function (err, release) {
tt.error(err)
tt.is(release.type, 'initial')
tt.is(release.version, '1.0.0')
+24 -12
View File
@@ -1,9 +1,9 @@
const test = require('tap').test
var test = require('tap').test
const type = require('../../dist/lib/type')
var type = require('../../src/lib/type')
test('get type from commits', (t) => {
t.test('get type from plugin', (tt) => {
test('get type from commits', function (t) {
t.test('get type from plugin', function (tt) {
tt.plan(2)
type({
@@ -12,33 +12,45 @@ test('get type from commits', (t) => {
message: 'a'
}],
lastRelease: {version: '1.0.0'},
plugins: {analyzeCommits: (config, cb) => cb(null, 'major')}
}, (err, type) => {
plugins: {
analyzeCommits: function (config, cb) {
cb(null, 'major')
}
}
}, function (err, type) {
tt.error(err)
tt.is(type, 'major')
})
})
t.test('error when no changes', (tt) => {
t.test('error when no changes', function (tt) {
tt.plan(1)
type({
commits: [],
lastRelease: {},
plugins: {analyzeCommits: (config, cb) => cb(null, null)}
}, (err) => {
plugins: {
analyzeCommits: function (config, cb) {
cb(null, null)
}
}
}, function (err) {
tt.is(err.code, 'ENOCHANGE')
})
})
t.test('initial version', (tt) => {
t.test('initial version', function (tt) {
tt.plan(2)
type({
commits: [],
lastRelease: {},
plugins: {analyzeCommits: (config, cb) => cb(null, 'major')}
}, (err, type) => {
plugins: {
analyzeCommits: function (config, cb) {
cb(null, 'major')
}
}
}, function (err, type) {
tt.error(err)
tt.is(type, 'initial')
})
+19 -14
View File
@@ -1,10 +1,10 @@
const test = require('tap').test
var test = require('tap').test
const verify = require('../../dist/lib/verify')
var verify = require('../../src/lib/verify')
test('verify pkg, options and env', (t) => {
t.test('dry run verification', (tt) => {
const noErrors = verify({
test('verify pkg, options and env', function (t) {
t.test('dry run verification', function (tt) {
var noErrors = verify({
options: {debug: true},
pkg: {
name: 'package',
@@ -16,7 +16,7 @@ test('verify pkg, options and env', (t) => {
tt.is(noErrors.length, 0)
const errors = verify({
var errors = verify({
options: {debug: true},
pkg: {}
})
@@ -25,24 +25,27 @@ test('verify pkg, options and env', (t) => {
tt.is(errors[0].code, 'ENOPKGNAME')
tt.is(errors[1].code, 'ENOPKGREPO')
const errors2 = verify({
tt.end()
})
t.test('dry run verification for gitlab repo', function (tt) {
var noErrors = verify({
options: {debug: true},
pkg: {
name: 'package',
repository: {
url: 'lol'
url: 'http://gitlab.corp.com/whats/up.git'
}
}
})
tt.is(errors2.length, 1)
tt.is(errors2[0].code, 'EMALFORMEDPKGREPO')
console.log(noErrors)
tt.is(noErrors.length, 0)
tt.end()
})
t.test('publish verification', (tt) => {
const noErrors = verify({
t.test('publish verification', function (tt) {
var noErrors = verify({
env: {NPM_TOKEN: 'yo'},
options: {githubToken: 'sup'},
pkg: {
@@ -55,7 +58,7 @@ test('verify pkg, options and env', (t) => {
tt.is(noErrors.length, 0)
const errors = verify({env: {}, options: {}, pkg: {}})
var errors = verify({env: {}, options: {}, pkg: {}})
tt.is(errors.length, 4)
tt.is(errors[0].code, 'ENOPKGNAME')
@@ -65,4 +68,6 @@ test('verify pkg, options and env', (t) => {
tt.end()
})
t.end()
})