Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Commit

Permalink
fix(nx-mesh): use node_modules bin symlinks for cli tools (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
domjtalbot authored Jan 15, 2023
1 parent f8dad9f commit 86322bd
Show file tree
Hide file tree
Showing 10 changed files with 203 additions and 166 deletions.
5 changes: 5 additions & 0 deletions .changeset/polite-moose-end.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'nx-mesh': patch
---

Use the `node_modules` bin symlink to run `graphql-mesh` & `graphql-codegen`
8 changes: 3 additions & 5 deletions libs/nx-mesh/src/utils/graphql-codegen-cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ import type { ChildProcess, ForkOptions } from 'child_process';

import type { Arguments } from './arguments';

import { fork } from 'child_process';
import { spawn } from 'child_process';

import { getCliArguments, flatternCliArguments } from './arguments';
import { resolveCliPath } from './path';

export let childProcess: ChildProcess;

Expand All @@ -15,13 +14,12 @@ export async function runCodegenCli(
context: ExecutorContext,
processOptions?: Pick<ForkOptions, 'stdio'>
) {
const cliPath = resolveCliPath(context.root);
const args = getCliArguments(options);
const cliArgs = flatternCliArguments(args);

return new Promise((resolve, reject) => {
childProcess = fork(cliPath, cliArgs, {
stdio: processOptions?.stdio,
childProcess = spawn('npx', ['graphql-codegen', ...cliArgs], {
stdio: processOptions?.stdio ?? [0, 1, 2],
cwd: context.root,
env: {
...process.env,
Expand Down
1 change: 0 additions & 1 deletion libs/nx-mesh/src/utils/graphql-codegen-cli/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export * from './arguments';
export * from './cli';
export * from './path';
41 changes: 0 additions & 41 deletions libs/nx-mesh/src/utils/graphql-codegen-cli/path.spec.ts

This file was deleted.

14 changes: 0 additions & 14 deletions libs/nx-mesh/src/utils/graphql-codegen-cli/path.ts

This file was deleted.

8 changes: 3 additions & 5 deletions libs/nx-mesh/src/utils/mesh-cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ import type { ChildProcess, ForkOptions } from 'child_process';

import type { Command, Options } from './commands';

import { fork } from 'child_process';
import { spawn } from 'child_process';

import { flatternCliArguments } from './arguments';
import { getCommandOptions } from './commands';
import { resolveCliPath } from './path';

export let childProcess: ChildProcess;

Expand All @@ -20,13 +19,12 @@ export async function runMeshCli<
context: ExecutorContext,
processOptions?: Pick<ForkOptions, 'stdio'>
) {
const cliPath = resolveCliPath(context.root);
const { args, env } = getCommandOptions<TCommand>(options);
const cliArgs = flatternCliArguments(args);

return new Promise((resolve, reject) => {
childProcess = fork(cliPath, [command, ...cliArgs], {
stdio: processOptions?.stdio,
childProcess = spawn(`npx`, ['graphql-mesh', command, ...cliArgs], {
stdio: processOptions?.stdio ?? [0, 1, 2],
cwd: context.root,
env: {
...process.env,
Expand Down
1 change: 0 additions & 1 deletion libs/nx-mesh/src/utils/mesh-cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ export * from './arguments';
export * from './cli';
export * from './commands';
export * from './env';
export * from './path';
41 changes: 0 additions & 41 deletions libs/nx-mesh/src/utils/mesh-cli/path.spec.ts

This file was deleted.

13 changes: 0 additions & 13 deletions libs/nx-mesh/src/utils/mesh-cli/path.ts

This file was deleted.

Loading

0 comments on commit 86322bd

Please sign in to comment.