Skip to content

Commit

Permalink
refactor(build): improved build process
Browse files Browse the repository at this point in the history
- 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

BREAKING CHANGE: this is re-write, though the API has not changed, check the README for install instructions
  • Loading branch information
Ahmad Nassri committed Nov 19, 2016
1 parent a7db19f commit c7eaa03
Show file tree
Hide file tree
Showing 13 changed files with 322 additions and 238 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.

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

This file was deleted.

27 changes: 24 additions & 3 deletions .travis.yml
@@ -1,11 +1,32 @@
sudo: false

language: node_js

node_js:
- 4
- 6
- 7

env:
- BABEL_ENV=test

matrix:
fast_finish: true

after_script:
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.
80 changes: 52 additions & 28 deletions README.md
Expand Up @@ -6,26 +6,65 @@ A Metalsmith plugin that adds file path values (`base`, `dir`, `ext`, `name`, `h
[![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-paths
```bash
npm install --production --save metalsmith-paths
```

## API
## Usage

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 paths = require('metalsmith-paths/lib/node7')

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

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

## API

var metalsmith = new Metalsmith(__dirname)
```js
const metalsmith = new Metalsmith(__dirname)
.use(paths({
property: "paths"
}))
```

given the following directory structure:

```
src/
├── blog
   └── post.html
```

The following metadata will be generated:

| metadata | value |
| ------------- | ----------------- |
| `path.base` | `post.html` |
| `path.dir` | `blog` |
| `path.ext` | `.html` |
| `path.name` | `post` |
| `path.href` | `/blog/post.html` |
| `path.dhref` | `/blog/` |

## CLI

You can also use the plugin with the Metalsmith CLI by adding a key to your `metalsmith.json` file:
Expand Down Expand Up @@ -72,20 +111,14 @@ Would produce the following filenames:
| /portfolio/project1.html | /portfolio/project1.html |
| /portfolio/project2.html | /portfolio/project2.html |

## 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
----
> :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)
[MIT](LICENSE) &copy; [Ahmad Nassri](https://www.ahmadnassri.com)

[license-url]: https://github.com/ahmadnassri/metalsmith-paths/blob/master/LICENSE
[license-url]: http://choosealicense.com/licenses/isc/

[travis-url]: https://travis-ci.org/ahmadnassri/metalsmith-paths
[travis-image]: https://img.shields.io/travis/ahmadnassri/metalsmith-paths.svg?style=flat-square
Expand All @@ -102,14 +135,5 @@ Donations are welcome to help support the continuous development of this project
[david-url]: https://david-dm.org/ahmadnassri/metalsmith-paths
[david-image]: https://img.shields.io/david/ahmadnassri/metalsmith-paths.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-paths
[paypal-image]: http://img.shields.io/badge/paypal-donate-green.svg?style=flat-square

[flattr-url]: https://flattr.com/submit/auto?user_id=ahmadnassri&url=https://github.com/ahmadnassri/metalsmith-paths&title=metalsmith-paths&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-paths
[dependencyci-url]: https://dependencyci.com/github/ahmadnassri/metalsmith-paths
[dependencyci-image]: https://dependencyci.com/github/ahmadnassri/metalsmith-paths/badge?style=flat-square
58 changes: 0 additions & 58 deletions lib/index.js

This file was deleted.

0 comments on commit c7eaa03

Please sign in to comment.