Skip to content

Keep package.json and package-lock.json in sync#154

Merged
wu-sheng merged 1 commit intomainfrom
lock
Sep 6, 2022
Merged

Keep package.json and package-lock.json in sync#154
wu-sheng merged 1 commit intomainfrom
lock

Conversation

@kezhenxu94
Copy link
Copy Markdown
Member

@kezhenxu94 kezhenxu94 commented Sep 6, 2022

The package.json and package-lock.json is not in sync, this patch makes them in sync and such we can perform reliable builds using npm ci.

npm ERR! code EUSAGE
npm ERR! 
npm ERR! `npm ci` can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with `npm install` before continuing.
npm ERR! 
npm ERR! Missing: @types/[email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: @vue/[email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Invalid: lock file's @babel/[email protected] does not satisfy @babel/[email protected]
npm ERR! Invalid: lock file's [email protected] does not satisfy [email protected]
npm ERR! Missing: [email protected] from lock file
npm ERR! Invalid: lock file's [email protected] does not satisfy [email protected]
npm ERR! Invalid: lock file's [email protected] does not satisfy [email protected]
npm ERR! 

@kezhenxu94
Copy link
Copy Markdown
Member Author

Maybe that's why every time I run npm i locally the package-lock.json file changes

@wu-sheng wu-sheng added this to the 9.3.0 milestone Sep 6, 2022
@wu-sheng wu-sheng added the dependencies Pull requests that update a dependency file label Sep 6, 2022
@wu-sheng
Copy link
Copy Markdown
Member

wu-sheng commented Sep 6, 2022

@kezhenxu94
Copy link
Copy Markdown
Member Author

@kezhenxu94
Copy link
Copy Markdown
Member Author

npm ci is preferred in CI environment only while npm install is still preferred in local development, we don't bother to change developers experience, I have also updated the command in GHA to ensure the package.json and package-lock.json is in sync so no commit breaking that will be merged.

@wu-sheng
Copy link
Copy Markdown
Member

wu-sheng commented Sep 6, 2022

I want to discuss what is recommend when we run skywalking UI/backend build. The difference would make veraions in license file not match the binary.

@kezhenxu94
Copy link
Copy Markdown
Member Author

I want to discuss what is recommend when we run skywalking UI/backend build. The difference would make veraions in license file not match the binary.

You don't understand how this is fixed.

This patch resolves the problem that package-lock.json doesn't lock some dependencies versions because they are missing in package-lock.json file. It also guarantees that this case won't happen again in the future by making sure the package-lock.json is in sync with package.json.

When developers build/install without any changes the versions are guaranteed by the lock file so no version is changed.

When developers upgrade any dependencies in local machine, they also have to make sure the two files are in sync otherwise the CI would fail.

@kezhenxu94
Copy link
Copy Markdown
Member Author

I want to discuss what is recommend when we run skywalking UI/backend build. The difference would make veraions in license file not match the binary.

There is nothing changed in building the UI. Just keep everything every command the same as before.

@wu-sheng wu-sheng merged commit 49bc349 into main Sep 6, 2022
@wu-sheng wu-sheng deleted the lock branch September 6, 2022 06:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants