@platforma-sdk/tengo-builder 4.0.9 → 4.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/run.js +5 -10
- package/dist/cli.cjs +28 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.ts +8 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +26 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/build.cjs +15 -13
- package/dist/commands/build.cjs.map +1 -1
- package/dist/commands/build.js +16 -14
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/check.cjs +13 -14
- package/dist/commands/check.cjs.map +1 -1
- package/dist/commands/check.js +14 -15
- package/dist/commands/check.js.map +1 -1
- package/dist/commands/dump/artifacts.cjs +10 -14
- package/dist/commands/dump/artifacts.cjs.map +1 -1
- package/dist/commands/dump/artifacts.js +11 -15
- package/dist/commands/dump/artifacts.js.map +1 -1
- package/dist/commands/dump/software.cjs +10 -11
- package/dist/commands/dump/software.cjs.map +1 -1
- package/dist/commands/dump/software.js +11 -12
- package/dist/commands/dump/software.js.map +1 -1
- package/dist/commands/test.cjs +13 -14
- package/dist/commands/test.cjs.map +1 -1
- package/dist/commands/test.js +14 -15
- package/dist/commands/test.js.map +1 -1
- package/dist/index.cjs +3 -17
- package/dist/index.d.ts +2 -17
- package/dist/index.js +2 -17
- package/dist/shared/basecmd.cjs +33 -44
- package/dist/shared/basecmd.cjs.map +1 -1
- package/dist/shared/basecmd.js +30 -42
- package/dist/shared/basecmd.js.map +1 -1
- package/package.json +7 -18
- package/src/cli.ts +27 -0
- package/src/commands/build.ts +16 -12
- package/src/commands/check.ts +14 -19
- package/src/commands/dump/artifacts.ts +11 -14
- package/src/commands/dump/software.ts +11 -13
- package/src/commands/test.ts +14 -15
- package/src/index.ts +1 -15
- package/src/shared/basecmd.ts +36 -32
- package/dist/commands/build.d.ts +0 -18
- package/dist/commands/build.d.ts.map +0 -1
- package/dist/commands/check.d.ts +0 -16
- package/dist/commands/check.d.ts.map +0 -1
- package/dist/commands/dump/artifacts.d.ts +0 -16
- package/dist/commands/dump/artifacts.d.ts.map +0 -1
- package/dist/commands/dump/software.d.ts +0 -15
- package/dist/commands/dump/software.d.ts.map +0 -1
- package/dist/commands/test.d.ts +0 -16
- package/dist/commands/test.d.ts.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
import { Command } from "
|
|
1
|
+
import { Command } from "commander";
|
|
2
2
|
import { createLogger } from "../../compiler/util";
|
|
3
3
|
import { dumpArtifacts } from "../../shared/dump";
|
|
4
4
|
import { stdout } from "node:process";
|
|
5
5
|
import type { ArtifactType } from "../../compiler/package";
|
|
6
6
|
import * as opts from "../../shared/basecmd";
|
|
7
7
|
|
|
8
|
-
export default
|
|
9
|
-
|
|
10
|
-
"parse sources in current package and dump all found artifacts to stdout"
|
|
8
|
+
export default function dumpArtifactsCommand(): Command {
|
|
9
|
+
const cmd = new Command("artifacts").description(
|
|
10
|
+
"parse sources in current package and dump all found artifacts to stdout",
|
|
11
|
+
);
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
opts.addOptions(cmd, opts.GlobalOptions(), opts.ArtifactTypeOptions());
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
};
|
|
15
|
+
cmd.action(async (o) => {
|
|
16
|
+
const logger = createLogger(o.logLevel as string);
|
|
17
|
+
dumpArtifacts(logger, stdout, o.type == "all" ? undefined : (o.type as ArtifactType));
|
|
18
|
+
});
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
const { flags } = await this.parse(DumpArtifacts);
|
|
21
|
-
const logger = createLogger(flags["log-level"]);
|
|
22
|
-
dumpArtifacts(logger, stdout, flags.type == "all" ? undefined : (flags.type as ArtifactType));
|
|
23
|
-
}
|
|
20
|
+
return cmd;
|
|
24
21
|
}
|
|
@@ -1,22 +1,20 @@
|
|
|
1
|
-
import { Command } from "
|
|
1
|
+
import { Command } from "commander";
|
|
2
2
|
import { createLogger } from "../../compiler/util";
|
|
3
3
|
import { dumpSoftware } from "../../shared/dump";
|
|
4
4
|
import { stdout } from "node:process";
|
|
5
5
|
import * as opts from "../../shared/basecmd";
|
|
6
6
|
|
|
7
|
-
export default
|
|
8
|
-
|
|
9
|
-
"parse sources in current package and dump all software descriptors used by templates"
|
|
7
|
+
export default function dumpSoftwareCommand(): Command {
|
|
8
|
+
const cmd = new Command("software").description(
|
|
9
|
+
"parse sources in current package and dump all software descriptors used by templates",
|
|
10
|
+
);
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
opts.addOptions(cmd, opts.GlobalOptions());
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
public async run(): Promise<void> {
|
|
18
|
-
const { flags } = await this.parse(DumpSoftware);
|
|
19
|
-
const logger = createLogger(flags["log-level"]);
|
|
14
|
+
cmd.action(async (o) => {
|
|
15
|
+
const logger = createLogger(o.logLevel as string);
|
|
20
16
|
dumpSoftware(logger, stdout);
|
|
21
|
-
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
return cmd;
|
|
22
20
|
}
|
package/src/commands/test.ts
CHANGED
|
@@ -1,30 +1,27 @@
|
|
|
1
|
-
import { Command } from "
|
|
1
|
+
import { Command } from "commander";
|
|
2
2
|
import { createLogger } from "../compiler/util";
|
|
3
3
|
import { dumpArtifacts } from "../shared/dump";
|
|
4
|
-
import {
|
|
4
|
+
import { addOptions, GlobalOptions } from "../shared/basecmd";
|
|
5
5
|
import { spawnEmbed, waitFor } from "../shared/proc";
|
|
6
6
|
import { TengoTesterBinaryPath } from "@milaboratories/tengo-tester";
|
|
7
7
|
|
|
8
|
-
export default
|
|
9
|
-
|
|
8
|
+
export default function testCommand(): Command {
|
|
9
|
+
const cmd = new Command("test").description("run tengo unit tests (.test.tengo)");
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
cmd.argument("[paths...]", "source paths to test (defaults to ./src)");
|
|
12
|
+
addOptions(cmd, GlobalOptions());
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
cmd.action(async (paths: string[], o) => {
|
|
15
|
+
const logLevel = o.logLevel as string;
|
|
16
|
+
const logger = createLogger(logLevel);
|
|
14
17
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
public async run(): Promise<void> {
|
|
18
|
-
const { flags } = await this.parse(Test);
|
|
19
|
-
const logger = createLogger(flags["log-level"]);
|
|
20
|
-
|
|
21
|
-
const testerArgs: string[] = this.argv.length == 0 ? ["./src"] : this.argv;
|
|
18
|
+
const testerArgs: string[] = paths.length == 0 ? ["./src"] : paths;
|
|
22
19
|
|
|
23
20
|
const tester = spawnEmbed(
|
|
24
21
|
TengoTesterBinaryPath,
|
|
25
22
|
"run",
|
|
26
23
|
"--log-level",
|
|
27
|
-
|
|
24
|
+
logLevel,
|
|
28
25
|
"--artifacts",
|
|
29
26
|
"-",
|
|
30
27
|
...testerArgs,
|
|
@@ -39,5 +36,7 @@ export default class Test extends Command {
|
|
|
39
36
|
const code = await waitFor(tester);
|
|
40
37
|
process.exit(code);
|
|
41
38
|
}
|
|
42
|
-
}
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
return cmd;
|
|
43
42
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,15 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import Cmd0 from "./commands/build";
|
|
4
|
-
import Cmd1 from "./commands/check";
|
|
5
|
-
import Cmd2 from "./commands/test";
|
|
6
|
-
import Cmd3 from "./commands/dump/artifacts";
|
|
7
|
-
import Cmd4 from "./commands/dump/software";
|
|
8
|
-
|
|
9
|
-
export const COMMANDS = {
|
|
10
|
-
build: Cmd0,
|
|
11
|
-
check: Cmd1,
|
|
12
|
-
test: Cmd2,
|
|
13
|
-
"dump:artifacts": Cmd3,
|
|
14
|
-
"dump:software": Cmd4,
|
|
15
|
-
};
|
|
1
|
+
export { run, buildProgram } from "./cli";
|
package/src/shared/basecmd.ts
CHANGED
|
@@ -1,37 +1,41 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Command, Option } from "commander";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
3
|
+
/** Add one or more groups of options to a command, preserving group order. */
|
|
4
|
+
export function addOptions(cmd: Command, ...optionGroups: Option[][]): Command {
|
|
5
|
+
for (const group of optionGroups) {
|
|
6
|
+
for (const opt of group) cmd.addOption(opt);
|
|
7
|
+
}
|
|
8
|
+
return cmd;
|
|
9
|
+
}
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
// Comma-delimited, repeatable collector: `--tags-additional-args -e,-x` and/or
|
|
12
|
+
// repeated occurrences accumulate into a single string[].
|
|
13
|
+
function collectComma(value: string, previous: string[]): string[] {
|
|
14
|
+
return previous.concat(value.split(","));
|
|
15
|
+
}
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
export const GlobalOptions = (): Option[] => [
|
|
18
|
+
new Option("--log-level <level>", "logging level")
|
|
19
|
+
.choices(["error", "warn", "info", "debug"])
|
|
20
|
+
.default("info"),
|
|
21
|
+
];
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
export const CtagsOptions = (): Option[] => [
|
|
24
|
+
new Option("--generate-tags", "generate tags, default false").default(false),
|
|
25
|
+
new Option(
|
|
26
|
+
"--tags-file <path>",
|
|
27
|
+
'where to put ".tags" file, it should be a root of VS Code project',
|
|
28
|
+
).default("../../.tags"), // usually a user opens a directory with all blocks
|
|
29
|
+
new Option(
|
|
30
|
+
"--tags-additional-args <args>",
|
|
31
|
+
"additional flags for universal-ctags command: e.g. -e for emacs",
|
|
32
|
+
)
|
|
33
|
+
.argParser(collectComma)
|
|
34
|
+
.default([] as string[]),
|
|
35
|
+
];
|
|
29
36
|
|
|
30
|
-
export const
|
|
31
|
-
type
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
default: "all",
|
|
36
|
-
}),
|
|
37
|
-
};
|
|
37
|
+
export const ArtifactTypeOptions = (): Option[] => [
|
|
38
|
+
new Option("-t, --type <type>", "artifact type")
|
|
39
|
+
.choices(["all", "library", "template", "test", "software", "asset", "wasm"])
|
|
40
|
+
.default("all"),
|
|
41
|
+
];
|
package/dist/commands/build.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Command } from "@oclif/core";
|
|
2
|
-
import * as _$_oclif_core_interfaces0 from "@oclif/core/interfaces";
|
|
3
|
-
|
|
4
|
-
//#region src/commands/build.d.ts
|
|
5
|
-
declare class Build extends Command {
|
|
6
|
-
static description: string;
|
|
7
|
-
static examples: string[];
|
|
8
|
-
static flags: {
|
|
9
|
-
"generate-tags": _$_oclif_core_interfaces0.BooleanFlag<boolean>;
|
|
10
|
-
"tags-file": _$_oclif_core_interfaces0.OptionFlag<string, _$_oclif_core_interfaces0.CustomOptions>;
|
|
11
|
-
"tags-additional-args": _$_oclif_core_interfaces0.OptionFlag<string[], _$_oclif_core_interfaces0.CustomOptions>;
|
|
12
|
-
"log-level": _$_oclif_core_interfaces0.OptionFlag<string, _$_oclif_core_interfaces0.CustomOptions>;
|
|
13
|
-
};
|
|
14
|
-
run(): Promise<void>;
|
|
15
|
-
}
|
|
16
|
-
//#endregion
|
|
17
|
-
export { Build };
|
|
18
|
-
//# sourceMappingURL=build.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","names":[],"sources":["../../src/commands/build.ts"],"mappings":";;;;cAYqB,KAAA,SAAc,OAAA;EAAA,OACjB,WAAA;EAAA,OAEA,QAAA;EAAA,OAEA,KAAA;qBALS,yBAAA,CAAA,WAAA;;;;;EAUZ,GAAA,CAAA,GAAO,OAAA;AAAA"}
|
package/dist/commands/check.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Command } from "@oclif/core";
|
|
2
|
-
import * as _$_oclif_core_interfaces0 from "@oclif/core/interfaces";
|
|
3
|
-
|
|
4
|
-
//#region src/commands/check.d.ts
|
|
5
|
-
declare class Check extends Command {
|
|
6
|
-
static description: string;
|
|
7
|
-
static strict: boolean;
|
|
8
|
-
static flags: {
|
|
9
|
-
"log-level": _$_oclif_core_interfaces0.OptionFlag<string, _$_oclif_core_interfaces0.CustomOptions>;
|
|
10
|
-
};
|
|
11
|
-
static examples: string[];
|
|
12
|
-
run(): Promise<void>;
|
|
13
|
-
}
|
|
14
|
-
//#endregion
|
|
15
|
-
export { Check };
|
|
16
|
-
//# sourceMappingURL=check.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"check.d.ts","names":[],"sources":["../../src/commands/check.ts"],"mappings":";;;;cAOqB,KAAA,SAAc,OAAA;EAAA,OACjB,WAAA;EAAA,OAMT,MAAA;EAAA,OAES,KAAA;8DATS,yBAAA,CAAA,aAAA;EAAA;EAAA,OAWT,QAAA;EAEH,GAAA,CAAA,GAAO,OAAA;AAAA"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Command } from "@oclif/core";
|
|
2
|
-
import * as _$_oclif_core_interfaces0 from "@oclif/core/interfaces";
|
|
3
|
-
|
|
4
|
-
//#region src/commands/dump/artifacts.d.ts
|
|
5
|
-
declare class DumpArtifacts extends Command {
|
|
6
|
-
static description: string;
|
|
7
|
-
static examples: string[];
|
|
8
|
-
static flags: {
|
|
9
|
-
type: _$_oclif_core_interfaces0.OptionFlag<string, _$_oclif_core_interfaces0.CustomOptions>;
|
|
10
|
-
"log-level": _$_oclif_core_interfaces0.OptionFlag<string, _$_oclif_core_interfaces0.CustomOptions>;
|
|
11
|
-
};
|
|
12
|
-
run(): Promise<void>;
|
|
13
|
-
}
|
|
14
|
-
//#endregion
|
|
15
|
-
export { DumpArtifacts };
|
|
16
|
-
//# sourceMappingURL=artifacts.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"artifacts.d.ts","names":[],"sources":["../../../src/commands/dump/artifacts.ts"],"mappings":";;;;cAOqB,aAAA,SAAsB,OAAA;EAAA,OACzB,WAAA;EAAA,OAGA,QAAA;EAAA,OAEA,KAAA;uDANiB,yBAAA,CAAA,aAAA;;;EAWpB,GAAA,CAAA,GAAO,OAAA;AAAA"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Command } from "@oclif/core";
|
|
2
|
-
import * as _$_oclif_core_interfaces0 from "@oclif/core/interfaces";
|
|
3
|
-
|
|
4
|
-
//#region src/commands/dump/software.d.ts
|
|
5
|
-
declare class DumpSoftware extends Command {
|
|
6
|
-
static description: string;
|
|
7
|
-
static examples: string[];
|
|
8
|
-
static flags: {
|
|
9
|
-
"log-level": _$_oclif_core_interfaces0.OptionFlag<string, _$_oclif_core_interfaces0.CustomOptions>;
|
|
10
|
-
};
|
|
11
|
-
run(): Promise<void>;
|
|
12
|
-
}
|
|
13
|
-
//#endregion
|
|
14
|
-
export { DumpSoftware };
|
|
15
|
-
//# sourceMappingURL=software.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"software.d.ts","names":[],"sources":["../../../src/commands/dump/software.ts"],"mappings":";;;;cAMqB,YAAA,SAAqB,OAAA;EAAA,OACxB,WAAA;EAAA,OAGA,QAAA;EAAA,OAEA,KAAA;8DANgB,yBAAA,CAAA,aAAA;EAAA;EAUnB,GAAA,CAAA,GAAO,OAAA;AAAA"}
|
package/dist/commands/test.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Command } from "@oclif/core";
|
|
2
|
-
import * as _$_oclif_core_interfaces0 from "@oclif/core/interfaces";
|
|
3
|
-
|
|
4
|
-
//#region src/commands/test.d.ts
|
|
5
|
-
declare class Test extends Command {
|
|
6
|
-
static description: string;
|
|
7
|
-
static strict: boolean;
|
|
8
|
-
static flags: {
|
|
9
|
-
"log-level": _$_oclif_core_interfaces0.OptionFlag<string, _$_oclif_core_interfaces0.CustomOptions>;
|
|
10
|
-
};
|
|
11
|
-
static examples: string[];
|
|
12
|
-
run(): Promise<void>;
|
|
13
|
-
}
|
|
14
|
-
//#endregion
|
|
15
|
-
export { Test };
|
|
16
|
-
//# sourceMappingURL=test.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test.d.ts","names":[],"sources":["../../src/commands/test.ts"],"mappings":";;;;cAOqB,IAAA,SAAa,OAAA;EAAA,OAChB,WAAA;EAAA,OAET,MAAA;EAAA,OAES,KAAA;8DALQ,yBAAA,CAAA,aAAA;EAAA;EAAA,OAOR,QAAA;EAEH,GAAA,CAAA,GAAO,OAAA;AAAA"}
|
package/dist/index.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["Cmd0","Cmd1","Cmd2","Cmd3","Cmd4"],"sources":["../src/index.ts"],"sourcesContent":["// DO NOT EDIT. This file was generated by oclif-index utility.\n\nimport Cmd0 from \"./commands/build\";\nimport Cmd1 from \"./commands/check\";\nimport Cmd2 from \"./commands/test\";\nimport Cmd3 from \"./commands/dump/artifacts\";\nimport Cmd4 from \"./commands/dump/software\";\n\nexport const COMMANDS = {\n build: Cmd0,\n check: Cmd1,\n test: Cmd2,\n \"dump:artifacts\": Cmd3,\n \"dump:software\": Cmd4,\n};\n"],"mappings":";;;;;;;AAQA,MAAa,WAAW;CACtB,OAAOA,cAAAA;CACP,OAAOC,cAAAA;CACP,MAAMC,aAAAA;CACN,kBAAkBC,kBAAAA;CAClB,iBAAiBC,iBAAAA;CAClB"}
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;cAQa,QAAA"}
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Cmd0","Cmd1","Cmd2","Cmd3","Cmd4"],"sources":["../src/index.ts"],"sourcesContent":["// DO NOT EDIT. This file was generated by oclif-index utility.\n\nimport Cmd0 from \"./commands/build\";\nimport Cmd1 from \"./commands/check\";\nimport Cmd2 from \"./commands/test\";\nimport Cmd3 from \"./commands/dump/artifacts\";\nimport Cmd4 from \"./commands/dump/software\";\n\nexport const COMMANDS = {\n build: Cmd0,\n check: Cmd1,\n test: Cmd2,\n \"dump:artifacts\": Cmd3,\n \"dump:software\": Cmd4,\n};\n"],"mappings":";;;;;;AAQA,MAAa,WAAW;CACtB,OAAOA;CACP,OAAOC;CACP,MAAMC;CACN,kBAAkBC;CAClB,iBAAiBC;CAClB"}
|