Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 629164f
Showing
6 changed files
with
193 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules/ | ||
npm-debug.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
registry=http://registry.npmjs.org/ | ||
save-exact=true | ||
progress=false | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# now-pipeline | ||
|
||
> Simple CI commands to deploy new version to Zeit Now if tests pass | ||
[![NPM][npm-icon] ][npm-url] | ||
|
||
[![Build status][ci-image] ][ci-url] | ||
[![semantic-release][semantic-image] ][semantic-url] | ||
[![js-standard-style][standard-image]][standard-url] | ||
|
||
## Install and use | ||
|
||
> Work in progress | ||
### Small print | ||
|
||
Author: Gleb Bahmutov <gleb.bahmutov@gmail.com> © 2016 | ||
|
||
* [@bahmutov](https://twitter.com/bahmutov) | ||
* [glebbahmutov.com](http://glebbahmutov.com) | ||
* [blog](http://glebbahmutov.com/blog) | ||
|
||
License: MIT - do anything with the code, but don't blame me if it does not work. | ||
|
||
Support: if you find any problems with this module, email / tweet / | ||
[open issue](https://github.com/bahmutov/now-pipeline/issues) on Github | ||
|
||
## MIT License | ||
|
||
Copyright (c) 2016 Gleb Bahmutov <gleb.bahmutov@gmail.com> | ||
|
||
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. | ||
|
||
[npm-icon]: https://nodei.co/npm/now-pipeline.svg?downloads=true | ||
[npm-url]: https://npmjs.org/package/now-pipeline | ||
[ci-image]: https://travis-ci.org/bahmutov/now-pipeline.svg?branch=master | ||
[ci-url]: https://travis-ci.org/bahmutov/now-pipeline | ||
[semantic-image]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg | ||
[semantic-url]: https://github.com/semantic-release/semantic-release | ||
[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg | ||
[standard-url]: http://standardjs.com/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
{ | ||
"name": "now-pipeline", | ||
"description": "Simple CI commands to deploy new version to Zeit Now if tests pass", | ||
"version": "1.0.0", | ||
"author": "Gleb Bahmutov <gleb.bahmutov@gmail.com>", | ||
"bugs": "https://github.com/bahmutov/now-pipeline/issues", | ||
"config": { | ||
"pre-git": { | ||
"commit-msg": "simple", | ||
"pre-commit": [ | ||
"npm prune", | ||
"npm run deps", | ||
"npm test", | ||
"npm run ban" | ||
], | ||
"pre-push": [ | ||
"npm run secure", | ||
"npm run license", | ||
"npm run ban -- --all", | ||
"npm run size" | ||
], | ||
"post-commit": [], | ||
"post-merge": [] | ||
} | ||
}, | ||
"engines": { | ||
"node": ">=6" | ||
}, | ||
"files": [ | ||
"src/*.js", | ||
"!src/*-spec.js" | ||
], | ||
"homepage": "https://github.com/bahmutov/now-pipeline#readme", | ||
"keywords": [ | ||
"ci", | ||
"now", | ||
"test", | ||
"tool", | ||
"util", | ||
"zeit" | ||
], | ||
"license": "MIT", | ||
"main": "src/", | ||
"noScopeName": "now-pipeline", | ||
"publishConfig": { | ||
"registry": "http://registry.npmjs.org/" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/bahmutov/now-pipeline.git" | ||
}, | ||
"scripts": { | ||
"ban": "ban", | ||
"deps": "deps-ok", | ||
"format": "standard-format -w src/*.js", | ||
"issues": "git-issues", | ||
"license": "license-checker --production --onlyunknown --csv", | ||
"lint": "standard --verbose --fix src/*.js", | ||
"pretest": "npm run format && npm run lint", | ||
"secure": "nsp check", | ||
"size": "t=\"$(npm pack .)\"; wc -c \"${t}\"; tar tvf \"${t}\"; rm \"${t}\";", | ||
"test": "npm run unit", | ||
"unit": "mocha src/*-spec.js" | ||
}, | ||
"devDependencies": { | ||
"ban-sensitive-files": "1.8.3", | ||
"deps-ok": "1.2.0", | ||
"git-issues": "1.2.0", | ||
"license-checker": "6.0.0", | ||
"mocha": "3.0.2", | ||
"nsp": "2.6.1", | ||
"pre-git": "3.10.0", | ||
"standard": "8.0.0", | ||
"standard-format": "2.2.3" | ||
}, | ||
"dependencies": { | ||
"axios": "0.14.0", | ||
"console.table": "0.7.0", | ||
"ramda": "0.22.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
'use strict' | ||
|
||
require('console.table') | ||
const axios = require('axios') | ||
const R = require('ramda') | ||
|
||
function httpClient (token) { | ||
const client = axios.create({ | ||
baseURL: 'https://api.zeit.co/now', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${token}` | ||
} | ||
}) | ||
return client | ||
} | ||
|
||
function nowApi () { | ||
const authToken = process.env.NOW_AUTH | ||
if (!authToken) { | ||
console.error('Cannot find NOW_AUTH token') | ||
process.exit(-1) | ||
} | ||
|
||
const rest = httpClient(authToken) | ||
|
||
const api = { | ||
deployments () { | ||
return rest.get('/deployments') | ||
.then(R.prop('data')) | ||
.then(R.prop('deployments')) | ||
} | ||
} | ||
return api | ||
} | ||
|
||
const now = nowApi() | ||
|
||
now.deployments().then(console.table).catch(console.error) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
'use strict' | ||
|
||
/* global describe, it */ | ||
describe('', () => { | ||
it('', () => { | ||
}) | ||
}) |