Skip to content

Commit

Permalink
package.json: update build system and dependencies
Browse files Browse the repository at this point in the history
- don't compile stuff in test/
- minify views
- use babel es2015-loose, Derby needs to be able to enumerate methods
  • Loading branch information
michael-brade committed Oct 7, 2016
1 parent a576bea commit 795ad11
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "derby-select2",
"description": "Native Derby JS replacement for jQuery Select2",
"version": "0.1.0",
"version": "0.2.0",
"author": {
"name": "Michael Brade",
"email": "[email protected]"
Expand All @@ -27,6 +27,9 @@
"babel-cli": "6.x",
"babel-preset-es2015-loose": "6.x"
},
"peerDependencies": {
"derby": "michael-brade/derby"
},
"eslintConfig": {
"env": {
"browser": true,
Expand All @@ -43,12 +46,10 @@
},
"scripts": {
"prebuild": "npm run clean; touch .create_stash && git stash save --include-untracked \"npm build stash\";",
"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\";",
"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\";",
"postbuild": "git stash pop --index && rm .create_stash;",
"clean": "rm -rf dist;",
"test": "echo \"TODO: no tests specified yet\" && exit 1;",
"prepublish": "npm run clean; npm run build;",
"publish": "npm publish dist;"
"test": "echo \"TODO: no tests specified yet\" && exit 1;"
},
"engines": {
"node": "6.x"
Expand Down
21 changes: 12 additions & 9 deletions package.json.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

name: 'derby-select2'
description: 'Native Derby JS replacement for jQuery Select2'
version: '0.1.0'
version: '0.2.0'

author:
name: 'Michael Brade'
Expand Down Expand Up @@ -30,6 +30,10 @@ devDependencies:
'babel-cli': '6.x'
'babel-preset-es2015-loose': '6.x'

peerDependencies:
'derby': 'michael-brade/derby'



eslintConfig:
env:
Expand Down Expand Up @@ -57,20 +61,23 @@ scripts:
export DEST=dist;
export ASSETS='.*\.scss|.*\.html|./README\.md|./package\.json';
find \\( -path './node_modules*' -o -path \"./$DEST\" \\) -prune -o -name '*.js' -print0
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 \"$0\" | uglifyjs - -cm -o \"$DEST/$0\";
babel --presets es2015-loose \"$0\" | uglifyjs - -cm -o \"$DEST/$0\";
';
echo \"\033[01;32mCopying assets...\033[00m\";
find \\( -path './node_modules*' -o -path \"./$DEST\" \\) -prune -o -regextype posix-egrep -regex $ASSETS -print0
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 \"\033[01;32mMinifying views...\033[00m\";
find \"$DEST\" -name '*.html' -print0 | xargs -n1 -0 perl -i -p0e 's/\\n//g;s/ +/ /g;s/<!--.*?-->//g';
echo \"\033[01;32mDone!\033[00m\";
"
# restore the original situation
Expand All @@ -82,11 +89,7 @@ scripts:

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

## publishing - run as "npm run publish"

prepublish: "npm run clean; npm run build;"
publish: "npm publish dist;"

## publishing: run "npm run build; cd dist; npm publish"

engines:
node: '6.x'
Expand Down

0 comments on commit 795ad11

Please sign in to comment.