diff --git a/package.json b/package.json index 08bbb64..7b6a77b 100644 --- a/package.json +++ b/package.json @@ -4,10 +4,11 @@ "description": "Trend Micro's ESLint config.", "main": "index.js", "scripts": { + "bowersync": "./scripts/bowersync", "lint": "eslint .", - "tests-only": "babel-tape-runner ./test/test-*.js", - "prepublish": "(in-install || eslint-find-rules --unused) && (not-in-publish || npm test) && safe-publish-latest", + "prepublish": "npm run bowersync && (in-install || eslint-find-rules --unused) && (not-in-publish || npm test) && safe-publish-latest", "pretest": "npm run --silent lint", + "tests-only": "babel-tape-runner ./test/test-*.js", "test": "npm run --silent tests-only" }, "repository": { diff --git a/scripts/bowersync b/scripts/bowersync new file mode 100755 index 0000000..c78cf64 --- /dev/null +++ b/scripts/bowersync @@ -0,0 +1,20 @@ +#!/usr/bin/env node + +var fs = require('fs'); +var path = require('path'); +var pkg = require('../package.json'); +var bower = require('../bower.json'); + +// Update bower.json +Object.keys(bower).forEach((key) => { + bower[key] = pkg[key] || bower[key]; +}); +bower.authors = pkg.contributors.map(author => { + return { + name: author.name, + email: author.email, + homepage: author.url + }; +}); + +fs.writeFileSync(path.join(__dirname, '../bower.json'), JSON.stringify(bower, null, 2), 'utf8');