Navigation Menu

Skip to content

Commit

Permalink
refactor: merge in conventional-github-releaser
Browse files Browse the repository at this point in the history
  • Loading branch information
hutson committed Mar 19, 2018
1 parent 4dc20e0 commit 663b64a
Show file tree
Hide file tree
Showing 17 changed files with 168 additions and 3,448 deletions.
File renamed without changes.
3 changes: 3 additions & 0 deletions lerna.json
Expand Up @@ -2,6 +2,9 @@
"commands": {
"bootstrap": {
"hoist": true
},
"exec": {
"concurrency": 1
}
},
"lerna": "2.9.0",
Expand Down
7 changes: 0 additions & 7 deletions packages/conventional-github-releaser/.eslintrc

This file was deleted.

1 change: 0 additions & 1 deletion packages/conventional-github-releaser/.gitattributes

This file was deleted.

4 changes: 0 additions & 4 deletions packages/conventional-github-releaser/.gitignore

This file was deleted.

35 changes: 0 additions & 35 deletions packages/conventional-github-releaser/.travis.yml

This file was deleted.

45 changes: 0 additions & 45 deletions packages/conventional-github-releaser/CONTRIBUTING.md

This file was deleted.

7 changes: 7 additions & 0 deletions packages/conventional-github-releaser/LICENSE.md
@@ -0,0 +1,7 @@
Copyright 2018 Conventional Changelog

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3 changes: 1 addition & 2 deletions packages/conventional-github-releaser/README.md
Expand Up @@ -191,7 +191,6 @@ Use [github-remove-all-releases](https://github.com/stevemao/github-remove-all-r
- [conventional-recommended-bump](https://github.com/conventional-changelog/conventional-recommended-bump) - Get a recommended version bump based on conventional commits
- [conventional-commits-detector](https://github.com/conventional-changelog/conventional-commits-detector) - Detect what commit message convention your repository is using
- [github-remove-all-releases](https://github.com/stevemao/github-remove-all-releases) - Remove all releases of your GitHub repo
- [conventional-gitlab-releaser](https://gitlab.com/hutson/conventional-gitlab-releaser) - Similar to `conventional-github-releaser`, but makes a GitLab release.

## License

Expand All @@ -213,4 +212,4 @@ JavaScript package managers should allow you to install this package with any ve

## Contributing

Please read our [contributing guide](https://gitlab.com/hyper-expanse/conventional-gitlab-releaser/blob/master/CONTRIBUTING.md) to see how you may contribute to this project.
Please read our [contributing guide](https://github.com/conventional-changelog/releaser-tools/blob/master/CONTRIBUTING.md) to see how you may contribute to this project.
10 changes: 1 addition & 9 deletions packages/conventional-github-releaser/package.json
Expand Up @@ -33,8 +33,7 @@
"url": "https://github.com/conventional-changelog/conventional-github-releaser.git"
},
"scripts": {
"dev": "docker run --rm --user node -v \"$(pwd)\":/app -w /app -it node:4 sh -c \"yarn install; yarn test; bash\"",
"test": "eslint src/ && nyc --all --cache --include=src/ --exclude=src/cli.js --exclude=src/**/*.spec.js --exclude=src/**/*.mocks.js --reporter=lcov --reporter=text mocha --check-leaks --full-trace --globals __core-js_shared__,__coverage__,YamlEscaper --inline-diffs --no-exit --recursive --reporter=progress --retries 1 src/**/*.spec.js"
"test": "eslint --fix src/ && nyc --all --cache --include=src/ --exclude=src/cli.js --exclude=src/**/*.spec.js --exclude=src/**/*.mocks.js --reporter=lcov --reporter=text mocha --check-leaks --full-trace --globals __core-js_shared__,__coverage__,YamlEscaper --inline-diffs --no-exit --recursive --reporter=progress --retries 1 src/**/*.spec.js"
},
"version": "1.1.12",
"dependencies": {
Expand All @@ -51,12 +50,5 @@
"through2": "^2.0.0"
},
"devDependencies": {
"chai": "^4.1.2",
"codecov": "^3.0.0",
"eslint": "^4.10.0",
"eslint-config-xo-space": "^0.17.0",
"mocha": "^4.0.1",
"npm-publish-git-tag": "^1.1.14",
"nyc": "^11.2.1"
}
}
11 changes: 0 additions & 11 deletions packages/conventional-github-releaser/renovate.json

This file was deleted.

64 changes: 32 additions & 32 deletions packages/conventional-github-releaser/src/cli.js
@@ -1,10 +1,10 @@
#!/usr/bin/env node

'use strict';
'use strict'

const meow = require('meow');
const conventionalGithubReleaser = require('./index');
const resolve = require('path').resolve;
const meow = require('meow')
const conventionalGithubReleaser = require('./index')
const resolve = require('path').resolve

const cli = meow({
help: [
Expand Down Expand Up @@ -37,8 +37,8 @@ const cli = meow({
' -c, --context A filepath of a javascript that is used to define template variables',
'',
' -d, --draft Publishes a draft instead of a real release',
' Default: false',
],
' Default: false'
]
}, {
alias: {
u: 'url',
Expand All @@ -49,67 +49,67 @@ const cli = meow({
v: 'verbose',
n: 'config',
c: 'context',
d: 'draft',
},
});
d: 'draft'
}
})

let config = {};
const flags = cli.flags;
let config = {}
const flags = cli.flags

let templateContext;
let gitRawCommitsOpts;
let parserOpts;
let writerOpts;
let templateContext
let gitRawCommitsOpts
let parserOpts
let writerOpts

try {
if (flags.context) {
templateContext = require(resolve(process.cwd(), flags.context));
templateContext = require(resolve(process.cwd(), flags.context))
}

if (flags.config) {
config = require(resolve(process.cwd(), flags.config));
config = require(resolve(process.cwd(), flags.config))
}

if (config.gitRawCommitsOpts) {
gitRawCommitsOpts = config.gitRawCommitsOpts;
gitRawCommitsOpts = config.gitRawCommitsOpts
}

if (config.parserOpts) {
parserOpts = config.parserOpts;
parserOpts = config.parserOpts
}

if (config.writerOpts) {
writerOpts = config.writerOpts;
writerOpts = config.writerOpts
}
} catch (err) {
console.error('Failed to get file. ' + err);
process.exit(1);
console.error('Failed to get file. ' + err)
process.exit(1)
}

const changelogOpts = {
preset: flags.preset,
pkg: {
path: flags.pkg,
path: flags.pkg
},
releaseCount: flags.releaseCount,
draft: flags.draft,
};
draft: flags.draft
}

if (flags.verbose) {
changelogOpts.debug = console.info.bind(console);
changelogOpts.warn = console.warn.bind(console);
changelogOpts.debug = console.info.bind(console)
changelogOpts.warn = console.warn.bind(console)
}

conventionalGithubReleaser({
url: flags.url || process.env.CONVENTIONAL_GITHUB_URL,
token: flags.token || process.env.CONVENTIONAL_GITHUB_RELEASER_TOKEN,
token: flags.token || process.env.CONVENTIONAL_GITHUB_RELEASER_TOKEN
}, changelogOpts, templateContext, gitRawCommitsOpts, parserOpts, writerOpts, function (err, data) {
if (err) {
console.error(err.toString());
process.exit(1);
console.error(err.toString())
process.exit(1)
}

if (flags.verbose) {
console.log(data);
console.log(data)
}
});
})

0 comments on commit 663b64a

Please sign in to comment.