New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to use lerna packages without publishing it to npm ? #536

Closed
sathishkumarsoundharajan opened this Issue Jan 26, 2017 · 6 comments

Comments

Projects
None yet
4 participants
@sathishkumarsoundharajan

sathishkumarsoundharajan commented Jan 26, 2017

Thanks for your awesome work.

If have 10 packages inside the lerna, but all the packages are private which should not published to npm. Is there way i can use those packages ? Like will lerna will do npm link for all the packages something like that ?

One another question ?

  • Do lerna support private registries ?
  • Can i use lerna without git ?

@sathishkumarsoundharajan sathishkumarsoundharajan changed the title from Is there a way to use lerna packages without publish it to npm ? to Is there a way to use lerna packages without publishing it to npm ? Jan 26, 2017

@sbryfcz

This comment has been minimized.

sbryfcz commented Jan 26, 2017

Yeah. The --skip-git command will prevent any git commands. I use it with TFS repository. I also use it with a private npm repository. My private repo has some issues (that I'm tracking down) so I disable npm with --skip-npm. At it bundles up my packages, I execute npm publish in every package.

My publish command is typically:

lerna publish --skip-git --skip-npm --force-publish * --yes && lerna exec -- npm publish

@sathishkumarsoundharajan

This comment has been minimized.

sathishkumarsoundharajan commented Jan 27, 2017

@sbryfcz Thanks for the info. I am using clearcase for vcs and i am using sinopia as private npm server.

@lukebatchelor

This comment has been minimized.

Contributor

lukebatchelor commented Jan 30, 2017

Lerna should also respect the private flag in your package.json

e.g.

{
  "name": "package-5",
  "dependencies": {
    "package-1": "^1.0.0"
  },
  "private": true,
  "version": "1.0.0"
}
@doug-wade

This comment has been minimized.

Contributor

doug-wade commented Jan 30, 2017

Is there way i can use those packages ?

There are two ways that I can think of, both of which you alluded to. You can set a publishConfig in every one of your modules' package.json that points to your sinopia server (e.g. "publishConfig": { "registry": "http://localhost:4873" }). There are plans to support a registry option in lerna.json and at the command line that would make this option simpler. This solution is good if you want to share your modules with other developers without publishing to the public registry, or to deploy your modules to a production environment.

The other option, best for local development, is to use npm link to link your lerna modules into the global node modules, and then link from the global node modules to other node modules on the local file system (you can do this in one command, like npm link relative/path/to/lerna/module . from the directory at the root of the module you want to use your lerna modules).

Will lerna will do npm link for all the packages something like that?

It does not -- Lerna locally symlinks packages, but doesn't use npm link and doesn't link through the global node modules folder, so they're not available in other packages. I think we'd be resistant to making Lerna do that by default, given how strongly node discourages use of the global node modules folder, but it might be reasonable to add a link command that symlinks all required lerna modules to an outside dependent, if there is need, since I think this'd be rough to do with lerna exec.

Do lerna support private registries ?

I think until we have automated tests, the answer is technically no. However, I use a local verdaccio instance for development, and there's a lot of people using sinopia, so I'd be surprised if Lerna stopped working with private registries any time soon.

@doug-wade doug-wade added the question label Jan 30, 2017

@sathishkumarsoundharajan

This comment has been minimized.

sathishkumarsoundharajan commented Jan 30, 2017

Thanks @doug-wade for your detailed answer. I think we can add these questions to FAQ section on the Website. It would really help people in future.

@doug-wade

This comment has been minimized.

Contributor

doug-wade commented Jan 30, 2017

Closing in favor of lerna/website#12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment