diff --git a/scripts/build/build.sh b/scripts/build/build.sh index 29e4c7457..5e1e2d2ec 100644 --- a/scripts/build/build.sh +++ b/scripts/build/build.sh @@ -1,9 +1,12 @@ #tsc -p tsconfig-core.json +VERSION=$(node -p -e "require('./package.json').version") PLUGINS="./src/@ionic-native/plugins/*" 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/' # Clean the old build dir rm -rf $BUILD_TMP @@ -16,6 +19,8 @@ for d in $PLUGINS ; do PLUGIN_BUILD_DIR="$BUILD_TMP/plugins/$BASE" 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" done diff --git a/scripts/package.json b/scripts/build/plugin-package.json.template similarity index 83% rename from scripts/package.json rename to scripts/build/plugin-package.json.template index 85d9f6db4..158d881e6 100644 --- a/scripts/package.json +++ b/scripts/build/plugin-package.json.template @@ -1,6 +1,6 @@ { - "name": "@ionic-native/PLUGIN", - "version": "VERSION", + "name": "@ionic-native/{{PLUGIN}}", + "version": "{{VERSION}}", "description": "Ionic Native - Native plugins for ionic apps", "module": "index.js", "typings": "index.d.ts", diff --git a/src/@ionic-native/plugins/themeable-browser/index.ts b/src/@ionic-native/plugins/themeable-browser/index.ts index 7dd88240c..89b29e348 100644 --- a/src/@ionic-native/plugins/themeable-browser/index.ts +++ b/src/@ionic-native/plugins/themeable-browser/index.ts @@ -1,6 +1,5 @@ import { Plugin, CordovaInstance } from '@ionic-native/core'; import { Observable } from 'rxjs/Observable'; -import { InAppBrowserEvent } from './inappbrowser'; declare var cordova: any; @@ -203,14 +202,13 @@ export class ThemeableBrowser { * A method that allows you to listen to events happening in the browser. * Available events are: `ThemeableBrowserError`, `ThemeableBrowserWarning`, `critical`, `loadfail`, `unexpected`, `undefined` * @param event Event name - * @returns {Observable} Returns back an observable that will listen to the event on subscribe, and will stop listening to the event on unsubscribe. + * @returns {Observable} Returns back an observable that will listen to the event on subscribe, and will stop listening to the event on unsubscribe. */ - on(event: string): Observable { - return new Observable((observer) => { + on(event: string): Observable { + return new Observable((observer) => { this._objectInstance.addEventListener(event, observer.next.bind(observer)); return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer)); }); } } -