Skip to content

Commit

Permalink
Update node example
Browse files Browse the repository at this point in the history
  • Loading branch information
sleeyax committed Apr 19, 2024
1 parent c0890a8 commit 3924c13
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 138 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,18 @@ jobs:
fail-fast: false
matrix:
node-version:
- 16
- 18
- 20
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
# test project
- run: npm install --ignore-scripts
- run: npm run prepare
- run: npm test
- run: npm test
# test node example
- run: cd example/node
- run: npm install
- run: npm run build
- run: npm test
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
"typescript.tsdk": "node_modules/typescript/lib",
"cSpell.words": [
"asar"
]
}
9 changes: 6 additions & 3 deletions example/node/build.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const asar = require('asar');
const asar = require('@electron/asar');
const asarmor = require('../../build/src');
const {original, protected} = require('./constants');

Expand All @@ -7,9 +7,12 @@ const {original, protected} = require('./constants');
await asar.createPackageFromFiles('.', original, ['src/index.js', 'src/sum.js', 'package.json']);
console.log('built archive:', original);

await asarmor.encrypt({src: original, dst: protected, key: '0x1e,0x79,0x7a,0x06,0x52,0xbe,0x5c,0x69,0xa1,0x8d,0x51,0x11,0x5e,0x4f,0xd4,0xfe,0x5d,0x66,0x03,0x8d,0x40,0x86,0xf2,0x53,0x2f,0x32,0xf0,0x84,0xef,0x27,0x3e,0xa1'});
console.log('encrypted archive:', protected);

// apply asarmor patches
const archive = await asarmor.open(original);
await archive.createBackup();
const archive = await asarmor.open(protected);
archive.patch(asarmor.createBloatPatch(1));
const path = await archive.write(protected);
console.log('protected archive:', path);
})();
144 changes: 42 additions & 102 deletions example/node/package-lock.json

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

4 changes: 2 additions & 2 deletions example/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"author": "Sleeyax",
"license": "MIT",
"dependencies": {
"asar": "^3.1.0",
"asar-node": "^2.1.3"
"@electron/asar": "^3.2.9",
"asar-node": "^3.1.1"
}
}
Loading

0 comments on commit 3924c13

Please sign in to comment.