Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions cli/bin/compose.js

This file was deleted.

6 changes: 6 additions & 0 deletions cli/bin/compose.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env node

import { main } from "../index.js";
import { exitWithError } from "../src/utils/errors.js";

main().catch(exitWithError);
24 changes: 8 additions & 16 deletions cli/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,17 @@
const js = require("@eslint/js");
import js from "@eslint/js";
import tseslint from "typescript-eslint";

module.exports = [
export default [
{
ignores: ["node_modules/**", "src/templates/**"],
ignores: ["node_modules/**", "dist/**", "src/templates/**"],
},
js.configs.recommended,
...tseslint.configs.recommended,
{
files: ["**/*.js"],
languageOptions: {
ecmaVersion: "latest",
sourceType: "script",
globals: {
console: "readonly",
process: "readonly",
__dirname: "readonly",
module: "readonly",
require: "readonly",
},
},
files: ["**/*.ts"],
rules: {
"no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
},
},
];
56 changes: 0 additions & 56 deletions cli/index.js

This file was deleted.

64 changes: 64 additions & 0 deletions cli/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/usr/bin/env node

import { Command } from "commander";
import { createRequire } from "node:module";
import { fileURLToPath } from "node:url";
import { dirname, resolve } from "node:path";

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const require = createRequire(import.meta.url);

const pkg = require(resolve(__dirname, "package.json")) as {
version: string;
name: string;
};

import { runInitCommand } from "./src/commands/init.js";
import { runUpdateCommand } from "./src/commands/update.js";
import { runListTemplatesCommand } from "./src/commands/listTemplates.js";

const program = new Command();

program
.name("compose")
.description(
"CLI for building, deploying, and managing diamond smart contracts",
)
.version(pkg.version, "-v, --version", "Print CLI version");

program
.command("init")
.description("Scaffold a new Compose diamond project")
.option("-n, --name <name>", "Project name")
.option("--template <id>", "Template ID")
.option("--framework <framework>", "Project framework (foundry | hardhat)")
.option(
"--language <language>",
"Project language (javascript | typescript)",
)
.option("--hardhat-project-type <type>", "Hardhat project type")
.option("--install-deps", "Install dependencies")
.option("--no-install-deps", "Skip dependency installation")
.option("-y, --yes", "Skip prompts and use defaults")
.action(async (options) => {
await runInitCommand(options);
});

program
.command("templates")
.description("List available templates")
.action(async () => {
await runListTemplatesCommand();
});

program
.command("update")
.description("Update the CLI to the latest version")
.action(async () => {
await runUpdateCommand(pkg.name);
});

export async function main(): Promise<void> {
await program.parseAsync(process.argv);
}
21 changes: 12 additions & 9 deletions cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,37 @@
"name": "@perfect-abstractions/compose-cli",
"version": "0.0.5",
"description": "CLI to scaffold Compose facet-based diamond projects",
"main": "index.js",
"type": "module",
"bin": {
"compose": "bin/compose.js"
},
"type": "commonjs",
"scripts": {
"compose": "tsx bin/compose.ts",
"build": "tsc",
"lint": "eslint .",
"test": "node --test \"test/**/*.test.js\"",
"test:unit": "node --test \"test/unit/**/*.test.js\"",
"test:integration": "node --test \"test/integration/**/*.test.js\"",
"test": "tsx --test \"test/**/*.test.ts\"",
"test:unit": "tsx --test \"test/unit/**/*.test.ts\"",
"test:integration": "tsx --test \"test/integration/**/*.test.ts\"",
"check": "npm run lint && npm run test",
"build:templates": "node scripts/generate-templates-config.js",
"build:templates": "tsx scripts/generate-templates-config.ts",
"pack:check": "npm pack --dry-run",
"prepublishOnly": "npm run check && npm run pack:check",
"prepublishOnly": "npm run check && npm run build && npm run pack:check",
"prepare:lib": "git submodule update --init --recursive"
},
"engines": {
"node": ">=20"
},
"files": [
"index.js",
"dist/",
"src/",
"!src/templates/**/lib/",
"README.md",
"LICENSE.md"
],
"dependencies": {
"commander": "^13.1.0",
"fs-extra": "^11.3.3",
"inquirer": "^13.3.0",
"minimist": "^1.2.8",
"picocolors": "^1.1.1"
},
"devDependencies": {
Expand All @@ -50,7 +51,9 @@
"forge-std": "github:foundry-rs/forge-std#v1.9.4",
"hardhat": "^3.1.10",
"mocha": "^11.7.5",
"tsx": "^4.19.0",
"typescript": "~5.8.0",
"typescript-eslint": "^8.30.0",
"viem": "^2.47.0"
},
"keywords": [
Expand Down
142 changes: 0 additions & 142 deletions cli/scripts/generate-templates-config.js

This file was deleted.

Loading
Loading