Skip to content

Commit

Permalink
feat(cli): build based on configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
tuler committed Sep 18, 2024
1 parent 548dca7 commit 0519ada
Show file tree
Hide file tree
Showing 17 changed files with 1,198 additions and 256 deletions.
6 changes: 5 additions & 1 deletion apps/cli/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ module.exports = {
],
parser: "@typescript-eslint/parser",
parserOptions: {
project: ["./tsconfig.eslint.json", "./tsconfig.json"],
project: [
"./tsconfig.eslint.json",
"./tsconfig.json",
"./test/tsconfig.json",
],
tsconfigRootDir: __dirname,
},
};
1 change: 1 addition & 0 deletions apps/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"ora": "^8.1.0",
"progress-stream": "^2.0.0",
"semver": "^7.6.3",
"smol-toml": "^1.3.0",
"tmp": "^0.2.3",
"viem": "^2.21.9"
},
Expand Down
7 changes: 7 additions & 0 deletions apps/cli/src/baseCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import fs from "fs";
import path from "path";
import { Address, Hash, getAddress, isHash } from "viem";

import { Config, parse } from "./config.js";
import {
authorityHistoryPairFactoryAddress,
cartesiDAppFactoryAddress,
Expand Down Expand Up @@ -54,6 +55,12 @@ export abstract class BaseCommand<T extends typeof Command> extends Command {
return path.join(".cartesi", ...paths);
}

protected getApplicationConfig(configPath: string): Config {
return fs.existsSync(configPath)
? parse(fs.readFileSync(configPath).toString())
: parse("");
}

protected getMachineHash(): Hash | undefined {
// read hash of the cartesi machine snapshot, if one exists
const hashPath = this.getContextPath("image", "hash");
Expand Down
Loading

0 comments on commit 0519ada

Please sign in to comment.