diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index f5275582..00000000 --- a/.editorconfig +++ /dev/null @@ -1,14 +0,0 @@ -root = true - -[*] -end_of_line = lf -insert_final_newline = true -charset = utf-8 -trim_trailing_whitespace = true - -[*{.js,.scss}] -indent_style = tab - -[*.json] -indent_style = space -indent_size = 2 diff --git a/.travis.yml b/.travis.yml index cd6a20a6..6dbbab0f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: node_js script: npm test node_js: -- '0.10' +- '0.12' before_deploy: - npm-prepublish --verbose deploy: diff --git a/bin/next-build-tools.js b/bin/next-build-tools.js index cd905f47..a9b5637a 100755 --- a/bin/next-build-tools.js +++ b/bin/next-build-tools.js @@ -12,7 +12,7 @@ var provision = require('../tasks/provision'); var downloadConfiguration = require('../tasks/download-configuration'); function list(val) { - return val.split(','); + return val.split(','); } function exit(err) { @@ -66,4 +66,15 @@ program } }); + program + .command('*') + .description('') + .action(function(app) { + exit("The command ‘" + app + "’ is not known"); + }); + program.parse(process.argv); + +if (!process.argv.slice(2).length) { + program.outputHelp(); +} diff --git a/lib/heroku-auth-token.js b/lib/heroku-auth-token.js index 9f836c54..2a19e4f8 100644 --- a/lib/heroku-auth-token.js +++ b/lib/heroku-auth-token.js @@ -1,3 +1,4 @@ +/*jshint node:true*/ 'use strict'; var denodeify = require('denodeify'); diff --git a/package.json b/package.json index 7595f98e..e272acf8 100644 --- a/package.json +++ b/package.json @@ -5,21 +5,20 @@ "next-build-tools": "./bin/next-build-tools.js" }, "scripts": { - "test": "jshint `find . -name '*.js' ! -path './node_modules/*'`" + "test": "origami-build-tools verify" }, "dependencies": { "commander": "^2.6.0", "debug": "^2.1.1", "denodeify": "^1.2.0", "es6-promise": "^2.0.1", - "haikro": "^1.12.0", + "haikro": "^1.9.0", "heroku-client": "^1.9.1", "fetchres": "^1.0.4", - "haikro": "^1.9.0", "isomorphic-fetch": "^1.1.0" }, "devDependencies": { - "jshint": "^2.6.0", - "npm-prepublish": "^1.2.0" + "npm-prepublish": "^1.2.0", + "origami-build-tools": "^2.10.0" } } diff --git a/tasks/clean.js b/tasks/clean.js index e30c5b55..1d757297 100644 --- a/tasks/clean.js +++ b/tasks/clean.js @@ -1,3 +1,4 @@ +/*jshint node:true*/ 'use strict'; var denodeify = require('denodeify'); diff --git a/tasks/configure.js b/tasks/configure.js index d31879a8..4bb29295 100644 --- a/tasks/configure.js +++ b/tasks/configure.js @@ -1,3 +1,5 @@ +/*jshint node:true*/ +/*global fetch*/ 'use strict'; var packageJson = require(process.cwd() + '/package.json'); @@ -6,12 +8,12 @@ var normalizeName = require('../lib/normalize-name'); var fetchres = require('fetchres'); module.exports = function(opts) { - + var source = opts.source || 'ft-next-' + normalizeName(packageJson.name); var target = opts.target || source; var overrides = {}; - if (opts.overrides) { + if (opts.overrides) { opts.overrides.map(function (o) { var t = o.split('='); overrides[t[0]] = t[1]; @@ -58,7 +60,7 @@ module.exports = function(opts) { Object.keys(desired).forEach(function(key) { patch[key] = desired[key]; }); - + Object.keys(overrides).forEach(function(key) { patch[key] = overrides[key]; }); @@ -70,9 +72,9 @@ module.exports = function(opts) { console.log("Setting config var: " + key); } }); - + console.log("Setting environment to", patch); - + return fetch('https://api.heroku.com/apps/' + target + '/config-vars', { headers: authorizedPostHeaders, method: 'patch', diff --git a/tasks/deploy.js b/tasks/deploy.js index 8f75e5a8..0333a8af 100644 --- a/tasks/deploy.js +++ b/tasks/deploy.js @@ -1,3 +1,4 @@ +/*jshint node:true*/ "use strict"; var packageJson = require(process.cwd() + '/package.json'); diff --git a/tasks/download-configuration.js b/tasks/download-configuration.js index 90645d23..e64d8321 100644 --- a/tasks/download-configuration.js +++ b/tasks/download-configuration.js @@ -1,3 +1,5 @@ +/*jshint node:true*/ +/*global fetch*/ 'use strict'; var herokuAuthToken = require('../lib/heroku-auth-token'); diff --git a/tasks/provision.js b/tasks/provision.js index b75d403b..3e9bd8c1 100644 --- a/tasks/provision.js +++ b/tasks/provision.js @@ -1,34 +1,32 @@ +/*jshint node:true*/ +'use strict'; -var debug = require('debug')('next-build-tools'); -var packageJson = require(process.cwd() + '/package.json'); var denodeify = require('denodeify'); var exec = denodeify(require('child_process').exec, function(err, stdout, stderr) { return [err, stdout]; }); var create = require('haikro/lib/create'); var logger = require('haikro/lib/logger'); -var normalizeName = require('../lib/normalize-name'); // create a Heroku application server module.exports = function (name) { + var heroku_auth = process.env.HEROKU_AUTH_TOKEN; - var heroku_auth = process.env.HEROKU_AUTH_TOKEN; - - if (!heroku_auth) { - throw "You need to set a HEROKU_AUTH_TOKEN environment variables"; - } + if (!heroku_auth) { + throw "You need to set a HEROKU_AUTH_TOKEN environment variables"; + } var token; return Promise.all([ process.env.HEROKU_AUTH_TOKEN ? Promise.resolve(process.env.HEROKU_AUTH_TOKEN) : exec('heroku auth:token'), ]) .then(function(results) { - logger.setLevel('debug'); + logger.setLevel('debug'); token = results[0].trim(); - var server = { - app: name, - region: 'eu', + var server = { + app: name, + region: 'eu', token: token, - organization: 'financial-times' - }; - return create(server); + organization: 'financial-times' + }; + return create(server); }); };