mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-01-31 18:49:43 +08:00
58 lines
1.3 KiB
JavaScript
58 lines
1.3 KiB
JavaScript
"use strict";
|
|
// 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');
|
|
|
|
const FLAGS = '--access public'; // add any flags here if you want... (example: --tag alpha)
|
|
|
|
console.log('Publishing @ionic-native/core');
|
|
exec(`npm publish ${CORE} ${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);
|
|
|
|
});
|