From 07a70402b74d59b281d7274555b3557c54f8899f Mon Sep 17 00:00:00 2001 From: vladilen11 Date: Sun, 24 Sep 2023 20:45:51 +0800 Subject: [PATCH] update --- packages/cli/obelisk.config.ts | 2 +- packages/cli/package.json | 2 +- packages/cli/scripts/compgen-test.ts | 103 +++++++++++------------ packages/cli/src/commands/compgen.ts | 3 +- packages/cli/src/commands/publish.ts | 3 +- packages/cli/src/commands/upgrade.ts | 3 +- packages/cli/src/utils/publishHandler.ts | 2 +- packages/cli/src/utils/upgradeHandler.ts | 2 +- packages/client/package.json | 2 +- packages/common/package.json | 12 +-- packages/common/src/index.ts | 1 + 11 files changed, 62 insertions(+), 73 deletions(-) diff --git a/packages/cli/obelisk.config.ts b/packages/cli/obelisk.config.ts index 7c52ac33..730aceeb 100644 --- a/packages/cli/obelisk.config.ts +++ b/packages/cli/obelisk.config.ts @@ -1,4 +1,4 @@ -import { ObeliskConfig } from "@0xobelisk/common/src/codegen/types"; +import { ObeliskConfig } from "@0xobelisk/common"; export const obeliskConfig = { name: "examples", diff --git a/packages/cli/package.json b/packages/cli/package.json index 6d087e03..46f62bf8 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@0xobelisk/cli", - "version": "0.1.3", + "version": "0.2.3", "description": "Tookit for interacting with move eps framework", "keywords": [ "sui", diff --git a/packages/cli/scripts/compgen-test.ts b/packages/cli/scripts/compgen-test.ts index ab317bb2..4a1a6d1d 100644 --- a/packages/cli/scripts/compgen-test.ts +++ b/packages/cli/scripts/compgen-test.ts @@ -1,67 +1,62 @@ -import { formatAndWriteMove } from "@0xobelisk/common/codegen"; +import { formatAndWriteMove } from "@0xobelisk/common"; -type ComponentMapType = Record -type ComponentValueType = string +type ComponentMapType = Record; +type ComponentValueType = string; -type ConfigDataType = Record +type ConfigDataType = Record; type ObeliskConfig = { - name: string, - systems: string[], - components: Record - // world 的顶级存储,适合定义world的规则,比如一个admin, 一个fee,并且可以帮你初始化数据 - // genesis_config: { - // admin: { - // type: "address", - // value: "0x1" - // }, - // world_info: { - // type: { - // name: "String", - // description: "String", - // birth_time: "u64", - // }, - // value: { - // name: "Crypto Pet", - // description: "Crypto Pet", - // birth_time: "auto", - // } - // }, - // fee: { - // type: "Table,u64>", - // value: [ - // { - // clean: "1000000" - // }, - // { - // paly: "1000000" - // }, - // ] - // }, - // } -} + name: string; + systems: string[]; + components: Record; + // world 的顶级存储,适合定义world的规则,比如一个admin, 一个fee,并且可以帮你初始化数据 + // genesis_config: { + // admin: { + // type: "address", + // value: "0x1" + // }, + // world_info: { + // type: { + // name: "String", + // description: "String", + // birth_time: "u64", + // }, + // value: { + // name: "Crypto Pet", + // description: "Crypto Pet", + // birth_time: "auto", + // } + // }, + // fee: { + // type: "Table,u64>", + // value: [ + // { + // clean: "1000000" + // }, + // { + // paly: "1000000" + // }, + // ] + // }, + // } +}; async function init() { let config = { name: "withinfinity", - systems: [ - "fee_system", - "home_system", - "pet_system", - "state_system", - ], + systems: ["fee_system", "home_system", "pet_system", "state_system"], components: { // Key - Struct value level: { - hunger: "u64", - cleanliness: "u64", - mood: "u64", - level: "u64", + hunger: "u64", + cleanliness: "u64", + mood: "u64", + level: "u64", }, // Key - Struct value state: { - state: "vector" , - last_update_time: "u64" , + state: "vector", + last_update_time: "u64", }, // Key - Single value suifren: "bool", @@ -110,8 +105,12 @@ async function init() { public fun components_length(entity: &mut Entity) : u64 { bag::length(get_mut_comps(entity)) } -}` - let a = formatAndWriteMove(output, "/Users/feng/Desktop/obelisk/obelisk-engine/packages/cli", "formatAndWriteMove"); +}`; + let a = formatAndWriteMove( + output, + "/Users/feng/Desktop/obelisk/obelisk-engine/packages/cli", + "formatAndWriteMove" + ); // console.log(output) } diff --git a/packages/cli/src/commands/compgen.ts b/packages/cli/src/commands/compgen.ts index 26180afd..74eafaa0 100644 --- a/packages/cli/src/commands/compgen.ts +++ b/packages/cli/src/commands/compgen.ts @@ -1,6 +1,5 @@ import type { CommandModule } from "yargs"; -import { worldgen, loadConfig } from "@0xobelisk/common/codegen"; -import { ObeliskConfig } from "@0xobelisk/common/src/codegen"; +import { worldgen, loadConfig, ObeliskConfig } from "@0xobelisk/common"; type Options = { configPath?: string; diff --git a/packages/cli/src/commands/publish.ts b/packages/cli/src/commands/publish.ts index 7a23a2fe..fdeda557 100644 --- a/packages/cli/src/commands/publish.ts +++ b/packages/cli/src/commands/publish.ts @@ -1,8 +1,7 @@ import type { CommandModule } from "yargs"; import { logError } from "../utils/errors"; import { publishHandler } from "../utils"; -import { loadConfig } from "@0xobelisk/common/src/codegen"; -import { ObeliskConfig } from "@0xobelisk/common/src/codegen/types"; +import { loadConfig, ObeliskConfig } from "@0xobelisk/common"; type Options = { configPath: string; diff --git a/packages/cli/src/commands/upgrade.ts b/packages/cli/src/commands/upgrade.ts index cc18301a..d5b882ae 100644 --- a/packages/cli/src/commands/upgrade.ts +++ b/packages/cli/src/commands/upgrade.ts @@ -1,8 +1,7 @@ import type { CommandModule } from "yargs"; import { logError } from "../utils/errors"; import { upgradeHandler } from "../utils"; -import { loadConfig } from "@0xobelisk/common/src/codegen"; -import { ObeliskConfig } from "@0xobelisk/common/src/codegen/types"; +import { loadConfig, ObeliskConfig } from "@0xobelisk/common"; type Options = { configPath: string; diff --git a/packages/cli/src/utils/publishHandler.ts b/packages/cli/src/utils/publishHandler.ts index f08d6e49..2ed7134f 100644 --- a/packages/cli/src/utils/publishHandler.ts +++ b/packages/cli/src/utils/publishHandler.ts @@ -12,7 +12,7 @@ import { generateIdConfig, saveContractData, generateEps, -} from "@0xobelisk/common/src/codegen"; +} from "@0xobelisk/common"; 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 ab36ef53..9e68d8af 100644 --- a/packages/cli/src/utils/upgradeHandler.ts +++ b/packages/cli/src/utils/upgradeHandler.ts @@ -13,7 +13,7 @@ import { generateIdConfig, generateEps, saveContractData, -} from "@0xobelisk/common/src/codegen"; +} from "@0xobelisk/common"; type ObjectContent = { type: string; diff --git a/packages/client/package.json b/packages/client/package.json index 5da06b67..ae688567 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@0xobelisk/client", - "version": "0.2.0", + "version": "0.2.3", "description": "Tookit for interacting with move eps framework", "keywords": [ "sui", diff --git a/packages/common/package.json b/packages/common/package.json index 90326b38..46e3d1bf 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@0xobelisk/common", - "version": "0.2.1", + "version": "0.2.3", "description": "Common low level logic shared between packages", "keywords": [ "sui", @@ -23,20 +23,12 @@ "node": ">=18" }, "exports": { - ".": "./dist/index.js", - "./codegen": "./dist/codegen.js", - "./utils": "./dist/utils.js" + ".": "./dist/index.js" }, "typesVersions": { "*": { "index": [ "./src/index.ts" - ], - "codegen": [ - "./src/codegen/index.ts" - ], - "utils": [ - "./src/utils/index.ts" ] } }, diff --git a/packages/common/src/index.ts b/packages/common/src/index.ts index e69de29b..7128704f 100755 --- a/packages/common/src/index.ts +++ b/packages/common/src/index.ts @@ -0,0 +1 @@ +export * from "./codegen";