Skip to content

Commit

Permalink
Merge pull request #7 from neocotic/develop
Browse files Browse the repository at this point in the history
2.1.0
  • Loading branch information
neocotic committed Mar 24, 2017
2 parents dff0803 + 737648a commit b95ee06
Show file tree
Hide file tree
Showing 23 changed files with 1,884 additions and 929 deletions.
12 changes: 11 additions & 1 deletion .eslintrc.json
Expand Up @@ -7,9 +7,19 @@
"sourceType": "module"
},
"rules": {
"callback-return": "off",
"max-params": [
"error",
4
]
],
"no-invalid-this": "off",
"no-unused-vars": [
"warn",
{
"args": "none",
"vars": "all"
}
],
"sort-keys": "off"
}
}
6 changes: 3 additions & 3 deletions .travis.yml
@@ -1,8 +1,8 @@
sudo: false
language: node_js
node_js:
- "0.10"
- "0.12"
- "4"
- "6"
- "7"
script:
- npm test
- npm run ci
4 changes: 4 additions & 0 deletions CHANGES.md
@@ -1,3 +1,7 @@
## Version 2.1.0, 2017.03.24

* Support JSON requests (GET & POST) [#6](https://github.com/neocotic/yourls-api/issues/6)

## 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)
Expand Down
12 changes: 2 additions & 10 deletions CONTRIBUTING.md
Expand Up @@ -7,7 +7,7 @@ Please [search existing issues](https://github.com/neocotic/yourls-api/issues) f
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:
This can easily be checked via command-line:

``` bash
# install/update package dependencies
Expand All @@ -16,15 +16,7 @@ $ npm install
$ 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.
You must have at least [Node.js](https://nodejs.org) version 4 or newer installed.

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

Expand Down
191 changes: 67 additions & 124 deletions Gruntfile.js
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2016 Alasdair Mercer
* Copyright (C) 2017 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 @@ -21,142 +21,85 @@
*/

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 */'
var nodeResolve = require('rollup-plugin-node-resolve')
var uglify = require('rollup-plugin-uglify')

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

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

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/**' ]
},
eslint: {
target: [ 'src/**/*.js' ]
},

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'
rollup: {
umdDevelopment: {
options: {
format: 'umd',
moduleId: 'yourls-api',
moduleName: 'yourls',
sourceMap: true,
sourceMapRelativePaths: true,
plugins: function() {
return [
nodeResolve({
browser: true,
jsnext: true,
main: true
})
]
}
},
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.js': 'src/yourls.js'
}
},
umdProduction: {
options: {
format: 'umd',
moduleId: 'yourls-api',
moduleName: 'yourls',
sourceMap: true,
sourceMapRelativePaths: true,
banner: '/*! YOURLS API v<%= pkg.version %> | (C) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %> | <%= pkg.license %> License */',
plugins: function() {
return [
nodeResolve({
browser: true,
jsnext: true,
main: true
}),
uglify({
output: {
comments: function(node, comment) {
return comment.type === 'comment2' && /^\!/.test(comment.value)
}
})
]
}
},
files: {
'dist/yourls.min.js': 'src/yourls.js'
}
})
]
}
},
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...')
}
watch: {
all: {
files: [ 'src/**/*.js' ],
tasks: [ 'eslint' ]
}
}
})

grunt.loadNpmTasks('grunt-contrib-watch')
require('load-grunt-tasks')(grunt)

grunt.registerTask('default', [ 'build' ])
grunt.registerTask('build', buildTasks)
grunt.registerTask('compile', compileTasks)
grunt.registerTask('test', testTasks)
grunt.registerTask('default', [ 'ci' ])
grunt.registerTask('build', [ 'eslint', 'clean:build', 'rollup' ])
grunt.registerTask('ci', [ 'eslint', 'clean', 'rollup' ])
grunt.registerTask('test', [ 'eslint' ])
}
2 changes: 1 addition & 1 deletion LICENSE.md
@@ -1,4 +1,4 @@
Copyright (C) 2016 Alasdair Mercer
Copyright (C) 2017 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 Down

0 comments on commit b95ee06

Please sign in to comment.