chore(build): set min core version

This commit is contained in:
Daniel Sogl 2019-02-14 16:29:31 +01:00
parent aed25a6642
commit d55d1d6f7f

View File

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