|
| 1 | +import cp from "child_process"; |
1 | 2 | import process from "process";
|
2 | 3 | import concurrently from "concurrently";
|
3 | 4 | import { EXTRA_PACKAGES, config } from "./lib.js";
|
4 | 5 |
|
5 | 6 | function hr() {
|
6 | 7 | // write regular dashes if this is a "simple" output stream ()
|
7 | 8 | if (!process.stdout.hasColors || !process.stdout.hasColors())
|
8 |
| - return '-'.repeat(process.stdout.columns ?? 40) |
9 |
| - return '─'.repeat(process.stdout.columns ?? 40) |
| 9 | + return "-".repeat(process.stdout.columns ?? 40); |
| 10 | + return "─".repeat(process.stdout.columns ?? 40); |
| 11 | +} |
| 12 | +function exec(cmd) { |
| 13 | + return new Promise((resolve, reject) => { |
| 14 | + cp.exec(cmd, (err, stdout, stderr) => { |
| 15 | + if (err) reject(err); |
| 16 | + resolve({ stdout, stderr }); |
| 17 | + }); |
| 18 | + }); |
| 19 | +} |
| 20 | +const yarnVersion = await exec("yarn -v"); |
| 21 | + |
| 22 | +// Require yarn > 1: |
| 23 | +if ( |
| 24 | + yarnVersion.stdout.startsWith("0.") || |
| 25 | + yarnVersion.stdout.startsWith("1.") |
| 26 | +) { |
| 27 | + console.error( |
| 28 | + "It seems like you're using an old version of yarn. Please upgrade to yarn 2 or later" |
| 29 | + ); |
| 30 | + console.error(`Detected yarn version: ${yarnVersion.stdout.trim()}`); |
| 31 | + console.error(`--`); |
| 32 | + console.error(`Tip:`); |
| 33 | + console.error( |
| 34 | + `To uninstall yarn classic, you can find where it's installed by running 'which yarn' or 'where yarn'` |
| 35 | + ); |
| 36 | + console.error(`After you have uninstalled it, run 'corepack enable'`); |
| 37 | + |
| 38 | + process.exit(1); |
10 | 39 | }
|
11 | 40 |
|
12 | 41 | try {
|
|
41 | 70 | console.log(" 🪛 Build packages...");
|
42 | 71 | console.log(hr());
|
43 | 72 |
|
44 |
| - const buildArgs = ['--ignore @sofie-automation/webui'] |
| 73 | + const buildArgs = ["--ignore @sofie-automation/webui"]; |
45 | 74 | if (config.uiOnly) {
|
46 |
| - buildArgs.push(...EXTRA_PACKAGES.map((pkg) => `--ignore ${pkg}`)) |
| 75 | + buildArgs.push(...EXTRA_PACKAGES.map((pkg) => `--ignore ${pkg}`)); |
47 | 76 | }
|
48 | 77 |
|
49 | 78 | await concurrently(
|
|
0 commit comments