-
Notifications
You must be signed in to change notification settings - Fork 144
/
Copy pathmonorepo-update.js
36 lines (32 loc) · 1009 Bytes
/
monorepo-update.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
const execa = require('execa');
const Listr = require('listr');
async function refreshPackage(task, packageName) {
task.title = `Updating ${packageName}`;
const { stdout } = await execa('git', ['subtree', 'pull', '-P', `packages/${packageName}`, '-m', `Update ${packageName}`, `https://github.com/AugurProject/${packageName}`, 'master']);
const firstLine = (stdout || '').split('\n')[0].trim();
task.title = `Done updating ${packageName} - ${firstLine}`;
}
let tasks;
if (process.argv.length == 2) {
tasks = new Listr([
{
title: 'Augur Core',
task: async (ctx, task) => await refreshPackage(task, 'augur-core')
},
{
title: 'Augur UI',
task: async (ctx, task) => await refreshPackage(task, 'augur-ui')
}
]);
} else {
tasks = new Listr([
{
title: `Updating ${process.argv[2]}`,
task: async (ctx, task) => await refreshPackage(task, process.argv[2])
}
]);
}
tasks.run().catch((err) => {
console.log(err);
process.exit(1);
});