@@ -46,19 +46,19 @@ export async function newPlugin(config: Config) {
46
46
{
47
47
type : 'input' ,
48
48
name : 'name' ,
49
- message : 'Plugin NPM name (kebab-case):' ,
49
+ message : 'Plugin npm name (kebab-case. ex: capacitor-plugin-example ):' ,
50
50
validate : requiredInput
51
51
} ,
52
52
{
53
53
type : 'input' ,
54
54
name : 'domain' ,
55
- message : 'Plugin id (domain-style syntax. ex: com.example.plugin )' ,
55
+ message : 'Plugin id (domain-style syntax. ex: com.mycompany.plugins.example )' ,
56
56
validate : requiredInput
57
57
} ,
58
58
{
59
59
type : 'input' ,
60
60
name : 'className' ,
61
- message : 'Plugin class name (ex: AwesomePlugin )' ,
61
+ message : 'Plugin class name (ex: Example )' ,
62
62
validate : requiredInput
63
63
} ,
64
64
{
@@ -167,24 +167,24 @@ async function createIosPlugin(config: Config, pluginPath: string, domain: strin
167
167
}
168
168
169
169
function generatePodspec ( config : Config , answers : NewPluginAnswers ) {
170
- return `
171
- require 'json'
172
-
173
- package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
174
-
175
- Pod::Spec.new do |s|
176
- s.name = ' ${ fixName ( answers . name ) } '
177
- s.version = package['version ']
178
- s.summary = package['description ']
179
- s.license = package['license ']
180
- s.homepage = package['repository']['url ']
181
- s.author = package['author']
182
- s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
183
- s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp }'
184
- s.ios.deployment_target = ' ${ config . ios . minVersion } '
185
- s.dependency 'Capacitor '
186
- s.swift_version = '5.0'
187
- end `;
170
+ return `require 'json'
171
+
172
+ package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
173
+
174
+ Pod::Spec.new do |s|
175
+ s.name = ' ${ fixName ( answers . name ) } '
176
+ s.version = package['version']
177
+ s.summary = package['description ']
178
+ s.license = package['license ']
179
+ s.homepage = package['repository']['url ']
180
+ s.author = package['author ']
181
+ s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
182
+ s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
183
+ s.ios.deployment_target = '${ config . ios . minVersion } '
184
+ s.dependency 'Capacitor '
185
+ s.swift_version = '5.1 '
186
+ end
187
+ ` ;
188
188
}
189
189
190
190
async function createAndroidPlugin ( config : Config , pluginPath : string , domain : string , className : string ) {
@@ -221,47 +221,61 @@ function generateAndroidManifest(domain: string, pluginPath: string) {
221
221
222
222
function generatePackageJSON ( answers : NewPluginAnswers , cliVersion : string ) {
223
223
return {
224
- name : answers . name ,
225
- version : '0.0.1' ,
226
- description : answers . description ,
227
- main : 'dist/esm/index.js' ,
228
- types : 'dist/esm/index.d.ts' ,
229
- scripts : {
230
- 'build' : 'npm run clean && tsc' ,
224
+ 'name' : answers . name ,
225
+ 'version' : '0.0.1' ,
226
+ 'description' : answers . description ,
227
+ 'main' : 'dist/plugin.js' ,
228
+ 'module' : 'dist/esm/index.js' ,
229
+ 'types' : 'dist/esm/index.d.ts' ,
230
+ 'scripts' : {
231
+ 'lint' : 'npm run prettier -- --check && npm run swiftlint -- lint' ,
232
+ 'prettier' : 'prettier "**/*.{css,html,ts,js,java}"' ,
233
+ 'swiftlint' : 'node-swiftlint' ,
234
+ 'build' : 'npm run clean && tsc && rollup -c rollup.config.js' ,
231
235
'clean' : 'rimraf ./dist' ,
232
236
'watch' : 'tsc --watch' ,
233
237
'prepublishOnly' : 'npm run build'
234
238
} ,
235
- author : answers . author ,
236
- license : answers . license ,
237
- dependencies : {
238
- '@capacitor/core' : `^${ cliVersion } `
239
- } ,
240
- devDependencies : {
241
- 'rimraf' : '^3.0.0' ,
242
- 'typescript' : '^3.2.4' ,
239
+ 'author' : answers . author ,
240
+ 'license' : answers . license ,
241
+ 'devDependencies' : {
242
+ '@capacitor/android' : `^${ cliVersion } ` ,
243
+ '@capacitor/core' : `^${ cliVersion } ` ,
243
244
'@capacitor/ios' : `^${ cliVersion } ` ,
244
- '@capacitor/android' : `^${ cliVersion } `
245
+ '@ionic/prettier-config' : '^1.0.0' ,
246
+ '@ionic/swiftlint-config' : '^1.0.0' ,
247
+ '@rollup/plugin-node-resolve' : '^8.1.0' ,
248
+ 'prettier' : '^2.0.5' ,
249
+ 'prettier-plugin-java' : '^0.8.0' ,
250
+ 'rimraf' : '^3.0.0' ,
251
+ 'rollup' : '^2.21.0' ,
252
+ 'swiftlint' : '^1.0.1' ,
253
+ 'typescript' : '~3.8.3'
254
+ } ,
255
+ 'peerDependencies' : {
256
+ '@capacitor/core' : `^${ cliVersion } `
245
257
} ,
246
- files : [
258
+ ' files' : [
247
259
'dist/' ,
248
260
'ios/' ,
249
261
'android/' ,
250
262
`${ fixName ( answers . name ) } .podspec`
251
263
] ,
252
- keywords : [
264
+ ' keywords' : [
253
265
'capacitor' ,
254
266
'plugin' ,
255
267
'native'
256
268
] ,
257
- capacitor : {
258
- ios : {
259
- src : 'ios' ,
269
+ ' capacitor' : {
270
+ ' ios' : {
271
+ ' src' : 'ios' ,
260
272
} ,
261
- android : {
262
- src : 'android'
273
+ ' android' : {
274
+ ' src' : 'android'
263
275
}
264
276
} ,
277
+ 'prettier' : '@ionic/prettier-config' ,
278
+ 'swiftlint' : '@ionic/swiftlint-config' ,
265
279
'repository' : {
266
280
'type' : 'git' ,
267
281
'url' : answers . git
0 commit comments