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
15 changes: 0 additions & 15 deletions .changeset/@graphprotocol_graph-cli-2032-dependencies.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/@graphprotocol_graph-cli-2058-dependencies.md

This file was deleted.

60 changes: 20 additions & 40 deletions packages/cli/CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@graphprotocol/graph-cli",
"version": "0.98.0",
"version": "0.98.1",
"type": "module",
"description": "CLI for building for and deploying to The Graph",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/tests/cli/globalSetup.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable */

import { linkCli } from './util';
import { linkCli } from './link';

export default async () => {
process.env.GRAPH_CLI_TESTS = '1';
Expand Down
48 changes: 48 additions & 0 deletions packages/cli/tests/cli/link.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import path from 'node:path';
import { system } from 'gluegun';
import spawn from 'spawn-command';

function runCommand(
command: string,
args: string[] = [],
cwd = process.cwd(),
): Promise<
[
number | null, // exitCode
string, // stdout
string, // stderr
]
> {
// Make sure to set an absolute working directory
cwd = cwd[0] === '/' ? cwd : path.resolve(__dirname, cwd);

return new Promise((resolve, reject) => {
let stdout = '';
let stderr = '';
const child = spawn(`${command} ${args.join(' ')}`, { cwd });

child.on('error', error => {
reject(error);
});

child.stdout.on('data', (data: Buffer) => {
stdout += data.toString();
});

child.stderr.on('data', (data: Buffer) => {
stderr += data.toString();
});

child.on('exit', exitCode => {
resolve([exitCode, stdout, stderr]);
});
});
}

export const linkCli = () => {
return runCommand(system.which('yarn') ? 'yarn' : 'npm', ['link']);
};

export const unlinkCli = () => {
return runCommand(system.which('yarn') ? 'yarn' : 'npm', ['unlink']);
};
9 changes: 2 additions & 7 deletions packages/cli/tests/cli/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,8 @@ export function runGraphCli(args: string[], cwd: string) {
return runCommand(graphCli, args, cwd);
}

export const linkCli = () => {
runCommand(system.which('yarn') ? 'yarn' : 'npm', ['link']);
};

export const unlinkCli = () => {
runCommand(system.which('yarn') ? 'yarn' : 'npm', ['unlink']);
};
// Re-export from link.ts to maintain backward compatibility
export { linkCli, unlinkCli } from './link.js';

export const packageManagerBuild = (cwd: string) =>
runCommand(system.which('yarn') ? 'yarn' : 'npm', ['run', 'build'], cwd);
1 change: 1 addition & 0 deletions packages/cli/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ export default defineConfig({
NODE_NO_WARNINGS: '1',
},
hookTimeout: 20_000,
globalSetup: './tests/cli/globalSetup.ts',
},
});