@pasosdejesus/m 0.15.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.
Files changed (324) hide show
  1. package/dist/blockchain/deployments.d.ts +40 -0
  2. package/dist/blockchain/deployments.d.ts.map +1 -0
  3. package/dist/blockchain/deployments.js +64 -0
  4. package/dist/debug/DebugConsole.d.ts +22 -0
  5. package/dist/debug/DebugConsole.d.ts.map +1 -0
  6. package/dist/debug/DebugConsole.js +79 -0
  7. package/dist/debug/Logger.d.ts +38 -0
  8. package/dist/debug/Logger.d.ts.map +1 -0
  9. package/dist/debug/Logger.js +94 -0
  10. package/dist/debug/index.d.ts +6 -0
  11. package/dist/debug/index.d.ts.map +1 -0
  12. package/dist/debug/index.js +4 -0
  13. package/dist/debug/useLogger.d.ts +14 -0
  14. package/dist/debug/useLogger.d.ts.map +1 -0
  15. package/dist/debug/useLogger.js +23 -0
  16. package/dist/debug/utils.d.ts +10 -0
  17. package/dist/debug/utils.d.ts.map +1 -0
  18. package/dist/debug/utils.js +53 -0
  19. package/dist/e2e/assertions.d.ts +5 -0
  20. package/dist/e2e/assertions.d.ts.map +1 -0
  21. package/dist/e2e/assertions.js +18 -0
  22. package/dist/e2e/browser.d.ts +37 -0
  23. package/dist/e2e/browser.d.ts.map +1 -0
  24. package/dist/e2e/browser.js +97 -0
  25. package/dist/e2e/env.d.ts +18 -0
  26. package/dist/e2e/env.d.ts.map +1 -0
  27. package/dist/e2e/env.js +57 -0
  28. package/dist/e2e/index.d.ts +11 -0
  29. package/dist/e2e/index.d.ts.map +1 -0
  30. package/dist/e2e/index.js +8 -0
  31. package/dist/e2e/navigation.d.ts +4 -0
  32. package/dist/e2e/navigation.d.ts.map +1 -0
  33. package/dist/e2e/navigation.js +32 -0
  34. package/dist/e2e/siwe-mock.d.ts +11 -0
  35. package/dist/e2e/siwe-mock.d.ts.map +1 -0
  36. package/dist/e2e/siwe-mock.js +112 -0
  37. package/dist/e2e/siwe.d.ts +15 -0
  38. package/dist/e2e/siwe.d.ts.map +1 -0
  39. package/dist/e2e/siwe.js +85 -0
  40. package/dist/e2e/wallet-mock.d.ts +13 -0
  41. package/dist/e2e/wallet-mock.d.ts.map +1 -0
  42. package/dist/e2e/wallet-mock.js +91 -0
  43. package/dist/i18n/common-cli.d.ts +11 -0
  44. package/dist/i18n/common-cli.d.ts.map +1 -0
  45. package/dist/i18n/common-cli.js +22 -0
  46. package/dist/i18n/createTranslator.d.ts +28 -0
  47. package/dist/i18n/createTranslator.d.ts.map +1 -0
  48. package/dist/i18n/createTranslator.js +48 -0
  49. package/dist/i18n/index.d.ts +4 -0
  50. package/dist/i18n/index.d.ts.map +1 -0
  51. package/dist/i18n/index.js +2 -0
  52. package/dist/i18n/locales/cli.d.ts +3 -0
  53. package/dist/i18n/locales/cli.d.ts.map +1 -0
  54. package/dist/i18n/locales/cli.js +180 -0
  55. package/dist/i18n/types.d.ts +3 -0
  56. package/dist/i18n/types.d.ts.map +1 -0
  57. package/dist/i18n/types.js +1 -0
  58. package/dist/index.d.ts +2 -0
  59. package/dist/index.d.ts.map +1 -0
  60. package/dist/index.js +15 -0
  61. package/dist/index.test.d.ts +2 -0
  62. package/dist/index.test.d.ts.map +1 -0
  63. package/dist/index.test.js +10 -0
  64. package/dist/m.d.ts +2 -0
  65. package/dist/m.d.ts.map +1 -0
  66. package/dist/m.js +334 -0
  67. package/dist/plugin.d.ts +10 -0
  68. package/dist/plugin.d.ts.map +1 -0
  69. package/dist/plugin.js +7 -0
  70. package/dist/shadcn_components/cn.d.ts +13 -0
  71. package/dist/shadcn_components/cn.d.ts.map +1 -0
  72. package/dist/shadcn_components/cn.js +15 -0
  73. package/dist/shadcn_components/ui/accordion.d.ts +8 -0
  74. package/dist/shadcn_components/ui/accordion.d.ts.map +1 -0
  75. package/dist/shadcn_components/ui/accordion.js +14 -0
  76. package/dist/shadcn_components/ui/alert-dialog.d.ts +21 -0
  77. package/dist/shadcn_components/ui/alert-dialog.d.ts.map +1 -0
  78. package/dist/shadcn_components/ui/alert-dialog.js +27 -0
  79. package/dist/shadcn_components/ui/alert.d.ts +9 -0
  80. package/dist/shadcn_components/ui/alert.d.ts.map +1 -0
  81. package/dist/shadcn_components/ui/alert.js +22 -0
  82. package/dist/shadcn_components/ui/avatar.d.ts +7 -0
  83. package/dist/shadcn_components/ui/avatar.d.ts.map +1 -0
  84. package/dist/shadcn_components/ui/avatar.js +12 -0
  85. package/dist/shadcn_components/ui/badge.d.ts +10 -0
  86. package/dist/shadcn_components/ui/badge.d.ts.map +1 -0
  87. package/dist/shadcn_components/ui/badge.js +22 -0
  88. package/dist/shadcn_components/ui/button.d.ts +11 -0
  89. package/dist/shadcn_components/ui/button.d.ts.map +1 -0
  90. package/dist/shadcn_components/ui/button.js +31 -0
  91. package/dist/shadcn_components/ui/card.d.ts +10 -0
  92. package/dist/shadcn_components/ui/card.d.ts.map +1 -0
  93. package/dist/shadcn_components/ui/card.js +24 -0
  94. package/dist/shadcn_components/ui/checkbox.d.ts +5 -0
  95. package/dist/shadcn_components/ui/checkbox.d.ts.map +1 -0
  96. package/dist/shadcn_components/ui/checkbox.js +9 -0
  97. package/dist/shadcn_components/ui/dialog.d.ts +20 -0
  98. package/dist/shadcn_components/ui/dialog.d.ts.map +1 -0
  99. package/dist/shadcn_components/ui/dialog.js +23 -0
  100. package/dist/shadcn_components/ui/dropdown-menu.d.ts +28 -0
  101. package/dist/shadcn_components/ui/dropdown-menu.d.ts.map +1 -0
  102. package/dist/shadcn_components/ui/dropdown-menu.js +36 -0
  103. package/dist/shadcn_components/ui/form.d.ts +24 -0
  104. package/dist/shadcn_components/ui/form.d.ts.map +1 -0
  105. package/dist/shadcn_components/ui/form.js +63 -0
  106. package/dist/shadcn_components/ui/input.d.ts +4 -0
  107. package/dist/shadcn_components/ui/input.d.ts.map +1 -0
  108. package/dist/shadcn_components/ui/input.js +6 -0
  109. package/dist/shadcn_components/ui/label.d.ts +6 -0
  110. package/dist/shadcn_components/ui/label.d.ts.map +1 -0
  111. package/dist/shadcn_components/ui/label.js +10 -0
  112. package/dist/shadcn_components/ui/menubar.d.ts +29 -0
  113. package/dist/shadcn_components/ui/menubar.d.ts.map +1 -0
  114. package/dist/shadcn_components/ui/menubar.js +46 -0
  115. package/dist/shadcn_components/ui/popover.d.ts +7 -0
  116. package/dist/shadcn_components/ui/popover.d.ts.map +1 -0
  117. package/dist/shadcn_components/ui/popover.js +10 -0
  118. package/dist/shadcn_components/ui/progress.d.ts +5 -0
  119. package/dist/shadcn_components/ui/progress.d.ts.map +1 -0
  120. package/dist/shadcn_components/ui/progress.js +8 -0
  121. package/dist/shadcn_components/ui/radio-group.d.ts +6 -0
  122. package/dist/shadcn_components/ui/radio-group.d.ts.map +1 -0
  123. package/dist/shadcn_components/ui/radio-group.js +15 -0
  124. package/dist/shadcn_components/ui/scroll-area.d.ts +6 -0
  125. package/dist/shadcn_components/ui/scroll-area.d.ts.map +1 -0
  126. package/dist/shadcn_components/ui/scroll-area.js +12 -0
  127. package/dist/shadcn_components/ui/select.d.ts +14 -0
  128. package/dist/shadcn_components/ui/select.d.ts.map +1 -0
  129. package/dist/shadcn_components/ui/select.js +27 -0
  130. package/dist/shadcn_components/ui/separator.d.ts +5 -0
  131. package/dist/shadcn_components/ui/separator.d.ts.map +1 -0
  132. package/dist/shadcn_components/ui/separator.js +8 -0
  133. package/dist/shadcn_components/ui/sheet.d.ts +26 -0
  134. package/dist/shadcn_components/ui/sheet.d.ts.map +1 -0
  135. package/dist/shadcn_components/ui/sheet.js +37 -0
  136. package/dist/shadcn_components/ui/skeleton.d.ts +3 -0
  137. package/dist/shadcn_components/ui/skeleton.d.ts.map +1 -0
  138. package/dist/shadcn_components/ui/skeleton.js +6 -0
  139. package/dist/shadcn_components/ui/slider.d.ts +5 -0
  140. package/dist/shadcn_components/ui/slider.d.ts.map +1 -0
  141. package/dist/shadcn_components/ui/slider.js +8 -0
  142. package/dist/shadcn_components/ui/switch.d.ts +5 -0
  143. package/dist/shadcn_components/ui/switch.d.ts.map +1 -0
  144. package/dist/shadcn_components/ui/switch.js +8 -0
  145. package/dist/shadcn_components/ui/table.d.ts +11 -0
  146. package/dist/shadcn_components/ui/table.d.ts.map +1 -0
  147. package/dist/shadcn_components/ui/table.js +20 -0
  148. package/dist/shadcn_components/ui/tabs.d.ts +8 -0
  149. package/dist/shadcn_components/ui/tabs.d.ts.map +1 -0
  150. package/dist/shadcn_components/ui/tabs.js +13 -0
  151. package/dist/shadcn_components/ui/textarea.d.ts +4 -0
  152. package/dist/shadcn_components/ui/textarea.d.ts.map +1 -0
  153. package/dist/shadcn_components/ui/textarea.js +8 -0
  154. package/dist/shadcn_components/ui/toast.d.ts +16 -0
  155. package/dist/shadcn_components/ui/toast.d.ts.map +1 -0
  156. package/dist/shadcn_components/ui/toast.js +34 -0
  157. package/dist/shadcn_components/ui/toaster.d.ts +2 -0
  158. package/dist/shadcn_components/ui/toaster.d.ts.map +1 -0
  159. package/dist/shadcn_components/ui/toaster.js +10 -0
  160. package/dist/shadcn_components/ui/tooltip.d.ts +8 -0
  161. package/dist/shadcn_components/ui/tooltip.d.ts.map +1 -0
  162. package/dist/shadcn_components/ui/tooltip.js +11 -0
  163. package/dist/shadcn_components/ui/use-toast.d.ts +45 -0
  164. package/dist/shadcn_components/ui/use-toast.d.ts.map +1 -0
  165. package/dist/shadcn_components/ui/use-toast.js +126 -0
  166. package/dist/tasks/context.d.ts +13 -0
  167. package/dist/tasks/context.d.ts.map +1 -0
  168. package/dist/tasks/context.js +310 -0
  169. package/dist/tasks/create.d.ts +2 -0
  170. package/dist/tasks/create.d.ts.map +1 -0
  171. package/dist/tasks/create.js +91 -0
  172. package/dist/tasks/db.d.ts +19 -0
  173. package/dist/tasks/db.d.ts.map +1 -0
  174. package/dist/tasks/db.js +791 -0
  175. package/dist/tasks/e2e.d.ts +2 -0
  176. package/dist/tasks/e2e.d.ts.map +1 -0
  177. package/dist/tasks/e2e.js +124 -0
  178. package/dist/tasks/edit.d.ts +7 -0
  179. package/dist/tasks/edit.d.ts.map +1 -0
  180. package/dist/tasks/edit.js +471 -0
  181. package/dist/tasks/engine.d.ts +2 -0
  182. package/dist/tasks/engine.d.ts.map +1 -0
  183. package/dist/tasks/engine.js +149 -0
  184. package/dist/tasks/env-diff.d.ts +2 -0
  185. package/dist/tasks/env-diff.d.ts.map +1 -0
  186. package/dist/tasks/env-diff.js +140 -0
  187. package/dist/tasks/fuzzy.d.ts +9 -0
  188. package/dist/tasks/fuzzy.d.ts.map +1 -0
  189. package/dist/tasks/fuzzy.js +153 -0
  190. package/dist/tasks/glob.d.ts +5 -0
  191. package/dist/tasks/glob.d.ts.map +1 -0
  192. package/dist/tasks/glob.js +57 -0
  193. package/dist/tasks/grep.d.ts +9 -0
  194. package/dist/tasks/grep.d.ts.map +1 -0
  195. package/dist/tasks/grep.js +93 -0
  196. package/dist/tasks/readfile.d.ts +2 -0
  197. package/dist/tasks/readfile.d.ts.map +1 -0
  198. package/dist/tasks/readfile.js +177 -0
  199. package/dist/tasks/update.d.ts +5 -0
  200. package/dist/tasks/update.d.ts.map +1 -0
  201. package/dist/tasks/update.js +200 -0
  202. package/dist/tasks/util.d.ts +12 -0
  203. package/dist/tasks/util.d.ts.map +1 -0
  204. package/dist/tasks/util.js +42 -0
  205. package/dist/tasks/wallet.d.ts +2 -0
  206. package/dist/tasks/wallet.d.ts.map +1 -0
  207. package/dist/tasks/wallet.js +697 -0
  208. package/dist/tasks/writefile.d.ts +2 -0
  209. package/dist/tasks/writefile.d.ts.map +1 -0
  210. package/dist/tasks/writefile.js +66 -0
  211. package/dist/templates/AGENTS.md.hbs +81 -0
  212. package/dist/templates/ARCHITECTURE.md.hbs +146 -0
  213. package/dist/templates/CONTRIBUTING.md.hbs +83 -0
  214. package/dist/templates/LICENCIA.md +21 -0
  215. package/dist/templates/LICENSE.md +15 -0
  216. package/dist/templates/Makefile +16 -0
  217. package/dist/templates/README.md.hbs +111 -0
  218. package/dist/templates/apps/.env.example.hbs +75 -0
  219. package/dist/templates/apps/hardhat/.prettierrc +16 -0
  220. package/dist/templates/apps/hardhat/MOCK_USDT_README.md +20 -0
  221. package/dist/templates/apps/hardhat/Makefile +13 -0
  222. package/dist/templates/apps/hardhat/README.md +129 -0
  223. package/dist/templates/apps/hardhat/bin/MusdtVerification +4 -0
  224. package/dist/templates/apps/hardhat/bin/approveDepositOwner +7 -0
  225. package/dist/templates/apps/hardhat/bin/contractVerification +9 -0
  226. package/dist/templates/apps/hardhat/bin/deployMockUSDT +7 -0
  227. package/dist/templates/apps/hardhat/bin/prepadJ.sh +14 -0
  228. package/dist/templates/apps/hardhat/bin/verifyMockUSDT +7 -0
  229. package/dist/templates/apps/hardhat/contracts/MockUSDT.sol +47 -0
  230. package/dist/templates/apps/hardhat/hardhat.config.ts +102 -0
  231. package/dist/templates/apps/hardhat/package.json +55 -0
  232. package/dist/templates/apps/hardhat/scripts/approveDepositOwner.ts +22 -0
  233. package/dist/templates/apps/hardhat/scripts/deployMockUSDT.ts +49 -0
  234. package/dist/templates/apps/hardhat/scripts/verifyDeployment.ts +93 -0
  235. package/dist/templates/apps/hardhat/scripts/verifyMockUSDT.ts +52 -0
  236. package/dist/templates/apps/hardhat/sync-abis.mjs +58 -0
  237. package/dist/templates/apps/hardhat/test/MockUSDT.test.ts +40 -0
  238. package/dist/templates/apps/hardhat/tsconfig.json +27 -0
  239. package/dist/templates/apps/nextjs/.config/kysely.config.ts +36 -0
  240. package/dist/templates/apps/nextjs/Makefile +24 -0
  241. package/dist/templates/apps/nextjs/README.md.hbs +76 -0
  242. package/dist/templates/apps/nextjs/abis/IERC20.json +74 -0
  243. package/dist/templates/apps/nextjs/abis/MockUSDT.json +242 -0
  244. package/dist/templates/apps/nextjs/abis/ReentrancyGuard.json +1 -0
  245. package/dist/templates/apps/nextjs/app/globals.css +3 -0
  246. package/dist/templates/apps/nextjs/app/layout.tsx.hbs +26 -0
  247. package/dist/templates/apps/nextjs/app/page.tsx.hbs +225 -0
  248. package/dist/templates/apps/nextjs/app/testui/page.tsx +371 -0
  249. package/dist/templates/apps/nextjs/bin/m +8 -0
  250. package/dist/templates/apps/nextjs/components.json +21 -0
  251. package/dist/templates/apps/nextjs/next-env.d.ts +5 -0
  252. package/dist/templates/apps/nextjs/next.config.ts +10 -0
  253. package/dist/templates/apps/nextjs/package.json.hbs +48 -0
  254. package/dist/templates/apps/nextjs/pnpm-workspace.yaml +13 -0
  255. package/dist/templates/apps/nextjs/postcss.config.mjs +6 -0
  256. package/dist/templates/apps/nextjs/tailwind.config.js +11 -0
  257. package/dist/templates/apps/nextjs/tests/helpers.ts +31 -0
  258. package/dist/templates/apps/nextjs/tests/index.test.ts +7 -0
  259. package/dist/templates/apps/nextjs/tests/setup-env.ts.hbs +8 -0
  260. package/dist/templates/apps/nextjs/tests/test-utils.example.test.ts +168 -0
  261. package/dist/templates/apps/nextjs/tsconfig.json +44 -0
  262. package/dist/templates/apps/nextjs/tsconfig.test.json +38 -0
  263. package/dist/templates/apps/nextjs/vitest.config.ts +13 -0
  264. package/dist/test-utils/fs-mocks.d.ts +32 -0
  265. package/dist/test-utils/fs-mocks.d.ts.map +1 -0
  266. package/dist/test-utils/fs-mocks.js +63 -0
  267. package/dist/test-utils/i18n-mock.d.ts +21 -0
  268. package/dist/test-utils/i18n-mock.d.ts.map +1 -0
  269. package/dist/test-utils/i18n-mock.js +29 -0
  270. package/dist/test-utils/index.d.ts +12 -0
  271. package/dist/test-utils/index.d.ts.map +1 -0
  272. package/dist/test-utils/index.js +11 -0
  273. package/dist/test-utils/kysely-mocks.d.ts +298 -0
  274. package/dist/test-utils/kysely-mocks.d.ts.map +1 -0
  275. package/dist/test-utils/kysely-mocks.js +173 -0
  276. package/dist/test-utils/radix-mocks.d.ts +134 -0
  277. package/dist/test-utils/radix-mocks.d.ts.map +1 -0
  278. package/dist/test-utils/radix-mocks.js +175 -0
  279. package/dist/test-utils/rainbowkit-mocks.d.ts +80 -0
  280. package/dist/test-utils/rainbowkit-mocks.d.ts.map +1 -0
  281. package/dist/test-utils/rainbowkit-mocks.js +247 -0
  282. package/dist/test-utils/viem-mocks.d.ts +86 -0
  283. package/dist/test-utils/viem-mocks.d.ts.map +1 -0
  284. package/dist/test-utils/viem-mocks.js +54 -0
  285. package/dist/util/cli-parser.d.ts +20 -0
  286. package/dist/util/cli-parser.d.ts.map +1 -0
  287. package/dist/util/cli-parser.js +38 -0
  288. package/dist/util/colors.d.ts +5 -0
  289. package/dist/util/colors.d.ts.map +1 -0
  290. package/dist/util/colors.js +5 -0
  291. package/dist/util/locale.d.ts +3 -0
  292. package/dist/util/locale.d.ts.map +1 -0
  293. package/dist/util/locale.js +10 -0
  294. package/dist/wba/client.d.ts +19 -0
  295. package/dist/wba/client.d.ts.map +1 -0
  296. package/dist/wba/client.js +31 -0
  297. package/dist/wba/index.d.ts +4 -0
  298. package/dist/wba/index.d.ts.map +1 -0
  299. package/dist/wba/index.js +2 -0
  300. package/dist/wba/routes/event.d.ts +32 -0
  301. package/dist/wba/routes/event.d.ts.map +1 -0
  302. package/dist/wba/routes/event.js +42 -0
  303. package/dist/wba/routes/index.d.ts +3 -0
  304. package/dist/wba/routes/index.d.ts.map +1 -0
  305. package/dist/wba/routes/index.js +2 -0
  306. package/dist/wba/routes/summary.d.ts +44 -0
  307. package/dist/wba/routes/summary.d.ts.map +1 -0
  308. package/dist/wba/routes/summary.js +146 -0
  309. package/dist/wba/server.d.ts +18 -0
  310. package/dist/wba/server.d.ts.map +1 -0
  311. package/dist/wba/server.js +29 -0
  312. package/dist/wba/types.d.ts +68 -0
  313. package/dist/wba/types.d.ts.map +1 -0
  314. package/dist/wba/types.js +6 -0
  315. package/package.json +223 -0
  316. package/src/blockchain/README.md +80 -0
  317. package/src/debug/README.md +94 -0
  318. package/src/e2e/README.md +105 -0
  319. package/src/i18n/README.md +143 -0
  320. package/src/shadcn_components/README.md +125 -0
  321. package/src/tasks/README.md +69 -0
  322. package/src/test-utils/README.md +638 -0
  323. package/src/util/README.md +18 -0
  324. package/src/wba/README.md +175 -0
@@ -0,0 +1,48 @@
1
+
2
+ {
3
+ "name": "{{name}}",
4
+ "version": "0.0.0",
5
+ "description": "{{description}}",
6
+ "type": "module",
7
+ "scripts": {
8
+ "dev": "next dev",
9
+ "build": "next build",
10
+ "start": "next start",
11
+ "lint": "next lint",
12
+ "test": "dotenv -e ../.env.test -- vitest run",
13
+ "typecheck": "tsc --noEmit"
14
+ },
15
+ "keywords": [],
16
+ "author": "",
17
+ "license": "ISC",
18
+ "dependencies": {
19
+ "@pasosdejesus/m": "gitlab:pasosdejesus/m",
20
+ "dotenv": "^17.4.2",
21
+ "kysely-postgres-js": "3.0.0",
22
+ "next": "15.5.12",
23
+ "pg": "8.17.2",
24
+ "react": "19.2.7",
25
+ "react-dom": "19.2.7"
26
+ },
27
+ "devDependencies": {
28
+ "@testing-library/react": "16.3.2",
29
+ "@types/node": "20.19.30",
30
+ "@types/react": "^19.2.15",
31
+ "@types/react-dom": "^19.2.3",
32
+ "autoprefixer": "^10.5.0",
33
+ "dotenv-cli": "^7.4.4",
34
+ "jsdom": "^29.1.1",
35
+ "kysely": "0.27.6",
36
+ "kysely-codegen": "0.19.0",
37
+ "kysely-ctl": "0.20.0",
38
+ "next-auth": "4.24.13",
39
+ "postcss": "^8.5.15",
40
+ "siwe": "2.3.2",
41
+ "tailwindcss": "3.4.19",
42
+ "typescript": "5.9.3",
43
+ "viem": "^2.51.0",
44
+ "vitest": "2.1.9",
45
+ "wagmi": "2.19.5"
46
+ },
47
+ "packageManager": "pnpm@10.34.5"
48
+ }
@@ -0,0 +1,13 @@
1
+ allowBuilds:
2
+ '@pasosdejesus/m': true
3
+ bufferutil: true
4
+ esbuild: true
5
+ keccak: true
6
+ sharp: true
7
+ utf-8-validate: true
8
+
9
+ overrides:
10
+ '@parcel/watcher': npm:@parcel/watcher-wasm
11
+ rollup: npm:@rollup/wasm-node
12
+ lightningcss: npm:lightningcss-wasm
13
+ '@tailwindcss/oxide': npm:@tailwindcss/oxide-wasm32-wasi
@@ -0,0 +1,6 @@
1
+ export default {
2
+ plugins: {
3
+ tailwindcss: {},
4
+ autoprefixer: {},
5
+ },
6
+ };
@@ -0,0 +1,11 @@
1
+ /** @type {import('tailwindcss').Config} */
2
+ export default {
3
+ content: [
4
+ "./app/**/*.{js,ts,jsx,tsx,mdx}",
5
+ "./src/**/*.{js,ts,jsx,tsx,mdx}",
6
+ ],
7
+ theme: {
8
+ extend: {},
9
+ },
10
+ plugins: [],
11
+ };
@@ -0,0 +1,31 @@
1
+ import { execSync } from 'child_process';
2
+
3
+ /**
4
+ * Check if psql command is available in the system PATH
5
+ * @returns boolean true if psql is available, false otherwise
6
+ */
7
+ export function psqlAvailable(): boolean {
8
+ try {
9
+ execSync('which psql', { stdio: 'ignore' });
10
+ return true;
11
+ } catch {
12
+ return false;
13
+ }
14
+ }
15
+
16
+ /**
17
+ * Check if all prerequisites for database integration tests are met:
18
+ * 1. PostgreSQL superuser credentials are configured in environment
19
+ * 2. psql command-line tool is available in PATH
20
+ * @returns boolean true if database tests can run, false otherwise
21
+ */
22
+ export function canRunDbTests(): boolean {
23
+ const superuserConfigured = process.env.PG_SUPERUSER && process.env.PG_SUPERUSER_PASSWORD !== undefined;
24
+ return superuserConfigured && psqlAvailable();
25
+ }
26
+
27
+ /**
28
+ * Skip condition for database integration tests
29
+ * Use as: const dbTest = canRunDbTests() ? describe : describe.skip;
30
+ */
31
+ export const dbTest = canRunDbTests() ? describe : describe.skip;
@@ -0,0 +1,7 @@
1
+ import { describe, it, expect } from 'vitest';
2
+
3
+ describe('Example Suite', () => {
4
+ it('should pass this example test', () => {
5
+ expect(true).toBe(true);
6
+ });
7
+ });
@@ -0,0 +1,8 @@
1
+ import dotenv from 'dotenv';
2
+ import path from 'path';
3
+
4
+ const testdir = process.env.TEST_DIR || 'tests/ordered';
5
+ const envPath = path.resolve(process.cwd(), '.env.test');
6
+ dotenv.config({ path: envPath });
7
+
8
+ console.log(`Usando entorno de ${envPath}`);
@@ -0,0 +1,168 @@
1
+ /**
2
+ * Example test file demonstrating how to use @pasosdejesus/m test-utils
3
+ *
4
+ * This file shows practical examples of mocking different parts of a Next.js + Hardhat application.
5
+ * Include it in your project as a reference when writing tests.
6
+ *
7
+ * "Y todo lo que hagáis, hacedlo de corazón, como para el Señor y no para los hombres" (Colosenses 3:23)
8
+ */
9
+
10
+ import { describe, it, expect, beforeEach, beforeAll, afterAll, vi } from 'vitest';
11
+ import { createFsMocks } from '@pasosdejesus/m/test-utils/fs-mocks';
12
+ import { createMockKysely } from '@pasosdejesus/m/test-utils/kysely-mocks';
13
+ import { createAuthMocks } from '@pasosdejesus/m/test-utils/rainbowkit-mocks';
14
+ import { viemMocks } from '@pasosdejesus/m/test-utils/viem-mocks';
15
+ // radix-mocks is a side-effect import that mocks radix-ui components globally
16
+ import '@pasosdejesus/m/test-utils/radix-mocks';
17
+
18
+ describe('Example: Using test-utils in your project', () => {
19
+ // Example 1: Mocking filesystem operations
20
+ describe('fs-mocks: Mocking filesystem', () => {
21
+ let fsMocks;
22
+
23
+ beforeAll(() => {
24
+ fsMocks = createFsMocks();
25
+ fsMocks.setupFsMocks();
26
+ });
27
+
28
+ afterAll(() => {
29
+ vi.clearAllMocks();
30
+ });
31
+
32
+ it('should mock readFile operations', () => {
33
+ // Setup mock to return specific content
34
+ fsMocks.mockReadFile.mockResolvedValue('{"data": "test"}');
35
+
36
+ // In your actual code, this would be called by the function you're testing
37
+ // Example: await readFile('/config.json', 'utf-8')
38
+ // The mock will return the content we set above
39
+ expect(fsMocks.mockReadFile).toBeDefined();
40
+ });
41
+
42
+ it('should mock readFile with custom content', () => {
43
+ const customFsMocks = createFsMocks({
44
+ readFileContent: '# Custom content',
45
+ });
46
+ // The mock is already configured with the custom content
47
+ expect(customFsMocks.mockReadFile).toBeDefined();
48
+ });
49
+ });
50
+
51
+ // Example 2: Mocking database operations with Kysely
52
+ describe('kysely-mocks: Mocking database queries', () => {
53
+ let dbMocks;
54
+
55
+ beforeAll(() => {
56
+ dbMocks = createMockKysely();
57
+ dbMocks.setupMocks();
58
+ dbMocks.setupCommonResponses();
59
+ });
60
+
61
+ it('should mock SELECT queries', () => {
62
+ // Configure mock to return specific data
63
+ dbMocks.mockExecuteTakeFirst.mockResolvedValue({ id: 1, name: 'John' });
64
+
65
+ // In your actual code, when a Kysely query executes, it will use the mock
66
+ // Example: await db.selectFrom('users').selectAll().executeTakeFirst()
67
+ // The mock will return { id: 1, name: 'John' }
68
+ expect(dbMocks.mockExecuteTakeFirst).toBeDefined();
69
+ });
70
+
71
+ it('should mock INSERT queries', () => {
72
+ dbMocks.mockExecute.mockResolvedValue([{ id: 3, name: 'Bob' }]);
73
+ expect(dbMocks.mockExecute).toBeDefined();
74
+ });
75
+ });
76
+
77
+ // Example 3: Mocking authentication and wallet state
78
+ describe('rainbowkit-mocks: Mocking authentication', () => {
79
+ let authMocks;
80
+
81
+ beforeAll(() => {
82
+ authMocks = createAuthMocks({
83
+ address: '0x1234567890123456789012345678901234567890',
84
+ isConnected: true,
85
+ chainId: 1,
86
+ });
87
+ authMocks.setupMocks();
88
+ authMocks.setupDefaultImplementations();
89
+ });
90
+
91
+ it('should mock useAccount hook', () => {
92
+ // The mock is already configured with the address above
93
+ // In your React component test, useAccount() will return the mocked data
94
+ expect(authMocks.mocks.mockUseAccount).toBeDefined();
95
+ });
96
+
97
+ it('should mock useSession hook', () => {
98
+ expect(authMocks.mocks.mockUseSession).toBeDefined();
99
+ });
100
+
101
+ it('should update configuration dynamically', () => {
102
+ authMocks.updateConfig({ isConnected: false });
103
+ // Now useAccount() will return isConnected: false
104
+ expect(authMocks.updateConfig).toBeDefined();
105
+ });
106
+ });
107
+
108
+ // Example 4: Mocking blockchain interactions
109
+ describe('viem-mocks: Mocking blockchain', () => {
110
+ beforeAll(() => {
111
+ // viemMocks are already defined, no setup needed
112
+ });
113
+
114
+ it('should mock public client', () => {
115
+ // Configure the mock
116
+ viemMocks.createPublicClient.mockReturnValue({
117
+ getBlockNumber: vi.fn().mockResolvedValue(123456n),
118
+ });
119
+
120
+ const client = viemMocks.createPublicClient();
121
+ expect(client.getBlockNumber).toBeDefined();
122
+ expect(viemMocks.createPublicClient).toHaveBeenCalled();
123
+ });
124
+
125
+ it('should mock wallet client', () => {
126
+ viemMocks.createWalletClient.mockReturnValue({
127
+ sendTransaction: vi.fn().mockResolvedValue('0xabc...'),
128
+ });
129
+
130
+ const client = viemMocks.createWalletClient();
131
+ expect(client.sendTransaction).toBeDefined();
132
+ });
133
+ });
134
+
135
+ // Example 5: Cleanup and teardown
136
+ describe('Setup and teardown patterns', () => {
137
+ let fsMocks;
138
+
139
+ beforeEach(() => {
140
+ fsMocks = createFsMocks();
141
+ fsMocks.setupFsMocks();
142
+ });
143
+
144
+ afterEach(() => {
145
+ vi.clearAllMocks();
146
+ });
147
+
148
+ it('should demonstrate proper mock cleanup', () => {
149
+ fsMocks.mockReadFile.mockResolvedValue('test');
150
+ // Test that mock can be called
151
+ expect(fsMocks.mockReadFile).toBeDefined();
152
+ });
153
+ });
154
+ });
155
+
156
+ // Helper: TypeScript types for the mocks (for reference)
157
+ /**
158
+ * Type imports for reference (not executed):
159
+ *
160
+ * import type {
161
+ * FsMocks,
162
+ * MockKysely,
163
+ * AuthMocks,
164
+ * ViemMocks
165
+ * } from '@pasosdejesus/m/test-utils';
166
+ *
167
+ * These types are automatically available when you import the mocks.
168
+ */
@@ -0,0 +1,44 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ESNext",
4
+ "module": "ESNext",
5
+ "moduleResolution": "bundler",
6
+ "strict": true,
7
+ "esModuleInterop": true,
8
+ "skipLibCheck": true,
9
+ "forceConsistentCasingInFileNames": true,
10
+ "outDir": "./dist",
11
+ "rootDir": ".",
12
+ "baseUrl": ".",
13
+ "paths": {
14
+ "@/*": [
15
+ "./*"
16
+ ]
17
+ },
18
+ "lib": [
19
+ "dom",
20
+ "dom.iterable",
21
+ "esnext"
22
+ ],
23
+ "allowJs": true,
24
+ "noEmit": true,
25
+ "incremental": true,
26
+ "resolveJsonModule": true,
27
+ "isolatedModules": true,
28
+ "jsx": "preserve",
29
+ "plugins": [
30
+ {
31
+ "name": "next"
32
+ }
33
+ ]
34
+ },
35
+ "include": [
36
+ "src/**/*.ts",
37
+ "app/**/*.ts",
38
+ "app/**/*.tsx",
39
+ ".next/types/**/*.ts"
40
+ ],
41
+ "exclude": [
42
+ "node_modules"
43
+ ]
44
+ }
@@ -0,0 +1,38 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "lib": ["dom", "dom.iterable", "esnext"],
5
+ "allowJs": true,
6
+ "skipLibCheck": true,
7
+ "strict": true,
8
+ "noEmit": true,
9
+ "esModuleInterop": true,
10
+ "module": "esnext",
11
+ "moduleResolution": "bundler",
12
+ "resolveJsonModule": true,
13
+ "isolatedModules": true,
14
+ "jsx": "react-jsx",
15
+ "incremental": true,
16
+ "plugins": [
17
+ {
18
+ "name": "next"
19
+ }
20
+ ],
21
+ "paths": {
22
+ "@/*": ["./*"]
23
+ },
24
+ "types": ["@testing-library/jest-dom", "vitest", "vitest/globals"]
25
+ },
26
+ "include": [
27
+ "next-env.d.ts",
28
+ "**/*.ts",
29
+ "**/*.tsx",
30
+ "types/**/*.d.ts",
31
+ "**/*.test.ts",
32
+ "**/*.test.tsx",
33
+ "vitest.setup.ts"
34
+ ],
35
+ "exclude": [
36
+ "node_modules"
37
+ ]
38
+ }
@@ -0,0 +1,13 @@
1
+ /// <reference types="vitest" />
2
+ import { defineConfig } from 'vitest/config';
3
+
4
+ const conditions = ['module-sync'];
5
+ if (process.platform === 'openbsd') conditions.push('wasm');
6
+
7
+ export default defineConfig({
8
+ test: {
9
+ globals: true,
10
+ restoreMocks: true,
11
+ },
12
+ resolve: { conditions },
13
+ });
@@ -0,0 +1,32 @@
1
+ /**
2
+ * File system mocking utilities for tests
3
+ *
4
+ * "Y todo lo que hagáis, hacedlo de corazón, como para el Señor y no para los hombres" (Colosenses 3:23)
5
+ */
6
+ /**
7
+ * Creates mocks for fs/promises and node:fs/promises modules
8
+ *
9
+ * @param options Configuration options
10
+ * @returns Object with mock functions and setup/cleanup utilities
11
+ */
12
+ export declare function createFsMocks(options?: {
13
+ readFileContent?: string;
14
+ readFileError?: Error;
15
+ }): {
16
+ mockReadFile: import("vitest").Mock<(...args: any[]) => any>;
17
+ mockNodeReadFile: import("vitest").Mock<(...args: any[]) => any>;
18
+ /**
19
+ * Setup vi.mock calls for fs modules
20
+ * Call this in your test file's setup
21
+ */
22
+ setupFsMocks(): void;
23
+ /**
24
+ * Reset all mock implementations
25
+ */
26
+ resetFsMocks(): void;
27
+ /**
28
+ * Set common responses for fs mocks
29
+ */
30
+ setupCommonResponses(): void;
31
+ };
32
+ //# sourceMappingURL=fs-mocks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs-mocks.d.ts","sourceRoot":"","sources":["../../src/test-utils/fs-mocks.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,OAAO,GAAE;IACrC,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,aAAa,CAAC,EAAE,KAAK,CAAA;CACjB;;;IAsBF;;;OAGG;;IAeH;;OAEG;;IAMH;;OAEG;;EAMN"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * File system mocking utilities for tests
3
+ *
4
+ * "Y todo lo que hagáis, hacedlo de corazón, como para el Señor y no para los hombres" (Colosenses 3:23)
5
+ */
6
+ import { vi } from 'vitest';
7
+ /**
8
+ * Creates mocks for fs/promises and node:fs/promises modules
9
+ *
10
+ * @param options Configuration options
11
+ * @returns Object with mock functions and setup/cleanup utilities
12
+ */
13
+ export function createFsMocks(options = {}) {
14
+ const mockReadFile = vi.hoisted(() => vi.fn());
15
+ const mockNodeReadFile = vi.hoisted(() => vi.fn());
16
+ // Apply default implementations
17
+ if (options.readFileContent !== undefined) {
18
+ mockReadFile.mockResolvedValue(options.readFileContent);
19
+ mockNodeReadFile.mockResolvedValue(options.readFileContent);
20
+ }
21
+ else {
22
+ mockReadFile.mockResolvedValue('# Crossword Source\n\nTexto con blanks');
23
+ mockNodeReadFile.mockResolvedValue('# Crossword Source (node namespace)');
24
+ }
25
+ if (options.readFileError !== undefined) {
26
+ mockReadFile.mockRejectedValue(options.readFileError);
27
+ mockNodeReadFile.mockRejectedValue(options.readFileError);
28
+ }
29
+ return {
30
+ mockReadFile,
31
+ mockNodeReadFile,
32
+ /**
33
+ * Setup vi.mock calls for fs modules
34
+ * Call this in your test file's setup
35
+ */
36
+ setupFsMocks() {
37
+ vi.mock('fs/promises', async (importOriginal) => {
38
+ const actual = await importOriginal();
39
+ return {
40
+ ...actual,
41
+ readFile: mockReadFile,
42
+ };
43
+ });
44
+ vi.mock('node:fs/promises', () => ({
45
+ readFile: mockNodeReadFile,
46
+ }));
47
+ },
48
+ /**
49
+ * Reset all mock implementations
50
+ */
51
+ resetFsMocks() {
52
+ mockReadFile.mockReset();
53
+ mockNodeReadFile.mockReset();
54
+ },
55
+ /**
56
+ * Set common responses for fs mocks
57
+ */
58
+ setupCommonResponses() {
59
+ mockReadFile.mockResolvedValue('# Crossword Source\n\nTexto con blanks');
60
+ mockNodeReadFile.mockResolvedValue('# Crossword Source (node namespace)');
61
+ },
62
+ };
63
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Reusable mock for createComponentT from @pasosdejesus/m/i18n
3
+ *
4
+ * Usage in tests:
5
+ *
6
+ * import { mockCreateComponentT } from '@pasosdejesus/m/test-utils/i18n-mock'
7
+ * vi.mock('@/lib/hooks/useTranslation', () => ({ createComponentT: mockCreateComponentT }))
8
+ *
9
+ * This mock always returns English translations by default, so tests
10
+ * can check for 'Edit Profile', 'Save', etc. without modification.
11
+ *
12
+ * To test Spanish translations, pass a locale:
13
+ *
14
+ * vi.mock('@/lib/hooks/useTranslation', () => ({
15
+ * createComponentT: (lang: string) => mockCreateComponentT(lang),
16
+ * }))
17
+ * // mockCreateComponentT will use the actual translations object
18
+ * // passed by the component, resolving to the correct locale
19
+ */
20
+ export declare function mockCreateComponentT(locale?: string): (lang: string, translations: Record<string, Record<string, string>>) => (key: string, ...args: string[]) => string;
21
+ //# sourceMappingURL=i18n-mock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i18n-mock.d.ts","sourceRoot":"","sources":["../../src/test-utils/i18n-mock.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,CAAC,EAAE,MAAM,IAC1C,MAAM,MAAM,EAAE,cAAc,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,MAEhE,KAAK,MAAM,EAAE,GAAG,MAAM,MAAM,EAAE,YAMzC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Reusable mock for createComponentT from @pasosdejesus/m/i18n
3
+ *
4
+ * Usage in tests:
5
+ *
6
+ * import { mockCreateComponentT } from '@pasosdejesus/m/test-utils/i18n-mock'
7
+ * vi.mock('@/lib/hooks/useTranslation', () => ({ createComponentT: mockCreateComponentT }))
8
+ *
9
+ * This mock always returns English translations by default, so tests
10
+ * can check for 'Edit Profile', 'Save', etc. without modification.
11
+ *
12
+ * To test Spanish translations, pass a locale:
13
+ *
14
+ * vi.mock('@/lib/hooks/useTranslation', () => ({
15
+ * createComponentT: (lang: string) => mockCreateComponentT(lang),
16
+ * }))
17
+ * // mockCreateComponentT will use the actual translations object
18
+ * // passed by the component, resolving to the correct locale
19
+ */
20
+ export function mockCreateComponentT(locale) {
21
+ return (lang, translations) => {
22
+ const dict = translations[locale || lang || 'en'] || translations.en || {};
23
+ return (key, ...args) => {
24
+ let val = dict[key] || key;
25
+ args.forEach((arg, i) => { val = val.replace(`{{${i}}}`, arg); });
26
+ return val;
27
+ };
28
+ };
29
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Common mocking utilities re-export index
3
+ *
4
+ * "Y todo lo que hagáis, hacedlo de corazón, como para el Señor y no para los hombres" (Colosenses 3:23)
5
+ */
6
+ export * from './fs-mocks.js';
7
+ export * from './kysely-mocks.js';
8
+ export * from './radix-mocks.js';
9
+ export * from './rainbowkit-mocks.js';
10
+ export * from './viem-mocks.js';
11
+ export * from './i18n-mock.js';
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test-utils/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,kBAAkB,CAAA;AAChC,cAAc,uBAAuB,CAAA;AACrC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Common mocking utilities re-export index
3
+ *
4
+ * "Y todo lo que hagáis, hacedlo de corazón, como para el Señor y no para los hombres" (Colosenses 3:23)
5
+ */
6
+ export * from './fs-mocks.js';
7
+ export * from './kysely-mocks.js';
8
+ export * from './radix-mocks.js';
9
+ export * from './rainbowkit-mocks.js';
10
+ export * from './viem-mocks.js';
11
+ export * from './i18n-mock.js';