mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Build: Fix final prompt for @grafana/ui npm publish confirmation
Fixes issue of the final confirmation prompt (the one to confirm the actual npm publish) being invisible, making it impossible to release by anyone but me. Also, before the release is created I'm assuring previous release bundle is remove (otherwise tests and checks would fail)
This commit is contained in:
parent
c31aaa1a25
commit
e9130210cc
@ -7,7 +7,7 @@ import { Task, TaskRunner } from './task';
|
|||||||
|
|
||||||
let distDir, cwd;
|
let distDir, cwd;
|
||||||
|
|
||||||
const clean = useSpinner<void>('Cleaning', async () => await execa('npm', ['run', 'clean']));
|
export const clean = useSpinner<void>('Cleaning', async () => await execa('npm', ['run', 'clean']));
|
||||||
|
|
||||||
const compile = useSpinner<void>('Compiling sources', () => execa('tsc', ['-p', './tsconfig.build.json']));
|
const compile = useSpinner<void>('Compiling sources', () => execa('tsc', ['-p', './tsconfig.build.json']));
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import execa from 'execa';
|
import execa from 'execa';
|
||||||
import { execTask } from '../utils/execTask';
|
import { execTask } from '../utils/execTask';
|
||||||
import { changeCwdToGrafanaUiDist, changeCwdToGrafanaUi } from '../utils/cwd';
|
import { changeCwdToGrafanaUiDist, changeCwdToGrafanaUi, restoreCwd } from '../utils/cwd';
|
||||||
import semver from 'semver';
|
import semver from 'semver';
|
||||||
import inquirer from 'inquirer';
|
import inquirer from 'inquirer';
|
||||||
import chalk from 'chalk';
|
import chalk from 'chalk';
|
||||||
import { useSpinner } from '../utils/useSpinner';
|
import { useSpinner } from '../utils/useSpinner';
|
||||||
import { savePackage, buildTask } from './grafanaui.build';
|
import { savePackage, buildTask, clean } from './grafanaui.build';
|
||||||
import { TaskRunner, Task } from './task';
|
import { TaskRunner, Task } from './task';
|
||||||
|
|
||||||
type VersionBumpType = 'prerelease' | 'patch' | 'minor' | 'major';
|
type VersionBumpType = 'prerelease' | 'patch' | 'minor' | 'major';
|
||||||
@ -81,12 +81,6 @@ const bumpVersion = (version: string) =>
|
|||||||
const publishPackage = (name: string, version: string) =>
|
const publishPackage = (name: string, version: string) =>
|
||||||
useSpinner<void>(`Publishing ${name} @ ${version} to npm registry...`, async () => {
|
useSpinner<void>(`Publishing ${name} @ ${version} to npm registry...`, async () => {
|
||||||
changeCwdToGrafanaUiDist();
|
changeCwdToGrafanaUiDist();
|
||||||
console.log(chalk.yellowBright.bold(`\nReview dist package.json before proceeding!\n`));
|
|
||||||
const { confirmed } = await promptConfirm('Are you ready to publish to npm?');
|
|
||||||
|
|
||||||
if (!confirmed) {
|
|
||||||
process.exit();
|
|
||||||
}
|
|
||||||
await execa('npm', ['publish', '--access', 'public']);
|
await execa('npm', ['publish', '--access', 'public']);
|
||||||
})();
|
})();
|
||||||
|
|
||||||
@ -111,13 +105,18 @@ const releaseTaskRunner: TaskRunner<ReleaseTaskOptions> = async ({
|
|||||||
usePackageJsonVersion,
|
usePackageJsonVersion,
|
||||||
createVersionCommit,
|
createVersionCommit,
|
||||||
}) => {
|
}) => {
|
||||||
await runChecksAndTests();
|
changeCwdToGrafanaUi();
|
||||||
|
await clean(); // Clean previous build if exists
|
||||||
|
restoreCwd();
|
||||||
|
|
||||||
if (publishToNpm) {
|
if (publishToNpm) {
|
||||||
// TODO: Ensure release branch
|
// TODO: Ensure release branch
|
||||||
// When need to update this when we star keeping @grafana/ui releases in sync with core
|
// When need to update this when we star keeping @grafana/ui releases in sync with core
|
||||||
await ensureMasterBranch();
|
await ensureMasterBranch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
runChecksAndTests();
|
||||||
|
|
||||||
await execTask(buildTask)();
|
await execTask(buildTask)();
|
||||||
|
|
||||||
let releaseConfirmed = false;
|
let releaseConfirmed = false;
|
||||||
@ -169,6 +168,13 @@ const releaseTaskRunner: TaskRunner<ReleaseTaskOptions> = async ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (publishToNpm) {
|
if (publishToNpm) {
|
||||||
|
console.log(chalk.yellowBright.bold(`\nReview dist package.json before proceeding!\n`));
|
||||||
|
const { confirmed } = await promptConfirm('Are you ready to publish to npm?');
|
||||||
|
|
||||||
|
if (!confirmed) {
|
||||||
|
process.exit();
|
||||||
|
}
|
||||||
|
|
||||||
await publishPackage(pkg.name, nextVersion);
|
await publishPackage(pkg.name, nextVersion);
|
||||||
console.log(chalk.green(`\nVersion ${nextVersion} of ${pkg.name} succesfully released!`));
|
console.log(chalk.green(`\nVersion ${nextVersion} of ${pkg.name} succesfully released!`));
|
||||||
console.log(chalk.yellow(`\nUpdated @grafana/ui/package.json with version bump created.`));
|
console.log(chalk.yellow(`\nUpdated @grafana/ui/package.json with version bump created.`));
|
||||||
|
Loading…
Reference in New Issue
Block a user