-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: migrate Lerna to NPM Workspaces
remove @loopback/monorepo. With the new version of lerna, this package no longer makes sense. Signed-off-by: Francisco Buceta <[email protected]>
- Loading branch information
Showing
37 changed files
with
14,367 additions
and
10,633 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright IBM Corp. 2020. All Rights Reserved. | ||
// Node module: @loopback/monorepo | ||
// This file is licensed under the MIT License. | ||
// License text available at https://opensource.org/licenses/MIT | ||
|
||
/** | ||
* This is a script to list workspace packages. | ||
*/ | ||
'use strict'; | ||
|
||
const pkgJson = require('@npmcli/package-json'); | ||
const mapWorkspaces = require('@npmcli/map-workspaces'); | ||
const debugFactory = require('debug'); | ||
const {runMain} = require('./script-util'); | ||
|
||
const debug = debugFactory('loopback:monorepo'); | ||
|
||
module.exports = { | ||
rules: { | ||
// eslint-disable-next-line @typescript-eslint/naming-convention | ||
'scope-enum': async ctx => [2, 'always', await getPackageNames(ctx)], | ||
}, | ||
}; | ||
|
||
async function getPackageNames() { | ||
const {content: pkg} = await pkgJson.normalize(process.cwd()); | ||
const workspaces = await mapWorkspaces({cwd: process.cwd(), pkg}); | ||
const packages = Array.from(workspaces, entry => { | ||
return entry[0].startsWith('@') ? entry[0].split('/')[1] : entry[0]; | ||
}); | ||
debug('Scope names for the NPM Workspace: %s', packages); | ||
return packages; | ||
} | ||
|
||
runMain(module, getPackageNames); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.