Enable Ember CLI users to opt into using yarn for packagement management.
Ember CLI currently uses the npm command line tool to install dependencies when you run
ember install or
ember addon. However, several problems usually arise from npm's semantics.
Dependency resolution and install times can be significant enough to disrupt workflows, as well as offline support, non-deterministic, non-flat dependency graphs.
- Faster installs
- Offline support
- Deterministic dependency graphs
- Lockfile semantics
While Ember CLI users can currently use Yarn to manage their dependencies, Ember CLI will use the npm client internally when running the above mentioned commands. By allowing users to specify that Ember CLI should use Yarn for everything, we're hoping to provide a more consistent experience.
Enabling Yarn is designed as opt-in to prevent disruptions to the developer's current workflow. We will address the two moments where this can happen.
There are two mechanisms through which to opt-in.
The first one is the presence of a
yarn.lock file in the project root.
yarn.lock file is generated by Yarn when you run
yarn install (or the shorter
so we assume that its presence means the developer intends to use Yarn to manage their dependencies.
Alternatively you, you can force Ember CLI to use Yarn with the
--yarn flag, and symmetrically,
you can force Ember CLI to not use Yarn with the
ember install ember-cli-miragewith
yarn.lockpresent will use Yarn
ember install ember-cli-miragewithout
yarn.lockpresent will use npm
ember install ember-cli-mirage --yarnwill use Yarn
ember install ember-cli-mirage --no-yarnwill use npm
Since this triad of commands is generally ran before a project is set up, there is no
yarn.lock file presence to check.
This means we are left with the
--no-yarn pair of flags, that will also be added to these commands:
ember new my-appwill use npm
ember new my-app --yarnwill use Yarn
The above also applies to
ember addon and
ember init, noting that
ember init doesn't receive any arguments.
How We Teach This
Both the Ember.js Guides as well as the Ember CLI Guides will be updated to reflect the new flags,
as well as the new semantics of
ember install in the presence of
In addition, the built-in instructions for
ember help will be updated to reflect this.
To be determined.
To be determined.