Skip to content

Use npm ci instead of install #617

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

Merged
merged 1 commit into from
Jan 23, 2019
Merged

Conversation

h-michael
Copy link
Contributor

fix #422

npm install is always recreate package-lock.json.
So we might use npm ci with install-code

https://docs.npmjs.com/cli/ci.html#description

@matklad
Copy link
Member

matklad commented Jan 23, 2019

LGTM, but I know nothing about npm. If no one thinks this will break in some cases, I'll merge!

@DJMcNab
Copy link
Contributor

DJMcNab commented Jan 23, 2019

I'm not sure that this is a good change - I think npm ci deletes node_modules, which is bad.

This means we reinstall node_modules on every cargo install-code

@h-michael h-michael changed the title Use npm ci instead of install Use npm install --no-save Jan 23, 2019
@h-michael
Copy link
Contributor Author

@DJMcNab Ok, how about this?

@matklad
Copy link
Member

matklad commented Jan 23, 2019

So, npm either ignores lockfile, or purges node_modules completely? 🤦‍♂️

@matklad
Copy link
Member

matklad commented Jan 23, 2019

FWIW, I'd personally will be more confident with npm ci: cargo install-code is not something which should be executed frequently, and I'd love to be sure that folks get exacetly the packages from package-lock.json.

@h-michael
Copy link
Contributor Author

I'm not sure that this is a good change - I think npm ci deletes node_modules, which is bad.

Uh, but I think we might use npm ci instead of npm install.
npm install always re-resolves package dependency and it's bit slow.
npm ci don't resolves package dependency.
Surely npm ci delete node_modules, but npm caches packages to .npm directory.
So I think npm ci isn't slow.

@h-michael h-michael changed the title Use npm install --no-save Use npm ci instead of install Jan 23, 2019
@DJMcNab
Copy link
Contributor

DJMcNab commented Jan 23, 2019

In a development cycle, I frequently run cargo install-code as its the easiest way for me to test out the new changes without making a full test. Maybe we should have a cargo install-lsp which forgoes installing the extension altogether.

@matklad
Copy link
Member

matklad commented Jan 23, 2019

@DJMcNab would VSCode's F5 command work for you during development? My understanding is that after #566 just hitting F5 runs a new vscode instance with freshly-built extension and freshly-build ra-analyzer?

@DJMcNab
Copy link
Contributor

DJMcNab commented Jan 23, 2019

I forgot we had that set up. However, I still want to use rust analyzer when developing it, so I still want the release version of ra_lsp_server installed and up to date as well..

@matklad
Copy link
Member

matklad commented Jan 23, 2019

so I still want the release version of ra_lsp_server installed and up to date as well..

For that, I personally do cargo install --path crates/ra_lsp_server/ --force. #618 should make that even better.

bors bot added a commit that referenced this pull request Jan 23, 2019
618: Add install-lsp subcommand r=matklad a=h-michael

related #617 (comment)

Co-authored-by: Hirokazu Hata <h.hata.ai.t@gmail.com>
@DJMcNab
Copy link
Contributor

DJMcNab commented Jan 23, 2019

Fair enough - cargo install-code as a blessed subcommand made me not even consider that as an option 🤦‍♂️.

@kjeremy
Copy link
Contributor

kjeremy commented Jan 23, 2019

Aren't we supposed to use vsce package? https://code.visualstudio.com/api/working-with-extensions/publishing-extension

@matklad
Copy link
Member

matklad commented Jan 23, 2019

that’s what install-code uses, yeah

bors r+

bors bot added a commit that referenced this pull request Jan 23, 2019
617: Use npm ci instead of install r=matklad a=h-michael

fix #422

`npm install` is always recreate `package-lock.json`.
So we might use `npm ci` with `install-code`

https://docs.npmjs.com/cli/ci.html#description

618: Add install-lsp subcommand r=matklad a=h-michael

related #617 (comment)

Co-authored-by: Hirokazu Hata <h.hata.ai.t@gmail.com>
@bors
Copy link
Contributor

bors bot commented Jan 23, 2019

Build succeeded

@bors bors bot merged commit 0dc60e1 into rust-lang:master Jan 23, 2019
@h-michael h-michael deleted the fix-install-code branch January 24, 2019 00:16
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

Successfully merging this pull request may close these issues.

cargo code-install makes package.json and package-lock.json diff
4 participants