Commit de3a7610 by Steven Vachon Committed by GitHub

Print Node.js and Toolkit versions (#30230)

* Minor changes

* Print Node.js and toolkit versions when building
parent 24cfab6c
// @ts-ignore // @ts-ignore
import chalk from 'chalk';
import program from 'commander'; import program from 'commander';
import { promises as fs } from 'fs';
import { execTask } from './utils/execTask'; import { execTask } from './utils/execTask';
import chalk from 'chalk';
import { startTask } from './tasks/core.start'; import { startTask } from './tasks/core.start';
import { changelogTask } from './tasks/changelog'; import { changelogTask } from './tasks/changelog';
import { cherryPickTask } from './tasks/cherrypick'; import { cherryPickTask } from './tasks/cherrypick';
...@@ -130,6 +131,12 @@ export const run = (includeInternalScripts = false) => { ...@@ -130,6 +131,12 @@ export const run = (includeInternalScripts = false) => {
}); });
} }
program.option('-v, --version', 'Toolkit version').action(async () => {
const pkg = await fs.readFile(`${__dirname}/../../package.json`, 'utf8');
const { version } = JSON.parse(pkg);
console.log(`v${version}`);
});
program program
.command('plugin:create [name]') .command('plugin:create [name]')
.description('Creates plugin from template') .description('Creates plugin from template')
......
...@@ -58,6 +58,14 @@ export const prepare = () => ...@@ -58,6 +58,14 @@ export const prepare = () =>
]) ])
); );
export const versions = async () => {
const nodeVersion = await execa('node', ['--version']);
console.log(`Using Node.js ${nodeVersion}`);
const toolkitVersion = await execa('grafana-toolkit', ['--version']);
console.log(`Using @grafana/toolkit ${toolkitVersion}`);
};
// @ts-ignore // @ts-ignore
const typecheckPlugin = () => useSpinner('Typechecking', () => execa('tsc', ['--noEmit'])); const typecheckPlugin = () => useSpinner('Typechecking', () => execa('tsc', ['--noEmit']));
...@@ -121,6 +129,7 @@ export const pluginBuildRunner: TaskRunner<PluginBuildOptions> = async ({ ...@@ -121,6 +129,7 @@ export const pluginBuildRunner: TaskRunner<PluginBuildOptions> = async ({
maxJestWorkers, maxJestWorkers,
preserveConsole, preserveConsole,
}) => { }) => {
await versions();
await prepare(); await prepare();
await lintPlugin({ fix: false }); await lintPlugin({ fix: false });
await testPlugin({ updateSnapshot: false, coverage, maxWorkers: maxJestWorkers, watch: false }); await testPlugin({ updateSnapshot: false, coverage, maxWorkers: maxJestWorkers, watch: false });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment