一些检查失败了
automerge / automerge (push) Has been cancelled
react-native-android-build-apk / AssembleRelease (push) Has been cancelled
Build macOS M1 / Main (push) Has been cancelled
Joplin Continuous Integration / Main (macos-15-intel) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-11-vs2026-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-2025) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04-arm) (push) Has been cancelled
Joplin UI tests / Main (ubuntu-22.04) (push) Has been cancelled
Joplin UI tests / Main (windows-2025) (push) Has been cancelled
Joplin UI tests / Mobile (push) Has been cancelled
Close stale issues / ProcessStaleIssues (push) Has been cancelled
42 行
1.5 KiB
JavaScript
42 行
1.5 KiB
JavaScript
const fs = require('fs-extra');
|
|
const path = require('path');
|
|
|
|
const baseDir = path.dirname(path.dirname(__dirname));
|
|
const sourcePath = `${__dirname}/../../lib/randomClipperPort.js`;
|
|
const clipperUtilsPath = `${__dirname}/../../lib/clipperUtils.js`;
|
|
|
|
const readFileNormalized = (filePath) => {
|
|
const js = fs.readFileSync(filePath, 'utf-8');
|
|
return js
|
|
.replace(/^['"]use strict['"];/, [
|
|
'\'use strict\';',
|
|
// Running the linter causes changes on each full rebuild, since
|
|
// the original file was generated by tsc.
|
|
'/* eslint-disable */',
|
|
`// Copied from ${path.relative(baseDir, filePath)}`,
|
|
'',
|
|
].join('\n'))
|
|
|
|
// Normalize line endings to avoid unnecessary changes on Windows
|
|
.replace(/\r\n/g, '\n')
|
|
.trim();
|
|
};
|
|
|
|
// Mozilla insists on building the clipper from a tarball, not from the repository
|
|
// so we add this check and only copy the file if it's present. Normally it rarely
|
|
// changes anyway and it is committed to the repo.
|
|
|
|
if (fs.pathExistsSync(sourcePath)) {
|
|
const content = readFileNormalized(sourcePath);
|
|
fs.writeFileSync(`${__dirname}/src/randomClipperPort.js`, content);
|
|
}
|
|
|
|
if (fs.pathExistsSync(clipperUtilsPath)) {
|
|
fs.copySync(clipperUtilsPath, `${__dirname}/../content_scripts/clipperUtils.js`);
|
|
}
|
|
|
|
// These files give warnings when loading the extension in Chrome, in dev mode
|
|
fs.removeSync(`${__dirname}/node_modules/public-encrypt/test/test_key.pem`);
|
|
fs.removeSync(`${__dirname}/node_modules/public-encrypt/test/test_rsa_pubkey.pem`);
|
|
fs.removeSync(`${__dirname}/node_modules/public-encrypt/test/test_rsa_privkey.pem`);
|