Skip to content

Commit

Permalink
Fixed Windows build: using"diff" instead of patch (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxdaniel98-sf authored Aug 10, 2023
1 parent 03fd1f7 commit c3e77b1
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 13 deletions.
32 changes: 24 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"dependencies": {
"debug": "^4.1.1",
"del": "^5.1.0",
"diff": "^5.1.0",
"git-clone": "^0.1.0",
"node-addon-api": "^5.0.0",
"node-gyp": "^9.3.0"
Expand Down
20 changes: 15 additions & 5 deletions scripts/build-srt-sdk.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

const path = require('path');
const fs = require('fs');
const jsdiff = require('diff');
const process = require('process');
const clone = require('git-clone');
const del = require('del');
Expand Down Expand Up @@ -36,12 +37,21 @@ if (!fs.existsSync(srtSourcePath)) {
if (fs.existsSync(srtSourcePath)) del.sync(srtSourcePath);
process.exit(1);
}

console.log("Patch build script");
const patch = spawnSync('patch', [ 'configure-data.tcl', '<', '../../scripts/configure-data.tcl.patch' ], { cwd: srtSourcePath, shell: true, stdio: 'inherit' });
if (patch.status) {
process.exit(patch.status);
}

// Read the source file and the patch file
const sourceFilePath = path.join(srtSourcePath, 'configure-data.tcl');
const patchFilePath = path.join(__dirname, 'configure-data.tcl.patch');

// Read the source file and the patch file
const sourceContent = fs.readFileSync(sourceFilePath, 'utf8');
const patchContent = fs.readFileSync(patchFilePath, 'utf8');

// Apply the patch
const patchedContent = jsdiff.applyPatch(sourceContent, patchContent);

// Write the patched content back to the source file
fs.writeFileSync(sourceFilePath, patchedContent, 'utf8');

build();
});
Expand Down

0 comments on commit c3e77b1

Please sign in to comment.