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:
committed by
Facebook GitHub Bot
parent
c628ad7cbd
commit
696ca8e604
@@ -14,6 +14,7 @@ export const appDir = path.join(rootDir, 'app');
|
|||||||
export const staticDir = path.join(rootDir, 'static');
|
export const staticDir = path.join(rootDir, 'static');
|
||||||
export const defaultPluginsIndexDir = path.join(staticDir, 'defaultPlugins');
|
export const defaultPluginsIndexDir = path.join(staticDir, 'defaultPlugins');
|
||||||
export const pluginsDir = path.join(rootDir, 'plugins');
|
export const pluginsDir = path.join(rootDir, 'plugins');
|
||||||
|
export const fbPluginsDir = path.join(pluginsDir, 'fb');
|
||||||
export const headlessDir = path.join(rootDir, 'headless');
|
export const headlessDir = path.join(rootDir, 'headless');
|
||||||
export const distDir = path.resolve(rootDir, '..', 'dist');
|
export const distDir = path.resolve(rootDir, '..', 'dist');
|
||||||
export const babelTransformationsDir = path.resolve(
|
export const babelTransformationsDir = path.resolve(
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
* @format
|
* @format
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {rootDir, pluginsDir} from './paths';
|
import {rootDir, pluginsDir, fbPluginsDir} from './paths';
|
||||||
import fs from 'fs-extra';
|
import fs from 'fs-extra';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import {promisify} from 'util';
|
import {promisify} from 'util';
|
||||||
@@ -28,7 +28,12 @@ export interface Workspaces {
|
|||||||
packages: Package[];
|
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 rootPackageJson = await fs.readJson(path.join(rootDir, 'package.json'));
|
||||||
const packageGlobs = rootPackageJson.workspaces.packages as string[];
|
const packageGlobs = rootPackageJson.workspaces.packages as string[];
|
||||||
const packages = await pmap(
|
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({
|
export async function bumpVersions({
|
||||||
newVersion,
|
newVersion,
|
||||||
dryRun,
|
dryRun,
|
||||||
@@ -107,13 +125,11 @@ async function bumpWorkspaceVersions(
|
|||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
newVersion = newVersion || (rootPackage.json.version as string);
|
newVersion = newVersion || (rootPackage.json.version as string);
|
||||||
const allPackages = [rootPackage, ...packages];
|
const allPackages = [rootPackage, ...packages];
|
||||||
const localPackageNames = packages
|
const localPackageNames = packages.map(({json}) => json.name as string);
|
||||||
.filter((pkg) => !pkg.isPlugin)
|
|
||||||
.map(({json}) => json.name as string);
|
|
||||||
for (const pkg of allPackages) {
|
for (const pkg of allPackages) {
|
||||||
const {json} = pkg;
|
const {json} = pkg;
|
||||||
let changed = false;
|
let changed = false;
|
||||||
if (json.version !== newVersion && !pkg.isPlugin) {
|
if (json.version && json.version !== newVersion) {
|
||||||
console.log(
|
console.log(
|
||||||
`Bumping version of ${json.name} from ${json.version} to ${newVersion}`,
|
`Bumping version of ${json.name} from ${json.version} to ${newVersion}`,
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user