@bloxbean/yaci-devkit 0.10.0-preview3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,38 @@
1
+ # Yaci Devkit
2
+
3
+ A set of development tools for building on Cardano by creating a local devnet.
4
+
5
+ ### Installation
6
+
7
+ ```bash
8
+ npm i -g @bloxbean/yaci-devkit
9
+ ```
10
+
11
+ ### **Commands**
12
+
13
+ 1. **Download and Start Cardano Node**
14
+ ```bash
15
+ yaci-devkit up
16
+ ```
17
+ - Downloads the Cardano node (if not already downloaded) and starts a new devnet.
18
+
19
+ 2. **Interactive Mode**
20
+ ```bash
21
+ yaci-devkit up --interactive
22
+ ```
23
+ - Downloads the node (if not already downloaded), starts a new devnet, and launches the `yaci-cli` prompt.
24
+
25
+ 3. **Yaci Store Mode (Blockfrost-Compatible API Endpoints)**
26
+ ```bash
27
+ yaci-devkit up --enable-yaci-store
28
+ ```
29
+ - Downloads and starts the Cardano node, Yaci Store, and Ogmios (used for script cost evaluation).
30
+ - Add `--interactive` to enter the `yaci-cli` prompt.
31
+
32
+ 4. **Kupomios Mode (Ogmios + Kupo)**
33
+ ```bash
34
+ yaci-devkit up --enable-kupomios
35
+ ```
36
+ - Downloads and starts the Cardano node, Ogmios, and Kupo.
37
+
38
+ For a full list of Yaci CLI commands, check the Yaci DevKit [documentation](https://devkit.yaci.xyz/commands).
package/package.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "@bloxbean/yaci-devkit",
3
+ "version": "0.10.0-preview3",
4
+ "description": "A set of development tools for building on Cardano by creating a local devnet.",
5
+ "keywords": [
6
+ "yaci-devkit",
7
+ "cardano",
8
+ "devnet"
9
+ ],
10
+ "engines": {
11
+ "node": ">=20.8.0"
12
+ },
13
+ "license": "MIT",
14
+ "homepage": "https://devkit.yaci.xyz/",
15
+ "repository": "github:bloxbean/yaci-devkit",
16
+ "bin": {
17
+ "yaci-devkit": "./start.mjs"
18
+ },
19
+ "dependencies": {
20
+ "@bloxbean/yaci-devkit-linux-x64": "0.10.0-preview3",
21
+ "@bloxbean/yaci-devkit-macos-arm64": "0.10.0-preview3"
22
+ },
23
+ "devDependencies": {
24
+ "@types/node": "^22.10.2",
25
+ "typescript": ">=5.0.0"
26
+ }
27
+ }
package/start.mjs ADDED
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { spawn } from "node:child_process";
4
+ import { platform } from "node:os";
5
+ import { fileURLToPath } from 'node:url';
6
+ import { dirname, resolve } from 'node:path';
7
+ // import { createHash } from "node:crypto";
8
+
9
+ const osType = platform();
10
+
11
+
12
+ /**
13
+ * Find the script for the corresponding os-specific package.
14
+ *
15
+ * Note: it's tempting to solve this in a few ways that are actually bad:
16
+ * 1. Call `npx <package> <script>` on the corresponding package.
17
+ * This is bad as there are package managers other than npm
18
+ * 2. Try to compute the path for the package manually.
19
+ * This is bad as different package managers & runtimes have different folder structures for dependencies
20
+ *
21
+ * Instead, we use `import.meta.resolve` which returns the path to the `main` entry in `package.json`.
22
+ * Conveniently, we've made the `main` in the packages point directly to the yaci-cli
23
+ *
24
+ * @return {Record<string, () => string}
25
+ */
26
+ const packageMap = {
27
+ darwin: () => import.meta.resolve("@bloxbean/yaci-devkit-macos-arm64"),
28
+ linux: () => import.meta.resolve("@bloxbean/yaci-devkit-linux-x64"),
29
+ };
30
+
31
+ if (packageMap[osType] == null) {
32
+ console.error(`Unsupported platform: ${osType}`);
33
+ process.exit(1);
34
+ }
35
+ const binPath = fileURLToPath(packageMap[osType]());
36
+
37
+ const devkitDir = dirname(binPath);
38
+
39
+ const configPath = resolve(devkitDir, 'config');
40
+
41
+ // const tmpSuffix = createHash('md5').update(workDir).digest("hex");
42
+ // const yaciCLIHome = resolve("/tmp", ".yaci-cli" + tmpSuffix )
43
+
44
+ const additionalConfig = "optional:file:" + configPath + "/application.properties,"
45
+ + "optional:file:" + configPath + "/download.properties,"
46
+ + "optional:file:" + configPath + "/node.properties"
47
+
48
+ const additionalConfigArg = "-Dspring.config.import=" + additionalConfig;
49
+
50
+ const child = spawn(binPath, [additionalConfigArg, ...process.argv.slice(2)], {
51
+ stdio: "inherit",
52
+ env: {
53
+ // YACI_CLI_HOME: yaciCLIHome
54
+ },
55
+
56
+ });
57
+
58
+ child.on("close", (code) => {
59
+ process.exit(code ?? 0);
60
+ });
package/tsconfig.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "compilerOptions": {
3
+ "checkJs": true,
4
+ "allowJs": true,
5
+ "noEmit": true,
6
+ "strict": true
7
+ },
8
+ "include": ["src/**/*.mjs"],
9
+ "exclude": ["node_modules"]
10
+ }