Add internal plugins as workspaces to single package.json

Summary: We cannot just add internal plugins as workspaces to the root package.json in "sonar/desktop" as they are not open-sourced, so public build will break. Instead, I have created root package.json for internal plugins and added all internal plugins as workspaces there. This means all these plugins will use the single root yarn.lock and installation of their dependencies will be faster. This also means that plugins can declare dependencies to other local packages included into workspaces and they will be symlinked automatically.

Reviewed By: mweststrate

Differential Revision: D20806237

fbshipit-source-id: f8b3327166963dec7da8ac74079682aebe4527e1
This commit is contained in:
Anton Nikolaev
2020-04-14 07:10:38 -07:00
committed by Facebook GitHub Bot
parent bcc133026e
commit 452c52c291
10 changed files with 78 additions and 91 deletions

View File

@@ -15,7 +15,8 @@ import path from 'path';
import fs from 'fs-extra';
import {spawn} from 'promisify-child-process';
import recursiveReaddir from 'recursive-readdir';
import {default as getWatchFolders} from '../static/get-watch-folders';
import getWatchFolders from '../static/get-watch-folders';
import getAppWatchFolders from './get-app-watch-folders';
import {
appDir,
staticDir,
@@ -106,12 +107,10 @@ export async function compileHeadless(buildFolder: string) {
const watchFolders = [
headlessDir,
...(await getWatchFolders(staticDir)),
...(await getWatchFolders(appDir)),
path.join(pluginsDir, 'navigation'),
path.join(pluginsDir, 'fb', 'layout', 'sidebar_extensions'),
path.join(pluginsDir, 'fb', 'mobileconfig'),
path.join(pluginsDir, 'fb', 'watch'),
].filter(fs.pathExistsSync);
...(await getAppWatchFolders()),
]
.filter((value, index, self) => self.indexOf(value) === index)
.filter(fs.pathExistsSync);
try {
await compile(
buildFolder,
@@ -127,13 +126,7 @@ export async function compileHeadless(buildFolder: string) {
export async function compileRenderer(buildFolder: string) {
console.log(`⚙️ Compiling renderer bundle...`);
const watchFolders = [
...(await getWatchFolders(appDir)),
path.join(pluginsDir, 'navigation'),
path.join(pluginsDir, 'fb', 'layout', 'sidebar_extensions'),
path.join(pluginsDir, 'fb', 'mobileconfig'),
path.join(pluginsDir, 'fb', 'watch'),
].filter(fs.pathExistsSync);
const watchFolders = await getAppWatchFolders();
try {
await compile(
buildFolder,