diff --git a/desktop/scripts/paths.ts b/desktop/scripts/paths.ts index ce9505985..a6f1fd704 100644 --- a/desktop/scripts/paths.ts +++ b/desktop/scripts/paths.ts @@ -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( diff --git a/desktop/scripts/workspaces.ts b/desktop/scripts/workspaces.ts index 56f9c74c7..61a35181c 100644 --- a/desktop/scripts/workspaces.ts +++ b/desktop/scripts/workspaces.ts @@ -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 { +async function getWorkspacesByRoot( + rootDir: string, +): Promise { + 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 { }; } +export async function getWorkspaces(): Promise { + 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 { 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}`, );