Update pdf-reader and note-editor, use specific prebuilds, tweak code
This commit is contained in:
parent
3ff650f046
commit
4de31ebb85
5 changed files with 59 additions and 37 deletions
|
@ -1 +1 @@
|
||||||
Subproject commit fb3daf6c7e1d7a91992deeea52889cb9c95972f7
|
Subproject commit 3c75eb213b23da239b5b0c69b9e61ff54a2f2a4c
|
|
@ -1 +1 @@
|
||||||
Subproject commit ac7cae37ae8ba5ea8fc5e0b2a3faebd2d432e65a
|
Subproject commit f147bbaeafd00023bfbd3058a6d7697570da509e
|
|
@ -1,6 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const fs = require('fs-extra');
|
const fs = require('fs-extra');
|
||||||
|
const path = require('path');
|
||||||
const util = require('util');
|
const util = require('util');
|
||||||
const exec = util.promisify(require('child_process').exec);
|
const exec = util.promisify(require('child_process').exec);
|
||||||
const { getSignatures, writeSignatures, onSuccess, onError } = require('./utils');
|
const { getSignatures, writeSignatures, onSuccess, onError } = require('./utils');
|
||||||
|
@ -9,28 +10,35 @@ const { buildsURL } = require('./config');
|
||||||
async function getZoteroNoteEditor(signatures) {
|
async function getZoteroNoteEditor(signatures) {
|
||||||
const t1 = Date.now();
|
const t1 = Date.now();
|
||||||
|
|
||||||
const { stdout } = await exec('git rev-parse HEAD', { cwd: './note-editor' });
|
const modulePath = path.join(__dirname, '..', 'note-editor');
|
||||||
|
|
||||||
|
const { stdout } = await exec('git rev-parse HEAD', { cwd: modulePath });
|
||||||
const hash = stdout.trim();
|
const hash = stdout.trim();
|
||||||
|
|
||||||
if (!('note-editor' in signatures) || signatures['note-editor'].hash !== hash) {
|
if (!('note-editor' in signatures) || signatures['note-editor'].hash !== hash) {
|
||||||
const targetDir = 'build/resource/note-editor/';
|
const targetDir = path.join(__dirname, '..', 'build', 'resource', 'note-editor');
|
||||||
try {
|
try {
|
||||||
const filename = hash + '.zip';
|
const filename = hash + '.zip';
|
||||||
const tmpDir = 'tmp/builds/note-editor/';
|
const tmpDir = path.join(__dirname, '..', 'tmp', 'builds', 'note-editor');
|
||||||
const url = buildsURL + 'client-note-editor/' + filename;
|
const url = buildsURL + 'client-note-editor/' + filename;
|
||||||
|
|
||||||
|
await fs.remove(targetDir);
|
||||||
|
await fs.ensureDir(targetDir);
|
||||||
|
await fs.ensureDir(tmpDir);
|
||||||
|
|
||||||
await exec(
|
await exec(
|
||||||
`mkdir -p ${tmpDir}`
|
`cd ${tmpDir}`
|
||||||
+ `&& cd ${tmpDir}`
|
+ ` && (test -f ${filename} || curl -f ${url} -o ${filename})`
|
||||||
+ `&& (test -f ${filename} || curl -f ${url} -o ${filename})`
|
+ ` && unzip ${filename} zotero/* -d ${targetDir}`
|
||||||
+ `&& rm -rf ../../../${targetDir}`
|
+ ` && mv ${path.join(targetDir, 'zotero', '*')} ${targetDir}`
|
||||||
+ `&& mkdir -p ../../../${targetDir}`
|
|
||||||
+ `&& unzip -o ${filename} -d ../../../${targetDir}`
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
await fs.remove(path.join(targetDir, 'zotero'));
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
await exec('npm ci', { cwd: 'note-editor' });
|
await exec('npm ci', { cwd: modulePath });
|
||||||
await exec('npm run build', { cwd: 'note-editor' });
|
await exec('npm run build', { cwd: modulePath });
|
||||||
await fs.copy('note-editor/build/zotero', targetDir);
|
await fs.copy(path.join(modulePath, 'build', 'zotero'), targetDir);
|
||||||
}
|
}
|
||||||
signatures['note-editor'] = { hash };
|
signatures['note-editor'] = { hash };
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const fs = require('fs-extra');
|
const fs = require('fs-extra');
|
||||||
|
const path = require('path');
|
||||||
const util = require('util');
|
const util = require('util');
|
||||||
const exec = util.promisify(require('child_process').exec);
|
const exec = util.promisify(require('child_process').exec);
|
||||||
const { getSignatures, writeSignatures, onSuccess, onError } = require('./utils');
|
const { getSignatures, writeSignatures, onSuccess, onError } = require('./utils');
|
||||||
|
@ -8,29 +9,36 @@ const { buildsURL } = require('./config');
|
||||||
|
|
||||||
async function getPDFReader(signatures) {
|
async function getPDFReader(signatures) {
|
||||||
const t1 = Date.now();
|
const t1 = Date.now();
|
||||||
|
|
||||||
|
const modulePath = path.join(__dirname, '..', 'pdf-reader');
|
||||||
|
|
||||||
const { stdout } = await exec('git rev-parse HEAD', { cwd: './pdf-reader' });
|
const { stdout } = await exec('git rev-parse HEAD', { cwd: modulePath });
|
||||||
const hash = stdout.trim();
|
const hash = stdout.trim();
|
||||||
|
|
||||||
if (!('pdf-reader' in signatures) || signatures['pdf-reader'].hash !== hash) {
|
if (!('pdf-reader' in signatures) || signatures['pdf-reader'].hash !== hash) {
|
||||||
const targetDir = 'build/resource/pdf-reader/';
|
const targetDir = path.join(__dirname, '..', 'build', 'resource', 'pdf-reader');
|
||||||
try {
|
try {
|
||||||
const filename = hash + '.zip';
|
const filename = hash + '.zip';
|
||||||
const tmpDir = 'tmp/builds/pdf-reader/';
|
const tmpDir = path.join(__dirname, '..', 'tmp', 'builds', 'pdf-reader');
|
||||||
const url = buildsURL + 'client-pdf-reader/' + filename;
|
const url = buildsURL + 'client-pdf-reader/' + filename;
|
||||||
|
|
||||||
|
await fs.remove(targetDir);
|
||||||
|
await fs.ensureDir(targetDir);
|
||||||
|
await fs.ensureDir(tmpDir);
|
||||||
|
|
||||||
await exec(
|
await exec(
|
||||||
`mkdir -p ${tmpDir}`
|
`cd ${tmpDir}`
|
||||||
+ `&& cd ${tmpDir}`
|
+ ` && (test -f ${filename} || curl -f ${url} -o ${filename})`
|
||||||
+ `&& (test -f ${filename} || curl -f ${url} -o ${filename})`
|
+ ` && unzip ${filename} zotero/* -d ${targetDir}`
|
||||||
+ `&& rm -rf ../../../${targetDir}`
|
+ ` && mv ${path.join(targetDir, 'zotero', '*')} ${targetDir}`
|
||||||
+ `&& mkdir -p ../../../${targetDir}`
|
|
||||||
+ `&& unzip -o ${filename} -d ../../../${targetDir}`
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
await fs.remove(path.join(targetDir, 'zotero'));
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
await exec('npm ci', { cwd: 'pdf-reader' });
|
await exec('npm ci', { cwd: modulePath });
|
||||||
await exec('npm run build', { cwd: 'pdf-reader' });
|
await exec('npm run build', { cwd: modulePath });
|
||||||
await fs.copy('pdf-reader/build/zotero', targetDir);
|
await fs.copy(path.join(modulePath, 'build', 'zotero'), targetDir);
|
||||||
}
|
}
|
||||||
signatures['pdf-reader'] = { hash };
|
signatures['pdf-reader'] = { hash };
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const fs = require('fs-extra');
|
const fs = require('fs-extra');
|
||||||
|
const path = require('path');
|
||||||
const util = require('util');
|
const util = require('util');
|
||||||
const exec = util.promisify(require('child_process').exec);
|
const exec = util.promisify(require('child_process').exec);
|
||||||
const { getSignatures, writeSignatures, onSuccess, onError } = require('./utils');
|
const { getSignatures, writeSignatures, onSuccess, onError } = require('./utils');
|
||||||
|
@ -9,27 +10,32 @@ const { buildsURL } = require('./config');
|
||||||
async function getPDFWorker(signatures) {
|
async function getPDFWorker(signatures) {
|
||||||
const t1 = Date.now();
|
const t1 = Date.now();
|
||||||
|
|
||||||
const { stdout } = await exec('git rev-parse HEAD', { cwd: 'pdf-worker' });
|
const modulePath = path.join(__dirname, '..', 'pdf-worker');
|
||||||
|
|
||||||
|
const { stdout } = await exec('git rev-parse HEAD', { cwd: modulePath });
|
||||||
const hash = stdout.trim();
|
const hash = stdout.trim();
|
||||||
|
|
||||||
if (!('pdf-worker' in signatures) || signatures['pdf-worker'].hash !== hash) {
|
if (!('pdf-worker' in signatures) || signatures['pdf-worker'].hash !== hash) {
|
||||||
const targetDir = 'build/chrome/content/zotero/xpcom/pdfWorker/';
|
const targetDir = path.join(__dirname, '..', 'build', 'chrome', 'content', 'zotero', 'xpcom', 'pdfWorker');
|
||||||
try {
|
try {
|
||||||
const filename = hash + '.zip';
|
const filename = hash + '.zip';
|
||||||
const tmpDir = 'tmp/builds/pdf-worker';
|
const tmpDir = path.join(__dirname, '..', 'tmp', 'builds', 'pdf-worker');
|
||||||
const url = buildsURL + 'client-pdf-worker/' + filename;
|
const url = buildsURL + 'client-pdf-worker/' + filename;
|
||||||
|
|
||||||
|
await fs.remove(targetDir);
|
||||||
|
await fs.ensureDir(targetDir);
|
||||||
|
await fs.ensureDir(tmpDir);
|
||||||
|
|
||||||
await exec(
|
await exec(
|
||||||
`mkdir -p ${tmpDir}`
|
`cd ${tmpDir}`
|
||||||
+ `&& cd ${tmpDir}`
|
+ ` && (test -f ${filename} || curl -f ${url} -o ${filename})`
|
||||||
+ `&& (test -f ${filename} || curl -f ${url} -o ${filename})`
|
+ ` && unzip -o ${filename} -d ${targetDir}`
|
||||||
+ `&& mkdir -p ../../../${targetDir}`
|
|
||||||
+ `&& unzip -o ${filename} -d ../../../${targetDir}`
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
await exec('npm ci', { cwd: 'pdf-worker' });
|
await exec('npm ci', { cwd: modulePath });
|
||||||
await exec('npm run build', { cwd: 'pdf-worker' });
|
await exec('npm run build', { cwd: modulePath });
|
||||||
await fs.copy('pdf-worker/build/worker.js', targetDir + 'worker.js');
|
await fs.copy(path.join(modulePath, 'build', 'worker.js'), path.join(targetDir, 'worker.js'));
|
||||||
}
|
}
|
||||||
signatures['pdf-worker'] = { hash };
|
signatures['pdf-worker'] = { hash };
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue