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,
|
promptPluginType,
|
||||||
removeGitFiles,
|
removeGitFiles,
|
||||||
verifyGitExists,
|
verifyGitExists,
|
||||||
|
removeLockFile,
|
||||||
} from './plugin/create';
|
} from './plugin/create';
|
||||||
import { Task, TaskRunner } from './task';
|
import { Task, TaskRunner } from './task';
|
||||||
|
|
||||||
@ -40,10 +41,14 @@ const pluginCreateRunner: TaskRunner<PluginCreateOptions> = async ({ name }) =>
|
|||||||
// 5. Update json files (package.json, src/plugin.json)
|
// 5. Update json files (package.json, src/plugin.json)
|
||||||
await prepareJsonFiles({ type: type, pluginDetails, pluginPath: destPath });
|
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);
|
await removeGitFiles(destPath);
|
||||||
|
|
||||||
// 7. Promote Grafana Tutorials :)
|
// 8. Promote Grafana Tutorials :)
|
||||||
printGrafanaTutorialsDetails(type);
|
printGrafanaTutorialsDetails(type);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import chalk from 'chalk';
|
import chalk from 'chalk';
|
||||||
import commandExists from 'command-exists';
|
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 { prompt } from 'inquirer';
|
||||||
import { kebabCase } from 'lodash';
|
import { kebabCase } from 'lodash';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
@ -177,6 +177,7 @@ export const printGrafanaTutorialsDetails = (type: PluginType) => {
|
|||||||
console.group();
|
console.group();
|
||||||
console.log();
|
console.log();
|
||||||
console.log(chalk.bold.yellow(`Congrats! You have just created ${PluginNames[type]}.`));
|
console.log(chalk.bold.yellow(`Congrats! You have just created ${PluginNames[type]}.`));
|
||||||
|
console.log('Please run `yarn install` to install frontend dependencies.');
|
||||||
console.log();
|
console.log();
|
||||||
if (type !== 'backend-datasource-plugin') {
|
if (type !== 'backend-datasource-plugin') {
|
||||||
console.log(`${PluginNames[type]} tutorial: ${TutorialPaths[type]}`);
|
console.log(`${PluginNames[type]} tutorial: ${TutorialPaths[type]}`);
|
||||||
@ -188,3 +189,10 @@ export const printGrafanaTutorialsDetails = (type: PluginType) => {
|
|||||||
console.groupEnd();
|
console.groupEnd();
|
||||||
};
|
};
|
||||||
/* eslint-enable no-console */
|
/* 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