mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-01-18 16:02:53 +08:00
chore(): update templates
This commit is contained in:
parent
f98f90a9a3
commit
a94651dc75
12
gulpfile.js
12
gulpfile.js
@ -34,14 +34,16 @@ gulp.task('plugin:create', () => {
|
||||
|
||||
const src = flags.m ? './scripts/templates/wrap-min.tmpl':'./scripts/templates/wrap.tmpl',
|
||||
pluginName = flags.n,
|
||||
pluginNameSpaced = pluginName.replace(/(?!^)([A-Z])/g, ' $1');
|
||||
spaced = pluginName.replace(/(?!^)([A-Z])/g, ' $1'),
|
||||
kebabCase = _.kebabCase(pluginName);
|
||||
|
||||
return gulp.src(src)
|
||||
.pipe(replace('$PluginName', pluginName))
|
||||
.pipe(replace('$Plugin_Name', pluginNameSpaced))
|
||||
.pipe(replace('$pluginName', _.lowerFirst(pluginName)))
|
||||
.pipe(replace('{{ PluginName }}', pluginName))
|
||||
.pipe(replace('{{ Plugin_Name }}', spaced))
|
||||
.pipe(replace('{{ pluginName }}', _.lowerFirst(pluginName)))
|
||||
.pipe(replace('{{ plugin-name }}', kebabCase))
|
||||
.pipe(rename('index.ts'))
|
||||
.pipe(gulp.dest('./src/@ionic-native/plugins/' + _.kebabCase(pluginName)));
|
||||
.pipe(gulp.dest('./src/@ionic-native/plugins/' + kebabCase));
|
||||
|
||||
} else {
|
||||
console.log("Usage is: gulp plugin:create -n PluginName");
|
||||
|
@ -2,15 +2,15 @@ import { Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
/**
|
||||
* @name $Plugin_Name
|
||||
* @name {{ Plugin_Name }}
|
||||
* @description
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { $PluginName } from 'ionic-native';
|
||||
* import { {{ PluginName }} } from '@ionic-native/{{ plugin-name }}';
|
||||
*
|
||||
*
|
||||
* constructor(private $pluginName: $PluginName) { }
|
||||
* constructor(private {{ pluginName }}: {{ PluginName }}) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
@ -18,13 +18,13 @@ import { Injectable } from '@angular/core';
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: '$PluginName',
|
||||
pluginName: '{{ PluginName }}',
|
||||
plugin: '',
|
||||
pluginRef: '',
|
||||
repo: '',
|
||||
platforms: []
|
||||
})
|
||||
@Injectable()
|
||||
export class $PluginName extends IonicNativePlugin {
|
||||
export class {{ PluginName }} extends IonicNativePlugin {
|
||||
|
||||
}
|
||||
|
@ -15,28 +15,28 @@ import { Plugin, Cordova, CordovaProperty, CordovaInstance, InstanceProperty, Io
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
/**
|
||||
* @name $Plugin_Name
|
||||
* @name {{ Plugin_Name }}
|
||||
* @description
|
||||
* This plugin does something
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { $PluginName } from '@ionic-native/';
|
||||
* import { {{ PluginName }} } from '@ionic-native/{{ plugin-name }}';
|
||||
*
|
||||
*
|
||||
* constructor(private $pluginName: $PluginName) { }
|
||||
* constructor(private {{ pluginName }}: {{ PluginName }}) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* this.$pluginName.functionName('Hello', 123)
|
||||
* this.{{ pluginName }}.functionName('Hello', 123)
|
||||
* .then((res: any) => console.log(res))
|
||||
* .catch((error: any) => console.error(error));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: '$PluginName',
|
||||
pluginName: '{{ PluginName }}',
|
||||
plugin: '', // npm package name, example: cordova-plugin-camera
|
||||
pluginRef: '', // the variable reference to call the plugin, example: navigator.geolocation
|
||||
repo: '', // the github repository URL for the plugin
|
||||
@ -44,7 +44,7 @@ import { Observable } from 'rxjs/Observable';
|
||||
install: '', // OPTIONAL install command, in case the plugin requires variables
|
||||
})
|
||||
@Injectable()
|
||||
export class $PluginName extends IonicNativePlugin {
|
||||
export class {{ PluginName }} extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* This function does something
|
||||
|
Loading…
Reference in New Issue
Block a user