Skip to content

fix: add missing package.json and source maps #5040

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 6 commits into from
Mar 30, 2022

Conversation

code-asher
Copy link
Member

These issues were caused when I switched Code's packaged build instead of putting it together ourselves.

See individual commits for more information.

@code-asher code-asher force-pushed the missing-files branch 2 times, most recently from 1adcedf to ecdbc78 Compare March 29, 2022 23:00
Instead of copying and then deleting them.  This will also catch some
node_modules directories that were missed.
Code packages all the dependencies using webpack for each extension so
there are no dependencies to install.
I also moved this to its own patch because it feels sufficiently
standalone.

Fixes coder#5026.
The base is slightly different so it needed to be refreshed.
This was caused by switching to Code's package step which does not
include the package.json.

Fixes coder#5019.
It seems this actually is used now.
@codecov
Copy link

codecov bot commented Mar 29, 2022

Codecov Report

Merging #5040 (4ae5e26) into main (18e19d2) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #5040   +/-   ##
=======================================
  Coverage   71.30%   71.30%           
=======================================
  Files          30       30           
  Lines        1683     1683           
  Branches      373      373           
=======================================
  Hits         1200     1200           
  Misses        413      413           
  Partials       70       70           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 18e19d2...4ae5e26. Read the comment docs.

@code-asher code-asher marked this pull request as ready for review March 29, 2022 23:36
@code-asher code-asher requested a review from a team March 29, 2022 23:36
rsync -avh --exclude .gitignore --exclude /node ./lib/vscode-reh-web-*/ "$VSCODE_OUT_PATH"
local rsync_opts=()
if [[ ${DEBUG-} = 1 ]]; then
rsync_opts+=(-vh)
Copy link
Contributor

Choose a reason for hiding this comment

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

What does -vh stand for here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah:

  • -h: -h, --human-readable output numbers in a human-readable format
  • -v: -v, --verbose increase verbosity

Source: https://linux.die.net/man/1/rsync

Comment on lines +84 to +99
fi

# Some extensions have a .gitignore which excludes their built source from the
# npm package so exclude any .gitignore files.
rsync_opts+=(--exclude .gitignore)

# Exclude Node as we will add it ourselves for the standalone and will not
# need it for the npm package.
rsync_opts+=(--exclude /node)

# Exclude Node modules.
if [[ $KEEP_MODULES = 0 ]]; then
rsync_opts+=(--exclude node_modules)
fi

rsync "${rsync_opts[@]}" ./lib/vscode-reh-web-*/ "$VSCODE_OUT_PATH"
Copy link
Contributor

Choose a reason for hiding this comment

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

This approach looks a lot cleaner 👏🏼

Comment on lines -101 to -108

for ext in */; do
ext="${ext%/}"
echo "extensions/$ext: installing dependencies"
cd "$ext"
yarn --production --frozen-lockfile
cd "$OLDPWD"
done
Copy link
Contributor

Choose a reason for hiding this comment

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

beautiful find

Copy link
Member Author

Choose a reason for hiding this comment

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

Hopefully I am not wrong about this removal hahaha

Copy link
Member Author

Choose a reason for hiding this comment

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

Before the next release we might want to run through all the builtin extensions to see if we have any more issues with them

Copy link
Contributor

Choose a reason for hiding this comment

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

Good idea. I'll add a note to the release issue

@@ -79,7 +79,7 @@ Index: code-server/lib/vscode/src/vs/code/browser/workbench/workbench.html
+ } catch (error) { /* Probably fine. */ }
Object.keys(self.webPackagePaths).map(function (key, index) {
self.webPackagePaths[key] = new URL(
`{{VS_BASE}}/static/remote/web/node_modules/${key}/${self.webPackagePaths[key]}`,
`{{VS_BASE}}/static/node_modules/${key}/${self.webPackagePaths[key]}`,
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this need to be changed in my upstream PR?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nope, this is not part of the changes this patch applies, it is just part of the surrounding context. So this change is from an earlier patch.

Copy link
Contributor

@jsjoeio jsjoeio left a comment

Choose a reason for hiding this comment

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

Nothing concerning, just a bunch of questions. Nice work!

Comment on lines 148 to 152
# Include global extension dependencies as well.
rsync "$VSCODE_SRC_PATH/extensions/package.json" "$VSCODE_OUT_PATH/extensions/package.json"
rsync "$VSCODE_SRC_PATH/extensions/yarn.lock" "$VSCODE_OUT_PATH/extensions/yarn.lock"
rsync "$VSCODE_SRC_PATH/extensions/postinstall.js" "$VSCODE_OUT_PATH/extensions/postinstall.js"

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice catch 👏🏼

Comment on lines +139 to +140
# version though so pull that from the main package.json.
jq --slurp '.[0] * {version: .[1].version}' \
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice catch! How'd you figure this out? That log message when code-server starts up? IIRC

Copy link
Member Author

Choose a reason for hiding this comment

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

Yup hahaha, no idea how I did not see it before

Copy link
Member Author

@code-asher code-asher Mar 30, 2022

Choose a reason for hiding this comment

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

Fortunately we still have libsecret as a dependency (which keytar needs) in our docs (as far as I could tell, hopefully I did not miss a spot) so nothing else changes

@code-asher code-asher merged commit 06e36b4 into coder:main Mar 30, 2022
@code-asher code-asher deleted the missing-files branch March 30, 2022 15:35
TinLe pushed a commit to TinLe/code-server that referenced this pull request Apr 23, 2022
* Use --exclude to skip node_modules

Instead of copying and then deleting them.  This will also catch some
node_modules directories that were missed.

* Remove per-extension dependency install

Code packages all the dependencies using webpack for each extension so
there are no dependencies to install.

* Include source maps

I also moved this to its own patch because it feels sufficiently
standalone.

Fixes coder#5026.

* Refresh language patch

The base is slightly different so it needed to be refreshed.

* Add missing package.json

This was caused by switching to Code's package step which does not
include the package.json.

Fixes coder#5019.

* Include keytar

It seems this actually is used now.
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.

2 participants