-
Notifications
You must be signed in to change notification settings - Fork 8
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
Showing
30 changed files
with
2,239 additions
and
638 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,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 |
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 @@ | ||
dist/ | ||
Gruntfile.js |
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,15 @@ | ||
{ | ||
"extends": "skelp/v3/es5", | ||
"env": { | ||
"browser": true | ||
}, | ||
"parserOptions": { | ||
"sourceType": "module" | ||
}, | ||
"rules": { | ||
"max-params": [ | ||
"error", | ||
4 | ||
] | ||
} | ||
} |
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 @@ | ||
* text eol=lf |
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 |
---|---|---|
@@ -1,4 +1,2 @@ | ||
.DS_Store? | ||
ehthumbs.db | ||
Icon? | ||
Thumbs.db | ||
node_modules/ | ||
*.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,7 @@ | ||
.* | ||
AUTHORS.md | ||
bower.json | ||
CHANGES.md | ||
CONTRIBUTING.md | ||
Gruntfile.js | ||
README.md |
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,8 @@ | ||
language: node_js | ||
node_js: | ||
- "0.10" | ||
- "0.12" | ||
- "4" | ||
- "6" | ||
script: | ||
- npm test |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# Authors ordered by first contribution | ||
|
||
* Alasdair Mercer <[email protected]> | ||
* Alasdair Mercer <[email protected]> | ||
* Josh Panter <[email protected]> |
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,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) |
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,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. |
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,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) | ||
} |
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
Oops, something went wrong.