mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2026-05-20 00:06:24 +08:00
chore(): add plugin template and generator (#429)
* chore(): add plugin template and generator * docs(): add instructions to use plugin generator
This commit is contained in:
+13
@@ -3,6 +3,8 @@ var minimist = require('minimist');
|
||||
var uglify = require('gulp-uglify');
|
||||
var rename = require("gulp-rename");
|
||||
var tslint = require('ionic-gulp-tslint');
|
||||
var decamelize = require('decamelize');
|
||||
var replace = require('gulp-replace');
|
||||
|
||||
var flagConfig = {
|
||||
string: ['port', 'version', 'ngVersion', 'animations'],
|
||||
@@ -26,3 +28,14 @@ gulp.task("minify:dist", function(){
|
||||
});
|
||||
|
||||
gulp.task('lint', tslint);
|
||||
|
||||
gulp.task('plugin:create', function(){
|
||||
if(flags.n && flags.n !== ''){
|
||||
return gulp.src('./TEMPLATE')
|
||||
.pipe(replace('PluginName', flags.n))
|
||||
.pipe(rename(decamelize(flags.n, '-') + '.ts'))
|
||||
.pipe(gulp.dest('./src/plugins/'));
|
||||
} else {
|
||||
console.log("Usage is: gulp plugin:create -n PluginName");
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user