From 03254ad4b71f1332e87de426dcb8490bdd3c1e9c Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Tue, 7 Feb 2017 14:51:40 -0600 Subject: [PATCH] Build and push --- package.json | 15 ++++++--------- scripts/build/build.sh | 16 +++++++++++++--- scripts/build/core-package.json.template | 17 +++++++++++++++++ scripts/build/publish.sh | 13 +++++++++++++ tsconfig-es5.json | 15 --------------- tsconfig-esm.json | 15 --------------- tsconfig.json | 15 --------------- typings.json | 5 ----- 8 files changed, 49 insertions(+), 62 deletions(-) create mode 100644 scripts/build/core-package.json.template create mode 100644 scripts/build/publish.sh delete mode 100644 tsconfig-es5.json delete mode 100644 tsconfig-esm.json delete mode 100644 tsconfig.json delete mode 100644 typings.json diff --git a/package.json b/package.json index 9fc4b0670..2ec88c349 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native", - "version": "2.4.1", + "version": "3.0.0-alpha.0", "description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support", "main": "dist/es5/index.js", "module": "dist/esm/index.js", @@ -50,14 +50,11 @@ "test:watch": "npm test -- --watch", "start": "npm run test:watch", "lint": "gulp lint", - "build": "npm run lint && npm run build:js && npm run build:esm && npm run build:bundle && npm run build:minify", - "build:jscore2": "tsc -p scripts/build/tsconfig-core.json", - "build:js2": "sh scripts/build/build.sh", - "build:js": "tsc -p tsconfig-es5.json", - "build:esm": "tsc -p tsconfig-esm.json", - "build:bundle": "browserify dist/es5/index.js > dist/ionic.native.js", - "build:minify": "gulp minify:dist", - "shipit": "npm run build && npm publish && bash ./scripts/bower.sh", + "build": "npm run lint && npm run build:core && npm run build:modules", + "build:core": "tsc -p scripts/build/tsconfig-core.json", + "build:modules": "sh scripts/build/build.sh", + "shipit": "npm run build && npm run npmpub", + "npmpub": "sh scripts/build/publish.sh", "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0", "plugin:create": "gulp plugin:create" }, diff --git a/scripts/build/build.sh b/scripts/build/build.sh index 5e1e2d2ec..1c6a71d64 100644 --- a/scripts/build/build.sh +++ b/scripts/build/build.sh @@ -1,26 +1,36 @@ -#tsc -p tsconfig-core.json VERSION=$(node -p -e "require('./package.json').version") PLUGINS="./src/@ionic-native/plugins/*" +CORE_PACKAGE_JSON=`cat ./scripts/build/core-package.json.template` PLUGIN_TSCONFIG=`cat ./scripts/build/tsconfig-plugin.json.template` PLUGIN_PACKAGE_JSON=`cat ./scripts/build/plugin-package.json.template` BUILD_TMP='.tmp' -BUILD_PLUGINS_DIST='dist/packages-dist/@ionic-native/plugins/' +BUILD_PLUGINS_DIST='dist/packages-dist/@ionic-native/plugins' +BUILD_CORE_DIST='dist/packages-dist/@ionic-native/core/' # Clean the old build dir rm -rf $BUILD_TMP # Make it again mkdir $BUILD_TMP + +NEW_CORE_PACKAGE_JSON="$(echo "$CORE_PACKAGE_JSON" | sed "s/{{VERSION}}/$VERSION/g")" +echo "$NEW_CORE_PACKAGE_JSON" > "$BUILD_CORE_DIST/$BASE/package.json" + + # For each plugin, replace the values in tsconfig w/ the appropriate ones for this plugin for d in $PLUGINS ; do BASE=`basename $d` + echo "Building plugin $BASE" PLUGIN_BUILD_DIR="$BUILD_TMP/plugins/$BASE" + + # Make the tmp build dir mkdir -p "$PLUGIN_BUILD_DIR" + NEW_TSCONFIG="$(echo "$PLUGIN_TSCONFIG" | sed "s/{{PLUGIN}}/$BASE/g")" NEW_PACKAGE_JSON="$(echo "$PLUGIN_PACKAGE_JSON" | sed "s/{{PLUGIN}}/$BASE/g;s/{{VERSION}}/$VERSION/g")" echo "$NEW_TSCONFIG" > "$PLUGIN_BUILD_DIR/tsconfig.json" - echo "$NEW_PACKAGE_JSON" > "$BUILD_PLUGINS_DIST/$BASE/package.json" ./node_modules/.bin/tsc -p "$PLUGIN_BUILD_DIR/tsconfig.json" + echo "$NEW_PACKAGE_JSON" > "$BUILD_PLUGINS_DIST/$BASE/package.json" done diff --git a/scripts/build/core-package.json.template b/scripts/build/core-package.json.template new file mode 100644 index 000000000..4e7585def --- /dev/null +++ b/scripts/build/core-package.json.template @@ -0,0 +1,17 @@ +{ + "name": "@ionic-native/core", + "version": "{{VERSION}}", + "description": "Ionic Native - Native plugins for ionic apps", + "module": "index.js", + "typings": "index.d.ts", + "author": "ionic", + "license": "MIT", + "peerDependencies": { + "rxjs": "^5.0.1", + "zone.js": "^0.7.2" + }, + "repository": { + "type": "git", + "url": "https://github.com/driftyco/ionic-native.git" + } +} diff --git a/scripts/build/publish.sh b/scripts/build/publish.sh new file mode 100644 index 000000000..f6597eb4a --- /dev/null +++ b/scripts/build/publish.sh @@ -0,0 +1,13 @@ +CORE="./dist/packages-dist/@ionic-native/core/" +PLUGINS="./src/@ionic-native/plugins/*" + +BUILD_PLUGINS_DIST='dist/packages-dist/@ionic-native/plugins' + +echo "Publishing @ionic-native/core" +npm publish "$CORE" --access public +# For each plugin, replace the values in tsconfig w/ the appropriate ones for this plugin +for d in $PLUGINS ; do + BASE=`basename $d` + echo "Publishing @ionic-native/$BASE" + npm publish "$BUILD_PLUGINS_DIST/$BASE/" --access public +done diff --git a/tsconfig-es5.json b/tsconfig-es5.json deleted file mode 100644 index a4f31bdca..000000000 --- a/tsconfig-es5.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "target": "ES5", - "sourceMap": true, - "declaration": true, - "experimentalDecorators": true, - "outDir": "dist/es5", - "moduleResolution": "node" - }, - "files": [ - "typings/es6-shim/es6-shim.d.ts", - "src/index.ts" - ] -} diff --git a/tsconfig-esm.json b/tsconfig-esm.json deleted file mode 100644 index 7fb860b6c..000000000 --- a/tsconfig-esm.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "compilerOptions": { - "module": "es2015", - "target": "ES5", - "sourceMap": true, - "declaration": true, - "experimentalDecorators": true, - "outDir": "dist/esm", - "moduleResolution": "node" - }, - "files": [ - "typings/es6-shim/es6-shim.d.ts", - "src/index.ts" - ] -} diff --git a/tsconfig.json b/tsconfig.json deleted file mode 100644 index be48d5b1b..000000000 --- a/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "target": "ES5", - "sourceMap": true, - "declaration": true, - "experimentalDecorators": true, - "outDir": "dist", - "moduleResolution": "node" - }, - "files": [ - "typings/es6-shim/es6-shim.d.ts", - "src/index.ts" - ] -} diff --git a/typings.json b/typings.json deleted file mode 100644 index dbbc9d62f..000000000 --- a/typings.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "globalDevDependencies": { - "jasmine": "registry:dt/jasmine#2.2.0+20160621224255" - } -}