Skip to content

Commit 795ad11

Browse files
committed
package.json: update build system and dependencies
- don't compile stuff in test/ - minify views - use babel es2015-loose, Derby needs to be able to enumerate methods
1 parent a576bea commit 795ad11

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "derby-select2",
33
"description": "Native Derby JS replacement for jQuery Select2",
4-
"version": "0.1.0",
4+
"version": "0.2.0",
55
"author": {
66
"name": "Michael Brade",
77
"email": "brade@kde.org"
@@ -27,6 +27,9 @@
2727
"babel-cli": "6.x",
2828
"babel-preset-es2015-loose": "6.x"
2929
},
30+
"peerDependencies": {
31+
"derby": "michael-brade/derby"
32+
},
3033
"eslintConfig": {
3134
"env": {
3235
"browser": true,
@@ -43,12 +46,10 @@
4346
},
4447
"scripts": {
4548
"prebuild": "npm run clean; touch .create_stash && git stash save --include-untracked \"npm build stash\";",
46-
"build": "export DEST=dist;export ASSETS='.*.scss|.*.html|./README.md|./package.json';find \\( -path './node_modules*' -o -path \"./$DEST\" \\) -prune -o -name '*.js' -print0| xargs -n1 -P8 -0 sh -c 'echo Compiling and minifying $0...;mkdir -p \"$DEST/`dirname $0`\";babel --presets es2015 \"$0\" | uglifyjs - -cm -o \"$DEST/$0\";';echo \"\u001b[01;32mCopying assets...\u001b[00m\";find \\( -path './node_modules*' -o -path \"./$DEST\" \\) -prune -o -regextype posix-egrep -regex $ASSETS -print0| xargs -n1 -0 sh -c 'mkdir -p \"$DEST/`dirname \"$0\"`\";cp -a \"$0\" \"$DEST/$0\"';echo \"\u001b[01;32mDone!\u001b[00m\";",
49+
"build": "export DEST=dist;export ASSETS='.*.scss|.*.html|./README.md|./package.json';find \\( -path './node_modules' -o -path \"./$DEST\" -o -path './test' \\) -prune -o -name '*.js' -print0| xargs -n1 -P8 -0 sh -c 'echo Compiling and minifying $0...;mkdir -p \"$DEST/`dirname $0`\";babel --presets es2015-loose \"$0\" | uglifyjs - -cm -o \"$DEST/$0\";';echo \"\u001b[01;32mCopying assets...\u001b[00m\";find \\( -path './node_modules' -o -path \"./$DEST\" \\) -prune -o -regextype posix-egrep -regex $ASSETS -print0| xargs -n1 -0 sh -c 'mkdir -p \"$DEST/`dirname \"$0\"`\";cp -a \"$0\" \"$DEST/$0\"';echo \"\u001b[01;32mMinifying views...\u001b[00m\";find \"$DEST\" -name '*.html' -print0 | xargs -n1 -0 perl -i -p0e 's/\\n//g;s/ +/ /g;s/<!--.*?-->//g';echo \"\u001b[01;32mDone!\u001b[00m\";",
4750
"postbuild": "git stash pop --index && rm .create_stash;",
4851
"clean": "rm -rf dist;",
49-
"test": "echo \"TODO: no tests specified yet\" && exit 1;",
50-
"prepublish": "npm run clean; npm run build;",
51-
"publish": "npm publish dist;"
52+
"test": "echo \"TODO: no tests specified yet\" && exit 1;"
5253
},
5354
"engines": {
5455
"node": "6.x"

package.json.sh

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
name: 'derby-select2'
44
description: 'Native Derby JS replacement for jQuery Select2'
5-
version: '0.1.0'
5+
version: '0.2.0'
66

77
author:
88
name: 'Michael Brade'
@@ -30,6 +30,10 @@ devDependencies:
3030
'babel-cli': '6.x'
3131
'babel-preset-es2015-loose': '6.x'
3232

33+
peerDependencies:
34+
'derby': 'michael-brade/derby'
35+
36+
3337

3438
eslintConfig:
3539
env:
@@ -57,20 +61,23 @@ scripts:
5761
export DEST=dist;
5862
export ASSETS='.*\.scss|.*\.html|./README\.md|./package\.json';
5963
60-
find \\( -path './node_modules*' -o -path \"./$DEST\" \\) -prune -o -name '*.js' -print0
64+
find \\( -path './node_modules' -o -path \"./$DEST\" -o -path './test' \\) -prune -o -name '*.js' -print0
6165
| xargs -n1 -P8 -0 sh -c '
6266
echo Compiling and minifying $0...;
6367
mkdir -p \"$DEST/`dirname $0`\";
64-
babel --presets es2015 \"$0\" | uglifyjs - -cm -o \"$DEST/$0\";
68+
babel --presets es2015-loose \"$0\" | uglifyjs - -cm -o \"$DEST/$0\";
6569
';
6670
6771
echo \"\033[01;32mCopying assets...\033[00m\";
68-
find \\( -path './node_modules*' -o -path \"./$DEST\" \\) -prune -o -regextype posix-egrep -regex $ASSETS -print0
72+
find \\( -path './node_modules' -o -path \"./$DEST\" \\) -prune -o -regextype posix-egrep -regex $ASSETS -print0
6973
| xargs -n1 -0 sh -c '
7074
mkdir -p \"$DEST/`dirname \"$0\"`\";
7175
cp -a \"$0\" \"$DEST/$0\"
7276
';
7377
78+
echo \"\033[01;32mMinifying views...\033[00m\";
79+
find \"$DEST\" -name '*.html' -print0 | xargs -n1 -0 perl -i -p0e 's/\\n//g;s/ +/ /g;s/<!--.*?-->//g';
80+
7481
echo \"\033[01;32mDone!\033[00m\";
7582
"
7683
# restore the original situation
@@ -82,11 +89,7 @@ scripts:
8289

8390
test: "echo \"TODO: no tests specified yet\" && exit 1;"
8491

85-
## publishing - run as "npm run publish"
86-
87-
prepublish: "npm run clean; npm run build;"
88-
publish: "npm publish dist;"
89-
92+
## publishing: run "npm run build; cd dist; npm publish"
9093

9194
engines:
9295
node: '6.x'

0 commit comments

Comments
 (0)