Bump script updated to also bump plugin versions

Summary:
Updated "bump-versions" script to also bump version of all plugins when we're releasing Flipper.

Changelog: Versions of bundled plugins will be matching Flipper core version.

Reviewed By: mweststrate

Differential Revision: D22042960

fbshipit-source-id: b2d361ce9cbfc8022e12aecbbf7c6101029844e5
This commit is contained in:
Anton Nikolaev
2020-06-15 09:26:43 -07:00
committed by Facebook GitHub Bot
parent c628ad7cbd
commit 696ca8e604
2 changed files with 23 additions and 6 deletions

View File

@@ -14,6 +14,7 @@ export const appDir = path.join(rootDir, 'app');
export const staticDir = path.join(rootDir, 'static');
export const defaultPluginsIndexDir = path.join(staticDir, 'defaultPlugins');
export const pluginsDir = path.join(rootDir, 'plugins');
export const fbPluginsDir = path.join(pluginsDir, 'fb');
export const headlessDir = path.join(rootDir, 'headless');
export const distDir = path.resolve(rootDir, '..', 'dist');
export const babelTransformationsDir = path.resolve(

View File

@@ -7,7 +7,7 @@
* @format
*/
import {rootDir, pluginsDir} from './paths';
import {rootDir, pluginsDir, fbPluginsDir} from './paths';
import fs from 'fs-extra';
import path from 'path';
import {promisify} from 'util';
@@ -28,7 +28,12 @@ export interface Workspaces {
packages: Package[];
}
export async function getWorkspaces(): Promise<Workspaces> {
async function getWorkspacesByRoot(
rootDir: string,
): Promise<Workspaces | null> {
if (!(await fs.pathExists(path.join(rootDir, 'package.json')))) {
return null;
}
const rootPackageJson = await fs.readJson(path.join(rootDir, 'package.json'));
const packageGlobs = rootPackageJson.workspaces.packages as string[];
const packages = await pmap(
@@ -59,6 +64,19 @@ export async function getWorkspaces(): Promise<Workspaces> {
};
}
export async function getWorkspaces(): Promise<Workspaces> {
const rootWorkspaces = await getWorkspacesByRoot(rootDir);
const fbWorkspaces = await getWorkspacesByRoot(fbPluginsDir);
if (!fbWorkspaces) {
return rootWorkspaces!;
}
const mergedWorkspaces: Workspaces = {
rootPackage: rootWorkspaces!.rootPackage,
packages: [...rootWorkspaces!.packages, ...fbWorkspaces.packages],
};
return mergedWorkspaces;
}
export async function bumpVersions({
newVersion,
dryRun,
@@ -107,13 +125,11 @@ async function bumpWorkspaceVersions(
): Promise<string> {
newVersion = newVersion || (rootPackage.json.version as string);
const allPackages = [rootPackage, ...packages];
const localPackageNames = packages
.filter((pkg) => !pkg.isPlugin)
.map(({json}) => json.name as string);
const localPackageNames = packages.map(({json}) => json.name as string);
for (const pkg of allPackages) {
const {json} = pkg;
let changed = false;
if (json.version !== newVersion && !pkg.isPlugin) {
if (json.version && json.version !== newVersion) {
console.log(
`Bumping version of ${json.name} from ${json.version} to ${newVersion}`,
);