diff --git a/scripts/tasks/publish.ts b/scripts/tasks/publish.ts index 1bece8774..effe83333 100644 --- a/scripts/tasks/publish.ts +++ b/scripts/tasks/publish.ts @@ -4,10 +4,10 @@ import * as fs from 'fs-extra'; import { merge } from 'lodash'; import { cpus } from 'os'; import * as path from 'path'; + import { PLUGIN_PATHS, ROOT } from '../build/helpers'; import { Logger } from '../logger'; - // tslint:disable-next-line:no-var-requires const MAIN_PACKAGE_JSON = require('../../package.json'); const VERSION = MAIN_PACKAGE_JSON.version; @@ -29,14 +29,15 @@ const DIST = path.resolve(ROOT, 'dist/@ionic-native'); const PACKAGES = []; -const RXJS_VERSION = '*'; +const MIN_CORE_VERSION = '^5.1.0'; +const RXJS_VERSION = '^6.3.0'; const PLUGIN_PEER_DEPENDENCIES = { - '@ionic-native/core': VERSION, // TODO change this in production + '@ionic-native/core': MIN_CORE_VERSION, rxjs: RXJS_VERSION }; -function getPackageJsonContent(name, peerDependencies = {}, dependencies = {}) { +function getPackageJsonContent(name: string, peerDependencies = {}, dependencies = {}) { return merge(PACKAGE_JSON_BASE, { name: '@ionic-native/' + name, dependencies, @@ -61,10 +62,7 @@ function prepare() { // write plugin package.json files PLUGIN_PATHS.forEach((pluginPath: string) => { const pluginName = pluginPath.split(/[\/\\]+/).slice(-2)[0]; - const packageJsonContents = getPackageJsonContent( - pluginName, - PLUGIN_PEER_DEPENDENCIES - ); + const packageJsonContents = getPackageJsonContent(pluginName, PLUGIN_PEER_DEPENDENCIES); const dir = path.resolve(DIST, 'plugins', pluginName); writePackageJson(packageJsonContents, dir); @@ -74,28 +72,27 @@ function prepare() { async function publish(ignoreErrors = false) { Logger.profile('Publishing'); // upload 1 package per CPU thread at a time - const worker = Queue.async.asyncify((pkg: any) => - new Promise((resolve, reject) => { - exec(`npm publish ${pkg} ${FLAGS}`, (err, stdout) => { - if (stdout) { - Logger.verbose(stdout.trim()); - resolve(stdout); - } - if (err) { - if (!ignoreErrors) { - if ( - err.message.includes( - 'You cannot publish over the previously published version' - ) - ) { - Logger.verbose('Ignoring duplicate version error.'); - return resolve(); - } - reject(err); + const worker = Queue.async.asyncify( + (pkg: any) => + new Promise((resolve, reject) => { + exec(`npm publish ${pkg} ${FLAGS}`, (err, stdout) => { + if (stdout) { + Logger.verbose(stdout.trim()); + resolve(stdout); } - } - }); - }) + if (err) { + if (!ignoreErrors) { + if ( + err.message.includes('You cannot publish over the previously published version') + ) { + Logger.verbose('Ignoring duplicate version error.'); + return resolve(); + } + reject(err); + } + } + }); + }) ); try {