Skip to content

Commit

Permalink
feat(pollinate): merge template fields into package.json
Browse files Browse the repository at this point in the history
instead of replacing package.json with a parsed template
  • Loading branch information
jedwards1211 committed Feb 20, 2017
1 parent dbf1cb9 commit 5456a20
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 107 deletions.
16 changes: 9 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@ language: node_js
cache:
directories:
- node_modules
notifications:
email: false
node_js:
- '7'
- '6'
- '4'
before_install:
- npm i -g howardroark/pollinate#feature/keep-history
- git config --global user.email "jedwards@fastmail.com"
- git config --global user.name "Andy Edwards"
before_script:
- npm prune
after_script:
- cd pollinated && cat coverage/lcov.info | node_modules/coveralls/bin/coveralls.js

script:
- cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
after_success:
- npm run semantic-release
branches:
except:
- /^v\d+\.\d+\.\d+$/
19 changes: 0 additions & 19 deletions PROJECT-.travis.yml

This file was deleted.

72 changes: 2 additions & 70 deletions PROJECT-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,82 +2,14 @@
"name": "{{ name }}",
"version": "0.0.0-development",
"description": "{{ description }}",
"main": "lib/index.js",
"scripts": {
"lint": "eslint src test",
"lint:fix": "eslint --fix src test",
"lint:watch": "esw --watch src test",
"flow": "flow",
"flow:coverage": "for file in src/**.js test/**.js; do echo $file; flow coverage $file; done",
"flow:watch": "flow-watch -e js,js.flow,flowconfig --ignore lib/ --ignore node_modules/ --watch .flowconfig --watch src/ --watch test/",
"gen-flow-files": "flow gen-flow-files src/ --out-dir lib",
"copy-flow-files": "cd src; copy *.js.flow **/*.js.flow ../lib",
"build": "rimraf lib && babel src --out-dir lib",
"test": "NODE_ENV=production BABEL_ENV=test nyc --reporter=lcov --reporter=text mocha $npm_package_config_mocha",
"commitmsg": "validate-commit-msg",
"precommit": "npm run lint && flow",
"prepush": "npm test",
"prepublish": "npm run lint && flow && npm test && npm run build && npm run copy-flow-files",
"open:coverage": "open coverage/lcov-report/index.html",
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
},
"config": {
"mocha": "--compilers js:babel-core/register ./test/**/*.js",
"commitizen": {
"path": "cz-conventional-changelog"
}
},
"nyc": {
"include": [
"src/**/*.js"
],
"require": [
"babel-register"
],
"sourceMap": false,
"instrument": false
},
"repository": {
"type": "git",
"url": "https://github.com/{{ organization }}/{{ name }}.git"
},
"keywords": [
"es2015"
],
"author": "{{ author }}",
"license": "MIT",
"bugs": {
"url": "https://github.com/{{ organization }}/{{ name }}/issues"
},
"homepage": "https://github.com/{{ organization }}/{{ name }}#readme",
"devDependencies": {
"@jedwards1211/eslint-config": "^1.0.0",
"@jedwards1211/eslint-config-flow": "^1.0.0",
"babel-cli": "^6.22.2",
"babel-core": "^6.22.1",
"babel-eslint": "^7.1.1",
"babel-plugin-istanbul": "^4.0.0",
"babel-plugin-transform-runtime": "^6.22.0",
"babel-preset-es2015": "^6.22.0",
"babel-preset-flow": "^6.23.0",
"babel-preset-stage-1": "^6.22.0",
"babel-register": "^6.22.0",
"babel-runtime": "^6.22.0",
"chai": "^3.5.0",
"copy": "^0.3.0",
"coveralls": "^2.11.16",
"eslint": "^3.13.1",
"eslint-plugin-flowtype": "^2.30.0",
"eslint-watch": "^3.0.0",
"flow-bin": "^0.39.0",
"flow-watch": "^1.1.0",
"husky": "^0.13.1",
"istanbul": "^0.4.5",
"mocha": "^3.2.0",
"nyc": "^10.1.2",
"rimraf": "^2.5.4",
"semantic-release": "^6.3.6",
"validate-commit-msg": "^2.8.2"
},
"dependencies": {}
"homepage": "https://github.com/{{ organization }}/{{ name }}#readme"
}

10 changes: 10 additions & 0 deletions complete.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -e

cd {{ name }}
git remote rename origin skeleton
./merge-json.js package.json PROJECT-package.json > package.json
rm merge-json.js PROJECT-package.json complete.sh
git add --all .
git commit -n -m 'pollinate project'"
7 changes: 7 additions & 0 deletions merge-json.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env node

var merge = require('lodash.merge')

var merged = merge.apply(undefined, process.argv.slice(2).map(function (file) { return require('./' + file) }))
console.log(JSON.stringify(merged, null, 2))

18 changes: 15 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "es2015-library-skeleton",
"version": "0.0.0-development",
"description": "my personal skeleton for ES2015 library NPM packages",
"description": "my personal ES2015 library project skeleton",
"main": "lib/index.js",
"scripts": {
"lint": "eslint src test",
Expand All @@ -10,13 +10,19 @@
"flow": "flow",
"flow:coverage": "for file in src/**.js test/**.js; do echo $file; flow coverage $file; done",
"flow:watch": "flow-watch -e js,js.flow,flowconfig --ignore lib/ --ignore node_modules/ --watch .flowconfig --watch src/ --watch test/",
"test": "rimraf pollinated && pollinate https://github.com/jedwards1211/es2015-library-skeleton.git#$(git rev-parse --abbrev-ref HEAD) --name pollinated --keep-history && cd pollinated && npm i",
"gen-flow-files": "flow gen-flow-files src/ --out-dir lib",
"copy-flow-files": "cd src; copy *.js.flow **/*.js.flow ../lib",
"build": "rimraf lib && babel src --out-dir lib",
"test": "NODE_ENV=production BABEL_ENV=test nyc --reporter=lcov --reporter=text mocha $npm_package_config_mocha",
"commitmsg": "validate-commit-msg",
"precommit": "npm run lint && flow",
"prepush": "npm test",
"open:coverage": "open coverage/lcov-report/index.html"
"prepublish": "npm run lint && flow && npm test && npm run build && npm run copy-flow-files",
"open:coverage": "open coverage/lcov-report/index.html",
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
},
"config": {
"mocha": "--compilers js:babel-core/register ./test/**/*.js",
"commitizen": {
"path": "cz-conventional-changelog"
}
Expand Down Expand Up @@ -57,15 +63,21 @@
"babel-preset-stage-1": "^6.22.0",
"babel-register": "^6.22.0",
"babel-runtime": "^6.22.0",
"chai": "^3.5.0",
"copy": "^0.3.0",
"coveralls": "^2.11.16",
"eslint": "^3.13.1",
"eslint-plugin-flowtype": "^2.30.0",
"eslint-watch": "^3.0.0",
"flow-bin": "^0.39.0",
"flow-watch": "^1.1.0",
"husky": "^0.13.1",
"istanbul": "^0.4.5",
"lodash.merge": "^4.6.0",
"mocha": "^3.2.0",
"nyc": "^10.1.2",
"rimraf": "^2.5.4",
"semantic-release": "^6.3.6",
"validate-commit-msg": "^2.8.2"
},
"dependencies": {}
Expand Down
13 changes: 5 additions & 8 deletions template.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,18 @@
"parse": [
"PROJECT-README",
"PROJECT-LICENSE",
"PROJECT-package.json"
"PROJECT-package.json",
"complete.sh"
],
"discard": [
"README.md",
"LICENSE.md",
"package.json",
"template.json",
".travis.yml"
"template.json"
],
"move": [
{ "PROJECT-README": "README.md" },
{ "PROJECT-LICENSE": "LICENSE.md" },
{ "PROJECT-package.json": "package.json" },
{ "PROJECT-.travis.yml": ".travis.yml" }
{ "PROJECT-LICENSE": "LICENSE.md" }
],
"complete": "cd {{ name }} && git remote rename origin skeleton && git add --all . && git commit -n -m 'pollinate project'"
"complete": "./complete.sh"
}

0 comments on commit 5456a20

Please sign in to comment.