Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions examples/workflow-test/configs/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,6 @@ export function getRepoPath(repoName: string): string {
return path.resolve(getRepoDir(), repoName);
}

// TEMPORARY: remove once all GLSP repos are migrated to pnpm.
// During the migration a cloned integration repo may still be yarn-based. The package manager
// determines how a binary is launched in a sub-package: pnpm's script shorthand only runs
// package.json scripts, so the `theia` binary must be invoked via `pnpm exec`, whereas yarn classic
// runs binaries directly and has no `exec` command. Detect the lockfile so callers can adapt.
// Mirrors the yarn.lock-based detection in scripts/setup.ts.
export function isYarnRepo(repoName: string): boolean {
return existsSync(path.resolve(getRepoPath(repoName), 'yarn.lock'));
}

export function getPort(envVar: string): number {
const val = process.env[envVar];
if (val) {
Expand Down
10 changes: 2 additions & 8 deletions examples/workflow-test/configs/webserver.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
********************************************************************************/

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

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

Expand All @@ -41,7 +41,6 @@ export function buildWebServers(activeProjects: ProjectName[]): PlaywrightTestCo
const standaloneBrowserPort = getPort('STANDALONE_BROWSER_PORT');
const theiaPort = getPort('THEIA_PORT');
const browserServerBundle = getBrowserServerBundlePath();
const theiaBin = isYarnRepo('glsp-theia-integration') ? 'theia' : 'exec theia';
const configs: Partial<Record<ProjectName, ProjectServerConfig>> = {
standalone: {
command: `${repo} client start --external-server --no-open`,
Expand All @@ -56,12 +55,7 @@ export function buildWebServers(activeProjects: ProjectName[]): PlaywrightTestCo
path: '/diagram.html'
},
theia: {
// TEMPORARY: drop the `isYarnRepo` branch once glsp-theia-integration is migrated to pnpm.
// The command resolves to `<pm> browser <exec?> theia start ...` in the cloned repo. Under
// pnpm the `theia` binary must be launched via `pnpm exec` (the script shorthand only runs
// package.json scripts, else it fails with ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL); yarn classic
// runs binaries directly and has no `exec` command.
command: `${repo} theia run browser ${theiaBin} start --WF_GLSP=${glspServerPort} --WF_PATH=workflow --glspDebug`,
command: `${repo} theia run browser exec theia start --WF_GLSP=${glspServerPort} --WF_PATH=workflow --glspDebug`,
port: theiaPort
}
};
Expand Down
32 changes: 1 addition & 31 deletions examples/workflow-test/scripts/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
********************************************************************************/
import { execSync } from 'child_process';
import { copyFileSync, existsSync, readFileSync, writeFileSync } from 'fs';
import { copyFileSync, readFileSync, writeFileSync } from 'fs';
import { resolve } from 'path';

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

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

if (repos.includes('glsp-vscode-integration')) {
// The glsp-vscode-integration repo is a lerna monorepo that gets cloned into the `.repositories`
// directory of this (also lerna-based) repo. Without an `nx.json` marking the repo root, lerna
// walks up the directory tree, detects the nesting and fails. Adding an empty `nx.json` tells
// lerna to stop the lookup at the repo root.
const nxJson = resolve(rootDir, '.repositories', 'glsp-vscode-integration', 'nx.json');
console.log(`Adding ${nxJson}`);
writeFileSync(nxJson, '{}');
}

// TEMPORARY: remove once all GLSP repos are migrated to pnpm.
// Yarn classic (1.x) walks up the directory tree looking for a `packageManager` field. Since this
// repo's root package.json declares `pnpm@<version>`, a `yarn install` inside a cloned (yarn-based)
// repo under `.repositories` would find that pnpm pin, misparse it as `yarn@pnpm@<version>`, and
// abort. Pin each cloned yarn repo to the local yarn version so the lookup stops at the repo itself.
const yarnVersion = execSync('yarn --version', { cwd: rootDir }).toString().trim();
for (const cloned of repos) {
const repoDir = resolve(rootDir, '.repositories', cloned);
const pkgPath = resolve(repoDir, 'package.json');
if (!existsSync(resolve(repoDir, 'yarn.lock')) || !existsSync(pkgPath)) {
continue;
}
const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
if (!pkg.packageManager) {
pkg.packageManager = `yarn@${yarnVersion}`;
writeFileSync(pkgPath, `${JSON.stringify(pkg, null, 2)}\n`);
console.log(`Pinned ${cloned} packageManager to yarn@${yarnVersion}`);
}
}

if (!skipBuild) {
run(`${repo} build`);
if (repos.includes('glsp-vscode-integration')) {
Expand Down