@cartesi/cli 2.0.0-alpha.21 → 2.0.0-alpha.22

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.
Files changed (131) hide show
  1. package/dist/index.js +685 -50
  2. package/dist/index.js.map +785 -0
  3. package/package.json +80 -84
  4. package/LICENSE +0 -202
  5. package/dist/base.d.ts +0 -28
  6. package/dist/base.d.ts.map +0 -1
  7. package/dist/base.js +0 -109
  8. package/dist/builder/directory.d.ts +0 -3
  9. package/dist/builder/directory.d.ts.map +0 -1
  10. package/dist/builder/directory.js +0 -39
  11. package/dist/builder/docker.d.ts +0 -10
  12. package/dist/builder/docker.d.ts.map +0 -1
  13. package/dist/builder/docker.js +0 -114
  14. package/dist/builder/empty.d.ts +0 -3
  15. package/dist/builder/empty.d.ts.map +0 -1
  16. package/dist/builder/empty.js +0 -21
  17. package/dist/builder/index.d.ts +0 -6
  18. package/dist/builder/index.d.ts.map +0 -1
  19. package/dist/builder/index.js +0 -5
  20. package/dist/builder/none.d.ts +0 -3
  21. package/dist/builder/none.d.ts.map +0 -1
  22. package/dist/builder/none.js +0 -11
  23. package/dist/builder/tar.d.ts +0 -3
  24. package/dist/builder/tar.d.ts.map +0 -1
  25. package/dist/builder/tar.js +0 -30
  26. package/dist/commands/address-book.d.ts +0 -6
  27. package/dist/commands/address-book.d.ts.map +0 -1
  28. package/dist/commands/address-book.js +0 -44
  29. package/dist/commands/build.d.ts +0 -8
  30. package/dist/commands/build.d.ts.map +0 -1
  31. package/dist/commands/build.js +0 -97
  32. package/dist/commands/clean.d.ts +0 -3
  33. package/dist/commands/clean.d.ts.map +0 -1
  34. package/dist/commands/clean.js +0 -10
  35. package/dist/commands/create.d.ts +0 -7
  36. package/dist/commands/create.d.ts.map +0 -1
  37. package/dist/commands/create.js +0 -37
  38. package/dist/commands/deploy/build.d.ts +0 -3
  39. package/dist/commands/deploy/build.d.ts.map +0 -1
  40. package/dist/commands/deploy/build.js +0 -9
  41. package/dist/commands/deploy.d.ts +0 -3
  42. package/dist/commands/deploy.d.ts.map +0 -1
  43. package/dist/commands/deploy.js +0 -12
  44. package/dist/commands/deposit/erc1155.d.ts +0 -18
  45. package/dist/commands/deposit/erc1155.d.ts.map +0 -1
  46. package/dist/commands/deposit/erc1155.js +0 -254
  47. package/dist/commands/deposit/erc20.d.ts +0 -10
  48. package/dist/commands/deposit/erc20.d.ts.map +0 -1
  49. package/dist/commands/deposit/erc20.js +0 -125
  50. package/dist/commands/deposit/erc721.d.ts +0 -10
  51. package/dist/commands/deposit/erc721.d.ts.map +0 -1
  52. package/dist/commands/deposit/erc721.js +0 -143
  53. package/dist/commands/deposit/ether.d.ts +0 -10
  54. package/dist/commands/deposit/ether.d.ts.map +0 -1
  55. package/dist/commands/deposit/ether.js +0 -65
  56. package/dist/commands/deposit.d.ts +0 -9
  57. package/dist/commands/deposit.d.ts.map +0 -1
  58. package/dist/commands/deposit.js +0 -37
  59. package/dist/commands/doctor.d.ts +0 -3
  60. package/dist/commands/doctor.d.ts.map +0 -1
  61. package/dist/commands/doctor.js +0 -105
  62. package/dist/commands/hash.d.ts +0 -5
  63. package/dist/commands/hash.d.ts.map +0 -1
  64. package/dist/commands/hash.js +0 -22
  65. package/dist/commands/logs.d.ts +0 -9
  66. package/dist/commands/logs.d.ts.map +0 -1
  67. package/dist/commands/logs.js +0 -34
  68. package/dist/commands/run.d.ts +0 -15
  69. package/dist/commands/run.d.ts.map +0 -1
  70. package/dist/commands/run.js +0 -202
  71. package/dist/commands/send.d.ts +0 -10
  72. package/dist/commands/send.d.ts.map +0 -1
  73. package/dist/commands/send.js +0 -130
  74. package/dist/commands/shell.d.ts +0 -7
  75. package/dist/commands/shell.d.ts.map +0 -1
  76. package/dist/commands/shell.js +0 -48
  77. package/dist/commands/status.d.ts +0 -6
  78. package/dist/commands/status.d.ts.map +0 -1
  79. package/dist/commands/status.js +0 -50
  80. package/dist/compose/default.env +0 -36
  81. package/dist/compose/docker-compose-anvil.yaml +0 -39
  82. package/dist/compose/docker-compose-bundler.yaml +0 -71
  83. package/dist/compose/docker-compose-database.yaml +0 -12
  84. package/dist/compose/docker-compose-explorer.yaml +0 -96
  85. package/dist/compose/docker-compose-node-cpus.yaml +0 -6
  86. package/dist/compose/docker-compose-node-memory.yaml +0 -6
  87. package/dist/compose/docker-compose-node.yaml +0 -50
  88. package/dist/compose/docker-compose-passkey-server.yaml +0 -37
  89. package/dist/compose/docker-compose-paymaster.yaml +0 -40
  90. package/dist/compose/docker-compose-proxy.yaml +0 -24
  91. package/dist/config.d.ts +0 -124
  92. package/dist/config.d.ts.map +0 -1
  93. package/dist/config.js +0 -418
  94. package/dist/contracts.d.ts +0 -4376
  95. package/dist/contracts.d.ts.map +0 -1
  96. package/dist/contracts.js +0 -1839
  97. package/dist/exec/cartesi-machine.d.ts +0 -9
  98. package/dist/exec/cartesi-machine.d.ts.map +0 -1
  99. package/dist/exec/cartesi-machine.js +0 -18
  100. package/dist/exec/genext2fs.d.ts +0 -31
  101. package/dist/exec/genext2fs.d.ts.map +0 -1
  102. package/dist/exec/genext2fs.js +0 -44
  103. package/dist/exec/index.d.ts +0 -4
  104. package/dist/exec/index.d.ts.map +0 -1
  105. package/dist/exec/index.js +0 -3
  106. package/dist/exec/mksquashfs.d.ts +0 -21
  107. package/dist/exec/mksquashfs.d.ts.map +0 -1
  108. package/dist/exec/mksquashfs.js +0 -47
  109. package/dist/exec/rollups.d.ts +0 -105
  110. package/dist/exec/rollups.d.ts.map +0 -1
  111. package/dist/exec/rollups.js +0 -375
  112. package/dist/exec/util.d.ts +0 -21
  113. package/dist/exec/util.d.ts.map +0 -1
  114. package/dist/exec/util.js +0 -31
  115. package/dist/index.d.ts +0 -3
  116. package/dist/index.d.ts.map +0 -1
  117. package/dist/machine.d.ts +0 -12
  118. package/dist/machine.d.ts.map +0 -1
  119. package/dist/machine.js +0 -90
  120. package/dist/prompts.d.ts +0 -73
  121. package/dist/prompts.d.ts.map +0 -1
  122. package/dist/prompts.js +0 -192
  123. package/dist/template.d.ts +0 -3
  124. package/dist/template.d.ts.map +0 -1
  125. package/dist/template.js +0 -16
  126. package/dist/types/docker.d.ts +0 -22
  127. package/dist/types/docker.d.ts.map +0 -1
  128. package/dist/types/docker.js +0 -1
  129. package/dist/wallet.d.ts +0 -9225
  130. package/dist/wallet.d.ts.map +0 -1
  131. package/dist/wallet.js +0 -41
@@ -1,114 +0,0 @@
1
- import { execa } from "execa";
2
- import fs from "fs-extra";
3
- import path from "node:path";
4
- import { genext2fs, mksquashfs } from "../exec/index.js";
5
- /**
6
- * Build Docker image (linux/riscv64). Returns image id.
7
- */
8
- const buildImage = async (options) => {
9
- const { buildArgs, context, destination, dockerfile, dockerfileContent, tags, target, } = options;
10
- // if dockerfileContext is specified, use it as the dockerfile passed through stdin
11
- const args = [
12
- "buildx",
13
- "build",
14
- "--platform",
15
- "linux/riscv64",
16
- "--file",
17
- dockerfileContent ? "-" : dockerfile,
18
- "--output",
19
- "type=docker",
20
- "--output",
21
- `type=tar,dest=${destination}`,
22
- "--progress",
23
- "quiet",
24
- ];
25
- // set tags for the image built
26
- args.push(...tags.flatMap((tag) => ["--tag", tag]));
27
- // set build args
28
- args.push(...buildArgs.flatMap((arg) => ["--build-arg", arg]));
29
- if (target) {
30
- args.push("--target", target);
31
- }
32
- args.push(context);
33
- const { stdout: imageId } = await execa("docker", args, {
34
- input: dockerfileContent,
35
- });
36
- return imageId;
37
- };
38
- /**
39
- * Query the image using docker image inspect
40
- * @param image image id or name
41
- * @returns Information about the image
42
- */
43
- const getImageInfo = async (image) => {
44
- const { stdout: jsonStr } = await execa("docker", [
45
- "image",
46
- "inspect",
47
- image,
48
- ]);
49
- // parse image info from docker inspect output
50
- const [imageInfo] = JSON.parse(jsonStr);
51
- // validate image architecture (must be riscv64)
52
- if (imageInfo.Architecture !== "riscv64") {
53
- throw new Error(`Invalid image Architecture: ${imageInfo.Architecture}. Expected riscv64`);
54
- }
55
- const info = {
56
- cmd: imageInfo.Config.Cmd ?? [],
57
- entrypoint: imageInfo.Config.Entrypoint ?? [],
58
- env: imageInfo.Config.Env || [],
59
- workdir: imageInfo.Config.WorkingDir,
60
- };
61
- return info;
62
- };
63
- export const build = async (name, drive, sdkImage, destination, debug) => {
64
- const { format } = drive;
65
- const tar = `${name}.tar`;
66
- const filename = `${name}.${format}`;
67
- // use pre-existing image or build docker image
68
- let image;
69
- if (drive.image) {
70
- // build a docker image with `FROM <image>`
71
- image = await buildImage({
72
- ...drive,
73
- destination: path.join(destination, tar),
74
- dockerfileContent: `FROM ${drive.image}`,
75
- });
76
- }
77
- else {
78
- image = await buildImage({
79
- ...drive,
80
- destination: path.join(destination, tar),
81
- });
82
- }
83
- const imageInfo = await getImageInfo(image);
84
- try {
85
- switch (format) {
86
- case "ext2": {
87
- await genext2fs.fromTar({
88
- extraSize: drive.extraSize,
89
- input: tar,
90
- output: filename,
91
- cwd: destination,
92
- image: sdkImage,
93
- });
94
- break;
95
- }
96
- case "sqfs": {
97
- await mksquashfs.fromTar({
98
- input: path.join(destination, tar),
99
- output: filename,
100
- cwd: destination,
101
- image: sdkImage,
102
- });
103
- break;
104
- }
105
- }
106
- }
107
- finally {
108
- // delete intermediate files
109
- if (!debug) {
110
- await fs.remove(path.join(destination, tar));
111
- }
112
- }
113
- return imageInfo;
114
- };
@@ -1,3 +0,0 @@
1
- import type { EmptyDriveConfig } from "../config.js";
2
- export declare const build: (name: string, drive: EmptyDriveConfig, sdkImage: string, destination: string) => Promise<void>;
3
- //# sourceMappingURL=empty.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"empty.d.ts","sourceRoot":"","sources":["../../src/builder/empty.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGrD,eAAO,MAAM,KAAK,GACd,MAAM,MAAM,EACZ,OAAO,gBAAgB,EACvB,UAAU,MAAM,EAChB,aAAa,MAAM,KACpB,OAAO,CAAC,IAAI,CAoBd,CAAC"}
@@ -1,21 +0,0 @@
1
- import fs from "fs-extra";
2
- import path from "node:path";
3
- import { genext2fs } from "../exec/index.js";
4
- export const build = async (name, drive, sdkImage, destination) => {
5
- const filename = `${name}.${drive.format}`;
6
- switch (drive.format) {
7
- case "ext2": {
8
- await genext2fs.empty({
9
- output: filename,
10
- size: drive.size,
11
- cwd: destination,
12
- image: sdkImage,
13
- });
14
- break;
15
- }
16
- case "raw": {
17
- await fs.writeFile(path.join(destination, filename), Buffer.alloc(drive.size));
18
- break;
19
- }
20
- }
21
- };
@@ -1,6 +0,0 @@
1
- export { build as buildDirectory } from "./directory.js";
2
- export { build as buildDocker } from "./docker.js";
3
- export { build as buildEmpty } from "./empty.js";
4
- export { build as buildNone } from "./none.js";
5
- export { build as buildTar } from "./tar.js";
6
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/builder/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,KAAK,IAAI,WAAW,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,KAAK,IAAI,UAAU,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,KAAK,IAAI,QAAQ,EAAE,MAAM,UAAU,CAAC"}
@@ -1,5 +0,0 @@
1
- export { build as buildDirectory } from "./directory.js";
2
- export { build as buildDocker } from "./docker.js";
3
- export { build as buildEmpty } from "./empty.js";
4
- export { build as buildNone } from "./none.js";
5
- export { build as buildTar } from "./tar.js";
@@ -1,3 +0,0 @@
1
- import { type ExistingDriveConfig } from "../config.js";
2
- export declare const build: (name: string, drive: ExistingDriveConfig, destination: string) => Promise<void>;
3
- //# sourceMappingURL=none.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"none.d.ts","sourceRoot":"","sources":["../../src/builder/none.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,mBAAmB,EAAkB,MAAM,cAAc,CAAC;AAExE,eAAO,MAAM,KAAK,GACd,MAAM,MAAM,EACZ,OAAO,mBAAmB,EAC1B,aAAa,MAAM,KACpB,OAAO,CAAC,IAAI,CAQd,CAAC"}
@@ -1,11 +0,0 @@
1
- import fs from "fs-extra";
2
- import path from "node:path";
3
- import { getDriveFormat } from "../config.js";
4
- export const build = async (name, drive, destination) => {
5
- // no need to build, drive already exists
6
- const src = drive.filename;
7
- const format = getDriveFormat(src);
8
- const filename = path.join(destination, `${name}.${format}`);
9
- // just copy it
10
- await fs.copyFile(src, filename);
11
- };
@@ -1,3 +0,0 @@
1
- import type { TarDriveConfig } from "../config.js";
2
- export declare const build: (name: string, drive: TarDriveConfig, sdkImage: string, destination: string) => Promise<void>;
3
- //# sourceMappingURL=tar.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tar.d.ts","sourceRoot":"","sources":["../../src/builder/tar.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAGnD,eAAO,MAAM,KAAK,GACd,MAAM,MAAM,EACZ,OAAO,cAAc,EACrB,UAAU,MAAM,EAChB,aAAa,MAAM,KACpB,OAAO,CAAC,IAAI,CA4Bd,CAAC"}
@@ -1,30 +0,0 @@
1
- import fs from "fs-extra";
2
- import path from "node:path";
3
- import { genext2fs, mksquashfs } from "../exec/index.js";
4
- export const build = async (name, drive, sdkImage, destination) => {
5
- const tar = `${name}.tar`;
6
- const filename = `${name}.${drive.format}`;
7
- // copy input tar to destination directory (with drive name)
8
- await fs.copy(drive.filename, path.join(destination, tar));
9
- switch (drive.format) {
10
- case "ext2": {
11
- await genext2fs.fromTar({
12
- extraSize: drive.extraSize,
13
- input: tar,
14
- output: filename,
15
- cwd: destination,
16
- image: sdkImage,
17
- });
18
- break;
19
- }
20
- case "sqfs": {
21
- await mksquashfs.fromTar({
22
- input: path.join(destination, tar),
23
- output: filename,
24
- cwd: destination,
25
- image: sdkImage,
26
- });
27
- break;
28
- }
29
- }
30
- };
@@ -1,6 +0,0 @@
1
- import { Command } from "@commander-js/extra-typings";
2
- export declare const createAddressBookCommand: () => Command<[], {
3
- json?: true | undefined;
4
- projectName?: string | undefined;
5
- }, {}>;
6
- //# sourceMappingURL=address-book.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"address-book.d.ts","sourceRoot":"","sources":["../../src/commands/address-book.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAItD,eAAO,MAAM,wBAAwB;;;MA4CpC,CAAC"}
@@ -1,44 +0,0 @@
1
- import { Command } from "@commander-js/extra-typings";
2
- import Table from "cli-table3";
3
- import { getAddressBook, getProjectName } from "../base.js";
4
- export const createAddressBookCommand = () => {
5
- return new Command("address-book")
6
- .description("Prints the addresses of all smart contracts deployed to the runtime environment of the application.")
7
- .option("--json", "Format output as json.")
8
- .option("--project-name <string>", "name of project (used by docker compose and cartesi-rollups-node)")
9
- .action(async (options) => {
10
- const { json } = options;
11
- const projectName = getProjectName(options);
12
- const addressBook = await getAddressBook({ projectName });
13
- if (!json) {
14
- // print as a table
15
- const table = new Table({
16
- head: ["Contract", "Address"],
17
- chars: {
18
- top: "",
19
- "top-mid": "",
20
- "top-left": "",
21
- "top-right": "",
22
- bottom: "",
23
- "bottom-mid": "",
24
- "bottom-left": "",
25
- "bottom-right": "",
26
- left: "",
27
- "left-mid": "",
28
- mid: "",
29
- "mid-mid": "",
30
- right: "",
31
- "right-mid": "",
32
- middle: " ",
33
- },
34
- style: { "padding-left": 0, "padding-right": 0 },
35
- });
36
- table.push(...Object.entries(addressBook));
37
- console.log(table.toString());
38
- }
39
- else {
40
- // print as json
41
- process.stdout.write(JSON.stringify(addressBook));
42
- }
43
- });
44
- };
@@ -1,8 +0,0 @@
1
- import { Command } from "@commander-js/extra-typings";
2
- export declare const createBuildCommand: () => Command<[], {
3
- config: string[];
4
- debug: boolean;
5
- drivesOnly?: true | undefined;
6
- verbose: boolean;
7
- }, {}>;
8
- //# sourceMappingURL=build.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,6BAA6B,CAAC;AAqE9D,eAAO,MAAM,kBAAkB;;;;;MAqF9B,CAAC"}
@@ -1,97 +0,0 @@
1
- import { Command, Option } from "@commander-js/extra-typings";
2
- import chalk from "chalk";
3
- import fs from "fs-extra";
4
- import { Listr } from "listr2";
5
- import path from "node:path";
6
- import tmp from "tmp";
7
- import { getApplicationConfig, getContextPath } from "../base.js";
8
- import { buildDirectory, buildDocker, buildEmpty, buildNone, buildTar, } from "../builder/index.js";
9
- import { bootMachine } from "../machine.js";
10
- const buildDriveTask = (name, drive) => ({
11
- title: `Building drive ${chalk.cyan(name)}`,
12
- task: async (ctx, task) => {
13
- const { config, debug, destination } = ctx;
14
- const sdk = config.sdk;
15
- switch (drive.builder) {
16
- case "directory": {
17
- await buildDirectory(name, drive, sdk, destination, debug);
18
- break;
19
- }
20
- case "docker": {
21
- const imageInfo = await buildDocker(name, drive, sdk, destination, debug);
22
- if (imageInfo && name === "root") {
23
- // only set image info for root drive
24
- ctx.imageInfo = imageInfo;
25
- }
26
- break;
27
- }
28
- case "empty": {
29
- await buildEmpty(name, drive, sdk, destination);
30
- break;
31
- }
32
- case "tar": {
33
- await buildTar(name, drive, sdk, destination);
34
- break;
35
- }
36
- case "none": {
37
- await buildNone(name, drive, destination);
38
- break;
39
- }
40
- }
41
- task.title = `Build drive ${chalk.cyan(name)}`;
42
- },
43
- });
44
- export const createBuildCommand = () => {
45
- return new Command("build")
46
- .description("Build application by building Cartesi machine drives, configuring a machine and booting it.")
47
- .option("-c, --config <config>", "path to the configuration file", (value, prev) => prev.concat([value]), ["cartesi.toml"])
48
- .addOption(new Option("--debug", "enable debug mode (do not remove intermediate files)")
49
- .default(false)
50
- .hideHelp())
51
- .option("-d, --drives-only", "only build drives, do not boot machine")
52
- .option("-v, --verbose", "verbose output", false)
53
- .action(async (options) => {
54
- const { debug, drivesOnly, verbose } = options;
55
- // clean up temp files we create along the process
56
- tmp.setGracefulCleanup();
57
- // get application configuration from 'cartesi.toml'
58
- const config = getApplicationConfig(options.config);
59
- // destination directory for image and intermediate files
60
- const destination = path.resolve(getContextPath());
61
- // prepare context directory
62
- await fs.emptyDir(destination); // XXX: make it less error prone
63
- // build context
64
- const ctx = { config, debug, destination, imageInfo: undefined };
65
- // tasks to build drives
66
- const driveTasks = Object.entries(config.drives).map(([name, drive]) => buildDriveTask(name, drive));
67
- const builds = new Listr([
68
- {
69
- title: "Build drives",
70
- task: async (_ctx, task) => {
71
- return task.newListr(driveTasks, {
72
- concurrent: true,
73
- rendererOptions: {
74
- collapseSubtasks: false,
75
- },
76
- ctx,
77
- });
78
- },
79
- },
80
- ], { ctx, renderer: verbose ? "verbose" : "default" });
81
- const result = await builds.run();
82
- // if only build drives, quit here
83
- if (drivesOnly) {
84
- return;
85
- }
86
- // create machine snapshot
87
- await bootMachine(config, result.imageInfo, {
88
- finalHash: true,
89
- store: "image",
90
- }, {
91
- cwd: destination,
92
- stdio: "inherit",
93
- });
94
- // make snapshot readable by all users, because cartesi-machine sets to 600
95
- await fs.chmod(path.join(destination, "image"), 0o755);
96
- });
97
- };
@@ -1,3 +0,0 @@
1
- import { Command } from "@commander-js/extra-typings";
2
- export declare const createCleanCommand: () => Command<[], {}, {}>;
3
- //# sourceMappingURL=clean.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"clean.d.ts","sourceRoot":"","sources":["../../src/commands/clean.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAItD,eAAO,MAAM,kBAAkB,2BAM9B,CAAC"}
@@ -1,10 +0,0 @@
1
- import { Command } from "@commander-js/extra-typings";
2
- import fs from "fs-extra";
3
- import { getContextPath } from "../base.js";
4
- export const createCleanCommand = () => {
5
- return new Command("clean")
6
- .description("Deletes all cached build artifacts of application.")
7
- .action(async () => {
8
- await fs.emptyDir(getContextPath());
9
- });
10
- };
@@ -1,7 +0,0 @@
1
- import { Command } from "@commander-js/extra-typings";
2
- export declare const DEFAULT_TEMPLATES_BRANCH = "prerelease/sdk-12";
3
- export declare const createCreateCommand: () => Command<[string], {
4
- template: "cpp" | "cpp-low-level" | "go" | "java" | "javascript" | "lua" | "python" | "ruby" | "rust" | "typescript";
5
- branch: string;
6
- }, {}>;
7
- //# sourceMappingURL=create.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,6BAA6B,CAAC;AAK9D,eAAO,MAAM,wBAAwB,sBAAsB,CAAC;AAe5D,eAAO,MAAM,mBAAmB;;;MA0B/B,CAAC"}
@@ -1,37 +0,0 @@
1
- import { Command, Option } from "@commander-js/extra-typings";
2
- import chalk from "chalk";
3
- import ora from "ora";
4
- import { download } from "../template.js";
5
- export const DEFAULT_TEMPLATES_BRANCH = "prerelease/sdk-12";
6
- const TEMPLATES = [
7
- "cpp",
8
- "cpp-low-level",
9
- "go",
10
- "java",
11
- "javascript",
12
- "lua",
13
- "python",
14
- "ruby",
15
- "rust",
16
- "typescript",
17
- ];
18
- export const createCreateCommand = () => {
19
- return new Command("create")
20
- .argument("<name>", "application and directory name")
21
- .addOption(new Option("-t, --template <template>", "template name to use")
22
- .choices(TEMPLATES)
23
- .makeOptionMandatory())
24
- .option("-b, --branch <branch>", "cartesi/application-templates repository branch name to use", DEFAULT_TEMPLATES_BRANCH)
25
- .action(async (name, { branch, template }) => {
26
- const spinner = ora("Creating application...").start();
27
- try {
28
- const { dir } = await download(template, branch, name);
29
- spinner.succeed(`Application created at ${chalk.cyan(dir)}`);
30
- }
31
- catch (e) {
32
- spinner.fail(e instanceof Error
33
- ? `Error creating application: ${chalk.red(e.message)}`
34
- : String(e));
35
- }
36
- });
37
- };
@@ -1,3 +0,0 @@
1
- import { Command } from "@commander-js/extra-typings";
2
- export declare const createBuildCommand: () => Command<[], {}, {}>;
3
- //# sourceMappingURL=build.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/commands/deploy/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAGtD,eAAO,MAAM,kBAAkB,2BAQ9B,CAAC"}
@@ -1,9 +0,0 @@
1
- import { Command } from "@commander-js/extra-typings";
2
- import chalk from "chalk";
3
- export const createBuildCommand = () => {
4
- return new Command("build")
5
- .description("DEPRECATED: Package the application in a Docker image ready to be deployed.")
6
- .action(async () => {
7
- console.warn(chalk.yellow("deploy build command is deprecated"));
8
- });
9
- };
@@ -1,3 +0,0 @@
1
- import { Command } from "@commander-js/extra-typings";
2
- export declare const createDeployCommand: () => Command<[], {}, {}>;
3
- //# sourceMappingURL=deploy.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAItD,eAAO,MAAM,mBAAmB,2BAc/B,CAAC"}
@@ -1,12 +0,0 @@
1
- import { Command } from "@commander-js/extra-typings";
2
- import chalk from "chalk";
3
- import { createBuildCommand } from "./deploy/build.js";
4
- export const createDeployCommand = () => {
5
- const command = new Command("deploy")
6
- .description("DEPRECATED: Package and deploy the application to a supported live network.")
7
- .action(async () => {
8
- console.warn(chalk.yellow("deploy command is deprecated, use 'cartesi-rollups-cli' directly instead"));
9
- });
10
- command.addCommand(createBuildCommand(), { hidden: true });
11
- return command;
12
- };
@@ -1,18 +0,0 @@
1
- import { Command } from "@commander-js/extra-typings";
2
- export declare const createErc1155SingleCommand: () => Command<[string | undefined, string | undefined], {
3
- [x: string]: never;
4
- }, {
5
- from?: string | undefined;
6
- application?: string | undefined;
7
- projectName?: string | undefined;
8
- rpcUrl?: string | undefined;
9
- }>;
10
- export declare const createErc1155BatchCommand: () => Command<[string | undefined, string | undefined], {
11
- [x: string]: never;
12
- }, {
13
- from?: string | undefined;
14
- application?: string | undefined;
15
- projectName?: string | undefined;
16
- rpcUrl?: string | undefined;
17
- }>;
18
- //# sourceMappingURL=erc1155.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"erc1155.d.ts","sourceRoot":"","sources":["../../../src/commands/deposit/erc1155.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAyCtD,eAAO,MAAM,0BAA0B;;;;;;;EAmItC,CAAC;AAEF,eAAO,MAAM,yBAAyB;;;;;;;EAwKrC,CAAC"}