Title: fix: Generate shrinkwraps for the bundled vscode by edvincent · Pull Request #5071 · coder/code-server · GitHub
Open Graph Title: fix: Generate shrinkwraps for the bundled vscode by edvincent · Pull Request #5071 · coder/code-server
X Title: fix: Generate shrinkwraps for the bundled vscode by edvincent · Pull Request #5071 · coder/code-server
Description: Fixes #5056 #5174 Why are we removing synp after all? Because it only takes care of putting in the package-lock/shrinkwrap file the first level of dependencies, not the nested dependencies which we have from the yarn lockfile. See the contents of https://unpkg.com/browse/code-server@4.2.0-5047-90c9adcded65d10004a9db71d0717cd90565baa3/npm-shrinkwrap.json, and how for example, @mapbox/node-pre-gyp is listed as a dependency of argon2 - but is not present anywhere in the shrinkwrap file. Why are we adding packages from resolutions in devDependencies too? What initially drove me to use synp was the fact that the npm shrinkwrap command would generate a lockfile that wasn't usable. Trying to install the package with that lockfile would fail with the following exception: Installing Code dependencies... [..] npm ERR! Cannot read property 'requires' of undefined This was actually due to npm shrinkwrap (in NPM 6) choking with some packages not being anywhere in the lockfile but being present in the package.json. So I simply tracked down their dependency tree, saw they were coming from devDependencies, and added them there - which now prevents the npm shrinkwrap-generated lockfile from breaking, and allows us to remove synp. This doesn't change the size of the dependency tree, and should be able to be removed when there are higher versions of NPM used. Why aren't we using npm ci to replace yarn --frozen-lockfile? NPM 6's npm ci doesn't deal very well with optional dependencies, which the bundled vscode needs for some Windows dependencies (namely, windows-process-tree and @vscode/windows-registry): The npm shrinkwrap command doesn't add them to the lockfile, because the CI runs from Linux, so it doesn't install them - and the commands generates the lockfile based on what's in node_modules. If we hacked the lockfile and added them there manually (with "optional": true), the install on a Linux machine would fail - because NPM 6's npm ci doesn't respect them from an npm-shrinkwrap.json file. If we don't add them and use npm ci, they are not installed - even on Windows machines. What I settled for was using npm install --production (for now), that will always respect the lockfile version if an entry is there, and will try to get versions not listed there. This effectively means that those two packages, on windows, won't be following the yarn.lock that is being used in the development package, but that seemed less worse. Note: Another idea was to hackily add the packages to the lockfile + enhance the postinstall.sh script to conditionally use --no-optional if we're running on a non-Windows machine - which skips those optional dependencies. I wasn't convinced by either the hacking around of the lockfile nor this conditional... But happy to hear thoughts? Why don't we need the "Remove the devDependencies" hack anymore? Because we are now generating the shrinkwrap file after stuff has been installed with yarn --production, which means npm shrinkwrap will only list the production dependencies. Why are we removing json after all? Because we don't need to remove the devDependencies anymore - which needed some more complex JSON mangling. Now we simply need to remove a line, which can be done with sed. But also, because doing it with json gets a bit tricky, as json would need to be listed as an actual dependency (rather than devDependency) of code-server and vscode too to be able to be used... Not worth it. Switching the jq commands to json might still be worth it, but no need to conflate the commits. Why no more yarn pack artifact? Realized I was trying to fix/conflate too many things into one PR, so will likely create a different issue to discuss this one.
Open Graph Description: Fixes #5056 #5174 Why are we removing synp after all? Because it only takes care of putting in the package-lock/shrinkwrap file the first level of dependencies, not the nested dependencies which ...
X Description: Fixes #5056 #5174 Why are we removing synp after all? Because it only takes care of putting in the package-lock/shrinkwrap file the first level of dependencies, not the nested dependencies which ...
Opengraph URL: https://github.com/coder/code-server/pull/5071
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:06a4f6b2-e8f4-b238-8ff2-f916f174a6a4 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | EC42:1F2B:CBE4BF:111267F:6B01D241 |
| html-safe-nonce | d7b44aa50f159ec877c08d499f744eb14ab780b6a7b09f2bbd0296d155887cd3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQzQyOjFGMkI6Q0JFNEJGOjExMTI2N0Y6NkIwMUQyNDEiLCJ2aXNpdG9yX2lkIjoiODY1NDgwMzgyNTYyMzk0NTc5MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | ea59ec558cd82162ce421dc3e71ea484bf86989e8d47e3b429b89ce279d9dc3a |
| hovercard-subject-tag | pull_request:902186829 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/coder/code-server/pull/5071/files |
| twitter:image | https://avatars.githubusercontent.com/u/4997403?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/4997403?s=400&v=4 |
| og:image:alt | Fixes #5056 #5174 Why are we removing synp after all? Because it only takes care of putting in the package-lock/shrinkwrap file the first level of dependencies, not the nested dependencies which ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/coder/code-server git https://github.com/coder/code-server.git |
| octolytics-dimension-user_id | 95932066 |
| octolytics-dimension-user_login | coder |
| octolytics-dimension-repository_id | 172953845 |
| octolytics-dimension-repository_nwo | coder/code-server |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 172953845 |
| octolytics-dimension-repository_network_root_nwo | coder/code-server |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width