Compatibility with pnpm
This commit is contained in:
parent
3a3cad1d03
commit
2a6d9a51fe
17
deps/download.js
vendored
17
deps/download.js
vendored
@ -12,22 +12,26 @@ const EXTENSION_VERSION = '0.2.1-asm2';
|
||||
const TAG = [SQLCIPHER_VERSION, EXTENSION_VERSION].join('--');
|
||||
const URL = `${BASE_URI}/sqlcipher-v2-${TAG}-${HASH}.tar.gz`;
|
||||
|
||||
const tmpFile = path.join(__dirname, 'unverified.tmp');
|
||||
const finalFile = path.join(__dirname, 'sqlcipher.tar.gz');
|
||||
const buildFile = process.argv[2];
|
||||
const targetFile = path.join(__dirname, 'sqlcipher.tar.gz');
|
||||
const tmpFile = `${targetFile}.tmp`;
|
||||
|
||||
async function main() {
|
||||
if (fs.statSync(finalFile, { throwIfNoEntry: false })) {
|
||||
if (fs.statSync(targetFile, { throwIfNoEntry: false })) {
|
||||
const hash = crypto.createHash('sha256');
|
||||
const existingHash = await pipeline(
|
||||
fs.createReadStream(finalFile),
|
||||
fs.createReadStream(targetFile),
|
||||
hash,
|
||||
);
|
||||
if (hash.digest('hex') === HASH) {
|
||||
console.log('local build artifact is up-to-date');
|
||||
fs.copyFileSync(targetFile, buildFile);
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('local build artifact is outdated');
|
||||
} else {
|
||||
console.log('local build artifact is absent');
|
||||
}
|
||||
download();
|
||||
}
|
||||
@ -54,8 +58,9 @@ function download() {
|
||||
throw new Error(`Digest mismatch. Expected ${HASH} got ${actualDigest}`);
|
||||
}
|
||||
|
||||
fs.renameSync(tmpFile, finalFile);
|
||||
})
|
||||
fs.renameSync(tmpFile, targetFile);
|
||||
fs.copyFileSync(targetFile, buildFile);
|
||||
});
|
||||
}
|
||||
|
||||
main();
|
||||
|
||||
4
deps/extract.js
vendored
4
deps/extract.js
vendored
@ -2,8 +2,8 @@
|
||||
const path = require('path');
|
||||
const tar = require('tar');
|
||||
|
||||
const dest = process.argv[2];
|
||||
const source = path.join(__dirname, 'sqlcipher.tar.gz');
|
||||
const source = process.argv[2];
|
||||
const dest = process.argv[3];
|
||||
|
||||
process.on('unhandledRejection', (err) => { throw err; });
|
||||
|
||||
|
||||
17
deps/sqlite3.gyp
vendored
17
deps/sqlite3.gyp
vendored
@ -8,13 +8,26 @@
|
||||
{
|
||||
'includes': ['common.gypi'],
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'download_sqlite3',
|
||||
'type': 'none',
|
||||
'hard_dependency': 1,
|
||||
'actions': [{
|
||||
'action_name': 'download_sqlite3',
|
||||
'inputs': ['download.js'],
|
||||
'outputs': [
|
||||
'<(SHARED_INTERMEDIATE_DIR)/sqlcipher.tar.gz'
|
||||
],
|
||||
'action': ['node', 'download.js', '<(SHARED_INTERMEDIATE_DIR)/sqlcipher.tar.gz'],
|
||||
}],
|
||||
},
|
||||
{
|
||||
'target_name': 'locate_sqlite3',
|
||||
'type': 'none',
|
||||
'hard_dependency': 1,
|
||||
'actions': [{
|
||||
'action_name': 'extract_sqlite3',
|
||||
'inputs': ['sqlcipher.tar.gz'],
|
||||
'inputs': ['<(SHARED_INTERMEDIATE_DIR)/sqlcipher.tar.gz'],
|
||||
'outputs': [
|
||||
'<(SHARED_INTERMEDIATE_DIR)/sqlite3/sqlite3.c',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/sqlite3/sqlite3.h',
|
||||
@ -27,7 +40,7 @@
|
||||
],
|
||||
}],
|
||||
],
|
||||
'action': ['node', 'extract.js', '<(SHARED_INTERMEDIATE_DIR)/sqlite3'],
|
||||
'action': ['node', 'extract.js', '<(SHARED_INTERMEDIATE_DIR)/sqlcipher.tar.gz', '<(SHARED_INTERMEDIATE_DIR)/sqlite3'],
|
||||
}],
|
||||
},
|
||||
{
|
||||
|
||||
@ -28,19 +28,14 @@
|
||||
"cli-color": "^2.0.2",
|
||||
"fs-extra": "^10.1.0",
|
||||
"mocha": "^8.3.2",
|
||||
"node-gyp": "^9.1.0",
|
||||
"nodemark": "^0.3.0",
|
||||
"sqlite": "^4.0.23",
|
||||
"sqlite3": "^5.0.2"
|
||||
},
|
||||
"scripts": {
|
||||
"format": "xcrun clang-format --style=chromium -Werror --verbose -i src/*.cpp src/*.hpp",
|
||||
"install": "npm run download && npm run build-release",
|
||||
"build-release": "node-gyp rebuild --release",
|
||||
"build-debug": "node-gyp rebuild --debug",
|
||||
"test": "mocha --exit --slow=75 --timeout=5000",
|
||||
"benchmark": "node benchmark",
|
||||
"download": "node ./deps/download.js"
|
||||
"benchmark": "node benchmark"
|
||||
},
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
|
||||
Loading…
Reference in New Issue
Block a user