Fail build when plugins don't compile

Summary:
This adds an option to the compilePlugin function that
allows specifying whether or not to throw an exception
if compiling a plugin fails.

While this seems like a sensible default while development,
it seems like a pretty bad idea when building releases.

Reviewed By: jknoxville

Differential Revision: D12904570

fbshipit-source-id: aee365074af129296a9d493804b959cb9513f9cc
This commit is contained in:
Pascal Hartig
2018-11-04 04:34:12 -08:00
committed by Facebook Github Bot
parent 870f6017ab
commit ac6575850e
2 changed files with 63 additions and 22 deletions

View File

@@ -190,17 +190,20 @@ function compileDefaultPlugins(buildFolder) {
path.join(__dirname, '..', 'src', 'fb', 'plugins'),
],
defaultPluginDir,
).then(defaultPlugins =>
fs.writeFileSync(
path.join(defaultPluginDir, 'index.json'),
JSON.stringify(
defaultPlugins.map(plugin => ({
...plugin,
out: path.join(defaultPluginFolder, path.parse(plugin.out).base),
})),
{force: true, failSilently: false},
)
.then(defaultPlugins =>
fs.writeFileSync(
path.join(defaultPluginDir, 'index.json'),
JSON.stringify(
defaultPlugins.map(plugin => ({
...plugin,
out: path.join(defaultPluginFolder, path.parse(plugin.out).base),
})),
),
),
),
);
)
.catch(die);
}
(async () => {