@0xflydev/labz 1.0.20 → 1.0.22
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/dist/index.js +72 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1616,8 +1616,11 @@ async function writeProject(outputDir, result, base, templatesDir) {
|
|
|
1616
1616
|
if (fs4.existsSync(pkgPath)) {
|
|
1617
1617
|
const pkg = JSON.parse(fs4.readFileSync(pkgPath, "utf-8"));
|
|
1618
1618
|
pkg.name = path4.basename(outputDir);
|
|
1619
|
+
pkg.description = base.description || "FHEVM Smart Contract";
|
|
1619
1620
|
fs4.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2), "utf-8");
|
|
1620
1621
|
}
|
|
1622
|
+
const readmeContent = generateBuildReadme(path4.basename(outputDir), base, result);
|
|
1623
|
+
fs4.writeFileSync(path4.join(outputDir, "README.md"), readmeContent, "utf-8");
|
|
1621
1624
|
cleanupGitkeep(outputDir);
|
|
1622
1625
|
}
|
|
1623
1626
|
function cleanupGitkeep(dir) {
|
|
@@ -1648,6 +1651,75 @@ function copyDirSync(src, dest) {
|
|
|
1648
1651
|
}
|
|
1649
1652
|
}
|
|
1650
1653
|
}
|
|
1654
|
+
function generateBuildReadme(projectName, base, result) {
|
|
1655
|
+
const contractName = result.stats.baseTemplate.charAt(0).toUpperCase() + result.stats.baseTemplate.slice(1);
|
|
1656
|
+
const modules = result.stats.modulesApplied || [];
|
|
1657
|
+
const lines = [];
|
|
1658
|
+
lines.push(`# ${projectName}`);
|
|
1659
|
+
lines.push("");
|
|
1660
|
+
lines.push(`${base.description}`);
|
|
1661
|
+
lines.push("");
|
|
1662
|
+
lines.push("## Overview");
|
|
1663
|
+
lines.push("");
|
|
1664
|
+
lines.push(`Base template: **${base.name}**`);
|
|
1665
|
+
if (modules.length > 0) {
|
|
1666
|
+
lines.push("");
|
|
1667
|
+
lines.push("### Modules Applied");
|
|
1668
|
+
lines.push("");
|
|
1669
|
+
for (const mod of modules) {
|
|
1670
|
+
lines.push(`- ${mod}`);
|
|
1671
|
+
}
|
|
1672
|
+
}
|
|
1673
|
+
lines.push("");
|
|
1674
|
+
lines.push("## Quick Start");
|
|
1675
|
+
lines.push("");
|
|
1676
|
+
lines.push("```bash");
|
|
1677
|
+
lines.push("# Install dependencies");
|
|
1678
|
+
lines.push("npm install");
|
|
1679
|
+
lines.push("");
|
|
1680
|
+
lines.push("# Compile contracts");
|
|
1681
|
+
lines.push("npx hardhat compile");
|
|
1682
|
+
lines.push("");
|
|
1683
|
+
lines.push("# Run tests");
|
|
1684
|
+
lines.push("npx hardhat test");
|
|
1685
|
+
lines.push("");
|
|
1686
|
+
lines.push("# Deploy (local)");
|
|
1687
|
+
lines.push("npx hardhat run deploy/deploy.ts");
|
|
1688
|
+
lines.push("```");
|
|
1689
|
+
lines.push("");
|
|
1690
|
+
lines.push("## Project Structure");
|
|
1691
|
+
lines.push("");
|
|
1692
|
+
lines.push("```");
|
|
1693
|
+
lines.push(`${projectName}/`);
|
|
1694
|
+
lines.push(" contracts/");
|
|
1695
|
+
lines.push(` ${contractName}.sol`);
|
|
1696
|
+
lines.push(" test/");
|
|
1697
|
+
lines.push(` ${contractName}.test.ts`);
|
|
1698
|
+
lines.push(" deploy/");
|
|
1699
|
+
lines.push(" deploy.ts");
|
|
1700
|
+
lines.push(" hardhat.config.ts");
|
|
1701
|
+
lines.push(" package.json");
|
|
1702
|
+
lines.push("```");
|
|
1703
|
+
lines.push("");
|
|
1704
|
+
lines.push("## FHE Operations");
|
|
1705
|
+
lines.push("");
|
|
1706
|
+
lines.push("This contract uses encrypted data types from FHEVM:");
|
|
1707
|
+
lines.push("- `euint64`, `euint32`, `ebool` - Encrypted integers and booleans");
|
|
1708
|
+
lines.push("- `FHE.add`, `FHE.sub`, `FHE.mul` - Encrypted arithmetic");
|
|
1709
|
+
lines.push("- `FHE.lt`, `FHE.gt`, `FHE.eq` - Encrypted comparisons");
|
|
1710
|
+
lines.push("- `FHE.select` - Encrypted conditional selection");
|
|
1711
|
+
lines.push("");
|
|
1712
|
+
lines.push("## Resources");
|
|
1713
|
+
lines.push("");
|
|
1714
|
+
lines.push("- [FHEVM Documentation](https://docs.zama.ai/fhevm)");
|
|
1715
|
+
lines.push("- [Lab-Z CLI](https://github.com/Farukest/Lab-Z)");
|
|
1716
|
+
lines.push("");
|
|
1717
|
+
lines.push("---");
|
|
1718
|
+
lines.push("");
|
|
1719
|
+
lines.push("Generated with [Lab-Z](https://github.com/Farukest/Lab-Z)");
|
|
1720
|
+
lines.push("");
|
|
1721
|
+
return lines.join("\n");
|
|
1722
|
+
}
|
|
1651
1723
|
|
|
1652
1724
|
// src/commands/doctor.ts
|
|
1653
1725
|
var import_commander7 = require("commander");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xflydev/labz",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.22",
|
|
4
4
|
"description": "Lab-Z CLI - Generate composable FHEVM smart contracts",
|
|
5
5
|
"author": "0xflydev",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"typecheck": "tsc --noEmit"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@0xflydev/labz-core": "^1.0.
|
|
25
|
+
"@0xflydev/labz-core": "^1.0.4",
|
|
26
26
|
"@inquirer/prompts": "^7.2.1",
|
|
27
27
|
"commander": "^12.1.0",
|
|
28
28
|
"chalk": "^5.3.0",
|