Skip to content

Commit d034a07

Browse files
authored
GLSP-1636: Remove yarn-compatibility workarounds for pnpm migration (#60)
Now that all GLSP repos are migrated to pnpm, drop the temporary workarounds that bridged the mid-migration yarn remainders: - Remove the yarn.lock detection (isYarnRepo) and always launch the theia binary via `pnpm exec` in the e2e web-server config - Stop pinning cloned yarn repos' packageManager field in setup.ts - Drop the nx.json workaround for the cloned glsp-vscode-integration repo, no longer lerna-based after its pnpm migration Part of: eclipse-glsp/glsp#1636
1 parent 5cd0167 commit d034a07

3 files changed

Lines changed: 3 additions & 49 deletions

File tree

examples/workflow-test/configs/utils.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,6 @@ export function getRepoPath(repoName: string): string {
4545
return path.resolve(getRepoDir(), repoName);
4646
}
4747

48-
// TEMPORARY: remove once all GLSP repos are migrated to pnpm.
49-
// During the migration a cloned integration repo may still be yarn-based. The package manager
50-
// determines how a binary is launched in a sub-package: pnpm's script shorthand only runs
51-
// package.json scripts, so the `theia` binary must be invoked via `pnpm exec`, whereas yarn classic
52-
// runs binaries directly and has no `exec` command. Detect the lockfile so callers can adapt.
53-
// Mirrors the yarn.lock-based detection in scripts/setup.ts.
54-
export function isYarnRepo(repoName: string): boolean {
55-
return existsSync(path.resolve(getRepoPath(repoName), 'yarn.lock'));
56-
}
57-
5848
export function getPort(envVar: string): number {
5949
const val = process.env[envVar];
6050
if (val) {

examples/workflow-test/configs/webserver.config.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
********************************************************************************/
1616

1717
import { PlaywrightTestConfig } from '@playwright/test';
18-
import { ProjectName, getBrowserServerBundlePath, getPort, getRepoDir, isYarnRepo, needsGlspServer } from './utils';
18+
import { ProjectName, getBrowserServerBundlePath, getPort, getRepoDir, needsGlspServer } from './utils';
1919

2020
type WebServerConfig = Extract<NonNullable<PlaywrightTestConfig['webServer']>, unknown[]>[number];
2121

@@ -41,7 +41,6 @@ export function buildWebServers(activeProjects: ProjectName[]): PlaywrightTestCo
4141
const standaloneBrowserPort = getPort('STANDALONE_BROWSER_PORT');
4242
const theiaPort = getPort('THEIA_PORT');
4343
const browserServerBundle = getBrowserServerBundlePath();
44-
const theiaBin = isYarnRepo('glsp-theia-integration') ? 'theia' : 'exec theia';
4544
const configs: Partial<Record<ProjectName, ProjectServerConfig>> = {
4645
standalone: {
4746
command: `${repo} client start --external-server --no-open`,
@@ -56,12 +55,7 @@ export function buildWebServers(activeProjects: ProjectName[]): PlaywrightTestCo
5655
path: '/diagram.html'
5756
},
5857
theia: {
59-
// TEMPORARY: drop the `isYarnRepo` branch once glsp-theia-integration is migrated to pnpm.
60-
// The command resolves to `<pm> browser <exec?> theia start ...` in the cloned repo. Under
61-
// pnpm the `theia` binary must be launched via `pnpm exec` (the script shorthand only runs
62-
// package.json scripts, else it fails with ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL); yarn classic
63-
// runs binaries directly and has no `exec` command.
64-
command: `${repo} theia run browser ${theiaBin} start --WF_GLSP=${glspServerPort} --WF_PATH=workflow --glspDebug`,
58+
command: `${repo} theia run browser exec theia start --WF_GLSP=${glspServerPort} --WF_PATH=workflow --glspDebug`,
6559
port: theiaPort
6660
}
6761
};

examples/workflow-test/scripts/setup.ts

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
1515
********************************************************************************/
1616
import { execSync } from 'child_process';
17-
import { copyFileSync, existsSync, readFileSync, writeFileSync } from 'fs';
17+
import { copyFileSync, readFileSync, writeFileSync } from 'fs';
1818
import { resolve } from 'path';
1919

2020
const args = process.argv.slice(2);
@@ -56,36 +56,6 @@ if (vscode || all) {
5656

5757
run(`${repo} clone ${repos.join(' ')}`);
5858

59-
if (repos.includes('glsp-vscode-integration')) {
60-
// The glsp-vscode-integration repo is a lerna monorepo that gets cloned into the `.repositories`
61-
// directory of this (also lerna-based) repo. Without an `nx.json` marking the repo root, lerna
62-
// walks up the directory tree, detects the nesting and fails. Adding an empty `nx.json` tells
63-
// lerna to stop the lookup at the repo root.
64-
const nxJson = resolve(rootDir, '.repositories', 'glsp-vscode-integration', 'nx.json');
65-
console.log(`Adding ${nxJson}`);
66-
writeFileSync(nxJson, '{}');
67-
}
68-
69-
// TEMPORARY: remove once all GLSP repos are migrated to pnpm.
70-
// Yarn classic (1.x) walks up the directory tree looking for a `packageManager` field. Since this
71-
// repo's root package.json declares `pnpm@<version>`, a `yarn install` inside a cloned (yarn-based)
72-
// repo under `.repositories` would find that pnpm pin, misparse it as `yarn@pnpm@<version>`, and
73-
// abort. Pin each cloned yarn repo to the local yarn version so the lookup stops at the repo itself.
74-
const yarnVersion = execSync('yarn --version', { cwd: rootDir }).toString().trim();
75-
for (const cloned of repos) {
76-
const repoDir = resolve(rootDir, '.repositories', cloned);
77-
const pkgPath = resolve(repoDir, 'package.json');
78-
if (!existsSync(resolve(repoDir, 'yarn.lock')) || !existsSync(pkgPath)) {
79-
continue;
80-
}
81-
const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
82-
if (!pkg.packageManager) {
83-
pkg.packageManager = `yarn@${yarnVersion}`;
84-
writeFileSync(pkgPath, `${JSON.stringify(pkg, null, 2)}\n`);
85-
console.log(`Pinned ${cloned} packageManager to yarn@${yarnVersion}`);
86-
}
87-
}
88-
8959
if (!skipBuild) {
9060
run(`${repo} build`);
9161
if (repos.includes('glsp-vscode-integration')) {

0 commit comments

Comments
 (0)