mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-01-19 00:12:53 +08:00
chore(build): set min core version
This commit is contained in:
parent
aed25a6642
commit
d55d1d6f7f
@ -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<any>((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<any>((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 {
|
||||
|
Loading…
Reference in New Issue
Block a user