Skip to content

Commit 639cc23

Browse files
Upcoming Release Changes (#2069)
* chore(release): update monorepo packages versions * fix global setup for tests --------- Co-authored-by: YaroShkvorets <[email protected]>
1 parent 84d94cf commit 639cc23

File tree

8 files changed

+73
-69
lines changed

8 files changed

+73
-69
lines changed

.changeset/@graphprotocol_graph-cli-2032-dependencies.md

Lines changed: 0 additions & 15 deletions
This file was deleted.

.changeset/@graphprotocol_graph-cli-2058-dependencies.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

packages/cli/CHANGELOG.md

Lines changed: 20 additions & 40 deletions
Large diffs are not rendered by default.

packages/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@graphprotocol/graph-cli",
3-
"version": "0.98.0",
3+
"version": "0.98.1",
44
"type": "module",
55
"description": "CLI for building for and deploying to The Graph",
66
"repository": {

packages/cli/tests/cli/globalSetup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable */
22

3-
import { linkCli } from './util';
3+
import { linkCli } from './link';
44

55
export default async () => {
66
process.env.GRAPH_CLI_TESTS = '1';

packages/cli/tests/cli/link.ts

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import path from 'node:path';
2+
import { system } from 'gluegun';
3+
import spawn from 'spawn-command';
4+
5+
function runCommand(
6+
command: string,
7+
args: string[] = [],
8+
cwd = process.cwd(),
9+
): Promise<
10+
[
11+
number | null, // exitCode
12+
string, // stdout
13+
string, // stderr
14+
]
15+
> {
16+
// Make sure to set an absolute working directory
17+
cwd = cwd[0] === '/' ? cwd : path.resolve(__dirname, cwd);
18+
19+
return new Promise((resolve, reject) => {
20+
let stdout = '';
21+
let stderr = '';
22+
const child = spawn(`${command} ${args.join(' ')}`, { cwd });
23+
24+
child.on('error', error => {
25+
reject(error);
26+
});
27+
28+
child.stdout.on('data', (data: Buffer) => {
29+
stdout += data.toString();
30+
});
31+
32+
child.stderr.on('data', (data: Buffer) => {
33+
stderr += data.toString();
34+
});
35+
36+
child.on('exit', exitCode => {
37+
resolve([exitCode, stdout, stderr]);
38+
});
39+
});
40+
}
41+
42+
export const linkCli = () => {
43+
return runCommand(system.which('yarn') ? 'yarn' : 'npm', ['link']);
44+
};
45+
46+
export const unlinkCli = () => {
47+
return runCommand(system.which('yarn') ? 'yarn' : 'npm', ['unlink']);
48+
};

packages/cli/tests/cli/util.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,8 @@ export function runGraphCli(args: string[], cwd: string) {
9898
return runCommand(graphCli, args, cwd);
9999
}
100100

101-
export const linkCli = () => {
102-
runCommand(system.which('yarn') ? 'yarn' : 'npm', ['link']);
103-
};
104-
105-
export const unlinkCli = () => {
106-
runCommand(system.which('yarn') ? 'yarn' : 'npm', ['unlink']);
107-
};
101+
// Re-export from link.ts to maintain backward compatibility
102+
export { linkCli, unlinkCli } from './link.js';
108103

109104
export const packageManagerBuild = (cwd: string) =>
110105
runCommand(system.which('yarn') ? 'yarn' : 'npm', ['run', 'build'], cwd);

packages/cli/vitest.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ export default defineConfig({
77
NODE_NO_WARNINGS: '1',
88
},
99
hookTimeout: 20_000,
10+
globalSetup: './tests/cli/globalSetup.ts',
1011
},
1112
});

0 commit comments

Comments
 (0)