[Poly > Yauzl] Initial Add
This commit is contained in:
parent
88c8a7bc27
commit
b3ffacf472
|
@ -23,15 +23,9 @@ jobs:
|
||||||
with:
|
with:
|
||||||
node-version: 16.x
|
node-version: 16.x
|
||||||
|
|
||||||
- name: NPM Install
|
|
||||||
run: |
|
|
||||||
cd src
|
|
||||||
npm i
|
|
||||||
cd ..
|
|
||||||
npm i -g asar uglify-js
|
|
||||||
|
|
||||||
- name: Pack base asar
|
- name: Pack base asar
|
||||||
run: |
|
run: |
|
||||||
|
npm i -g asar uglify-js
|
||||||
node scripts/strip.js
|
node scripts/strip.js
|
||||||
node scripts/injectPolyfills.js
|
node scripts/injectPolyfills.js
|
||||||
sed -i -e "s/nightly/nightly-$(git rev-parse HEAD | cut -c 1-7)/" src/index.js
|
sed -i -e "s/nightly/nightly-$(git rev-parse HEAD | cut -c 1-7)/" src/index.js
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
// Jank replacement for yauzl by just using unzip where it expects and skipping (speed++, size--)
|
||||||
|
const { spawn } = require('child_process');
|
||||||
|
const { createReadStream, mkdirSync, rmdirSync } = require('original-fs');
|
||||||
|
const { join, basename } = require('path');
|
||||||
|
|
||||||
|
exports.open = async (zipPath, _options, callback) => {
|
||||||
|
const extractPath = join(global.moduleDataPath, basename(zipPath).split('.')[0].split('-')[0]);
|
||||||
|
const listeners = [];
|
||||||
|
log('Yauzl', 'Zip path:', zipPath, 'Extract path:', extractPath);
|
||||||
|
|
||||||
|
const errorOut = (err) => {
|
||||||
|
listeners.error(err);
|
||||||
|
};
|
||||||
|
|
||||||
|
callback(null, {
|
||||||
|
on: (event, listener) => {
|
||||||
|
listeners[event] = listener;
|
||||||
|
},
|
||||||
|
|
||||||
|
readEntry: () => {},
|
||||||
|
openReadStream: () => {},
|
||||||
|
close: () => {}
|
||||||
|
});
|
||||||
|
|
||||||
|
mkdirSync(extractPath, { recursive: true });
|
||||||
|
|
||||||
|
// const proc = spawn('tar', ['-v', '-xf', `"${zipPath.replaceAll('"', '')}"`, '-C', `"${extractPath}"`]);
|
||||||
|
const proc = spawn('unzip', ['-o', `${zipPath.replaceAll('"', '')}`, '-d', `${extractPath}`]);
|
||||||
|
console.log('spawn');
|
||||||
|
proc.stdout.on('data', (data) => {
|
||||||
|
});
|
||||||
|
|
||||||
|
proc.stderr.on('data', (data) => {
|
||||||
|
console.log('stderr', data.toString());
|
||||||
|
errorOut(data.toString());
|
||||||
|
});
|
||||||
|
|
||||||
|
proc.on('error', (err) => {
|
||||||
|
errorOut(err);
|
||||||
|
});
|
||||||
|
|
||||||
|
proc.on('close', async () => {
|
||||||
|
finishedExtract = true;
|
||||||
|
console.log('close');
|
||||||
|
listeners.end();
|
||||||
|
});
|
||||||
|
};
|
|
@ -1,8 +1,5 @@
|
||||||
{
|
{
|
||||||
"name": "discord",
|
"name": "discord",
|
||||||
"description": "Open-source alternative of Discord desktop's app.asar",
|
"description": "Open-source alternative of Discord desktop's app.asar",
|
||||||
"main": "index.js",
|
"main": "index.js"
|
||||||
"dependencies": {
|
|
||||||
"yauzl": "^2.10.0"
|
|
||||||
}
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue