{"_id":"@ahfarmer/lerna","_rev":"5-d9edea23e5c7690dd0b481084eaf3248","name":"@ahfarmer/lerna","time":{"modified":"2022-06-12T14:24:31.646Z","created":"2016-11-29T22:18:18.730Z","2.0.0-beta.99":"2016-11-29T22:18:18.730Z","2.0.0-beta.98":"2016-11-30T04:53:18.873Z"},"maintainers":[{"name":"ahfarmer","email":"ahfarmer@gmail.com"}],"dist-tags":{"latest":"2.0.0-beta.98"},"description":"Tool for managing JavaScript projects with multiple packages","readme":"<p align=\"center\">\n  <img alt=\"Lerna\" src=\"https://cloud.githubusercontent.com/assets/952783/15271604/6da94f96-1a06-11e6-8b04-dc3171f79a90.png\" width=\"480\">\n</p>\n\n<p align=\"center\">\n  A tool for managing JavaScript projects with multiple packages.\n</p>\n\n<p align=\"center\">\n  <a href=\"https://www.npmjs.com/package/lerna\"><img alt=\"NPM Status\" src=\"https://img.shields.io/npm/v/lerna.svg?style=flat\"></a>\n  <a href=\"https://travis-ci.org/lerna/lerna\"><img alt=\"Travis Status\" src=\"https://img.shields.io/travis/lerna/lerna/master.svg?style=flat&label=travis\"></a>\n  <a href=\"https://ci.appveyor.com/project/lerna/lerna\"><img alt=\"Appveyor Status\" src=\"https://img.shields.io/appveyor/ci/lerna/lerna.svg\"></a>\n  <a href=\"https://slack.lernajs.io/\"><img alt=\"Slack Status\" src=\"https://slack.lernajs.io/badge.svg\"></a>\n</p>\n\n## About\n\nSplitting up large codebases into separate independently versioned packages\nis extremely useful for code sharing. However, making changes across many\nrepositories is *messy* and difficult to track, and testing across repositories\ngets complicated really fast.\n\nTo solve these (and many other) problems, some projects will organize their\ncodebases into multi-package repositories (sometimes called [monorepos](https://github.com/babel/babel/blob/master/doc/design/monorepo.md)). Projects like [Babel](https://github.com/babel/babel/tree/master/packages), [React](https://github.com/facebook/react/tree/master/packages), [Angular](https://github.com/angular/angular/tree/master/modules),\n[Ember](https://github.com/emberjs/ember.js/tree/master/packages), [Meteor](https://github.com/meteor/meteor/tree/devel/packages), [Jest](https://github.com/facebook/jest/tree/master/packages), and many others develop all of their packages within a\nsingle repository.\n\n**Lerna is a tool that optimizes the workflow around managing multi-package\nrepositories with git and npm.**\n\n### What does a Lerna repo look like?\n\nThere's actually very little to it. You have a file system that looks like this:\n\n```\nmy-lerna-repo/\n  package.json\n  packages/\n    package-1/\n      package.json\n    package-2/\n      package.json\n```\n\n### What can Lerna do?\n\nThe two primary commands in Lerna are `lerna bootstrap` and `lerna publish`.\n\n`bootstrap` will link dependencies in the repo together.\n`publish` will help publish any updated packages.\n\n## Getting Started\n\n> The instructions below are for Lerna 2.x which is currently in beta.\n> We recommend using it instead of 1.x for a new Lerna project. Check the [wiki](https://github.com/lerna/lerna/wiki/1.x-Docs) if you need to see the 1.x README.\n\nLet's start by installing Lerna globally with [npm](https://www.npmjs.com/).\n\n```sh\n# install the latest 2.x version using the `prerelease` dist-tag\n$ npm install --global lerna@prerelease\n# install version directly\n$ npm install --global lerna@^2.0.0-beta\n```\n\nNext we'll create a new [git](https://git-scm.com/) repository:\n\n```sh\n$ git init lerna-repo\n$ cd lerna-repo\n```\n\nAnd now let's turn it into a Lerna repo:\n\n```sh\n$ lerna init\n```\n\nYour repository should now look like this:\n\n```\nlerna-repo/\n  packages/\n  package.json\n  lerna.json\n```\n\nThis will create a `lerna.json` configuration file as well as a `packages` folder.\n\n## How it works\n\nLerna allows you to manage your project using one of two modes: Fixed or Independent.\n\n### Fixed/Locked mode (default)\n\nFixed mode Lerna projects operate on a single version line. The version is kept in the `lerna.json` file at the root of your project under the `version` key. When you run `lerna publish`, if a module has been updated since the last time a release was made, it will be updated to the new version you're releasing. This means that you only publish a new version of a package when you need to.\n\nThis is the mode that [Babel](https://github.com/babel/babel) is currently using. Use this if you want to automatically tie all package versions together. One issue with this approach is that a major change in any package will result in all packages having a new major version.\n\n### Independent mode (`--independent`)\n\nIndependent mode Lerna projects allows maintainers to increment package versions independently of each other. Each time you publish, you will get a prompt for each package that has changed to specify if it's a patch, minor, major or custom change.\n\nIndependent mode allows you to more specifically update versions for each package and makes sense for a group of components. Combining this mode with something like [semantic-release](https://github.com/semantic-release/semantic-release) would make it less painful. (There is work on this already at [atlassian/lerna-semantic-release](https://github.com/atlassian/lerna-semantic-release).\n\n> The `version` key in `lerna.json` is ignored in independent mode.\n\n## Commands\n\n### init\n\n```sh\n$ lerna init\n```\n\nCreate a new Lerna repo or upgrade an existing repo to the current version of Lerna.\n\n> Lerna assumes the repo has already been initialized with `git init`.\n\nWhen run, this command will:\n1. Add `lerna` as a [`devDependency`](https://docs.npmjs.com/files/package.json#devdependencies) in `package.json` if it doesn't already exist.\n2. Create a `lerna.json` config file to store the `version` number.\n3. Create a `packages` directory if it hasn't been created already.\n\nExample output on a new git repo:\n\n```sh\n> lerna init\n$ Lerna v2.0.0-beta.18\n$ Creating packages directory.\n$ Updating package.json.\n$ Creating lerna.json.\n$ Successfully created Lerna files\n```\n\n#### --independent, -i\n\n```sh\n$ lerna publish --independent\n```\n\nThis flag tells Lerna to use independent versioning mode.\n\n### bootstrap\n\n```sh\n$ lerna bootstrap\n```\n\nBootstrap the packages in the current Lerna repo.\nInstalls all of their dependencies and links any cross-dependencies.\n\nWhen run, this command will:\n\n1. `npm install` all external dependencies of each package.\n2. Symlink together all Lerna `packages` that are dependencies of each other.\n3. `npm prepublish` all bootstrapped packages.\n\n`lerna bootstrap` respects the `--ignore` flag (see below).\n\n#### How `bootstrap` works\n\nLet's use `babel` as an example.\n\n- `babel-generator` and `source-map` (among others) are dependencies of `babel-core`.\n-  `babel-core`'s [`package.json`](https://github.com/babel/babel/blob/13c961d29d76ccd38b1fc61333a874072e9a8d6a/packages/babel-core/package.json#L28-L47) lists both these packages as keys in `dependencies`, as shown below.\n\n```js\n// babel-core package.json\n{\n  \"name\": \"babel-core\",\n  ...\n  \"dependencies\": {\n    ...\n    \"babel-generator\": \"^6.9.0\",\n    ...\n    \"source-map\": \"^0.5.0\"\n  }\n}\n```\n\n- Lerna checks if each dependency is also part of the Lerna repo.\n  - In this example, `babel-generator` is a dependency, while `source-map` is not.\n  - `source-map` is `npm install`ed like normal.\n- `packages/babel-core/node_modules/babel-generator` symlinks to `packages/babel-generator`\n- This allows nested directory imports\n\n**Note:** Circular dependencies result in circular symlinks which *may* impact your editor/IDE.\n\n[Webstorm](https://www.jetbrains.com/webstorm/) locks up when circular symlinks are present. To prevent this, add `node_modules` to the list of ignored files and folders in `Preferences | Editor | File Types | Ignored files and folders`.  \n\n### publish\n\n```sh\n$ lerna publish\n```\n\nPublish packages in the current Lerna project. When run, this command does the following:\n\nCreates a new release of the packages that have been updated.\nPrompts for a new version.\nCreates a new git commit/tag in the process of publishing to npm.\n\nMore specifically, this command will:\n\n1. Publish each module in `packages` that has been updated since the last version to npm with the [dist-tag](https://docs.npmjs.com/cli/dist-tag) `lerna-temp`.\n  1. Run the equivalent of `lerna updated` to determine which packages need to be published.\n  2. If necessary, increment the `version` key in `lerna.json`.\n  3. Update the `package.json` of all updated packages to their new versions.\n  4. Update all dependencies of the updated packages with the new versions.\n  5. Create a new git commit and tag for the new version.\n  6. Publish updated packages to npm.\n2. Once all packages have been published, remove the `lerna-temp` tags and add the tags to `latest`.\n\n> A temporary dist-tag is used at the start to prevent the case where only some of the packages are published; this can cause issues for users installing a package that only has some updated packages.\n\n> Lerna won't publish packages which are marked as private (`\"private\": true` in the `package.json`).\n\n#### --npm-tag [tagname]\n\n```sh\n$ lerna publish --npm-tag=next\n```\n\nWhen run with this flag, `publish` will publish to npm with the given npm [dist-tag](https://docs.npmjs.com/cli/dist-tag) (defaults to `latest`).\n\nThis option can be used to publish a [`prerelease`](http://carrot.is/coding/npm_prerelease) or `beta` version.\n\n> Note: the `latest` tag is the one that is used when a user runs `npm install my-package`.\n> To install a different tag, a user can run `npm install my-package@prerelease`.\n\n#### --canary, -c\n\n```sh\n$ lerna publish --canary\n```\n\nWhen run with this flag, `publish` publishes packages in a more granular way (per commit). Before publishing to npm, it creates the new `version` tag by taking the current `version` and appending the current git sha (ex: `1.0.0-alpha.81e3b443`).\n\n> The intended use case for this flag is a per commit level release or nightly release.\n\n#### --skip-git\n\n```sh\n$ lerna publish --skip-git\n```\n\nWhen run with this flag, `publish` will publish to npm without running any of the git commands.\n\n> Only publish to npm; skip committing, tagging, and pushing git changes (this only affects publish).\n\n#### --skip-npm\n\n```sh\n$ lerna publish --skip-npm\n```\n\nWhen run with this flag, `publish` will update all `package.json` package\nversions and dependency versions, but it will not actually publish the\npackages to npm.\n\nThis is useful as a workaround for an [npm\nissue](https://github.com/npm/registry/issues/42) which prevents README updates\nfrom appearing on npmjs.com when published via Lerna.  When publishing with\nREADME changes, use `--skip-npm` and do the final `npm publish` by hand for\neach package.\n\nThis flag can be combined with `--skip-git` to _just_ update versions and\ndependencies, without committing, tagging, pushing or publishing.\n\n> Only update versions and dependencies; don't actually publish (this only affects publish).\n\n#### --force-publish [packages]\n\n```sh\n$ lerna publish --force-publish=package-2,package-4\n# force publish all packages\n$ lerna publish --force-publish=*\n```\n\nWhen run with this flag, `publish` will force publish the specified packages (comma-separated) or all packages using `*`.\n\n> This will skip the `lerna updated` check for changed packages and forces a package that didn't have a `git diff` change to be updated.\n\n#### --yes\n\n```sh\n$ lerna publish --canary --yes\n# skips `Are you sure you want to publish the above changes?`\n```\n\nWhen run with this flag, `publish` will skip all confirmation prompts.\nUseful in [Continuous integration (CI)](https://en.wikipedia.org/wiki/Continuous_integration) to automatically answer the publish confirmation prompt.\n\n#### --repo-version\n\n```sh\n$ lerna publish --repo-version 1.0.1\n# applies version and skips `Select a new version for...` prompt\n```\n\nWhen run with this flag, `publish` will skip the version selection prompt and use the specified version.\nUseful for bypassing the user input prompt if you already know which version to publish.\n\n### updated\n\n```sh\n$ lerna updated\n```\n\nCheck which `packages` have changed since the last release (the last git tag).\n\nLerna determines the last git tag created and runs `git diff --name-only v6.8.1` to get all files changed since that tag. It then returns an array of packages that have an updated file.\n\n### clean\n\n```sh\n$ lerna clean\n```\n\nRemove the `node_modules` directory from all packages.\n\n### diff\n\n```sh\n$ lerna diff [package?]\n\n$ lerna diff\n# diff a specific package\n$ lerna diff package-name\n```\n\nDiff all packages or a single package since the last release.\n\n> Similar to `lerna updated`. This command runs `git diff`.\n\n### ls\n\n```sh\n$ lerna ls\n```\n\nList all of the public packages in the current Lerna repo.\n\n### run\n\n```sh\n$ lerna run [script] # runs npm run my-script in all packages that have it\n$ lerna run test\n$ lerna run build\n```\n\nRun an [npm script](https://docs.npmjs.com/misc/scripts) in each package that contains that script.\n\n`lerna run` respects the `--concurrency` flag (see below).\n\n`lerna run` respects the `--scope` flag (see below).\n\n```sh\n$ lerna run --scope my-component test\n```\n\n### exec\n\n```sh\n$ lerna exec -- [command] # runs the command in all packages\n$ lerna exec -- rm -rf ./node_modules\n$ lerna exec -- protractor conf.js\n```\n\nRun an arbitrary command in each package.\n\n`lerna exec` respects the `--concurrency` flag (see below).\n\n`lerna exec` respects the `--scope` flag (see below).\n\n```sh\n$ lerna exec --scope my-component -- ls -la\n```\n\n> Hint: The commands are spawned in parallel, using the concurrency given.\n> The output is piped through, so not deterministic.\n> If you want to run the command in one package after another, use it like this:\n\n```sh\n$ lerna exec --concurrency 1 -- ls -la\n```\n\n### import\n\n```sh\n$ lerna import <path-to-external-repository>\n```\n\nImport the package at `<path-to-external-repository>`, with commit history,\ninto `packages/<directory-name>`.  Original commit authors, dates and messages\nare preserved.  Commits are applied to the current branch.\n\nThis is useful for gathering pre-existing standalone packages into a Lerna\nrepo.  Each commit is modified to make changes relative to the package\ndirectory.  So, for example, the commit that added `package.json` will\ninstead add `packages/<directory-name>/package.json`.\n\n## Misc\n\nLerna will log to a `lerna-debug.log` file (same as `npm-debug.log`) when it encounters an error running a command.\n\nLerna also has support for [scoped packages](https://docs.npmjs.com/misc/scope).\n\nRunning `lerna` without arguments will show all commands/options.\n\n### lerna.json\n\n```js\n{\n  \"lerna\": \"2.0.0-beta.18\",\n  \"version\": \"1.1.3\",\n  \"publishConfig\": {\n    \"ignore\": [\n      \"ignored-file\",\n      \"*.md\"\n    ]\n  },\n  \"linkedFiles\": {\n    \"prefix\": \"/**\\n * @flow\\n */\"\n  },\n  \"packages\": [\"packages/*\"]\n}\n```\n\n- `lerna`: the current version of Lerna being used.\n- `version`: the current version of the repository.\n- `publishConfig.ignore`: an array of globs that won't be included in `lerna updated/publish`. Use this to prevent publishing a new version unnecessarily for changes, such as fixing a `README.md` typo.\n- `linkedFiles.prefix`: a prefix added to linked dependency files.\n- `packages`: Array of globs to use as package locations.\n\n### Common `devDependencies`\n\nMost `devDependencies` can be pulled up to the root of a Lerna repo.\n\nThis has a few benefits:\n\n- All packages use the same version of a given dependency\n- Can keep dependencies at the root up-to-date with an automated tool such as [GreenKeeper](https://greenkeeper.io/)\n- Dependency installation time is reduced\n- Less storage is needed\n\nNote that `devDependencies` providing \"binary\" executables that are used by\nnpm scripts still need to be installed directly in each package where they're\nused.\n\nFor example the `nsp` dependency is necessary in this case for `lerna run nsp`\n(and `npm run nsp` within the package's directory) to work correctly:\n\n```json\n\n{\n  \"scripts\": {\n    \"nsp\": \"nsp\"\n  },\n  \"devDependencies\": {\n    \"nsp\": \"^2.3.3\"\n  }\n}\n```\n\n### Flags\n\n#### --concurrency\n\nHow many threads to use when Lerna parallelizes the tasks (defaults to `4`)\n\n```sh\n$ lerna publish --concurrency 1\n```\n\n#### --scope [glob]\n\nScopes a command to a subset of packages.\n\n```sh\n$ lerna exec --scope my-component -- ls -la\n```\n\n```sh\n$ lerna run --scope toolbar-* test\n```\n\n#### --ignore [glob]\n\nExcludes a subset of packages when running the `bootstrap` command.\n\n```sh\n$ lerna bootstrap --ignore component-*\n```\n\nThe `ignore` flag, when used with the `bootstrap` command, can also be set in `lerna.json` under the `bootstrapConfig` key. The command-line flag will take precendence over this option. This flag is supported in `bootstrap` and `exec` commands.\n\n**Note**: If both `scope` and `ignore` are provided to `exec` command, `scope` takes precedence.\n\n**Example**\n\n```javascript\n{\n  \"lerna\": \"2.0.0-beta.16\",\n  \"version\": \"0.0.0\",\n  \"bootstrapConfig\": {\n    \"ignore\": \"component-*\"\n  }\n}\n```\n\n> Hint: The glob is matched against the package name defined in `package.json`,\n> not the directory name the package lives in.\n\n#### --only-explicit-updates\n\nOnly will bump versions for packages that have been updated explicitly rather than cross-dependencies.\n\n> This may not make sense for a major version bump since other packages that depend on the updated packages wouldn't be updated.\n\n```sh\n$ lerna updated --only-explicit-updates\n$ lerna publish --only-explicit-updates\n```\n\nEx: in Babel, `babel-types` is depended upon by all packages in the monorepo (over 100). However, Babel uses `^` for most of it's dependencies so it isn't necessary to bump the versions of all packages if only `babel-types` is updated. This option allows only the packages that have been explicitly updated to make a new version.\n","versions":{"2.0.0-beta.98":{"name":"@ahfarmer/lerna","version":"2.0.0-beta.98","description":"Tool for managing JavaScript projects with multiple packages","main":"lib/index.js","scripts":{"build":"babel src -d lib","dev":"babel -w src -d lib","lint":"eslint src test","fix":"eslint src test --fix","test":"mocha -t 5000","ci":"npm run lint && cross-env DEBUG_CALLS=true npm run test","prepublish":"npm run build"},"repository":{"type":"git","url":"git+https://github.com/lerna/lerna.git"},"author":{"name":"Sebastian McKenzie","email":"sebmck@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/lerna/lerna/issues"},"homepage":"https://lernajs.io/","dependencies":{"async":"^1.5.0","chalk":"^1.1.1","cmd-shim":"^2.0.2","command-join":"^1.1.1","cross-spawn":"^4.0.0","glob":"^7.0.6","inquirer":"^0.12.0","lodash.find":"^4.3.0","lodash.unionwith":"^4.2.0","meow":"^3.7.0","minimatch":"^3.0.0","mkdirp":"^0.5.1","normalize-path":"^2.0.1","object-assign":"^4.0.1","object-assign-sorted":"^1.0.0","pad":"^1.0.0","path-exists":"^2.1.0","progress":"^1.1.8","read-cmd-shim":"^1.0.1","rimraf":"^2.4.4","semver":"^5.1.0","signal-exit":"^2.1.2","sync-exec":"^0.6.2"},"bin":{"lerna":"./bin/lerna.js"},"devDependencies":{"babel-cli":"^6.7.5","babel-eslint":"^6.0.2","babel-plugin-add-module-exports":"^0.2.1","babel-plugin-transform-decorators-legacy":"^1.3.4","babel-preset-es2015":"^6.6.0","babel-register":"^6.7.2","cross-env":"^1.0.8","eslint":"^2.3.0","eslint-config-babel":"^1.0.1","eslint-plugin-babel":"^3.3.0","eslint-plugin-flow-vars":"^0.5.0","fs-extra":"^0.30.0","mocha":"^2.4.5","normalize-newline":"^2.1.0"},"gitHead":"db1bcc3e728e5f21e2febc066d5f7a7b17e47df8","_id":"@ahfarmer/lerna@2.0.0-beta.98","_shasum":"193c019831023a8990f992d0f5d85c221578d2c9","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.4.0","_npmUser":{"name":"ahfarmer","email":"ahfarmer@gmail.com"},"dist":{"shasum":"193c019831023a8990f992d0f5d85c221578d2c9","tarball":"https://registry.npmjs.org/@ahfarmer/lerna/-/lerna-2.0.0-beta.98.tgz","integrity":"sha512-ZOCqKMfAjyl4Jl2PfoVznzb4RX5Rj2OZ71tvyzZ/ldMx6QV74+a5A+xDycOP9zBaQobD2JvyXFnWtkgjwyflIA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIA7JaNEp3dmxdCXsa+zEwIse8ATPMIQxhD788+nnYL1pAiEApbgm0onCPlJ2Mg1Cz6kVvvWgzlbsfkljm+4HPTUMUbw="}]},"maintainers":[{"name":"ahfarmer","email":"ahfarmer@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/lerna-2.0.0-beta.98.tgz_1480481598626_0.08157518855296075"}}},"homepage":"https://lernajs.io/","repository":{"type":"git","url":"git+https://github.com/lerna/lerna.git"},"author":{"name":"Sebastian McKenzie","email":"sebmck@gmail.com"},"bugs":{"url":"https://github.com/lerna/lerna/issues"},"license":"MIT","readmeFilename":"README.md"}