mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-03-17 00:51:07 +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 { 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,28 +72,27 @@ 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(
|
||||||
new Promise<any>((resolve, reject) => {
|
(pkg: any) =>
|
||||||
exec(`npm publish ${pkg} ${FLAGS}`, (err, stdout) => {
|
new Promise<any>((resolve, reject) => {
|
||||||
if (stdout) {
|
exec(`npm publish ${pkg} ${FLAGS}`, (err, stdout) => {
|
||||||
Logger.verbose(stdout.trim());
|
if (stdout) {
|
||||||
resolve(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);
|
|
||||||
}
|
}
|
||||||
}
|
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 {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user