mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Grafana Toolkit: Prevent installation of outdated FE dependencies (#42663)
This commit is contained in:
parent
0bd30c8256
commit
36b0cb64fd
@ -11,6 +11,7 @@ import {
|
||||
promptPluginType,
|
||||
removeGitFiles,
|
||||
verifyGitExists,
|
||||
removeLockFile,
|
||||
} from './plugin/create';
|
||||
import { Task, TaskRunner } from './task';
|
||||
|
||||
@ -40,10 +41,14 @@ const pluginCreateRunner: TaskRunner<PluginCreateOptions> = async ({ name }) =>
|
||||
// 5. Update json files (package.json, src/plugin.json)
|
||||
await prepareJsonFiles({ type: type, pluginDetails, pluginPath: destPath });
|
||||
|
||||
// 6. Remove cloned repository .git dir
|
||||
// 6. Starter templates include `yarn.lock` files which will rarely (if ever) be in sync with `latest` dist-tag
|
||||
// so best to remove it after cloning.
|
||||
removeLockFile({ pluginPath: destPath });
|
||||
|
||||
// 7. Remove cloned repository .git dir
|
||||
await removeGitFiles(destPath);
|
||||
|
||||
// 7. Promote Grafana Tutorials :)
|
||||
// 8. Promote Grafana Tutorials :)
|
||||
printGrafanaTutorialsDetails(type);
|
||||
};
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import chalk from 'chalk';
|
||||
import commandExists from 'command-exists';
|
||||
import { promises as fs, readFileSync } from 'fs';
|
||||
import { promises as fs, readFileSync, existsSync, unlinkSync } from 'fs';
|
||||
import { prompt } from 'inquirer';
|
||||
import { kebabCase } from 'lodash';
|
||||
import path from 'path';
|
||||
@ -177,6 +177,7 @@ export const printGrafanaTutorialsDetails = (type: PluginType) => {
|
||||
console.group();
|
||||
console.log();
|
||||
console.log(chalk.bold.yellow(`Congrats! You have just created ${PluginNames[type]}.`));
|
||||
console.log('Please run `yarn install` to install frontend dependencies.');
|
||||
console.log();
|
||||
if (type !== 'backend-datasource-plugin') {
|
||||
console.log(`${PluginNames[type]} tutorial: ${TutorialPaths[type]}`);
|
||||
@ -188,3 +189,10 @@ export const printGrafanaTutorialsDetails = (type: PluginType) => {
|
||||
console.groupEnd();
|
||||
};
|
||||
/* eslint-enable no-console */
|
||||
|
||||
export const removeLockFile = ({ pluginPath }: { pluginPath: string }) => {
|
||||
const lockFilePath = path.resolve(pluginPath, 'yarn.lock');
|
||||
if (existsSync(lockFilePath)) {
|
||||
unlinkSync(lockFilePath);
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user