Skip to content

Commit 5456a20

Browse files
committed
feat(pollinate): merge template fields into package.json
instead of replacing package.json with a parsed template
1 parent dbf1cb9 commit 5456a20

File tree

7 files changed

+48
-107
lines changed

7 files changed

+48
-107
lines changed

.travis.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,18 @@ language: node_js
22
cache:
33
directories:
44
- node_modules
5+
notifications:
6+
email: false
57
node_js:
68
- '7'
79
- '6'
810
- '4'
9-
before_install:
10-
- npm i -g howardroark/pollinate#feature/keep-history
11-
- git config --global user.email "jedwards@fastmail.com"
12-
- git config --global user.name "Andy Edwards"
1311
before_script:
1412
- npm prune
15-
after_script:
16-
- cd pollinated && cat coverage/lcov.info | node_modules/coveralls/bin/coveralls.js
17-
13+
script:
14+
- cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
15+
after_success:
16+
- npm run semantic-release
17+
branches:
18+
except:
19+
- /^v\d+\.\d+\.\d+$/

PROJECT-.travis.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

PROJECT-package.json

Lines changed: 2 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -2,82 +2,14 @@
22
"name": "{{ name }}",
33
"version": "0.0.0-development",
44
"description": "{{ description }}",
5-
"main": "lib/index.js",
6-
"scripts": {
7-
"lint": "eslint src test",
8-
"lint:fix": "eslint --fix src test",
9-
"lint:watch": "esw --watch src test",
10-
"flow": "flow",
11-
"flow:coverage": "for file in src/**.js test/**.js; do echo $file; flow coverage $file; done",
12-
"flow:watch": "flow-watch -e js,js.flow,flowconfig --ignore lib/ --ignore node_modules/ --watch .flowconfig --watch src/ --watch test/",
13-
"gen-flow-files": "flow gen-flow-files src/ --out-dir lib",
14-
"copy-flow-files": "cd src; copy *.js.flow **/*.js.flow ../lib",
15-
"build": "rimraf lib && babel src --out-dir lib",
16-
"test": "NODE_ENV=production BABEL_ENV=test nyc --reporter=lcov --reporter=text mocha $npm_package_config_mocha",
17-
"commitmsg": "validate-commit-msg",
18-
"precommit": "npm run lint && flow",
19-
"prepush": "npm test",
20-
"prepublish": "npm run lint && flow && npm test && npm run build && npm run copy-flow-files",
21-
"open:coverage": "open coverage/lcov-report/index.html",
22-
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
23-
},
24-
"config": {
25-
"mocha": "--compilers js:babel-core/register ./test/**/*.js",
26-
"commitizen": {
27-
"path": "cz-conventional-changelog"
28-
}
29-
},
30-
"nyc": {
31-
"include": [
32-
"src/**/*.js"
33-
],
34-
"require": [
35-
"babel-register"
36-
],
37-
"sourceMap": false,
38-
"instrument": false
39-
},
405
"repository": {
416
"type": "git",
427
"url": "https://github.com/{{ organization }}/{{ name }}.git"
438
},
44-
"keywords": [
45-
"es2015"
46-
],
479
"author": "{{ author }}",
48-
"license": "MIT",
4910
"bugs": {
5011
"url": "https://github.com/{{ organization }}/{{ name }}/issues"
5112
},
52-
"homepage": "https://github.com/{{ organization }}/{{ name }}#readme",
53-
"devDependencies": {
54-
"@jedwards1211/eslint-config": "^1.0.0",
55-
"@jedwards1211/eslint-config-flow": "^1.0.0",
56-
"babel-cli": "^6.22.2",
57-
"babel-core": "^6.22.1",
58-
"babel-eslint": "^7.1.1",
59-
"babel-plugin-istanbul": "^4.0.0",
60-
"babel-plugin-transform-runtime": "^6.22.0",
61-
"babel-preset-es2015": "^6.22.0",
62-
"babel-preset-flow": "^6.23.0",
63-
"babel-preset-stage-1": "^6.22.0",
64-
"babel-register": "^6.22.0",
65-
"babel-runtime": "^6.22.0",
66-
"chai": "^3.5.0",
67-
"copy": "^0.3.0",
68-
"coveralls": "^2.11.16",
69-
"eslint": "^3.13.1",
70-
"eslint-plugin-flowtype": "^2.30.0",
71-
"eslint-watch": "^3.0.0",
72-
"flow-bin": "^0.39.0",
73-
"flow-watch": "^1.1.0",
74-
"husky": "^0.13.1",
75-
"istanbul": "^0.4.5",
76-
"mocha": "^3.2.0",
77-
"nyc": "^10.1.2",
78-
"rimraf": "^2.5.4",
79-
"semantic-release": "^6.3.6",
80-
"validate-commit-msg": "^2.8.2"
81-
},
82-
"dependencies": {}
13+
"homepage": "https://github.com/{{ organization }}/{{ name }}#readme"
8314
}
15+

complete.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
cd {{ name }}
5+
git remote rename origin skeleton
6+
./merge-json.js package.json PROJECT-package.json > package.json
7+
rm merge-json.js PROJECT-package.json complete.sh
8+
git add --all .
9+
git commit -n -m 'pollinate project'"
10+

merge-json.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env node
2+
3+
var merge = require('lodash.merge')
4+
5+
var merged = merge.apply(undefined, process.argv.slice(2).map(function (file) { return require('./' + file) }))
6+
console.log(JSON.stringify(merged, null, 2))
7+

package.json

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "es2015-library-skeleton",
33
"version": "0.0.0-development",
4-
"description": "my personal skeleton for ES2015 library NPM packages",
4+
"description": "my personal ES2015 library project skeleton",
55
"main": "lib/index.js",
66
"scripts": {
77
"lint": "eslint src test",
@@ -10,13 +10,19 @@
1010
"flow": "flow",
1111
"flow:coverage": "for file in src/**.js test/**.js; do echo $file; flow coverage $file; done",
1212
"flow:watch": "flow-watch -e js,js.flow,flowconfig --ignore lib/ --ignore node_modules/ --watch .flowconfig --watch src/ --watch test/",
13-
"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",
13+
"gen-flow-files": "flow gen-flow-files src/ --out-dir lib",
14+
"copy-flow-files": "cd src; copy *.js.flow **/*.js.flow ../lib",
15+
"build": "rimraf lib && babel src --out-dir lib",
16+
"test": "NODE_ENV=production BABEL_ENV=test nyc --reporter=lcov --reporter=text mocha $npm_package_config_mocha",
1417
"commitmsg": "validate-commit-msg",
1518
"precommit": "npm run lint && flow",
1619
"prepush": "npm test",
17-
"open:coverage": "open coverage/lcov-report/index.html"
20+
"prepublish": "npm run lint && flow && npm test && npm run build && npm run copy-flow-files",
21+
"open:coverage": "open coverage/lcov-report/index.html",
22+
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
1823
},
1924
"config": {
25+
"mocha": "--compilers js:babel-core/register ./test/**/*.js",
2026
"commitizen": {
2127
"path": "cz-conventional-changelog"
2228
}
@@ -57,15 +63,21 @@
5763
"babel-preset-stage-1": "^6.22.0",
5864
"babel-register": "^6.22.0",
5965
"babel-runtime": "^6.22.0",
66+
"chai": "^3.5.0",
67+
"copy": "^0.3.0",
68+
"coveralls": "^2.11.16",
6069
"eslint": "^3.13.1",
6170
"eslint-plugin-flowtype": "^2.30.0",
6271
"eslint-watch": "^3.0.0",
6372
"flow-bin": "^0.39.0",
6473
"flow-watch": "^1.1.0",
6574
"husky": "^0.13.1",
6675
"istanbul": "^0.4.5",
76+
"lodash.merge": "^4.6.0",
77+
"mocha": "^3.2.0",
6778
"nyc": "^10.1.2",
6879
"rimraf": "^2.5.4",
80+
"semantic-release": "^6.3.6",
6981
"validate-commit-msg": "^2.8.2"
7082
},
7183
"dependencies": {}

template.json

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,18 @@
66
"parse": [
77
"PROJECT-README",
88
"PROJECT-LICENSE",
9-
"PROJECT-package.json"
9+
"PROJECT-package.json",
10+
"complete.sh"
1011
],
1112
"discard": [
1213
"README.md",
1314
"LICENSE.md",
14-
"package.json",
15-
"template.json",
16-
".travis.yml"
15+
"template.json"
1716
],
1817
"move": [
1918
{ "PROJECT-README": "README.md" },
20-
{ "PROJECT-LICENSE": "LICENSE.md" },
21-
{ "PROJECT-package.json": "package.json" },
22-
{ "PROJECT-.travis.yml": ".travis.yml" }
19+
{ "PROJECT-LICENSE": "LICENSE.md" }
2320
],
24-
"complete": "cd {{ name }} && git remote rename origin skeleton && git add --all . && git commit -n -m 'pollinate project'"
21+
"complete": "./complete.sh"
2522
}
2623

0 commit comments

Comments
 (0)