Skip to content

Commit

Permalink
chore(cli): pin cli version instead of latest on plugin generation (#…
Browse files Browse the repository at this point in the history
…3201)



Co-authored-by: Dan Imhoff <dwieeb@gmail.com>
  • Loading branch information
jcesarmobile and imhoffd authored Jul 6, 2020
1 parent c2133c5 commit 8651ef1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions cli/src/tasks/new-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ export async function newPlugin(config: Config) {
const pluginPath = removeScope(answers.name);
const domain = answers.domain;
const className = answers.className;
const cliVersion = config.cli.package.version;

if (await existsAsync(pluginPath)) {
logFatal(`Directory ${pluginPath} already exists. Not overwriting.`);
Expand All @@ -112,7 +113,7 @@ export async function newPlugin(config: Config) {
});

await runTask('Writing package.json', () => {
return writePrettyJSON(join(pluginPath, 'package.json'), generatePackageJSON(answers));
return writePrettyJSON(join(pluginPath, 'package.json'), generatePackageJSON(answers, cliVersion));
});

await runTask('Installing NPM dependencies', async () => {
Expand Down Expand Up @@ -218,7 +219,7 @@ function generateAndroidManifest(domain: string, pluginPath: string) {
`;
}

function generatePackageJSON(answers: NewPluginAnswers) {
function generatePackageJSON(answers: NewPluginAnswers, cliVersion: string) {
return {
name: answers.name,
version: '0.0.1',
Expand All @@ -234,13 +235,13 @@ function generatePackageJSON(answers: NewPluginAnswers) {
author: answers.author,
license: answers.license,
dependencies: {
'@capacitor/core': 'latest'
'@capacitor/core': `^${cliVersion}`
},
devDependencies: {
'rimraf': '^3.0.0',
'typescript': '^3.2.4',
'@capacitor/ios': 'latest',
'@capacitor/android': 'latest'
'@capacitor/ios': `^${cliVersion}`,
'@capacitor/android': `^${cliVersion}`
},
files: [
'dist/',
Expand Down Expand Up @@ -270,4 +271,3 @@ function generatePackageJSON(answers: NewPluginAnswers) {
}
};
}

0 comments on commit 8651ef1

Please sign in to comment.