From 87b5327a42b508a8987baec45012685f92d6c407 Mon Sep 17 00:00:00 2001 From: Ibby Date: Thu, 16 Feb 2017 22:00:06 -0500 Subject: [PATCH] fix AoT support and add publish script --- package.json | 11 +++--- scripts/build/publish.js | 58 ++++++++++++++++++++++++++++++ scripts/build/publish.sh | 6 ++-- scripts/build/tsconfig-core.json | 8 ++--- scripts/build/tsconfig-plugin.json | 8 ++--- 5 files changed, 72 insertions(+), 19 deletions(-) create mode 100644 scripts/build/publish.js diff --git a/package.json b/package.json index cbe1b56fd..de4e0c554 100644 --- a/package.json +++ b/package.json @@ -9,11 +9,12 @@ "dist" ], "devDependencies": { - "@angular/compiler": "^2.4.7", - "@angular/compiler-cli": "^2.4.7", - "@angular/core": "^2.4.6", + "@angular/compiler": "2.2.1", + "@angular/compiler-cli": "2.2.1", + "@angular/core": "2.2.1", "browserify": "^13.3.0", "canonical-path": "0.0.2", + "child-process-promise": "^2.2.0", "conventional-changelog-cli": "^1.2.0", "conventional-github-releaser": "^1.1.3", "cpr": "^2.0.2", @@ -41,12 +42,14 @@ "q": "1.4.1", "queue": "^4.2.1", "rimraf": "^2.5.4", + "rxjs": "5.0.0-beta.12", "semver": "^5.3.0", "tsify": "~3.0.0", "tslint": "^3.15.1", "tslint-ionic-rules": "0.0.7", "typescript": "~2.0.10", - "watchify": "~3.7.0" + "watchify": "~3.7.0", + "zone.js": "0.6.26" }, "scripts": { "test": "karma start", diff --git a/scripts/build/publish.js b/scripts/build/publish.js new file mode 100644 index 000000000..71e4b9ba6 --- /dev/null +++ b/scripts/build/publish.js @@ -0,0 +1,58 @@ +// Node module dependencies +const fs = require('fs-extra-promise').useFs(require('fs-extra')), + queue = require('queue'), + path = require('path'), + exec = require('child-process-promise').exec; + + +const ROOT = path.resolve(path.join(__dirname, '../../')), + DIST = path.resolve(ROOT, 'dist', 'packages-dist', '@ionic-native'), + PLUGINS_ROOT = path.resolve(DIST, 'plugins'), + CORE = path.resolve(DIST, 'core'), + UTILS = path.resolve(DIST, 'utils'); + +const FLAGS = '--access public --tag alpha'; // add any flags here if you want... (example: --tag alpha) + +console.log('Publishing @ionic-native/core'); +exec(`npm publish ${CORE} ${FLAGS}`) + .then(() => exec(`npm publish ${UTILS} ${FLAGS}`)) + .then(() => { + + const PLUGINS = fs.readdirSync(PLUGINS_ROOT); + + const QUEUE = queue({ + concurrency: 10 + }); + + PLUGINS.forEach(pluginName => { + + QUEUE.push(done => { + + console.log(`Publishing plugin ${pluginName}`); + const pluginPath = path.resolve(PLUGINS_ROOT, pluginName); + + exec(`npm publish ${pluginPath} ${FLAGS}`) + .then(() => done()) + .catch(done); + + }); + + }); + + QUEUE.start((err) => { + + if (err) { + console.log('Error publishing ionic-native. ', err); + } else { + console.log('Done publishing ionic-native!'); + } + + }); + + }) + .catch(e => { + + console.log('Publish failed'); + console.log(e); + + }); diff --git a/scripts/build/publish.sh b/scripts/build/publish.sh index 0fe00596f..5aae0edf4 100644 --- a/scripts/build/publish.sh +++ b/scripts/build/publish.sh @@ -5,14 +5,14 @@ UTILS="./dist/packages-dist/@ionic-native/utils/" BUILD_PLUGINS_DIST='dist/packages-dist/@ionic-native/plugins' echo "Publishing @ionic-native/core" -npm publish "$CORE" --access public +npm publish "$CORE" --access public --tag alpha echo "Publishing @ionic-native/utils" -npm publish "$UTILS" --access public +npm publish "$UTILS" --access public --tag alpha # 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 + npm publish "$BUILD_PLUGINS_DIST/$BASE/" --access public --tag alpha done diff --git a/scripts/build/tsconfig-core.json b/scripts/build/tsconfig-core.json index 1ca978269..8a826e1d9 100644 --- a/scripts/build/tsconfig-core.json +++ b/scripts/build/tsconfig-core.json @@ -4,20 +4,16 @@ "declaration": true, "stripInternal": true, "experimentalDecorators": true, + "emitDecoratorMetadata": true, "module": "es2015", "moduleResolution": "node", "outDir": "../../dist/packages-dist/", "rootDir": "../../src/", - "sourceMap": true, - "inlineSources": true, "target": "es5", "skipLibCheck": true, "lib": ["es2015", "dom"] }, "files": [ "../../src/@ionic-native/core/index.ts" - ], - "angularCompilerOptions": { - "genDir": "aot" - } + ] } diff --git a/scripts/build/tsconfig-plugin.json b/scripts/build/tsconfig-plugin.json index fe15f7a66..0de7d7fa7 100644 --- a/scripts/build/tsconfig-plugin.json +++ b/scripts/build/tsconfig-plugin.json @@ -4,6 +4,7 @@ "declaration": true, "stripInternal": true, "experimentalDecorators": true, + "emitDecoratorMetadata": true, "module": "es2015", "moduleResolution": "node", "outDir": "../../../dist/packages-dist/", @@ -11,16 +12,11 @@ "@ionic-native/core": ["../../../dist/packages-dist/@ionic-native/core"] }, "rootDir": "../../../src/", - "sourceMap": true, - "inlineSources": true, "target": "es5", "skipLibCheck": true, "lib": ["es2015", "dom"] }, "files": [ "../../../src/@ionic-native/plugins/{{PLUGIN}}/index.ts" - ], - "angularCompilerOptions": { - "genDir": "aot" - } + ] }