Bit: Determine automatically the package manager

Created on 17 Apr 2018  路  7Comments  路  Source: teambit/bit

Expected Behavior

When we use $ bit init, it should be great if "bit" detects the package manager automatically and sets the good value for packageManager into bit.json.

It's easy to determine the default package manager used into a project:

  • package-lock.json for NPM
  • yarn.lock for Yarn.

Actual Behavior

When we do a $ bit init, packageManager is configured with "npm" by default.

areconfig typfeature typhelp wanted

All 7 comments

Great suggestion @kcampion .
We will add it to our backlog.
Thanks.

Update: I've started to work on this feature (along with some other cool features for bit init) in this branch: https://github.com/teambit/bit/tree/feature/interactive-init

I'm not sure that Bit should decide on the package manager automatically. I'm seeing a lot of projects that switch between these tools every other day... As each has its own faults.
The fact that there's a yarn.lock in a project does not mean that this is the preferred method.

While this should be solved by a better experience for bit init (for example using params or even an interactive init process), I don't think that an automated process is a correct approach.
I'm leaving this issue open for now to see if there are any feedbacks.

As additional feedback, the following issue: https://github.com/teambit/bit/issues/1578 wouldn't happen if Bit was automatically recognized Yarn as the package manager.

An interactive init process probably makes the most sense, but a yarn.lock in the repo is a pretty good indicator IMO, so the init process could suggest Yarn based on this

@orinokai There is a lot of cases when you have both yarn.lock and pacakge-lock.json.
I might change the interactive init in a way that if I see yarn.lock file, the default value for the interactive will be yarn, otherwise it will be npm.

Resolved using the interactive flow of bit init.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

KutnerUri picture KutnerUri  路  4Comments

idkjs picture idkjs  路  4Comments

JamesNorris11 picture JamesNorris11  路  4Comments

kegi picture kegi  路  4Comments

Nuruddinjr picture Nuruddinjr  路  3Comments