From f0d98f7b4e74cd892fb35bb1941f3b49cb601140 Mon Sep 17 00:00:00 2001 From: Jack Westbrook Date: Fri, 27 Sep 2024 10:52:38 +0200 Subject: [PATCH] feat(create-plugin): run go sdk update function when updating a plugin --- .../src/commands/generate.command.ts | 2 +- .../create-plugin/src/commands/update.command.ts | 16 +++++++++------- .../utils.goSdk.ts} | 0 3 files changed, 10 insertions(+), 8 deletions(-) rename packages/create-plugin/src/{commands/generate/update-go-sdk-and-packages.ts => utils/utils.goSdk.ts} (100%) diff --git a/packages/create-plugin/src/commands/generate.command.ts b/packages/create-plugin/src/commands/generate.command.ts index 4b60f19c6..593879634 100644 --- a/packages/create-plugin/src/commands/generate.command.ts +++ b/packages/create-plugin/src/commands/generate.command.ts @@ -11,7 +11,7 @@ import { renderTemplateFromFile, getTemplateData } from '../utils/utils.template import { prettifyFiles } from '../utils/utils.prettifyFiles.js'; import { printGenerateSuccessMessage } from './generate/print-success-message.js'; import { promptUser } from './generate/prompt-user.js'; -import { updateGoSdkAndModules } from './generate/update-go-sdk-and-packages.js'; +import { updateGoSdkAndModules } from '../utils/utils.goSdk.js'; import { TemplateData } from '../types.js'; export const generate = async (argv: minimist.ParsedArgs) => { diff --git a/packages/create-plugin/src/commands/update.command.ts b/packages/create-plugin/src/commands/update.command.ts index b3a4bcab4..eda7db52b 100644 --- a/packages/create-plugin/src/commands/update.command.ts +++ b/packages/create-plugin/src/commands/update.command.ts @@ -1,13 +1,14 @@ -import minimist from 'minimist'; import chalk from 'chalk'; -import { printRedBox, printBlueBox } from '../utils/utils.console.js'; -import { updatePackageJson, updateNpmScripts } from '../utils/utils.npm.js'; -import { isGitDirectory, isGitDirectoryClean } from '../utils/utils.git.js'; -import { isPluginDirectory, updateDotConfigFolder } from '../utils/utils.plugin.js'; -import { getVersion, getGrafanaRuntimeVersion } from '../utils/utils.version.js'; -import { getPackageManagerFromUserAgent } from '../utils/utils.packageManager.js'; +import minimist from 'minimist'; import { UDPATE_CONFIG } from '../constants.js'; +import { printBlueBox, printRedBox } from '../utils/utils.console.js'; import { getOnlyExistingInCwd, removeFilesInCwd } from '../utils/utils.files.js'; +import { isGitDirectory, isGitDirectoryClean } from '../utils/utils.git.js'; +import { updateGoSdkAndModules } from '../utils/utils.goSdk.js'; +import { updateNpmScripts, updatePackageJson } from '../utils/utils.npm.js'; +import { getPackageManagerFromUserAgent } from '../utils/utils.packageManager.js'; +import { isPluginDirectory, updateDotConfigFolder } from '../utils/utils.plugin.js'; +import { getGrafanaRuntimeVersion, getVersion } from '../utils/utils.version.js'; export const update = async (argv: minimist.ParsedArgs) => { const { packageManagerName } = getPackageManagerFromUserAgent(); @@ -55,6 +56,7 @@ In case you want to proceed as is please use the ${chalk.bold('--force')} flag.) onlyOutdated: true, ignoreGrafanaDependencies: false, }); + await updateGoSdkAndModules(process.cwd()); const filesToRemove = getOnlyExistingInCwd(UDPATE_CONFIG.filesToRemove); if (filesToRemove.length) { diff --git a/packages/create-plugin/src/commands/generate/update-go-sdk-and-packages.ts b/packages/create-plugin/src/utils/utils.goSdk.ts similarity index 100% rename from packages/create-plugin/src/commands/generate/update-go-sdk-and-packages.ts rename to packages/create-plugin/src/utils/utils.goSdk.ts