lerna cli with custom command extensions, forked with official [lerna](https://www.npmjs.com/package/lerna)
npm install lerna-cli





> lerna cli with custom command extensions, forked with official lerna
See https://github.com/lerna/lerna/issues/2742
- Use local lerna even in global command. see import-local
- Custom command
- Nested lerna.json in packages
``text`
packages/
foo/
projects/
bar/
lerna.json
lerna.json
packages
- Respect pnpm-workspace.yaml
1. overwriting workspace:version
2. dependencies' version allows `
text`
packages/
lerna.json
pnpm-workspace.yaml
In my best practices case: use pnpm as a monorepo manager, use lerna for publishing or some custom commands.
`bash
npm install lerna-cli -D
lerna --help
`
1. lerna.json
Add extendCommands field, supports local file or npm package
`diff`
+ "extendCommands": [
+ "./commands/custom",
+ "lerna-custom-command",
+ ],
2. Write myself custom command
- See official command: @lerna/init, @lerna/add
Add command.js
`javascript
/**
* @see https://github.com/yargs/yargs/blob/master/docs/advanced.md#providing-a-command-module
*/
exports.command = 'custom'
exports.describe = 'custom command.'
exports.builder = {
exact: {
describe: 'Specify lerna dependency version in package.json without a caret (^)',
type: 'boolean'
},
independent: {
describe: 'Version packages independently',
alias: 'i',
type: 'boolean'
}
}
exports.handler = function handler(argv) {
return require('..')(argv)
}
`
3. Run custom command
`bash`
lerna custom
1. lerna.json
Add extendCommands field, supports local file or npm package
`diff`
+ "extendCommands": [
+ "lerna-custom-preset-command",
+ ],
2. Write myself custom command preset in command.js or command/index.js
`javascript`
module.exports = [
require('lerna-command-a/command'),
require('lerna-command-b/command'),
require('lerna-command-c/command')
]
3. Run custom command
`bash`
lerna custom-a
lerna custom-b
lerna custom-c
- lerna-gpm - lerna command for git package manager
- lerna-command-toc - lerna command for generate toc of packages in markdown
- Fork it!
- Create your new branch:
git checkout -b feature-new or git checkout -b fix-which-buggit commit -am 'feat: some description (close #123)'
- Start your magic work now
- Make sure npm test passes
- Commit your changes:
or git commit -am 'fix: some description (fix #123)'git push`
- Push to the branch:
- Submit a pull request :)
This library is written and maintained by imcuttle, imcuttle@163.com.com.
MIT - imcuttle 🐟