Skip to content

Commit 2e6b0a3

Browse files
committed
chore: add run-lerna script to run lerna with repo root
The script sets `LERNA_ROOT_PATH` to the root directory of loopback-next monorepo and run `lerna` commands.
1 parent a670b32 commit 2e6b0a3

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

bin/run-lerna.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env node
2+
// Copyright IBM Corp. 2017,2018. All Rights Reserved.
3+
// Node module: @loopback/cli
4+
// This file is licensed under the MIT License.
5+
// License text available at https://opensource.org/licenses/MIT
6+
7+
/**
8+
* This is an internal script to run `lerna` command with enviornment variable
9+
* `LERNA_ROOT_PATH` set to the root directory of `loopback-next` monorepo
10+
*/
11+
'use strict';
12+
13+
const path = require('path');
14+
const lerna = require('lerna');
15+
const build = require('../packages/build');
16+
17+
function run(argv, options) {
18+
const ls = new lerna.LsCommand(
19+
null,
20+
{json: true, loglevel: 'silent'},
21+
path.join(__dirname, '..'),
22+
);
23+
const rootPath = ls.repository.rootPath;
24+
25+
process.env.LERNA_ROOT_PATH = rootPath;
26+
const args = argv.slice(2);
27+
return build.runCLI('lerna/bin/lerna', args, options);
28+
}
29+
30+
module.exports = run;
31+
if (require.main === module) run(process.argv);

0 commit comments

Comments
 (0)