Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add curated extensions list as source of truth #155

Merged
merged 7 commits into from
Nov 22, 2024
Merged
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: 3 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ jobs:

- name: Run lint
run: yarn lint --max-warnings=0

- name: Run type-check
run: yarn type-check
9 changes: 9 additions & 0 deletions lefthook.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
pre-commit:
parallel: true
commands:
type-check:
glob: "src/**/*.ts"
run: yarn type-check
lint:
glob: "*.{js,ts,md}"
run: yarn eslint --fix {staged_files}
format:
glob: "*.{js,ts,md,json}"
run: |
yarn prettier --write {staged_files}
git add {staged_files}
14 changes: 8 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"lint": "eslint .",
"format": "prettier --write .",
"test": "echo \"Error: no test specified\" && exit 1",
"type-check": "tsc --noEmit",
"changeset:release": "yarn build && changeset publish"
},
"keywords": [
Expand All @@ -32,21 +33,22 @@
],
"license": "MIT",
"devDependencies": {
"@eslint/js": "^9.3.0",
"@eslint/js": "^9.15.0",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-typescript": "11.1.0",
"@types/inquirer": "9.0.3",
"@types/ncp": "2.0.5",
"@types/node": "18.16.0",
"eslint": "^9.3.0",
"eslint": "^9.15.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-prettier": "^5.2.1",
"lefthook": "^1.6.16",
"prettier": "3.3.2",
"prettier": "^3.3.3",
"rollup": "3.21.0",
"rollup-plugin-auto-external": "2.0.0",
"tslib": "2.5.0",
"typescript": "5.0.4",
"typescript-eslint": "^7.10.0"
"typescript": "^5.6.3",
"typescript-eslint": "^8.15.0"
},
"dependencies": {
"@changesets/cli": "^2.26.2",
Expand Down
3 changes: 2 additions & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import typescript from "@rollup/plugin-typescript";
import autoExternal from "rollup-plugin-auto-external";
import json from "@rollup/plugin-json";

export default {
input: "src/cli.ts",
Expand All @@ -8,5 +9,5 @@ export default {
format: "es",
sourcemap: true,
},
plugins: [autoExternal(), typescript({ exclude: ["templates/**", "externalExtensions/**"] })],
plugins: [autoExternal(), typescript({ exclude: ["templates/**", "externalExtensions/**"] }), json()],
};
38 changes: 12 additions & 26 deletions src/curated-extensions.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,16 @@
import { ExternalExtension } from "./types";
import extensions from "./extensions.json";

const CURATED_EXTENSIONS: { [key: string]: ExternalExtension } = {
subgraph: {
repository: "https://github.com/scaffold-eth/create-eth-extensions",
branch: "subgraph",
},
"eip-712": {
repository: "https://github.com/scaffold-eth/create-eth-extensions",
branch: "eip-712",
},
ponder: {
repository: "https://github.com/scaffold-eth/create-eth-extensions",
branch: "ponder",
},
onchainkit: {
repository: "https://github.com/scaffold-eth/create-eth-extensions",
branch: "onchainkit",
},
"erc-20": {
repository: "https://github.com/scaffold-eth/create-eth-extensions",
branch: "erc-20",
},
"eip-5792": {
repository: "https://github.com/scaffold-eth/create-eth-extensions",
branch: "eip-5792",
},
};
const CURATED_EXTENSIONS = extensions.reduce<Record<string, ExternalExtension>>((acc, ext) => {
if (!ext.branch || !ext.repository || !ext.description) {
throw new Error(`Extension missing required fields: ${JSON.stringify(ext)}`);
}

acc[ext.branch] = {
repository: ext.repository,
branch: ext.branch,
};
return acc;
}, {});

export { CURATED_EXTENSIONS };
37 changes: 37 additions & 0 deletions src/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[
{
"description": "This Scaffold-ETH 2 extension helps you build and test subgraphs locally for your contracts. It also enables interaction with the front-end and facilitates easy deployment to Subgraph Studio.",
"repository": "https://github.com/scaffold-eth/create-eth-extensions",
"branch": "subgraph"
},
{
"description": "An implementation of EIP-712, allowing you to send, sign, and verify typed messages in a user-friendly manner.",
"repository": "https://github.com/scaffold-eth/create-eth-extensions",
"branch": "eip-712"
},
{
"description": "This Scaffold-ETH 2 extension comes pre-configured with ponder.sh, providing an example to help you get started quickly.",
"repository": "https://github.com/scaffold-eth/create-eth-extensions",
"branch": "ponder"
},
{
"description": "This Scaffold-ETH 2 extension comes pre-configured with onchainkit, providing an example to help you get started quickly.",
"repository": "https://github.com/scaffold-eth/create-eth-extensions",
"branch": "onchainkit"
},
{
"description": "This extension introduces an ERC-20 token contract and demonstrates how to interact with it, including getting a holder balance and transferring tokens.",
"repository": "https://github.com/scaffold-eth/create-eth-extensions",
"branch": "erc-20"
},
{
"description": "This extension demonstrates on how to use EIP-5792 wallet capabilities. This EIP introduces new JSON-RPC methods for sending multiple calls from the user wallet, and checking their status",
"repository": "https://github.com/scaffold-eth/create-eth-extensions",
"branch": "eip-5792"
},
{
"description": "This extension shows how to use on-chain randomness using RANDAO for truly on-chain unpredictable random sources.",
"repository": "https://github.com/scaffold-eth/create-eth-extensions",
"branch": "randao"
}
]
2 changes: 1 addition & 1 deletion src/utils/parse-arguments-into-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export async function parseArgumentsIntoOptions(

// if lengh is 1, we don't give user a choice and set it ourselves.
const solidityFramework =
solidityFrameworkChoices.length === 1 ? solidityFrameworkChoices[0] : args["--solidity-framework"] ?? null;
solidityFrameworkChoices.length === 1 ? solidityFrameworkChoices[0] : (args["--solidity-framework"] ?? null);

if (solidityFramework === SOLIDITY_FRAMEWORKS.FOUNDRY) {
await validateFoundryUp();
Expand Down
2 changes: 1 addition & 1 deletion src/utils/system-validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { execa } from "execa";
export const validateFoundryUp = async () => {
try {
await execa("foundryup", ["-h"]);
} catch (error) {
} catch {
const message = ` ${chalk.bold.yellow("Attention: Foundryup is not installed in your system.")}
${chalk.bold.yellow("To use foundry, please install foundryup")}
${chalk.bold.yellow("Checkout: https://getfoundry.sh")}
Expand Down
5 changes: 3 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"esModuleInterop": true,
"sourceMap": true,
"skipLibCheck": true,
"moduleResolution": "node"
"moduleResolution": "node",
"resolveJsonModule": true
},
"exclude": ["node_modules"]
"exclude": ["node_modules", "templates", "externalExtensions", "**/*.test.ts"]
}
Loading
Loading