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

Use node_modules bin symlinks for CLI tools #121

Merged
merged 1 commit into from
Jan 15, 2023
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
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