Skip to content

Commit

Permalink
build(build): rewrite + improved build process
Browse files Browse the repository at this point in the history
- rewrite in ES2015
- only build for LTS versions of node
- updated semantic-release no longer needing after_all script
- set package version to 0.0.0-development to avoid local build issues
- ignore building new greenkeeper branches
  • Loading branch information
Ahmad Nassri committed Nov 19, 2016
1 parent 952fd3b commit 66303de
Show file tree
Hide file tree
Showing 12 changed files with 208 additions and 146 deletions.
23 changes: 23 additions & 0 deletions .babelrc
@@ -0,0 +1,23 @@
{
"env": {
"test": {
"presets": [ ["env", { "targets": { "node": "current" } }] ],
"plugins": []
},

"v4": {
"presets": [ ["env", { "targets": { "node": 4.0 } }] ],
"plugins": ["babel-plugin-add-module-exports"]
},

"v6": {
"presets": [ ["env", { "targets": { "node": 6.0 } }] ],
"plugins": ["babel-plugin-add-module-exports"]
},

"v7": {
"presets": [ ["env", { "targets": { "node": 7.0 } }] ],
"plugins": ["babel-plugin-add-module-exports"]
}
}
}
17 changes: 17 additions & 0 deletions .codeclimate.yml
@@ -0,0 +1,17 @@
engines:
fixme:
enabled: true

duplication:
enabled: true
config:
languages:
- javascript

eslint:
enabled: true

ratings:
paths:
- src/**
- test/**
8 changes: 4 additions & 4 deletions .editorconfig
Expand Up @@ -2,12 +2,12 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false
1 change: 0 additions & 1 deletion .gitattributes

This file was deleted.

6 changes: 3 additions & 3 deletions .gitignore
@@ -1,4 +1,4 @@
*.log
node_modules
coverage*
test/build
/lib
/node_modules
/.nyc_output
4 changes: 0 additions & 4 deletions .jshintrc

This file was deleted.

26 changes: 25 additions & 1 deletion .travis.yml
Expand Up @@ -3,6 +3,30 @@ language: node_js
node_js:
- 4
- 6
- 7

after_script:
env:
- BABEL_ENV=test

matrix:
fast_finish: true

cache:
directories:
- node_modules

before_script:
- npm prune

after_success:
- npm run coverage
- npm run codeclimate
- BABEL_ENV=v4 npm run compile -- -d lib
- BABEL_ENV=v6 npm run compile -- -d lib/node6
- BABEL_ENV=v7 npm run compile -- -d lib/node7
- npm run semantic-release

branches:
except:
- /^v\d+\.\d+\.\d+$/
- /^greenkeeper\/.+/
34 changes: 13 additions & 21 deletions LICENSE
@@ -1,21 +1,13 @@
The MIT License (MIT)

Copyright (c) 2015 Ahmad Nassri (https://www.ahmadnassri.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.
Copyright (c) 2015, Ahmad Nassri <ahmad@ahmadnassri.com>

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
78 changes: 38 additions & 40 deletions README.md
@@ -1,30 +1,50 @@
# Metalsmith Request [![version][npm-version]][npm-url] [![License][npm-license]][license-url] [![Actively Maintained][active-image]][active-url]
# Metalsmith Request [![version][npm-version]][npm-url] [![License][npm-license]][license-url]

[Metalsmith](http://www.metalsmith.io/) plugin to grab content from the web and expose the results to metadata.
> [Metalsmith](http://www.metalsmith.io/) plugin to grab content from the web and expose the results to metadata.
uses [got](https://github.com/sindresorhus/got) under the hood to make HTTP calls.

[![Build Status][travis-image]][travis-url]
[![Downloads][npm-downloads]][npm-url]
[![Code Climate][codeclimate-quality]][codeclimate-url]
[![Coverage Status][codeclimate-coverage]][codeclimate-url]
[![Dependency Status][dependencyci-image]][dependencyci-url]
[![Dependencies][david-image]][david-url]

## Install

```sh
npm install --save metalsmith-request
```bash
npm install --production --save metalsmith-request
```

## API
## Usage

Pass `targets` to the plugin with the `use` method:
I recommend using an optimized build matching your Node.js environment version, otherwise, the standard `require` would work just fine with any version of Node `>= v4.0` .

```js
var Metalsmith = require('metalsmith')
/*
* Node 7
*/
const request = require('metalsmith-request/lib/node7')

/*
* Node 6
*/
const request = require('metalsmith-request/lib/node6')

/*
* Node 4 (Default)
* Note: additional ES2015 polyfills may be required
*/
var request = require('metalsmith-request')
```

## API

var metalsmith = new Metalsmith(__dirname)
Pass `targets` to the plugin with the `use` method:

```js
const metalsmith = new Metalsmith(__dirname)
.use(request({
foo: 'http://domain.com/foo'
}))
Expand All @@ -33,12 +53,9 @@ var metalsmith = new Metalsmith(__dirname)
You can also pass `options` as the second argument to use with the [got](https://github.com/sindresorhus/got) module

```js
var Metalsmith = require('metalsmith')
var request = require('metalsmith-request')

var metalsmith = new Metalsmith(__dirname)
const metalsmith = new Metalsmith(__dirname)
.use(request(
{
{
foo: 'http://domain.com/foo.json'
},
{
Expand All @@ -61,20 +78,13 @@ You can also use the plugin with the Metalsmith CLI by adding a key to your `met
}
```

## Support

Donations are welcome to help support the continuous development of this project.

[![Gratipay][gratipay-image]][gratipay-url]
[![PayPal][paypal-image]][paypal-url]
[![Flattr][flattr-image]][flattr-url]
[![Bitcoin][bitcoin-image]][bitcoin-url]

## License

[MIT](LICENSE) &copy; [Ahmad Nassri](https://www.ahmadnassri.com)
----
> :copyright: [ahmadnassri.com](https://www.ahmadnassri.com/) &nbsp;&middot;&nbsp;
> License: [ISC][license-url] &nbsp;&middot;&nbsp;
> Github: [@ahmadnassri](https://github.com/ahmadnassri) &nbsp;&middot;&nbsp;
> Twitter: [@ahmadnassri](https://twitter.com/ahmadnassri)
[license-url]: https://github.com/ahmadnassri/metalsmith-request/blob/master/LICENSE
[license-url]: http://choosealicense.com/licenses/isc/

[travis-url]: https://travis-ci.org/ahmadnassri/metalsmith-request
[travis-image]: https://img.shields.io/travis/ahmadnassri/metalsmith-request.svg?style=flat-square
Expand All @@ -91,17 +101,5 @@ Donations are welcome to help support the continuous development of this project
[david-url]: https://david-dm.org/ahmadnassri/metalsmith-request
[david-image]: https://img.shields.io/david/ahmadnassri/metalsmith-request.svg?style=flat-square

[gratipay-url]: https://www.gratipay.com/ahmadnassri/
[gratipay-image]: https://img.shields.io/gratipay/ahmadnassri.svg?style=flat-square

[paypal-url]: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=UJ2B2BTK9VLRS&on0=project&os0=metalsmith-request
[paypal-image]: http://img.shields.io/badge/paypal-donate-green.svg?style=flat-square

[flattr-url]: https://flattr.com/submit/auto?user_id=codeinchaos&url=https://github.com/ahmadnassri/metalsmith-request&title=metalsmith-request&language=&tags=github&category=software
[flattr-image]: http://img.shields.io/badge/flattr-donate-green.svg?style=flat-square

[bitcoin-image]: http://img.shields.io/badge/bitcoin-1Nb46sZRVG3or7pNaDjthcGJpWhvoPpCxy-green.svg?style=flat-square
[bitcoin-url]: https://www.coinbase.com/checkouts/ae383ae6bb931a2fa5ad11cec115191e?name=metalsmith-request

[active-image]: https://maintained.tech/badge.svg
[active-url]: https://maintained.tech/
[dependencyci-url]: https://dependencyci.com/github/ahmadnassri/metalsmith-request
[dependencyci-image]: https://dependencyci.com/github/ahmadnassri/metalsmith-request/badge?style=flat-square
64 changes: 44 additions & 20 deletions package.json
@@ -1,11 +1,15 @@
{
"version": "1.0.0",
"version": "0.0.0-development",
"name": "metalsmith-request",
"description": "Metalsmith plugin to grab content from the web and expose the results to metadata",
"author": "Ahmad Nassri <ahmad@ahmadnassri.com> (https://www.ahmadnassri.com/)",
"repository": "ahmadnassri/metalsmith-request",
"license": "MIT",
"main": "src/index.js",
"homepage": "https://github.com/ahmadnassri/metalsmith-request",
"repository": {
"type": "git",
"url": "https://github.com/ahmadnassri/metalsmith-request.git"
},
"license": "ISC",
"main": "lib/index.js",
"keywords": [
"metalsmith",
"plugin",
Expand All @@ -15,33 +19,53 @@
"got"
],
"engines": {
"node": ">= 4"
"node": ">=4"
},
"files": [
"lib",
"src"
],
"bugs": {
"url": "https://github.com/ahmadnassri/metalsmith-request/issues"
},
"scripts": {
"pretest": "standard && echint",
"test": "mocha",
"posttest": "npm run coverage",
"coverage": "istanbul cover --dir coverage _mocha -- -R dot",
"codeclimate": "codeclimate < coverage/lcov.info"
"compile": "babel -q src",
"test": "BABEL_ENV=test tap test/*.js --node-arg=--require --node-arg=babel-register | tap-mocha-reporter spec",
"pretest": "snazzy && echint",
"coverage": "BABEL_ENV=test tap test/*.js --coverage --nyc-arg=--require --nyc-arg=babel-register",
"codeclimate": "nyc report --reporter=text-lcov | codeclimate-test-reporter",
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
},
"standard": {
"ignore": [
"lib/**"
]
},
"echint": {
"ignore": [
"lib/**"
]
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
},
"devDependencies": {
"codeclimate-test-reporter": "0.3.2",
"echint": "^1.1.1",
"istanbul": "^0.4.3",
"metalsmith": "^1.7.0",
"mocha": "^3.0.1",
"should": "^11.0.0",
"standard": "^8.0.0"
"babel-cli": "^6.18.0",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-preset-env": "0.0.8",
"babel-register": "^6.18.0",
"codeclimate-test-reporter": "^0.4.0",
"cz-conventional-changelog": "^1.2.0",
"echint": "^1.5.3",
"metalsmith": "^2.3.0",
"semantic-release": "^6.3.2",
"snazzy": "^5.0.0",
"tap": "^8.0.1",
"tap-mocha-reporter": "^3.0.0"
},
"dependencies": {
"async": "^1.0.0",
"debug": "^2.2.0",
"got": "^6.3.0"
"got": "^6.6.3"
}
}

0 comments on commit 66303de

Please sign in to comment.