Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions bin/run-lerna.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env node
// Copyright IBM Corp. 2017,2018. All Rights Reserved.
// Node module: @loopback/cli
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT

/**
* This is an internal script to run `lerna` command with enviornment variable
* `LERNA_ROOT_PATH` set to the root directory of `loopback-next` monorepo
*/
'use strict';

const path = require('path');
const lerna = require('lerna');
const build = require('../packages/build');

function run(argv, options) {
const ls = new lerna.LsCommand(
null,
{json: true, loglevel: 'silent'},
path.join(__dirname, '..'),
);
const rootPath = ls.repository.rootPath;

process.env.LERNA_ROOT_PATH = rootPath;
let args = argv.slice(2);

return build.runCLI('lerna/bin/lerna', args, options);
}

module.exports = run;
if (require.main === module) run(process.argv);
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"prettier:fix": "npm run prettier:cli -- --write",
"clean": "lerna run clean --loglevel=silent --parallel && node packages/build/bin/run-clean \"packages/*/dist*\"",
"clean:lerna": "lerna clean --yes --parallel --loglevel=silent",
"build": "lerna run build --parallel --loglevel=silent",
"build": "node bin/run-lerna run build --parallel --loglevel=silent",
"build:full": "npm run clean:lerna && npm run bootstrap && npm test",
"pretest": "npm run clean && npm run build",
"test": "node packages/build/bin/run-nyc npm run mocha --scripts-prepend-node-path",
Expand Down
11 changes: 9 additions & 2 deletions packages/build/bin/compile-package.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,10 @@ function run(argv, options) {

const args = [];

const cwd = process.env.LERNA_ROOT_PATH || process.cwd();
if (tsConfigFile) {
args.push('-p', tsConfigFile);
// Make the config file relative the current directory
args.push('-p', path.relative(cwd, tsConfigFile));
}

if (outDir) {
Expand All @@ -114,7 +116,12 @@ function run(argv, options) {

args.push(...compilerOpts);

return utils.runCLI('typescript/lib/tsc', args, options);
if (options === true) {
options = {dryRun: true};
} else {
options = options || {};
}
return utils.runCLI('typescript/lib/tsc', args, {cwd, ...options});
}

module.exports = run;
Expand Down