Skip to content

Commit

Permalink
release v2.0.0 (#2) :shipit:
Browse files Browse the repository at this point in the history
  • Loading branch information
neocotic authored Nov 23, 2016
1 parent 5ae1034 commit dff0803
Show file tree
Hide file tree
Showing 30 changed files with 2,239 additions and 638 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

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

[*.md]
trim_trailing_whitespace = false
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist/
Gruntfile.js
15 changes: 15 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"extends": "skelp/v3/es5",
"env": {
"browser": true
},
"parserOptions": {
"sourceType": "module"
},
"rules": {
"max-params": [
"error",
4
]
}
}
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text eol=lf
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
.DS_Store?
ehthumbs.db
Icon?
Thumbs.db
node_modules/
*.log
7 changes: 7 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.*
AUTHORS.md
bower.json
CHANGES.md
CONTRIBUTING.md
Gruntfile.js
README.md
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
language: node_js
node_js:
- "0.10"
- "0.12"
- "4"
- "6"
script:
- npm test
3 changes: 2 additions & 1 deletion AUTHORS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Authors ordered by first contribution

* Alasdair Mercer <[email protected]>
* Alasdair Mercer <[email protected]>
* Josh Panter <[email protected]>
19 changes: 19 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## Version 2.0.0, 2016.11.23

* Support time-limited signature token for [passwordless API](https://github.com/YOURLS/YOURLS/wiki/PasswordlessAPI) (Josh Panter) [#1](https://github.com/neocotic/yourls-api/issues/1)
* Rewrite library to be easier to maintain
* Refactor API methods to be easier to use (incl. breaking changes)
* Add `yourls.disconnect` API method to clear previously stored connection information
* Add `yourls.db.stats` API method to fetch statistics for all links
* Add `yourls.version` API method to fetch YOURLS version information
* Fix bug where query string parameter name and/or value are not always URL-encoded
* Rewrite documentation to be more informative
* Remove `docs` generated by [Docco](https://jashkenas.github.io/docco/)
* Add [EditorConfig](http://editorconfig.org) file
* Add [ESLint](http://eslint.org)
* Bundle library using [Rollup](http://rollupjs.org)
* Build library using [Grunt](http://gruntjs.com)
* Add continuous integration using [Travis](http://travis-ci.org)
* Add contributor guidelines
* Publish to [Bower](http://bower.io)
* Publish to [npm](https://www.npmjs.org)
33 changes: 33 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Contributing

If you have any questions about [YOURLS API](https://github.com/neocotic/yourls-api) please feel free to
[raise an issue](https://github.com/neocotic/yourls-api/issues/new).

Please [search existing issues](https://github.com/neocotic/yourls-api/issues) for the same feature and/or issue before
raising a new issue. Commenting on an existing issue is usually preferred over raising duplicate issues.

Please ensure that all files conform to the coding standards, using the same coding style as the rest of the code base.
This can be done easily via command-line:

``` bash
# install/update package dependencies
$ npm install
# run test suite
$ npm test
```

This will recompile the distribution files as well.

If you're using a version of [Node.js](https://nodejs.org) that is older than 0.12, then linting is not performed by
this step. Please consider upgrading to at least 0.12 or your pull request may fail on the CI build.

Likewise, [Node.js](https://nodejs.org) versions older than 0.10 will also not be able to compile the source code using
[Rollup](http://rollupjs.org) so the test suite will not be executed against any changes you've made to `src/**.js`. For
this reason, 0.10 is not supported from a development perspective, but our CI builds do run the test suite against the
pre-compiled code for this version to ensure that it works.

All pull requests should be made to the `develop` branch.

Don't forget to add your details to the list of
[AUTHORS.md](https://github.com/neocotic/yourls-api/blob/master/AUTHORS.md) if you want your contribution to be
recognized by others.
162 changes: 162 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
/*
* Copyright (C) 2016 Alasdair Mercer
*
* 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.
*/

module.exports = function(grunt) {
var commonjs
var nodeResolve
var semver = require('semver')
var uglify

var bannerLarge = [
'/*',
' * Copyright (C) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>',
' *',
' * 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.',
' */'
].join('\n')
var bannerSmall = '/*! YOURLS API v<%= pkg.version %> | (C) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %> | MIT License */'

grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),

watch: {
all: {
files: [ 'src/**/*.js' ],
tasks: [ 'test' ]
}
}
})

var buildTasks = [ 'compile' ]
var compileTasks = []
var testTasks = [ 'compile' ]

if (semver.satisfies(process.version, '>=0.12')) {
commonjs = require('rollup-plugin-commonjs')
nodeResolve = require('rollup-plugin-node-resolve')
uglify = require('rollup-plugin-uglify')

compileTasks.push('clean', 'rollup')

grunt.config.merge({
clean: {
build: [ 'dist/**' ]
},

rollup: {
umdDevelopment: {
options: {
format: 'umd',
moduleId: 'yourls-api',
moduleName: 'yourls',
sourceMap: true,
sourceMapRelativePaths: true,
banner: bannerLarge,
plugins: function() {
return [
nodeResolve({
browser: true,
jsnext: true,
main: true
}),
commonjs()
]
}
},
files: {
'dist/yourls.js': 'src/yourls.js'
}
},
umdProduction: {
options: {
format: 'umd',
moduleId: 'yourls-api',
moduleName: 'yourls',
sourceMap: true,
sourceMapRelativePaths: true,
banner: bannerSmall,
plugins: function() {
return [
nodeResolve({
browser: true,
jsnext: true,
main: true
}),
commonjs(),
uglify({
output: {
comments: function(node, comment) {
return comment.type === 'comment2' && /^\!/.test(comment.value)
}
}
})
]
}
},
files: {
'dist/yourls.min.js': 'src/yourls.js'
}
}
}
})

grunt.loadNpmTasks('grunt-contrib-clean')
grunt.loadNpmTasks('grunt-rollup')
} else {
grunt.log.writeln('"clean" and "rollup" tasks are disabled because Node.js version is <0.12! Please consider upgrading Node.js...')
}

if (semver.satisfies(process.version, '>=4')) {
compileTasks.unshift('eslint')

grunt.config.set('eslint', {
target: [ 'src/**/*.js' ]
})

grunt.loadNpmTasks('grunt-eslint')
} else {
grunt.log.writeln('"eslint" task is disabled because Node.js version is <4! Please consider upgrading Node.js...')
}

grunt.loadNpmTasks('grunt-contrib-watch')

grunt.registerTask('default', [ 'build' ])
grunt.registerTask('build', buildTasks)
grunt.registerTask('compile', compileTasks)
grunt.registerTask('test', testTasks)
}
4 changes: 2 additions & 2 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (C) 2011 Alasdair Mercer, http://neocotic.com/
Copyright (C) 2016 Alasdair Mercer

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -16,4 +16,4 @@ 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.
SOFTWARE.
Loading

0 comments on commit dff0803

Please sign in to comment.