Skip to content

Conversation

@ChristophWurst
Copy link
Member

@ChristophWurst ChristophWurst commented Sep 30, 2019

No description provided.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
@ChristophWurst ChristophWurst added this to the Nextcloud 18 milestone Sep 30, 2019
@ChristophWurst ChristophWurst self-assigned this Sep 30, 2019
@skjnldsv skjnldsv added the bug label Sep 30, 2019
@skjnldsv
Copy link
Member

/backport to stable17

@skjnldsv
Copy link
Member

/backport to stable16

image: node
commands:
- npm install handlebars -g
- npm i
Copy link
Collaborator

@kesselb kesselb Sep 30, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

npm i will install the latest handlebars version in the range ^4.2.1.
npm ci would install the exact version from package-lock.json.
Fake news 🙈

Just as information. I was running into troubles with npm i on ci in the past.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where's that documented? Can't find the info at https://docs.npmjs.com/cli/ci.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the ^ version range is a problem in general. If you add a new dependency with npm i -S xxx to Nextcloud npm will update the package-lock.json with a newer version of handlebars. Not quite what we want.

This also caused issues in the past (@juliushaertl 👀)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kesselb doesn't npm ci only make sure to clean the node_modules folder?

Copy link
Member

@skjnldsv skjnldsv Sep 30, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This command is similar to npm-install, except it’s meant to be used in automated environments such as test platforms, continuous integration, and deployment – or any situation where you want to make sure you’re doing a clean install of your dependencies. It can be significantly faster than a regular npm install by skipping certain user-oriented features. It is also more strict than a regular install, which can help catch errors or inconsistencies caused by the incrementally-installed local environments of most npm users.

In short, the main differences between using npm install and npm ci are:

  • The project must have an existing package-lock.json or npm-shrinkwrap.json.
  • If dependencies in the package lock do not match those in package.json, npm ci will exit with an error, instead of updating the package lock.
  • npm ci can only install entire projects at a time: individual dependencies cannot be added with this command.
  • If a node_modules is already present, it will be automatically removed before npm ci begins its install.
  • It will never write to package.json or any of the package-locks: installs are essentially frozen.

Oh!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should actually use this in our makefiles too see_no_evil

If you prefer slower installs, sure, go ahead 😉

Also, you won't see the security alerts as I just tested.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where's that documented? Can't find the info at https://docs.npmjs.com/cli/ci.

Fair question.

npm i will install the latest handlebars version in the range ^4.2.1

I'm not 100% sure. We had less issues with conflicting package-lock.json or failing builds after we switched to npm ci (also locally). I haven't compared my node_modules folder with others in depth 🙈 A positive side effect of npm ci is that package-lock.json is not modified.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unless you specify a package, npm i seems to install the version written on package.json/lock :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

npm i seems to install the version written on package.json/lock

Which also is the sole purpose of the lock file, right? :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's merge then! :)

@skjnldsv skjnldsv merged commit 48239c9 into master Oct 1, 2019
@skjnldsv skjnldsv deleted the fix/hbs-compile-script branch October 1, 2019 05:53
@backportbot-nextcloud
Copy link

The backport to stable17 failed. Please do this backport manually.

@backportbot-nextcloud
Copy link

The backport to stable16 failed. Please do this backport manually.

@skjnldsv
Copy link
Member

skjnldsv commented Oct 1, 2019

Backports in #17347 #17348

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants