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

77 lines
2.0 KiB
JavaScript
Raw Normal View History

2020-11-05 18:58:23 +02:00
const gulp = require('gulp');
const fs = require('fs-extra');
const utils = require('@joplin/tools/gulp/utils');
2020-11-05 18:58:23 +02:00
const tasks = {
// compileExtensions: {
// fn: require('../Tools/gulp/tasks/compileExtensions.js'),
// },
// copyLib: require('../Tools/gulp/tasks/copyLib'),
// tsc: require('../Tools/gulp/tasks/tsc'),
// updateIgnoredTypeScriptBuild: require('../Tools/gulp/tasks/updateIgnoredTypeScriptBuild'),
};
2020-11-06 23:25:07 +02:00
async function makePackagePublic(filePath) {
const text = await fs.readFile(filePath, 'utf8');
const obj = JSON.parse(text);
delete obj.private;
await fs.writeFile(filePath, JSON.stringify(obj), 'utf8');
}
2020-11-05 18:58:23 +02:00
tasks.prepareBuild = {
fn: async () => {
const buildDir = `${__dirname}/build`;
await utils.copyDir(`${__dirname}/app`, buildDir, {
excluded: ['node_modules'],
});
2020-11-06 23:25:07 +02:00
2020-11-05 18:58:23 +02:00
await utils.copyFile(`${__dirname}/package.json`, `${buildDir}/package.json`);
2020-11-06 23:25:07 +02:00
await makePackagePublic(`${buildDir}/package.json`);
2020-11-05 18:58:23 +02:00
await utils.copyFile(`${__dirname}/package-lock.json`, `${buildDir}/package-lock.json`);
await utils.copyFile(`${__dirname}/gulpfile.js`, `${buildDir}/gulpfile.js`);
fs.chmodSync(`${buildDir}/main.js`, 0o755);
},
};
tasks.prepareTestBuild = {
fn: async () => {
const testBuildDir = `${__dirname}/tests-build`;
await utils.copyDir(`${__dirname}/tests`, testBuildDir, {
excluded: [
'lib/',
'locales/',
'node_modules/',
'*.ts',
'*.tsx',
],
});
// const rootDir = utils.rootDir();
// await utils.copyDir(`${rootDir}/packages/app-mobile/lib`, `${testBuildDir}/lib`, {
// excluded: [
// `${rootDir}/packages/app-mobile/lib/joplin-renderer/node_modules`,
// ],
// });
// await utils.copyDir(`${rootDir}/packages/app-mobile/locales`, `${testBuildDir}/locales`);
await fs.mkdirp(`${testBuildDir}/data`);
},
};
utils.registerGulpTasks(gulp, tasks);
gulp.task('build', gulp.series([
'prepareBuild',
// 'compileExtensions',
// 'copyLib',
]));
// gulp.task('buildTests', gulp.series([
// // 'prepareTestBuild',
// // 'compileExtensions',
// // 'copyLib',
// ]));