trejder
trejder

Reputation: 17495

How Composer handles local changes

Suppose I install package for CKEditor through Composer and manually add new skins and plugins to it. How Composer will handle this, when next update to base package will be released?

Will it overwrite entire package directory (deleting local changes) or update only listed files?

Also, I'm having problems updating one package to newest version and made that update locally, manually. Yet, composer status shows No local changes. Does this mean, that Composer itself does not check contents of each package's folder for local changes, only operates on differences between composer.json and composer.lock?

Upvotes: 1

Views: 2075

Answers (2)

RLX
RLX

Reputation: 86

Composer will updated to newest version matched to version what you've added in composer.json and yes - it will overwrite existing package (including all of yours changes) but it will omit files which not exist in packages.

Command: "composer status" shows all changes in files what belongs to specified package. If you will change some file then it will be shown in that list, but if you will add a new one then of course not.

Generally, your approach might work in some cases but I strongly DO NOT recommend it. Problem will be when you create some file, and then will be added into package (for example in newer version).

You should just use all packages "as is" directly in your application, and within it add new stuff, or another configuration, etc.

Upvotes: 2

Yo-han
Yo-han

Reputation: 351

Will it overwrite entire package directory (deleting local changes) or update only listed files?

Yes. When updating a package Composer removes the current version of the package and installs the new one.

Also, I'm having problems updating one package to newest version and made that update locally, manually. Yet, composer status shows No local changes. Does this mean, that Composer itself does not check contents of each package's folder for local changes, only operates on differences between composer.json and composer.lock?

The 1.* part in your composer.json tells Composer to only update when there is a new release available in the 1.* version range. New commits are not a new release. A new update will be available when the package owner creates a new release with a higher version number. If you want to update after each new commit you should change "1.*" to "dev-master".

Upvotes: 1

Related Questions