Skip to content
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
7c3e5cc
Bump semver from 5.7.1 to 5.7.2
dependabot[bot] Apr 25, 2024
2784d02
Bump tar from 6.1.13 to 6.2.1
dependabot[bot] Apr 25, 2024
7cf8a95
Bump ip from 2.0.0 to 2.0.1
dependabot[bot] May 15, 2024
9b86106
remove handling of generated dir and yarn.lock file
technophile-04 Jun 5, 2024
6d88840
allow undefined args to be passed by extensions
technophile-04 Jun 6, 2024
a5cc76f
simplify copyBaseFiles
technophile-04 Jun 6, 2024
e95f6b7
remove passing of extra option argument from copyBaseFiles
technophile-04 Jun 7, 2024
99608a0
Bump braces from 3.0.2 to 3.0.3
dependabot[bot] Jun 11, 2024
21c75a1
remove logic nested-extension + extends extension
technophile-04 Jun 12, 2024
962db91
remove dangling TODO
technophile-04 Jun 12, 2024
e7b5b33
tidy up extension-tree.ts file
technophile-04 Jun 12, 2024
8e4323c
remove nested and extending section from RFC.md file
technophile-04 Jun 12, 2024
91d3d33
remove handlebars from dependency
technophile-04 Jun 13, 2024
89401d4
feat: linkr2
rin-st Jun 13, 2024
faba4af
fix: change base branch
rin-st Jun 13, 2024
48c59fd
chore: changeset
rin-st Jun 13, 2024
bab3675
chore: changeset message
rin-st Jun 13, 2024
8f54794
remove husky
technophile-04 Jun 14, 2024
2746eca
add and configure lefthook
technophile-04 Jun 14, 2024
9f61c72
remove lint-staged
technophile-04 Jun 14, 2024
48f8fde
chore: remove @types/listr
rin-st Jun 14, 2024
23462be
remvoe pinst
technophile-04 Jun 14, 2024
51831ed
fix: render options
rin-st Jun 14, 2024
3660a05
don't symlink yarn.lock in dev mode
technophile-04 Jun 14, 2024
4ac42dc
don't symlink deployedContracts.ts in dev mode
technophile-04 Jun 14, 2024
0bb4055
Merge branch 'dependabot/npm_and_yarn/semver-5.7.2' into rc-0.0.47
carletex Jun 14, 2024
583a453
Merge branch 'dependabot/npm_and_yarn/tar-6.2.1' into rc-0.0.47
carletex Jun 14, 2024
16f00b8
Merge remote-tracking branch 'origin/dependabot/npm_and_yarn/ip-2.0.1…
carletex Jun 14, 2024
e75cce0
Merge remote-tracking branch 'origin/dependabot/npm_and_yarn/braces-3…
carletex Jun 14, 2024
fdb7f70
Merge remote-tracking branch 'origin/fix-spamming-message' into rc-0.…
carletex Jun 14, 2024
207e3d9
rename rfc-extensions to core-extensions
technophile-04 Jun 14, 2024
bd30a58
Regenerate yarn.lock
carletex Jun 14, 2024
944e5bd
Regenerate yarn.lock
carletex Jun 14, 2024
4dae0a6
Add changeset
carletex Jun 14, 2024
ac1dbd9
Remove changeset
carletex Jun 14, 2024
df5f0af
Add eip712
carletex Jun 14, 2024
2b60c23
Merge branch 'cleanup' into rc-0.0.47
technophile-04 Jun 14, 2024
cc231a6
rename eip712 => eip-712
technophile-04 Jun 14, 2024
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
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "cli",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
10 changes: 10 additions & 0 deletions .changeset/strange-tigers-repair.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"create-eth": patch
---

- Cleanup unused extensions
- Fix listr spamming
- Migrate from husky to lefthook
- Upgrade dependencies
- Templatized foundry deploy script
- Add eip712 curated extension
1 change: 0 additions & 1 deletion .husky/pre-commit

This file was deleted.

3 changes: 0 additions & 3 deletions .lintstagedrc.json

This file was deleted.

62 changes: 2 additions & 60 deletions contributors/RFC-extensions.md → contributors/core-extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,62 +6,6 @@ This change should make it easier to grow the options we provide our users witho

This change requires a new file, `src/config.ts`, where a few things about the extensions are defined, e.g. the sequence of questions about extensions.

## Nested extensions

We can add extensions of extensions, just by adding an `/extensions` folder inside an existing extension. For example, adding [next-auth][1] as an extension for next would look something like the following:

```text
create-dapp-example/
├─ src/
│ ├─ ...
├─ templates/
│ ├─ base/
│ ├─ extensions/
│ │ ├─nextjs
│ │ ├─ ...
│ │ ├─ extensions/
│ │ │ ├─ next-auth/
│ │ │ ├─ ...
```

## Extending extensions

> sorry for the confusing naming

Extensions can also inherit (or extend) another extension. The goal of this feature is that two extensions can share files or nested extensions without duplication. An example of this could be hardhat and foundry, which are two different extensions, but both of them could have a shared UI to debug smart contracts.

The file structure could be like this:

```text
create-dapp-example/
├─ src/
│ ├─ ...
├─ templates/
│ ├─ base/
│ ├─ extensions/
│ │ ├─ foundry/
│ │ │ ├─ config.json <- important to declare the `extends` field here
│ │ │ ├─ ...
│ │ ├─ hardhat/
│ │ │ ├─ config.json <- important to declare the `extends` field here
│ │ │ ├─ ...
│ │ ├─ common/
│ │ │ ├─ extensions/
│ │ │ │ ├─ possible-shared-nested-extension/
│ │ │ │ ├─ ...
│ │ │ ├─ shared-file.md
```

For `foundry` and `hardhat` extensions to inherit from `common`, they need to add the `extends` field to the config.json file.

```json
{
"extends": "common"
}
```

# Config files

There's one main `src/config.ts` file to configure the questions shown to the user.
Expand All @@ -86,14 +30,12 @@ Those properties are:

- `name`: the string to be used when showing the package name to the user via the cli, as well as for error reporting.

- `extends`: the name of a different extension used as "parent extension". Read more at the [Extending extensions](#extending-extensions) section

Note that all values are optional, as well as the file itself.

| ⚠️ TODO list when new properties are added to config.json:
| - Update this document
| - Update the ExtensionDescriptor type at /src/types.ts
| - Update the src/utils/extensions-tree.ts file so the new field from the config is actually added into the extension descriptor
| - Update the src/utils/extensions-dictionary.ts file so the new field from the config is actually added into the extension descriptor

# Template files

Expand Down Expand Up @@ -270,7 +212,7 @@ The special files and folders are:

- [`package.json` file](#merging-packagejson-files)
- [`config.json` file](#extensionconfigjson)
- [`extensions/` folder](#nested-extensions)
- `extensions/` folder

# Things worth mentioning

Expand Down
5 changes: 5 additions & 0 deletions lefthook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pre-commit:
commands:
lint:
glob: "*.{js,ts,md}"
run: yarn eslint --fix {staged_files}
13 changes: 3 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@
"lint": "eslint .",
"format": "prettier --write .",
"test": "echo \"Error: no test specified\" && exit 1",
"changeset:release": "yarn build && changeset publish",
"postinstall": "husky",
"prepack": "pinst --disable",
"postpack": "pinst --enable"
"changeset:release": "yarn build && changeset publish"
},
"keywords": [
"cli",
Expand All @@ -36,15 +33,12 @@
"@eslint/js": "^9.3.0",
"@rollup/plugin-typescript": "11.1.0",
"@types/inquirer": "9.0.3",
"@types/listr": "0.14.4",
"@types/ncp": "2.0.5",
"@types/node": "18.16.0",
"eslint": "^9.3.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"husky": "^9.0.11",
"lint-staged": "^15.2.4",
"pinst": "^3.0.0",
"lefthook": "^1.6.16",
"prettier": "3.2.5",
"rollup": "3.21.0",
"rollup-plugin-auto-external": "2.0.0",
Expand All @@ -57,9 +51,8 @@
"arg": "5.0.2",
"chalk": "5.2.0",
"execa": "7.1.1",
"handlebars": "^4.7.7",
"inquirer": "9.2.0",
"listr": "0.14.3",
"listr2": "^8.2.1",
"merge-packages": "^0.1.6",
"ncp": "2.0.0",
"pkg-install": "1.0.0"
Expand Down
4 changes: 4 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ const CURATED_EXTENSIONS: { [key: string]: ExternalExtension } = {
repository: "https://github.com/scaffold-eth/create-eth-extensions",
branch: "subgraph",
},
eip712: {
repository: "https://github.com/scaffold-eth/create-eth-extensions",
branch: "eip-712",
},
};

export { config, CURATED_EXTENSIONS };
71 changes: 38 additions & 33 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
import type { Options } from "./types";
import { renderOutroMessage } from "./utils/render-outro-message";
import chalk from "chalk";
import Listr from "listr";
import { Listr } from "listr2";
import path from "path";
import { fileURLToPath } from "url";
import { getArgumentFromExternalExtensionOption } from "./utils/external-extensions";
Expand All @@ -22,40 +22,45 @@ export async function createProject(options: Options) {

const targetDirectory = path.resolve(process.cwd(), options.project);

const tasks = new Listr([
{
title: `📁 Create project directory ${targetDirectory}`,
task: () => createProjectDirectory(options.project),
},
{
title: `🚀 Creating a new Scaffold-ETH 2 app in ${chalk.green.bold(
options.project,
)}${options.externalExtension ? ` with the ${chalk.green.bold(getArgumentFromExternalExtensionOption(options.externalExtension))} extension` : ""}`,
task: () => copyTemplateFiles(options, templateDirectory, targetDirectory),
},
{
title: `📦 Installing dependencies with yarn, this could take a while`,
task: () => installPackages(targetDirectory),
skip: () => {
if (!options.install) {
return "Manually skipped";
}
const tasks = new Listr(
[
{
title: `📁 Create project directory ${targetDirectory}`,
task: () => createProjectDirectory(options.project),
},
},
{
title: "🪄 Formatting files with prettier",
task: () => prettierFormat(targetDirectory),
skip: () => {
if (!options.install) {
return "Skipping because prettier install was skipped";
}
{
title: `🚀 Creating a new Scaffold-ETH 2 app in ${chalk.green.bold(
options.project,
)}${options.externalExtension ? ` with the ${chalk.green.bold(getArgumentFromExternalExtensionOption(options.externalExtension))} extension` : ""}`,
task: () => copyTemplateFiles(options, templateDirectory, targetDirectory),
},
},
{
title: `📡 Initializing Git repository ${options.extensions.includes("foundry") ? "and submodules" : ""}`,
task: () => createFirstGitCommit(targetDirectory, options),
},
]);
{
title: `📦 Installing dependencies with yarn, this could take a while`,
task: () => installPackages(targetDirectory),
skip: () => {
if (!options.install) {
return "Manually skipped";
}
return false;
},
},
{
title: "🪄 Formatting files with prettier",
task: () => prettierFormat(targetDirectory),
skip: () => {
if (!options.install) {
return "Skipping because prettier install was skipped";
}
return false;
},
},
{
title: `📡 Initializing Git repository ${options.extensions.includes("foundry") ? "and submodules" : ""}`,
task: () => createFirstGitCommit(targetDirectory, options),
},
],
{ rendererOptions: { collapseSkips: false, suffixSkips: true } },
);

try {
await tasks.run();
Expand Down
Loading