1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-06 23:56:13 +02:00

Tools: Use Yarn 3 to manage monorepo (#5833)

This commit is contained in:
Laurent
2021-12-20 16:08:43 +01:00
committed by GitHub
parent dea79fa3b7
commit 7f64fbfd9b
127 changed files with 32340 additions and 261687 deletions

View File

@ -1,7 +1,7 @@
const fs = require('fs-extra');
const spawnSync = require('child_process').spawnSync;
const { chdir } = require('process');
const babelPath = `${__dirname}/../node_modules/.bin/babel${process.platform === 'win32' ? '.cmd' : ''}`;
const basePath = `${__dirname}/../../..`;
function fileIsNewerThan(path1, path2) {
@ -14,6 +14,8 @@ function fileIsNewerThan(path1, path2) {
}
function convertJsx(path) {
chdir(`${__dirname}/..`);
fs.readdirSync(path).forEach((filename) => {
const jsxPath = `${path}/${filename}`;
const p = jsxPath.split('.');
@ -28,7 +30,7 @@ function convertJsx(path) {
if (fileIsNewerThan(jsxPath, jsPath)) {
console.info(`Compiling ${jsxPath}...`);
const result = spawnSync(babelPath, ['--presets', 'react', '--out-file', jsPath, jsxPath]);
const result = spawnSync('yarn', ['run', 'babel', '--presets', 'react', '--out-file', jsPath, jsxPath]);
if (result.status !== 0) {
const msg = [];
if (result.stdout) msg.push(result.stdout.toString());