Skip to content

Commit 2e61a9a

Browse files
authored
chore(cli): read plugin podspec values from package.json (#3092)
1 parent c5878a8 commit 2e61a9a

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

cli/src/tasks/new-plugin.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,17 +167,22 @@ async function createIosPlugin(config: Config, pluginPath: string, domain: strin
167167

168168
function generatePodspec(config: Config, answers: NewPluginAnswers) {
169169
return `
170+
require 'json'
171+
172+
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
173+
170174
Pod::Spec.new do |s|
171175
s.name = '${fixName(answers.name)}'
172-
s.version = '0.0.1'
173-
s.summary = '${answers.description}'
174-
s.license = '${answers.license}'
175-
s.homepage = '${answers.git}'
176-
s.author = '${answers.author}'
177-
s.source = { :git => '${answers.git}', :tag => s.version.to_s }
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 }
178182
s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
179183
s.ios.deployment_target = '${config.ios.minVersion}'
180184
s.dependency 'Capacitor'
185+
s.swift_version = '5.0'
181186
end`;
182187
}
183188

0 commit comments

Comments
 (0)