@gapi/cli-builder
v1.8.151
Published
## Installation:
Downloads
30
Readme
@Gapi Graphql CLI Builder
Installation:
$ npm install @gapi/cli-builer
import {
CLIBuilder,
Environment,
GenericEnum,
Bootstrap,
executeCommand,
SpawnOptionsWithoutStdio,
} from '@gapi/cli-builder';
export const Git = (
args: string[] = [],
options?: SpawnOptionsWithoutStdio
) => executeCommand('git', args, options);
export enum Commands {
GIT = 1,
}
Bootstrap(
CLIBuilder.forRoot<typeof Commands>(
{
GIT: async (args: string[]) => {
console.log('[RUN_GIT]: started arguments: ', args);
const data = await Git(args);
console.log('[RUN_GIT]: exited');
return data;
},
},
Commands
)
).subscribe(() => {
if (Environment.GRAPHQL_RUNNER_SUBSCRIPTION_URI) {
console.log(
'STARTED_SUBSCRIPTIONS:',
Environment.GRAPHQL_RUNNER_SUBSCRIPTION_URI
);
} else {
console.log(
'SIGNAL_MAIN_API_STARTED',
`Running at http://localhost:${Environment.GRAPHQL_RUNNER_API_PORT}`
);
}
});
Open http://localhost:42043` Execute graphql query
mutation {
execute(cmd: GIT, args: ["status"]) {
code
data
error
}
}
Subscribing to other topic
mutation subscribeToGraphqlPubsub {
subscribeToGraphqlPubsub(
uri: "ws://localhost:9000/subscriptions"
worker_type: "runner"
) {
code
data
error
}
}
mutation unsubscribeToGraphqlPubsub {
unsubscribeToGraphqlPubsub {
code
data
error
}
}