-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Add disabling of autoinstall globally via environment variable #2130
Add disabling of autoinstall globally via environment variable #2130
Conversation
Reduces amount of warnings during tests.
* handle empty config && asset files * remove bad empty asset solution
Don’t use “last 2 versions”. See https://jamie.build/last-2-versions
<!--- Thanks for filing a pull request 😄 ! Before you submit, please read the following: Search open/closed issues before submitting since someone might have pushed the same thing before! --> # ↪️ Pull Request <!--- Provide a general summary of the pull request here Please look for any issues that this PR resolves and tag them in the PR. --> Changed the logic to determine which package manager to use during auto-installation. The only situation Parcel should use yarn is when it satisfies - There is `yarn` command available AND - There is `yarn.lock` file AND - There is NOT `package-lock.json` Otherwise, it uses npm. Fixes #2117 ## 🚨 Test instructions <!-- In case it is impossible (or too hard) to reliably test this feature/fix with unit tests, please provide test instructions! --> Setup a testing directory with different setups (package-lock existence, yarn.lock existence, yarn command existence). The only situation Parcel should use yarn is when - There is `yarn` command available AND - There is `yarn.lock` file AND - There is NOT `package-lock.json` ## ✔️ PR Todo ~~- [ ] Added/updated unit tests for this change~~ - [x] Filled out test instructions (In case there aren't any unit tests) - [x] Included links to related issues/PRs <!-- Love parcel? Please consider supporting our collective: 👉 https://opencollective.com/parcel/donate --> ## Side note There is a situation where there are both package-lock.json and yarn.lock. Having npm as default package manager means that it should use npm in this situation. That's why there is only one situation where Parcel should use yarn.
Very small change, but I noticed how these were calling `this.dest` directly over using the Packager's methods.
Maybe this is a better place for disabling autoinstall: Lines 137 to 140 in e86ddf4
|
Agreed @mischnic. Let me do the checking there. |
-Allows disabling autoinstall via a environment variable named PARCEL_NO_AUTOINSTALL. -Closes 2081.
Hmm why do we need an environment variable and not just use the cli flag that already exists? |
I don't want to add the --no-autoinstall flag to every project of mine and having this flag set implicitly (so not specified in the package.json) doesn't change the build output. |
I'd like the same in my projects @devongovett. 😄 |
src/Bundler.js
Outdated
@@ -135,7 +135,8 @@ class Bundler extends EventEmitter { | |||
detailedReport: options.detailedReport || false, | |||
global: options.global, | |||
autoinstall: | |||
typeof options.autoinstall === 'boolean' | |||
typeof options.autoinstall === 'boolean' && | |||
process.env.PARCEL_NO_AUTOINSTALL !== 'true' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better if the options were positive instead of negative, so PARCEL_AUTOINSTALL=false
should disable it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was my original thought. Brb updating.
Due to move to monorepo which rewrote the git history, this PR was automatically closed. Please open a new PR against master with your changes. You can do a diff against the |
…ent variable -Closes parcel-bundler#2130.
…ment variable -Closes parcel-bundler#2130.
…ent variable -Closes parcel-bundler#2130.
…ment variable -Closes parcel-bundler#2130.
…ent variable -Closes parcel-bundler#2130.
…ent variable -Closes parcel-bundler#2130.
…ment variable -Closes parcel-bundler#2130.
…ment variable -Closes parcel-bundler#2130.
↪️ Pull Request
-Allow disabling of autoinstall via a environment variable named PARCEL_NO_AUTOINSTALL.
✔️ PR Todo
Feature Request: #2081