Add "targets" command
This commit is contained in:
parent
49425cab39
commit
983ba1f870
@ -10567,7 +10567,7 @@ var CSharpTarget = class extends CompileTarget {
|
|||||||
a(0, ``);
|
a(0, ``);
|
||||||
a(0, `public abstract class ${definition.name}Server<TContext> : JRpcService<TContext> {`);
|
a(0, `public abstract class ${definition.name}Server<TContext> : JRpcService<TContext> {`);
|
||||||
a(0, ``);
|
a(0, ``);
|
||||||
a(1, `public ${definition.name}Server(JRpcClient client) {`);
|
a(1, `public ${definition.name}Server() {`);
|
||||||
for (const fnc of definition.functions) {
|
for (const fnc of definition.functions) {
|
||||||
a(2, `this.RegisterFunction("${fnc.name}");`);
|
a(2, `this.RegisterFunction("${fnc.name}");`);
|
||||||
}
|
}
|
||||||
@ -10575,7 +10575,7 @@ var CSharpTarget = class extends CompileTarget {
|
|||||||
a(0, ``);
|
a(0, ``);
|
||||||
for (const fnc of definition.functions) {
|
for (const fnc of definition.functions) {
|
||||||
let params = [
|
let params = [
|
||||||
fnc.inputs.map((inp) => {
|
...fnc.inputs.map((inp) => {
|
||||||
if (inp.array) {
|
if (inp.array) {
|
||||||
return `List<${toCSharpType(inp.type)}> ${inp.name}`;
|
return `List<${toCSharpType(inp.type)}> ${inp.name}`;
|
||||||
} else {
|
} else {
|
||||||
@ -10815,6 +10815,11 @@ yargs_default(hideBin(process.argv)).version("1.0.0").command("compile <input>",
|
|||||||
targets: argv.output,
|
targets: argv.output,
|
||||||
emitDefinitions: argv.definition
|
emitDefinitions: argv.definition
|
||||||
});
|
});
|
||||||
|
}).command("targets", "List all targets", (yargs) => yargs, () => {
|
||||||
|
console.log("Targets:");
|
||||||
|
Targets.forEach((__dirname3, target) => {
|
||||||
|
console.log(" " + target);
|
||||||
|
});
|
||||||
}).option("verbose", {
|
}).option("verbose", {
|
||||||
alias: "v",
|
alias: "v",
|
||||||
type: "boolean",
|
type: "boolean",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hibas123/jrpcgen",
|
"name": "@hibas123/jrpcgen",
|
||||||
"version": "1.0.13",
|
"version": "1.0.14",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"packageManager": "yarn@3.1.1",
|
"packageManager": "yarn@3.1.1",
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import yargs from "yargs";
|
import yargs from "yargs";
|
||||||
import { hideBin } from "yargs/helpers";
|
import { hideBin } from "yargs/helpers";
|
||||||
import startCompile, { Target } from "./process";
|
import startCompile, { Target, Targets } from "./process";
|
||||||
|
|
||||||
import dbg from "debug";
|
import dbg from "debug";
|
||||||
const log = dbg("app");
|
const log = dbg("app");
|
||||||
@ -54,6 +54,12 @@ yargs(hideBin(process.argv))
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
.command("targets", "List all targets", (yargs)=>yargs, ()=>{
|
||||||
|
console.log("Targets:")
|
||||||
|
Targets.forEach((__dirname, target) => {
|
||||||
|
console.log(" " + target);
|
||||||
|
})
|
||||||
|
})
|
||||||
.option("verbose", {
|
.option("verbose", {
|
||||||
alias: "v",
|
alias: "v",
|
||||||
type: "boolean",
|
type: "boolean",
|
||||||
|
@ -16,12 +16,13 @@ class CatchedError extends Error {}
|
|||||||
|
|
||||||
const log = dbg("app");
|
const log = dbg("app");
|
||||||
|
|
||||||
const Targets = new Map<string, typeof CompileTarget>();
|
export const Targets = new Map<string, typeof CompileTarget>();
|
||||||
|
|
||||||
Targets.set("ts-esm", ESMTypescriptTarget);
|
Targets.set("ts-esm", ESMTypescriptTarget);
|
||||||
Targets.set("ts-node", NodeJSTypescriptTarget);
|
Targets.set("ts-node", NodeJSTypescriptTarget);
|
||||||
Targets.set("c#", CSharpTarget as typeof CompileTarget);
|
Targets.set("c#", CSharpTarget as typeof CompileTarget);
|
||||||
|
|
||||||
|
|
||||||
function indexToLineAndCol(src: string, index: number) {
|
function indexToLineAndCol(src: string, index: number) {
|
||||||
let line = 1;
|
let line = 1;
|
||||||
let col = 1;
|
let col = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user