From 34e5aaec6ede7ac9f0157fc1d06ea524dbf34408 Mon Sep 17 00:00:00 2001 From: Dave Kozma Date: Fri, 21 Jul 2023 06:14:59 -0400 Subject: [PATCH 1/2] Don't check for presence of `C2PA_LIBRARY_PATH` on `postinstall` This is so that downstream applications can do their own postinstall to download a custom binary. --- scripts/postinstall.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/scripts/postinstall.js b/scripts/postinstall.js index ffa1ed6..aeddce2 100644 --- a/scripts/postinstall.js +++ b/scripts/postinstall.js @@ -25,7 +25,7 @@ const execCallback = (err, stdout, stderr) => { async function fileExists(path) { try { - const result = await stat(path); + await stat(path); return true; } catch (err) { if (err.code === 'ENOENT') { @@ -57,17 +57,10 @@ async function main() { const distRoot = resolve(appRoot, 'dist'); const cargoDistPath = resolve(distRoot, 'Cargo.toml'); const libraryOverridePath = process.env.C2PA_LIBRARY_PATH; - const overridePathExists = - libraryOverridePath && (await fileExists(libraryOverridePath)); const cargoDistPathExists = await fileExists(cargoDistPath); - if (libraryOverridePath && !overridePathExists) { - process.error(`C2PA_LIBRARY_PATH (${libraryOverridePath}) doesn't exist`); - process.exit(1); - } - if (libraryOverridePath) { - console.log('Skipping Rust build'); + console.log('Skipping Rust build since C2PA_LIBRARY_PATH is set'); } else if (cargoDistPathExists) { await buildRust(distRoot); } else { From a1e02c19b9a60a819df0bef810784a6c87f85f97 Mon Sep 17 00:00:00 2001 From: Dave Kozma Date: Fri, 21 Jul 2023 06:17:27 -0400 Subject: [PATCH 2/2] Add changeset --- .changeset/strong-masks-pay.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/strong-masks-pay.md diff --git a/.changeset/strong-masks-pay.md b/.changeset/strong-masks-pay.md new file mode 100644 index 0000000..1a534ee --- /dev/null +++ b/.changeset/strong-masks-pay.md @@ -0,0 +1,5 @@ +--- +'c2pa-node': patch +--- + +Don't check for presence of `C2PA_LIBRARY_PATH` on `postinstall`