1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-12 08:54:00 +02:00
joplin/packages/app-desktop/gulpfile.js

73 lines
2.1 KiB
JavaScript
Raw Normal View History

2020-11-05 18:58:23 +02:00
const gulp = require('gulp');
const utils = require('@joplin/tools/gulp/utils');
2020-11-05 18:58:23 +02:00
const fs = require('fs-extra');
const tasks = {
compileScripts: {
fn: require('./tools/compileScripts'),
},
compilePackageInfo: {
fn: require('./tools/compile-package-info.js'),
},
copyPluginAssets: {
fn: require('./tools/copyPluginAssets.js'),
},
copyTinyMceLangs: {
fn: require('./tools/copyTinyMceLangs.js'),
},
electronRebuild: {
fn: require('./tools/electronRebuild.js'),
},
// compileExtensions: {
// fn: require('@joplin/tools/gulp/tasks/compileExtensions.js'),
2020-11-05 18:58:23 +02:00
// },
// copyLib: require('@joplin/tools/gulp/tasks/copyLib'),
tsc: require('@joplin/tools/gulp/tasks/tsc'),
updateIgnoredTypeScriptBuild: require('@joplin/tools/gulp/tasks/updateIgnoredTypeScriptBuild'),
2020-11-05 18:58:23 +02:00
linkReact: {
fn: async () => {
// React is a dependency of both the lib and app-desktop
// packages, which cause a duplicate React issue. To go around
// this, one way is to manually link the package.
//
// Note that React must also be unlinked in preinstall step
// otherwise there will be permission errors when running
// `lerna bootstrap`
//
// https://reactjs.org/warnings/invalid-hook-call-warning.html#duplicate-react
process.chdir(__dirname);
await fs.remove('./node_modules/react');
await fs.remove('./node_modules/react-dom');
await utils.execCommand('npm link ../lib/node_modules/react');
await utils.execCommand('npm link ../lib/node_modules/react-dom');
},
},
};
utils.registerGulpTasks(gulp, tasks);
// const buildSeries = [
// // 'compileExtensions',
// // 'copyLib',
// ];
// On Windows also run tsc because `npm run watch` locks some folders
// which makes the copyPluginAssets command fail. For that reason,
// it's not possible to run watch on Windows while testing the desktop app.
// if (require('os').platform() === 'win32') {
// buildSeries.push('tsc');
// }
const buildParallel = [
// gulp.series(...buildSeries),
'compileScripts',
'compilePackageInfo',
'copyPluginAssets',
'copyTinyMceLangs',
'updateIgnoredTypeScriptBuild',
// 'linkReact',
];
gulp.task('build', gulp.parallel(...buildParallel));