Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.0.0 #2

Merged
merged 20 commits into from
Nov 23, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
2e2f3d6
added EditorConfig file
alasdairmercerswrx Nov 22, 2016
cf0b0bc
updated ignored files for Git
alasdairmercerswrx Nov 22, 2016
3a9444b
added npm ignore file
alasdairmercerswrx Nov 22, 2016
0b415b1
added final new line to all files
alasdairmercerswrx Nov 22, 2016
8d8577c
updated license date
alasdairmercerswrx Nov 22, 2016
ca7ca1d
added bower file
alasdairmercerswrx Nov 22, 2016
a512804
reformatted package.json and updated description in bower.json
alasdairmercerswrx Nov 22, 2016
d31b155
removed docs
alasdairmercerswrx Nov 22, 2016
5576c6c
massive rewrite of code which has been cleanly split into separate fi…
alasdairmercerswrx Nov 22, 2016
d95c9ff
bumped version to 2.0.0
alasdairmercerswrx Nov 22, 2016
75f53fd
callbacks are now passed better information
alasdairmercerswrx Nov 22, 2016
a784e2c
added function to retrieve YOURLS version from API
alasdairmercerswrx Nov 22, 2016
9f03d92
added contribution docs and travis config
alasdairmercerswrx Nov 22, 2016
d18b303
added Josh Panter for his contributions to the time-limited signature…
alasdairmercerswrx Nov 23, 2016
6ebbad4
simplified and clarified the stats method and its parameters
alasdairmercerswrx Nov 23, 2016
a9ce132
version method can now be configured to include the YOURLS DB version…
alasdairmercerswrx Nov 23, 2016
26491db
improved documentation
alasdairmercerswrx Nov 23, 2016
3178f28
added CONTRIBUTING.md to ignores for installs
alasdairmercerswrx Nov 23, 2016
06a049a
updated changelog for v2.0.0
alasdairmercerswrx Nov 23, 2016
a433bad
added missing bug fix to changelog for 2.0.0
alasdairmercerswrx Nov 23, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 <mercer.alasdair@gmail.com>
* Alasdair Mercer <mercer.alasdair@gmail.com>
* Josh Panter <joshu@unfettered.net>
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