Skip to content
Open
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
4 changes: 2 additions & 2 deletions packages/rust/src/executors/wasm-pack/executor.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ExecutorContext } from '@nx/devkit';
import { buildCommand } from '../../utils/build-command';
import { buildCommand, buildWasmPackCommand } from '../../utils/build-command';
import { runProcess } from '../../utils/run-process';
import { WasmPackExecutorSchema } from './schema';

Expand All @@ -12,7 +12,7 @@ export default async function runExecutor(
context: ExecutorContext
) {
const wasmPackOptions = wasmPackArgs(options);
const args = buildCommand('build', wasmPackOptions, context);
const args = buildWasmPackCommand('build', wasmPackOptions, context);
return runWasmPack(...args);
}

Expand Down
24 changes: 22 additions & 2 deletions packages/rust/src/utils/build-command.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { ExecutorContext } from '@nx/devkit';
import { BaseOptions } from '../models/base-options';

export function buildCommand(
function prebuildCommand(
baseCommand: string,
options: BaseOptions,
context: ExecutorContext
): string[] {
const args = [];

Expand Down Expand Up @@ -32,8 +31,29 @@ export function buildCommand(
args.push(`--${key}`, value);
}
}
return args;
}

function getProjectPath(context: ExecutorContext) {
return context.projectsConfigurations!/*is here 16+*/.projects[context.projectName!/*has to be here for it all to work*/].root;
}

export function buildCommand(
baseCommand: string,
options: BaseOptions,
context: ExecutorContext
): string[] {
const args = prebuildCommand(baseCommand, options);
args.push('-p', context.projectName);
return args;
}

export function buildWasmPackCommand(
baseCommand: string,
options: BaseOptions,
context: ExecutorContext
): string[] {
const args = prebuildCommand(baseCommand, options);
args.push(getProjectPath(context));
return args;
}