Merge plugin package.json from public and fb-internal parts
Summary: Allow splitting package.json to public one and fb-internal one located in "fb/package.json". When plugin is packaged, fields in package.json are overwritten by fields from "fb/package.json" if they exist. This give us a way to specify additional metadata which only make sense internally (e.g. oncall and internal links to docs and support). Reviewed By: mweststrate Differential Revision: D28542101 fbshipit-source-id: c0167461897a994e5731aaf0fe625de052eda864
This commit is contained in:
committed by
Facebook GitHub Bot
parent
d680a2807f
commit
5ae104cc59
@@ -66,6 +66,7 @@ async function buildPlugin() {
|
||||
const outputUnpackedArg = argv['output-unpacked'];
|
||||
const minFlipperVersion = argv['min-flipper-version'];
|
||||
const packageJsonPath = path.join(pluginDir, 'package.json');
|
||||
const packageJsonOverridePath = path.join(pluginDir, 'fb', 'package.json');
|
||||
await runBuild(pluginDir, false);
|
||||
const checksum = await computePackageChecksum(pluginDir);
|
||||
if (previousChecksum !== checksum && argv.version) {
|
||||
@@ -86,7 +87,14 @@ async function buildPlugin() {
|
||||
const packageJsonBackupPath = path.join(tmpDir, 'package.json');
|
||||
await fs.copy(packageJsonPath, packageJsonBackupPath, {overwrite: true});
|
||||
try {
|
||||
const packageJson = await fs.readJson(packageJsonPath);
|
||||
const packageJsonOverride =
|
||||
(await fs.readJson(packageJsonOverridePath, {
|
||||
throws: false,
|
||||
})) ?? {};
|
||||
const packageJson = Object.assign(
|
||||
await fs.readJson(packageJsonPath),
|
||||
packageJsonOverride,
|
||||
);
|
||||
if (minFlipperVersion) {
|
||||
if (!packageJson.engines) {
|
||||
packageJson.engines = {};
|
||||
|
||||
Reference in New Issue
Block a user