Update version number for default plugins
Summary: Prior to this fix, plugins were copied with verion 0.0.0 which forced them to be updated with "newer" versions from marketplace Reviewed By: nikoant Differential Revision: D34457087 fbshipit-source-id: a3242578c570447f8ecf9c62bcaa69e5d9688c42
This commit is contained in:
committed by
Facebook GitHub Bot
parent
b82cdfb664
commit
8ee788239b
@@ -142,7 +142,7 @@ if (argv['default-plugins-dir']) {
|
|||||||
process.env.FLIPPER_DEFAULT_PLUGINS_DIR = argv['default-plugins-dir'];
|
process.env.FLIPPER_DEFAULT_PLUGINS_DIR = argv['default-plugins-dir'];
|
||||||
}
|
}
|
||||||
|
|
||||||
async function copyStaticResources(outDir: string) {
|
async function copyStaticResources(outDir: string, versionNumber: string) {
|
||||||
console.log(`⚙️ Copying default plugins...`);
|
console.log(`⚙️ Copying default plugins...`);
|
||||||
|
|
||||||
const plugins = await fs.readdir(defaultPluginsDir);
|
const plugins = await fs.readdir(defaultPluginsDir);
|
||||||
@@ -166,12 +166,15 @@ async function copyStaticResources(outDir: string) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// for plugins, only copy package.json & dist, to keep impact minimal
|
// Update version number of the default plugins to prevent them from updating from marketplace
|
||||||
await fs.copy(
|
// Preserve current plugin versions if plugins were previously downloaded from marketplace during the build on Sandcastle.
|
||||||
path.join(source, 'package.json'),
|
// See build-utils:prepareDefaultPlugins
|
||||||
path.join(target, 'package.json'),
|
packageJson.version =
|
||||||
);
|
packageJson.version === '0.0.0' ? versionNumber : packageJson.version;
|
||||||
|
|
||||||
|
// for plugins, only keep package.json & dist, to keep impact minimal
|
||||||
await fs.copy(path.join(source, 'dist'), path.join(target, 'dist'));
|
await fs.copy(path.join(source, 'dist'), path.join(target, 'dist'));
|
||||||
|
await fs.writeJSON(path.join(target, 'package.json'), packageJson);
|
||||||
} else {
|
} else {
|
||||||
await fs.copy(source, target);
|
await fs.copy(source, target);
|
||||||
}
|
}
|
||||||
@@ -300,7 +303,7 @@ async function buildServerRelease() {
|
|||||||
|
|
||||||
await compileServerMain(false);
|
await compileServerMain(false);
|
||||||
await prepareDefaultPlugins(argv.channel === 'insiders');
|
await prepareDefaultPlugins(argv.channel === 'insiders');
|
||||||
await copyStaticResources(dir);
|
await copyStaticResources(dir, versionNumber);
|
||||||
await downloadIcons(path.join(dir, 'static'));
|
await downloadIcons(path.join(dir, 'static'));
|
||||||
await buildBrowserBundle(path.join(dir, 'static'), false);
|
await buildBrowserBundle(path.join(dir, 'static'), false);
|
||||||
await modifyPackageManifest(dir, versionNumber, hgRevision, argv.channel);
|
await modifyPackageManifest(dir, versionNumber, hgRevision, argv.channel);
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ export async function prepareDefaultPlugins(isInsidersBuild: boolean = false) {
|
|||||||
await fs.emptyDir(defaultPluginsDir);
|
await fs.emptyDir(defaultPluginsDir);
|
||||||
const forcedDefaultPluginsDir = process.env.FLIPPER_DEFAULT_PLUGINS_DIR;
|
const forcedDefaultPluginsDir = process.env.FLIPPER_DEFAULT_PLUGINS_DIR;
|
||||||
if (forcedDefaultPluginsDir) {
|
if (forcedDefaultPluginsDir) {
|
||||||
|
// Used for internal builds. Sandcastle downloads plugins from the marketplace to preserve their versions if they are not updated.
|
||||||
console.log(
|
console.log(
|
||||||
`⚙️ Copying the provided default plugins dir "${forcedDefaultPluginsDir}"...`,
|
`⚙️ Copying the provided default plugins dir "${forcedDefaultPluginsDir}"...`,
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user