1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-27 10:32:58 +02:00
joplin/packages/app-mobile/tools/prepareRelease.js

33 lines
1019 B
JavaScript

// This is to replace the symlinks inside node_modules with the actual packages
// as I assumed it was needed to build the final release. However it seems
// Android `assembleRelease` handles symlinks properly so maybe this is not
// needed after all ¯\_(ツ)_/¯
const { copyDir } = require('@joplin/tools/gulp/utils');
const { rootDir, deleteLink, toSystemSlashes } = require('@joplin/tools/tool-utils');
const mobileDir = `${rootDir}/packages/app-mobile`;
module.exports = async function() {
const dirsToCopy = [
'fork-htmlparser2',
'fork-sax',
'lib',
'renderer',
];
const destDir = `${mobileDir}/node_modules/@joplin`;
for (const dir of dirsToCopy) {
const destPath = toSystemSlashes(`${destDir}/${dir}`);
const sourcePath = toSystemSlashes(`${rootDir}/packages/${dir}`);
console.info(`Copying ${sourcePath} => ${destPath}`);
// TODO: copy symlink so that it can be restored
await deleteLink(destPath);
await copyDir(sourcePath, destPath, {
excluded: ['node_modules'],
});
}
};