Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
vladilen11 committed Sep 24, 2023
1 parent c3d09a3 commit b13dacc
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 23 deletions.
2 changes: 1 addition & 1 deletion packages/cli/obelisk.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ObeliskConfig } from "../common/src/codegen/types";
import { ObeliskConfig } from "@0xobelisk/common/src/codegen/types";

export const obeliskConfig = {
name: "examples",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"lint": "eslint . --ext .ts"
},
"dependencies": {
"@0xobelisk/common": "link:../common",
"@0xobelisk/common": "workspace:*",
"@mysten/sui.js": "^0.41.0",
"chalk": "^5.0.1",
"child_process": "^1.0.2",
Expand Down
10 changes: 4 additions & 6 deletions packages/cli/src/commands/compgen.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import type { CommandModule } from "yargs";
import { worldgen, loadConfig } from "../../../common/src/codegen";
import { ObeliskConfig } from "../../../common/src/codegen/types";
import path from "path";

import { worldgen, loadConfig } from "@0xobelisk/common/codegen";
import { ObeliskConfig } from "@0xobelisk/common/src/codegen";

type Options = {
configPath?: string;
Expand All @@ -20,8 +18,8 @@ const commandModule: CommandModule<Options, Options> = {
},

async handler({ configPath }) {
const obeliskConfig = await loadConfig(configPath) as ObeliskConfig;
worldgen(obeliskConfig)
const obeliskConfig = (await loadConfig(configPath)) as ObeliskConfig;
worldgen(obeliskConfig);
process.exit(0);
},
};
Expand Down
30 changes: 19 additions & 11 deletions packages/cli/src/commands/publish.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import type { CommandModule } from "yargs";
import { logError } from "../utils/errors";
import { publishHandler } from "../utils";
import { loadConfig } from "../../../common/src/codegen";
import { ObeliskConfig } from "../../../common/src/codegen/types";
import { loadConfig } from "@0xobelisk/common/src/codegen";
import { ObeliskConfig } from "@0xobelisk/common/src/codegen/types";

type Options = {
configPath: string,
network: any
savePath?: string
}
configPath: string;
network: any;
savePath?: string;
};

const commandModule: CommandModule<Options, Options> = {
command: "publish",
Expand All @@ -17,15 +17,23 @@ const commandModule: CommandModule<Options, Options> = {

builder(yargs) {
return yargs.options({
configPath: { type: "string", default: ".", decs: "Path to the config file" },
network: { type: 'string', choices: ['mainnet', 'testnet', 'devnet', 'localnet'], desc: "Network of the node (mainnet/testnet/devnet/localnet)" },
savePath: { type: 'string', desc: "Path to the save template file" }
configPath: {
type: "string",
default: ".",
decs: "Path to the config file",
},
network: {
type: "string",
choices: ["mainnet", "testnet", "devnet", "localnet"],
desc: "Network of the node (mainnet/testnet/devnet/localnet)",
},
savePath: { type: "string", desc: "Path to the save template file" },
});
},

async handler({ configPath, network, savePath}) {
async handler({ configPath, network, savePath }) {
try {
const obeliskConfig = await loadConfig(configPath) as ObeliskConfig;
const obeliskConfig = (await loadConfig(configPath)) as ObeliskConfig;

await publishHandler(obeliskConfig.name, network, savePath);
} catch (error: any) {
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/commands/upgrade.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { CommandModule } from "yargs";
import { logError } from "../utils/errors";
import { upgradeHandler } from "../utils";
import { loadConfig } from "../../../common/src/codegen";
import { ObeliskConfig } from "../../../common/src/codegen/types";
import { loadConfig } from "@0xobelisk/common/src/codegen";
import { ObeliskConfig } from "@0xobelisk/common/src/codegen/types";

type Options = {
configPath: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/utils/publishHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
generateIdConfig,
saveContractData,
generateEps,
} from "../../../common/src/codegen";
} from "@0xobelisk/common/src/codegen";
import fs from "fs";

export async function publishHandler(
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/utils/upgradeHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
generateIdConfig,
generateEps,
saveContractData,
} from "../../../common/src/codegen";
} from "@0xobelisk/common/src/codegen";

type ObjectContent = {
type: string;
Expand Down
1 change: 1 addition & 0 deletions packages/common/src/codegen/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
// import "./modules.d";
export * from "./utils";
export * from "./types";

0 comments on commit b13dacc

Please sign in to comment.