@dropsy/airdrop 0.2.7 → 0.4.0

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/generate-md.js DELETED
@@ -1,71 +0,0 @@
1
- // generate-instruction-mdx.js
2
- const fs = require("fs");
3
- const path = require("path");
4
-
5
- const instructionsDir = path.join(__dirname, "src", "accounts");
6
-
7
- function toTitle(name) {
8
- return name
9
- .replace(/\.mdx$/, "")
10
- .replace(/\.ts$/, "")
11
- .replace(/([A-Z])/g, " $1")
12
- .replace(/^./, (str) => str.toUpperCase())
13
- .trim();
14
- }
15
-
16
- function createMDXTemplate(name) {
17
- const title = toTitle(name);
18
-
19
- return `---
20
- title: "${title}"
21
- sidebar_position: 1
22
- ---
23
-
24
- # ${title}
25
-
26
- This page documents the **\`${name.replace(
27
- ".ts",
28
- ""
29
- )}\`** instruction of the Dropsy protocol.
30
-
31
- ## Overview
32
-
33
- Describe what this instruction does.
34
-
35
- ## Parameters
36
-
37
- (Add a list of parameters extracted from the TypeScript file.)
38
-
39
- ## Example (TypeScript)
40
-
41
- \`\`\`ts
42
- import { ${name.replace(".ts", "")} } from "@dropsy/sdk";
43
-
44
- // Example usage:
45
- \`\`\`
46
-
47
- ## On-Chain Accounts
48
-
49
- (Add the required accounts here.)
50
-
51
- ## Events
52
-
53
- (Add emitted events if any.)
54
- `;
55
- }
56
-
57
- fs.readdirSync(instructionsDir).forEach((file) => {
58
- if (!file.endsWith(".ts")) return;
59
- if (file === "index.ts") return;
60
-
61
- const mdxName = file.replace(".ts", ".mdx");
62
- const mdxPath = path.join(instructionsDir, mdxName);
63
-
64
- if (!fs.existsSync(mdxPath)) {
65
- const content = createMDXTemplate(file);
66
- fs.writeFileSync(mdxPath, content, "utf-8");
67
- console.log("✅ Created:", mdxName);
68
- } else {
69
- console.log("⏩ Skipped (already exists):", mdxName);
70
- }
71
- });