Skip to content

fix(lib/vscode): remove symlink in npm package #3935

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 1 commit into from
Aug 9, 2021
Merged

Conversation

jsjoeio
Copy link
Contributor

@jsjoeio jsjoeio commented Aug 9, 2021

This PR removes the symlink to node_modules.asar when packaging up for npm because as of recently, npm no longer allows symbolic links in packages (we also don't need it).

Why are we doing this?

On Friday, August 6th, we released 3.11.1.

The npm workflow did not work as expected leading to 3.11.1 not being published on npm, Homebrew, or AUR. We did some investigation and came to the conclusion something changed on the npm side with regard to symlinks in packages.

We spoke to someone today, August 9th from GitHub who confirmed our theory.

Hi Joe! Saw your tweet about symlinks in npm packages. We did make some changes here recently. Can you drop me a line so that we can work through how to support you?

A few of the maintainers chatted and we came to the conclusion that we can remove this symlink.

We rm -f this symlink in the post-install and recreate it (to make sure it's correct) so the packaged link will never be used.

@code-asher

This PR removes that symlink.

Why did we have this before?

If you take a look at lib.sh, you'll see previous maintainers left a comment explaining why we do this.

VS Code bundles some modules into an asar which is an archive format that
works like tar. It then seems to get unpacked into node_modules.asar.

I don't know why they do this but all the dependencies they bundle already
exist in node_modules so just symlink it. We have to do this since not only VS
Code itself but also extensions will look specifically in this directory for
files (like the ripgrep binary or the oniguruma wasm).

You sure this won't break anything?

90% sure it shouldn't break anything because we actually remoe the symlink in the post-install and recreate it anyway so the one included in the npm package is never actually used.

There may be an edge case or two that we didn't anticipate but I (@jsjoeio) removed it, published to npm, tested locally and did not find any major issues.

How I tested locally

  1. yarn
  2. yarn build
  3. yarn build:vscode
  4. yarn release
  5. check for symlinks - cd release && find . -type l -ls

Then I tested the individual release:

  1. cd release
  2. yarn
  3. node .

Screenshot and video

image

Screen.Recording.2021-08-09.at.12.18.56.PM.mov

Fixes N/A

Related:

Other notes

@jawnsy showed me this trick to find symlinked files in a directory.

find . -type l -ls

Helpful for debuggging this kind of thing.

@jsjoeio jsjoeio self-assigned this Aug 9, 2021
@jsjoeio jsjoeio added the ci Issues related to ci label Aug 9, 2021
@jsjoeio jsjoeio added this to the 3.12.0 milestone Aug 9, 2021
@codecov
Copy link

codecov bot commented Aug 9, 2021

Codecov Report

Merging #3935 (9d83659) into main (741b834) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3935   +/-   ##
=======================================
  Coverage   63.51%   63.51%           
=======================================
  Files          36       36           
  Lines        1872     1872           
  Branches      379      379           
=======================================
  Hits         1189     1189           
  Misses        580      580           
  Partials      103      103           

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 741b834...9d83659. Read the comment docs.

@jsjoeio jsjoeio changed the title fix: remove symlink in npm package fix(lib/vscode): remove symlink in npm package Aug 9, 2021
@jsjoeio jsjoeio force-pushed the jsjoeio-rm-symlink branch from 5710b04 to 9d83659 Compare August 9, 2021 18:55
@jsjoeio jsjoeio marked this pull request as ready for review August 9, 2021 19:21
@jsjoeio jsjoeio requested a review from a team as a code owner August 9, 2021 19:21
@greyscaled greyscaled requested a review from GirlBossRush August 9, 2021 19:23
Copy link
Contributor

@jawnsy jawnsy left a comment

Choose a reason for hiding this comment

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

Love the writeup! I trust you :)

Copy link
Contributor

@greyscaled greyscaled left a comment

Choose a reason for hiding this comment

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

Seems fine to me, but I don't know what I don't know w.r.t to the fork solution and testing this.

the ripgrep ext worked, but I have no way to know if some other ext breaks :(

@jsjoeio
Copy link
Contributor Author

jsjoeio commented Aug 9, 2021

I don't know w.r.t to the fork solution and testing this.

I think @TeffenEllis mentioned once the fork solution is implemented, we won't even have to worry about this symlink issue cause it's non-existent there.

the ripgrep ext worked, but I have no way to know if some other ext breaks :(

Yeah, worked for me too! I guess we'll have to release and see what happens? If something does break, we can figure it out though. And eventually, we'll be able to write more tests for specific extensions (once #3621 gets merged)

@jsjoeio jsjoeio merged commit 5049447 into main Aug 9, 2021
@jsjoeio jsjoeio deleted the jsjoeio-rm-symlink branch August 9, 2021 19:29
@jsjoeio jsjoeio modified the milestones: 3.12.0, 3.11.2 Aug 9, 2021
jsjoeio added a commit that referenced this pull request Aug 10, 2021
This reverts commit 5049447, reversing changes
made to 741b834.

We still need the symlink for the standlone packages which means we need to redo
how the symlink is removed, ensuring it's only removed in the npm package.
jsjoeio added a commit that referenced this pull request Aug 10, 2021
This reverts commit 5049447, reversing changes
made to 741b834.

We still need the symlink for the standlone packages which means we need to redo
how the symlink is removed, ensuring it's only removed in the npm package.
jsjoeio added a commit that referenced this pull request Aug 10, 2021
Revert "Merge pull request #3935 from cdr/jsjoeio-rm-symlink"
@jsjoeio jsjoeio modified the milestones: 3.11.2, 3.12.0 Aug 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci Issues related to ci
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants