mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-01-19 08:32:52 +08:00
Extend IonicNativePlugin
This commit is contained in:
parent
2f5f34c2c5
commit
542e7d24f0
21
package-lock.json
generated
21
package-lock.json
generated
@ -507,6 +507,27 @@
|
|||||||
"integrity": "sha1-GdOGodntxufByF04iu28xW0zYC0=",
|
"integrity": "sha1-GdOGodntxufByF04iu28xW0zYC0=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"async-promise-queue": {
|
||||||
|
"version": "1.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/async-promise-queue/-/async-promise-queue-1.0.4.tgz",
|
||||||
|
"integrity": "sha512-GQ5X3DT+TefYuFPHdvIPXFTlKnh39U7dwtl+aUBGeKjMea9nBpv3c91DXgeyBQmY07vQ97f3Sr9XHqkamEameQ==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"async": "2.6.0",
|
||||||
|
"debug": "2.6.9"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"async": {
|
||||||
|
"version": "2.6.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/async/-/async-2.6.0.tgz",
|
||||||
|
"integrity": "sha512-xAfGg1/NTLBBKlHFmnd7PlmUW9KhVQIUuSrYem9xzFUZy13ScvtyGGejaae9iAVRiRq9+Cx7DPFaAAhCpyxyPw==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"lodash": "4.17.4"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"asynckit": {
|
"asynckit": {
|
||||||
"version": "0.4.0",
|
"version": "0.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
||||||
|
@ -18,7 +18,8 @@
|
|||||||
"lint": "gulp lint",
|
"lint": "gulp lint",
|
||||||
"readmes": "gulp readmes",
|
"readmes": "gulp readmes",
|
||||||
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
|
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
|
||||||
"postchangelog": "git commit -am \"chore(): update changelog\""
|
"postchangelog": "git commit -am \"chore(): update changelog\"",
|
||||||
|
"shipit": "npm run build && npm run readmes && npm run npmpub"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@angular/common": "latest",
|
"@angular/common": "latest",
|
||||||
@ -32,6 +33,7 @@
|
|||||||
"@types/node": "8.0.47",
|
"@types/node": "8.0.47",
|
||||||
"@types/rimraf": "^2.0.2",
|
"@types/rimraf": "^2.0.2",
|
||||||
"@types/webpack": "^3.8.1",
|
"@types/webpack": "^3.8.1",
|
||||||
|
"async-promise-queue": "^1.0.4",
|
||||||
"babel-core": "^6.26.0",
|
"babel-core": "^6.26.0",
|
||||||
"babel-preset-env": "^1.6.1",
|
"babel-preset-env": "^1.6.1",
|
||||||
"babelify": "^8.0.0",
|
"babelify": "^8.0.0",
|
||||||
|
@ -25,7 +25,7 @@ const webpackConfig: webpack.Configuration = {
|
|||||||
modules: ['node_modules'],
|
modules: ['node_modules'],
|
||||||
extensions: ['.js'],
|
extensions: ['.js'],
|
||||||
alias: {
|
alias: {
|
||||||
'@ionic-native/core': path.resolve(DIST, 'core/index.js')
|
'@ionic-native/core': path.resolve(DIST, '@ionic-native/core/index.js')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
@ -44,7 +44,8 @@ const webpackConfig: webpack.Configuration = {
|
|||||||
}),
|
}),
|
||||||
new uglifyJsPlugin({
|
new uglifyJsPlugin({
|
||||||
sourceMap: true
|
sourceMap: true
|
||||||
})
|
}),
|
||||||
|
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3,20 +3,22 @@ import * as path from 'path';
|
|||||||
import { merge } from 'lodash';
|
import { merge } from 'lodash';
|
||||||
import { exec } from 'child_process';
|
import { exec } from 'child_process';
|
||||||
import { PLUGIN_PATHS, ROOT } from '../build/helpers';
|
import { PLUGIN_PATHS, ROOT } from '../build/helpers';
|
||||||
|
import { cpus } from 'os';
|
||||||
|
import * as Queue from 'async-promise-queue';
|
||||||
|
|
||||||
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;
|
||||||
const FLAGS = '--access public --tag beta';
|
const FLAGS = '--access public --tag beta';
|
||||||
|
|
||||||
const PACKAGE_JSON_BASE = {
|
const PACKAGE_JSON_BASE = {
|
||||||
"description": "Ionic Native - Native plugins for ionic apps",
|
'description': 'Ionic Native - Native plugins for ionic apps',
|
||||||
"module": "index.js",
|
'module': 'index.js',
|
||||||
"typings": "index.d.ts",
|
'typings': 'index.d.ts',
|
||||||
"author": "ionic",
|
'author': 'ionic',
|
||||||
"license": "MIT",
|
'license': 'MIT',
|
||||||
"repository": {
|
'repository': {
|
||||||
"type": "git",
|
'type': 'git',
|
||||||
"url": "https://github.com/ionic-team/ionic-native.git"
|
'url': 'https://github.com/ionic-team/ionic-native.git'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -63,17 +65,34 @@ function prepare() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function publish() {
|
async function publish(ignoreErrors: boolean = false) {
|
||||||
// TODO apply queue system to process them concurrently
|
// upload 1 package per CPU thread at a time
|
||||||
for (let pkg of PACKAGES) {
|
const worker = Queue.async.asyncify((pkg: any) => {
|
||||||
// console.log('Going to run the following command: ', `npm publish ${ pkg } ${ FLAGS }`);
|
new Promise<any>((resolve, reject) => {
|
||||||
await new Promise<any>((resolve, reject) => {
|
exec(`npm publish ${ pkg } ${ FLAGS }`, (err, stdout) => {
|
||||||
exec(`npm publish ${ pkg } ${ FLAGS }`, (err, stdout, stderr) => {
|
if (stdout) {
|
||||||
if (err) reject(err);
|
console.log(stdout);
|
||||||
if (stderr) reject(stderr);
|
resolve(stdout);
|
||||||
if (stdout) resolve(stdout);
|
}
|
||||||
|
if (err) {
|
||||||
|
if (!ignoreErrors) {
|
||||||
|
if (err.message.includes('You cannot publish over the previously published version')) {
|
||||||
|
console.log('Ignoring duplicate version error.');
|
||||||
|
return resolve();
|
||||||
|
}
|
||||||
|
reject(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
try {
|
||||||
|
await Queue(worker, PACKAGES, cpus().length);
|
||||||
|
console.log('Done publishing!');
|
||||||
|
} catch (e) {
|
||||||
|
console.log('Error publishing!');
|
||||||
|
console.log(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ export interface AdMobFreeRewardVideoConfig {
|
|||||||
plugin: 'cordova-plugin-admob-free',
|
plugin: 'cordova-plugin-admob-free',
|
||||||
pluginRef: 'admob.banner',
|
pluginRef: 'admob.banner',
|
||||||
})
|
})
|
||||||
export class AdMobFreeBanner {
|
export class AdMobFreeBanner extends IonicNativePlugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update config.
|
* Update config.
|
||||||
@ -130,7 +130,7 @@ export class AdMobFreeBanner {
|
|||||||
plugin: 'cordova-plugin-admob-free',
|
plugin: 'cordova-plugin-admob-free',
|
||||||
pluginRef: 'admob.interstitial',
|
pluginRef: 'admob.interstitial',
|
||||||
})
|
})
|
||||||
export class AdMobFreeInterstitial {
|
export class AdMobFreeInterstitial extends IonicNativePlugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update config.
|
* Update config.
|
||||||
@ -179,7 +179,7 @@ export class AdMobFreeInterstitial {
|
|||||||
plugin: 'cordova-plugin-admob-free',
|
plugin: 'cordova-plugin-admob-free',
|
||||||
pluginRef: 'admob.rewardvideo',
|
pluginRef: 'admob.rewardvideo',
|
||||||
})
|
})
|
||||||
export class AdMobFreeRewardVideo {
|
export class AdMobFreeRewardVideo extends IonicNativePlugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update config.
|
* Update config.
|
||||||
|
Loading…
Reference in New Issue
Block a user