Skip to content

Commit d9fe4d1

Browse files
author
Andrea Giammarchi
committed
using npm-dollar to better organize the package
1 parent f51c329 commit d9fe4d1

File tree

1 file changed

+80
-12
lines changed

1 file changed

+80
-12
lines changed

package.json

+80-12
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,86 @@
88
"module": "esm/index.js",
99
"types": "index.d.ts",
1010
"scripts": {
11-
"add-domdiff": "echo '/* AUTOMATICALLY IMPORTED, DO NOT MODIFY */' > esm/shared/domdiff.js && cat node_modules/domdiff/esm/index.js >> esm/shared/domdiff.js",
12-
"build": "npm run cjs && npm run max && npm run min && npm run ie && npm run umd && npm test && npm run size",
13-
"cleanup": "bash -c \"echo \\\"\\$(cat index.js | sed 's/(exports)/(global)/' | sed 's/return exports;/return hyper;/' | sed -e 's/exports.*;//g' | sed 's/({})/(window)/')\\\" > index.js\"",
14-
"cjs": "npm run add-domdiff && ascjs ./esm ./cjs",
11+
"$": "npm-dollar",
12+
"build": "npm run $ build",
13+
"bundle": "npm run $ bundle",
1514
"coveralls": "cat ./coverage/lcov.info | coveralls",
16-
"ie": "babel ./test/test.js --out-dir ./test/ie --plugins=$(node -e 'console.log([\"transform-es2015-classes\", \"transform-es2015-template-literals\"].concat(require(\"./babel-plugins.json\")).join(\",\"))')",
17-
"max": "rollup --config rollup.config.js && npm run cleanup",
18-
"min": "bash -c 'echo \"/*! (c) Andrea Giammarchi (ISC) */$(uglifyjs index.js --support-ie8 --comments=/^!/ -c -m)\" > min.js'",
19-
"umd": "echo \"(function(A,G){if(typeof define=='function'&&define.amd)define([],G);else if(typeof module=='object'&&module.exports)module.exports=G();else A.hyperHTML=G()}(typeof self!='undefined'?self:this,function(){\">umd.js;cat min.js>>umd.js;echo \"return hyperHTML}));\">>umd.js",
20-
"size": "cat index.js | wc -c;cat min.js | wc -c;gzip -c9 min.js | wc -c",
21-
"brotli": "cat min.js | bro | wc -c",
22-
"test": "cp index.js index.c.js && echo 'module.exports = hyperHTML;' >> index.c.js && istanbul cover test/runner.js && rm index.c.js",
23-
"postinstall": "lightercollective"
15+
"postinstall": "lightercollective",
16+
"test": "npm run $ test"
17+
},
18+
"$": {
19+
"bundle": {
20+
"max": [
21+
"rollup --config rollup.config.js",
22+
"$ cleanup"
23+
],
24+
"min": [
25+
[
26+
"echo \"/*! (c) Andrea Giammarchi (ISC) */$(",
27+
"uglifyjs index.js --support-ie8 --comments=/^!/ -c -m",
28+
")\" > min.js"
29+
]
30+
],
31+
"ie": [
32+
[
33+
"babel ./test/test.js --out-dir ./test/ie --plugins=$(",
34+
"node -e 'console.log([\"transform-es2015-classes\", \"transform-es2015-template-literals\"].concat(require(\"./babel-plugins.json\")).join(\",\")",
35+
")')"
36+
]
37+
],
38+
"umd": [
39+
[
40+
"echo \"(function(A,G){if(typeof define=='function'&&define.amd)define([],G);else",
41+
"if(typeof module=='object'&&module.exports)module.exports=G();else",
42+
"A.hyperHTML=G()}(typeof self!='undefined'?self:this,function(){\">umd.js;cat",
43+
"min.js>>umd.js;echo \"return hyperHTML}));\">>umd.js"
44+
]
45+
]
46+
},
47+
"build": [
48+
"$ cjs",
49+
"$ bundle.max",
50+
"$ bundle.min",
51+
"$ bundle.ie",
52+
"$ bundle.umd",
53+
"$ test",
54+
"$ size"
55+
],
56+
"cleanup": [
57+
[
58+
"cat index.js |",
59+
"sed 's/(exports)/(global)/' |",
60+
"sed 's/return exports;/return hyper;/' |",
61+
"sed -e 's/exports.*;//g' |",
62+
"sed 's/({})/(window)/' > index.clean"
63+
],
64+
"mv index.clean index.js"
65+
],
66+
"cjs": [
67+
"$ domdiff",
68+
"ascjs ./esm ./cjs"
69+
],
70+
"domdiff": [
71+
"echo '/* AUTOMATICALLY IMPORTED, DO NOT MODIFY */' > esm/shared/domdiff.js",
72+
"cat node_modules/domdiff/esm/index.js >> esm/shared/domdiff.js"
73+
],
74+
"size": {
75+
"gzip": [
76+
[
77+
"cat index.js |",
78+
"wc -c;cat min.js |",
79+
"wc -c;gzip -c9 min.js |",
80+
"wc -c"
81+
]
82+
],
83+
"brotli": "cat min.js | brotli | wc -c"
84+
},
85+
"test": [
86+
"cp index.js index.c.js",
87+
"echo 'module.exports = hyperHTML;' >> index.c.js",
88+
"istanbul cover test/runner.js",
89+
"rm index.c.js"
90+
]
2491
},
2592
"repository": {
2693
"type": "git",
@@ -64,6 +131,7 @@
64131
"coveralls": "^3.0.0",
65132
"domdiff": "^0.4.0",
66133
"istanbul": "^0.4.5",
134+
"npm-dollar": "^0.1.1",
67135
"rollup": "^0.60.0",
68136
"rollup-plugin-babel": "^3.0.2",
69137
"tressa": "^0.3.1",

0 commit comments

Comments
 (0)