Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't check for presence of C2PA_LIBRARY_PATH on postinstall #18

Merged
merged 2 commits into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/strong-masks-pay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'c2pa-node': patch
---

Don't check for presence of `C2PA_LIBRARY_PATH` on `postinstall`
11 changes: 2 additions & 9 deletions scripts/postinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down Expand Up @@ -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 {
Expand Down