diff --git a/packages/cli/obelisk.config.ts b/packages/cli/obelisk.config.ts index 75998c71..7c52ac33 100644 --- a/packages/cli/obelisk.config.ts +++ b/packages/cli/obelisk.config.ts @@ -1,4 +1,4 @@ -import { ObeliskConfig } from "../common/src/codegen/types"; +import { ObeliskConfig } from "@0xobelisk/common/src/codegen/types"; export const obeliskConfig = { name: "examples", diff --git a/packages/cli/package.json b/packages/cli/package.json index 143b6ec1..6d087e03 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -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", diff --git a/packages/cli/src/commands/compgen.ts b/packages/cli/src/commands/compgen.ts index a72d0d41..26180afd 100644 --- a/packages/cli/src/commands/compgen.ts +++ b/packages/cli/src/commands/compgen.ts @@ -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; @@ -20,8 +18,8 @@ const commandModule: CommandModule = { }, async handler({ configPath }) { - const obeliskConfig = await loadConfig(configPath) as ObeliskConfig; - worldgen(obeliskConfig) + const obeliskConfig = (await loadConfig(configPath)) as ObeliskConfig; + worldgen(obeliskConfig); process.exit(0); }, }; diff --git a/packages/cli/src/commands/publish.ts b/packages/cli/src/commands/publish.ts index 04ef6ec5..7a23a2fe 100644 --- a/packages/cli/src/commands/publish.ts +++ b/packages/cli/src/commands/publish.ts @@ -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 = { command: "publish", @@ -17,15 +17,23 @@ const commandModule: CommandModule = { 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) { diff --git a/packages/cli/src/commands/upgrade.ts b/packages/cli/src/commands/upgrade.ts index 6e31c241..cc18301a 100644 --- a/packages/cli/src/commands/upgrade.ts +++ b/packages/cli/src/commands/upgrade.ts @@ -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; diff --git a/packages/cli/src/utils/publishHandler.ts b/packages/cli/src/utils/publishHandler.ts index 90291bc6..f08d6e49 100644 --- a/packages/cli/src/utils/publishHandler.ts +++ b/packages/cli/src/utils/publishHandler.ts @@ -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( diff --git a/packages/cli/src/utils/upgradeHandler.ts b/packages/cli/src/utils/upgradeHandler.ts index 1e1bb8e0..ab36ef53 100644 --- a/packages/cli/src/utils/upgradeHandler.ts +++ b/packages/cli/src/utils/upgradeHandler.ts @@ -13,7 +13,7 @@ import { generateIdConfig, generateEps, saveContractData, -} from "../../../common/src/codegen"; +} from "@0xobelisk/common/src/codegen"; type ObjectContent = { type: string; diff --git a/packages/common/src/codegen/index.ts b/packages/common/src/codegen/index.ts index 27365dd4..a27f0dba 100644 --- a/packages/common/src/codegen/index.ts +++ b/packages/common/src/codegen/index.ts @@ -1,2 +1,3 @@ // import "./modules.d"; export * from "./utils"; +export * from "./types";