main
js 29 lines 753 Bytes
Raw
1 /**
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8 const ora = require('ora');
9 const {execHelper} = require('./utils');
10
11 async function buildPackages(pkgNames) {
12 const spinner = ora(`Building packages`).info();
13 for (const pkgName of pkgNames) {
14 const command = `NODE_ENV=production yarn workspace ${pkgName} run build --dts`;
15 spinner.start(`Running: ${command}\n`);
16 try {
17 await execHelper(command);
18 } catch (e) {
19 spinner.fail(e.toString());
20 throw e;
21 }
22 spinner.succeed(`Successfully built ${pkgName}`);
23 }
24 spinner.stop();
25 }
26
27 module.exports = {
28 buildPackages,
29 };