Skip to content
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

Update Yarn and Better Document Dependencies #689

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

elijah-potter
Copy link
Collaborator

#688 informed me that Harper has been using an old (deprecated) version of Yarn. This PR updates the referenced Yarn version in our package.json files and modifies our tooling to work with it.

I've also added a short blurb about certain integration test dependencies on certain Linux platforms.

@shanecranor, does this look good to you?

@elijah-potter elijah-potter added documentation Improvements or additions to documentation dependencies Pull requests that update a dependency file labels Feb 15, 2025
@shanecranor
Copy link

shanecranor commented Feb 15, 2025

LGTM, maybe add some stuff to the .gitignore https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored

oops, I sent that before just setup finished, I'm getting some errors that I wasn't before

error: Cannot find module '/home/shane/tmp_stuff/harper/packages/vscode-plugin/build/tests/runTests.js'
    at Function._resolveFilename (node:internal/modules/cjs/loader:1405:15)
    at defaultResolveImpl (node:internal/modules/cjs/loader:1061:19)
    at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1066:22)
    at Function._load (node:internal/modules/cjs/loader:1215:37)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:151:5)
    at node:internal/main/run_main_module:33:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
Node.js v23.8.0
error: Recipe `test-vscode` failed with exit code 1

@mcecode
Copy link
Collaborator

mcecode commented Feb 17, 2025

oops, I sent that before just setup finished, I'm getting some errors that I wasn't before

error: Cannot find module '/home/shane/tmp_stuff/harper/packages/vscode-plugin/build/tests/runTests.js'
    at Function._resolveFilename (node:internal/modules/cjs/loader:1405:15)
    at defaultResolveImpl (node:internal/modules/cjs/loader:1061:19)
    at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1066:22)
    at Function._load (node:internal/modules/cjs/loader:1215:37)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:151:5)
    at node:internal/main/run_main_module:33:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
Node.js v23.8.0
error: Recipe `test-vscode` failed with exit code 1

This is because Yarn >=2.x no longer automatically runs pre and post scripts outside of set lifecycle scripts, so the tests aren't being built before Yarn tries to run them.

We can remedy this by merging the pretest command with the test command in packages/vscode-plugin/package.json:

	"scripts": {
		"watch:esbuild": "node esbuild.cjs --watch",
		"watch:tsc": "tsc --noEmit --watch",
-		"pretest": "yarn lint && tsc && node esbuild.cjs",
+		"test": "yarn lint && tsc && node esbuild.cjs && node build/tests/runTests.js",
		"vscode:prepublish": "yarn lint && tsc --noEmit && node esbuild.cjs --production",
		"package": "vsce package",
		"lint": "eslint src --ext ts"
	},

I'd do it myself but I don't think I have access to this branch to add changes so leaving the fix here.

This should also fix the failing precommit workflow.

elijah-potter and others added 2 commits February 17, 2025 13:28
Co-authored-by: mcecode <mcecode@users.noreply.github.com>
@mcecode
Copy link
Collaborator

mcecode commented Feb 20, 2025

I just realized because of the failing test that a blocker in doing this Yarn migration is @vscode/vsce, which is what's used to package and publish VS Code extensions. It only officially supports Yarn 1.x. Though, there is a workaround that might work for us since we also use esbuild to bundle our extension.

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 documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants