|
@@ -1,11 +1,18 @@
|
|
|
#!/usr/bin/env zx
|
|
#!/usr/bin/env zx
|
|
|
import "zx/globals";
|
|
import "zx/globals";
|
|
|
-import * as k from "@metaplex-foundation/kinobi";
|
|
|
|
|
|
|
+import * as k from "kinobi";
|
|
|
|
|
+import { rootNodeFromAnchor } from "@kinobi-so/nodes-from-anchor";
|
|
|
|
|
+{% if jsClient %}
|
|
|
|
|
+import { renderVisitor as renderJavaScriptVisitor } from "@kinobi-so/renderers-js";
|
|
|
|
|
+{% endif %}
|
|
|
|
|
+{% if rustClient %}
|
|
|
|
|
+import { renderVisitor as renderRustVisitor } from "@kinobi-so/renderers-rust";
|
|
|
|
|
+{% endif %}
|
|
|
import { getAllProgramIdls } from "./utils.mjs";
|
|
import { getAllProgramIdls } from "./utils.mjs";
|
|
|
|
|
|
|
|
// Instanciate Kinobi.
|
|
// Instanciate Kinobi.
|
|
|
-const [idl, ...additionalIdls] = getAllProgramIdls();
|
|
|
|
|
-const kinobi = k.createFromIdl(idl, additionalIdls);
|
|
|
|
|
|
|
+const [idl, ...additionalIdls] = getAllProgramIdls().map(idl => rootNodeFromAnchor(require(idl)))
|
|
|
|
|
+const kinobi = k.createFromRoot(idl, additionalIdls);
|
|
|
|
|
|
|
|
// Update programs.
|
|
// Update programs.
|
|
|
kinobi.update(
|
|
kinobi.update(
|
|
@@ -59,20 +66,23 @@ kinobi.update(
|
|
|
})
|
|
})
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
|
|
+{% if jsClient %}
|
|
|
// Render JavaScript.
|
|
// Render JavaScript.
|
|
|
const jsClient = path.join(__dirname, "..", "clients", "js");
|
|
const jsClient = path.join(__dirname, "..", "clients", "js");
|
|
|
kinobi.accept(
|
|
kinobi.accept(
|
|
|
- k.renderJavaScriptExperimentalVisitor(
|
|
|
|
|
- path.join(jsClient, "src", "generated"),
|
|
|
|
|
- { prettier: require(path.join(jsClient, ".prettierrc.json")) }
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ renderJavaScriptVisitor(path.join(jsClient, "src", "generated"), {
|
|
|
|
|
+ prettier: require(path.join(jsClient, ".prettierrc.json"))
|
|
|
|
|
+ })
|
|
|
);
|
|
);
|
|
|
|
|
+{% endif %}
|
|
|
|
|
|
|
|
|
|
+{% if rustClient %}
|
|
|
// Render Rust.
|
|
// Render Rust.
|
|
|
const rustClient = path.join(__dirname, "..", "clients", "rust");
|
|
const rustClient = path.join(__dirname, "..", "clients", "rust");
|
|
|
kinobi.accept(
|
|
kinobi.accept(
|
|
|
- k.renderRustVisitor(path.join(rustClient, "src", "generated"), {
|
|
|
|
|
|
|
+ renderRustVisitor(path.join(rustClient, "src", "generated"), {
|
|
|
formatCode: true,
|
|
formatCode: true,
|
|
|
crateFolder: rustClient,
|
|
crateFolder: rustClient,
|
|
|
})
|
|
})
|
|
|
);
|
|
);
|
|
|
|
|
+{% endif %}
|