Skip to content
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

Make yarn --no-lockfile optional #196

Closed
oscarni opened this issue May 18, 2018 · 5 comments
Closed

Make yarn --no-lockfile optional #196

oscarni opened this issue May 18, 2018 · 5 comments

Comments

@oscarni
Copy link

oscarni commented May 18, 2018

We've encountered an issue where we have a dependency which makes our tests fail. It's very annoying and it would be great if --no-lockfile could be optional, preferably set by default and you have the option to respect the lock file in a scenario if you'd like.

We use ember-try to test different builds of our ember-app. We use ember-cli-conditional-compile in order to create different builds for different websites with different features and to test the different builds we use ember-try's different scenarios. It works great for us in most cases, but it feels like ember-try is only focusing on different scenarios where you test ember betas or other versions of ember data, etc. In those cases --no-lockfile makes a lot of sense. But for us in order to test our different conditionally compiled scenarios we would be prefer if we could test the different compilations with the lockfile so we can make sure the tests are run with the exact same deps and the same deps as the production build will have.

A setting like --respect-lockfile or some similiar naming could work great. I'd be happy to give it a whirl and create a PR if you find this approach reasonable?

@rwjblue
Copy link
Member

rwjblue commented May 19, 2018

Seems reasonable to skip the npm/yarn install step when no package changes are made.

@kategengler - what do you think?

@rwjblue
Copy link
Member

rwjblue commented May 19, 2018

I think that the nomOptions option should default to —no-lockfile —ignore-engines (when using yarn) and —no-shrinkwrap (when using npm), but if the user provides a custom value (at all) we use it without modification.

Currently, we always add to the options and there is (as pointed out above) no way to opt out

if (this.useYarnCommand) {
if (mgrOptions.indexOf('--no-lockfile') === -1) {
mgrOptions = mgrOptions.concat(['--no-lockfile']);
}
// npm warns on incompatible engines
// yarn errors, not a good experience
if (mgrOptions.indexOf('--ignore-engines') === -1) {
mgrOptions = mgrOptions.concat(['--ignore-engines']);
}
} else if (mgrOptions.indexOf('--no-shrinkwrap') === -1) {
mgrOptions = mgrOptions.concat(['--no-shrinkwrap']);
}
return this.run(cmd, [].concat(['install'], mgrOptions), { cwd: this.cwd }).then(() => {
if (!adapter.useYarnCommand) {
return adapter.run(adapter.configKey, ['prune'], { cwd: adapter.cwd });
}
});
},

@kategengler
Copy link
Member

I think skipping the install when no dep changes are made makes sense. That ties in with #143 a bit and requires a bit of a big refactor (which I think is due anyway because ember-try apparently isn't just about changing dependencies anymore).

I'm less sure about having npmOptions override, since it would be a breaking change. What about a new option managerOptions that would be used if set in place? It's a better name now that it is used for npm & yarn and won't break anybody's existing config.

I do think that we'll need to stress that when testing different dependencies (especially ember versions) that ignoring the lockfile is the best way to truly test that those dependency change work.

@rwjblue
Copy link
Member

rwjblue commented May 29, 2018

I'm less sure about having npmOptions override, since it would be a breaking change. What about a new option managerOptions that would be used if set in place? It's a better name now that it is used for npm & yarn and won't break anybody's existing config.

Sounds good to me...

@rwjblue
Copy link
Member

rwjblue commented Nov 2, 2020

This was fixed by #409 (via buildManagerOptions) and is documented in the README.

@rwjblue rwjblue closed this as completed Nov 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants