From 795ad11503e93b6b2219665d7c0c8265fe7e776e Mon Sep 17 00:00:00 2001 From: Michael Brade Date: Sat, 8 Oct 2016 00:57:59 +0200 Subject: [PATCH] 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 --- package.json | 11 ++++++----- package.json.sh | 21 ++++++++++++--------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index 9b128f1..f72c79a 100644 --- a/package.json +++ b/package.json @@ -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": "brade@kde.org" @@ -27,6 +27,9 @@ "babel-cli": "6.x", "babel-preset-es2015-loose": "6.x" }, + "peerDependencies": { + "derby": "michael-brade/derby" + }, "eslintConfig": { "env": { "browser": true, @@ -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" diff --git a/package.json.sh b/package.json.sh index 5fbefaf..7e41309 100755 --- a/package.json.sh +++ b/package.json.sh @@ -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' @@ -30,6 +30,10 @@ devDependencies: 'babel-cli': '6.x' 'babel-preset-es2015-loose': '6.x' +peerDependencies: + 'derby': 'michael-brade/derby' + + eslintConfig: env: @@ -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 @@ -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'