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

CLI initial version #413

Closed
wants to merge 180 commits into from
Closed
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
180 commits
Select commit Hold shift + click to select a range
99a8a8d
CLI initial version
carletex Jul 7, 2023
853fff4
New name + version
carletex Jul 7, 2023
cc0798c
Change git emoji
carletex Jul 7, 2023
8e05bbb
add logic to replace .env-defalut and make a generic renameFunction
technophile-04 Jul 7, 2023
da43950
update the outro message
technophile-04 Jul 7, 2023
68d0ccf
version++. Lets find a better way :)
carletex Jul 7, 2023
42e26bb
Remove the ascii art and use chalk
carletex Jul 7, 2023
14acb2a
fix: tasks order
rin-st Jul 8, 2023
2b12462
fix: filename typo
rin-st Jul 8, 2023
77cf376
fix: rfc arg files example
rin-st Jul 8, 2023
e9636cb
update task:git init -> yarn install -> make the first commit
technophile-04 Jul 10, 2023
305c1a2
link to foundry docs if foundryup is not present
technophile-04 Jul 10, 2023
e4f0e9f
update the package version
technophile-04 Jul 10, 2023
edf96e4
fix spellling of the file
technophile-04 Jul 10, 2023
5fcadcb
Change version to see why Shiv cant publish
carletex Jul 10, 2023
9bb9422
move yarn start message outof if block
technophile-04 Jul 10, 2023
2f36b2e
Fix bug with findFilesRecursiveSync (#417)
dgrcode Jul 12, 2023
ee95894
Version
carletex Jul 12, 2023
2599a95
Use templates instead of renaming files (#423)
dgrcode Jul 17, 2023
92dda57
Version. Publish
carletex Jul 17, 2023
67f7daf
lock viem and wagmi version (#421)
technophile-04 Jul 17, 2023
20a8084
Version++
carletex Jul 17, 2023
26d89bf
Back-merge main
carletex Jul 17, 2023
e844021
Remove unused types (#432)
dgrcode Jul 19, 2023
1987a5a
Update withDefaults API to receive an object (#430)
dgrcode Jul 19, 2023
84bc3fa
Version
carletex Jul 19, 2023
0eb0c29
Change foundryup command (#435)
carletex Jul 20, 2023
686db1a
fix yarn generate & better yarn account (#434)
technophile-04 Jul 20, 2023
8095b16
Version
carletex Jul 20, 2023
b5fa79a
backmerge main
carletex Jul 21, 2023
fb4cf88
Fix Windows descriptor location (#443)
carletex Jul 25, 2023
ec76ce8
Merge branch 'main' into cli
carletex Jul 25, 2023
aaf8629
yarn test alias for hardhat/foundry. version++
carletex Jul 25, 2023
504b3bc
Dynamic artifacts path for the blockexplorer (#452)
technophile-04 Jul 26, 2023
f68e080
Version++
carletex Jul 26, 2023
40e254a
Merge branch 'main' into cli
carletex Jul 27, 2023
ace612f
Version
carletex Jul 27, 2023
aff853a
Merge branch 'main' into cli
carletex Jul 27, 2023
d4e7890
Version++
carletex Jul 27, 2023
3ce0482
backmerge main, version
carletex Jul 28, 2023
e76f0cd
Merge branch 'origin/main' into cli
technophile-04 Aug 1, 2023
e663158
update version
technophile-04 Aug 1, 2023
5d73804
cli/merge foundry and main changes (#473)
technophile-04 Aug 2, 2023
b5e3c86
version++
carletex Aug 2, 2023
efda5d6
backmerge recent updates into CLI (#483)
technophile-04 Aug 12, 2023
5b87e70
Merge remote-tracking branch 'origin/main' into cli
technophile-04 Aug 12, 2023
6f3f696
version++
technophile-04 Aug 12, 2023
6f696b0
Adapt README to CLI and foundry (#442)
Pabl0cks Aug 14, 2023
06f8bed
back merge lib updates (#493)
technophile-04 Aug 17, 2023
ceeb96f
merge main
technophile-04 Aug 17, 2023
4a8c26e
CLI dev mode (#436)
dgrcode Aug 19, 2023
d059aa7
setup ci/cd with changeset for cli (#494)
technophile-04 Aug 28, 2023
32caee5
backmerge latest changes to CLI (#523)
technophile-04 Sep 7, 2023
0808571
Version Packages (#525)
github-actions[bot] Sep 8, 2023
9c967d9
Update CLI with latest main (#555)
carletex Oct 5, 2023
81c738b
Version Packages (#557)
github-actions[bot] Oct 5, 2023
3b8e5fe
merge main into cli
technophile-04 Oct 5, 2023
787429d
Package.json repo url + README link to CLI branch (#566)
carletex Oct 12, 2023
16f1a72
backmerge latest main changes to cli (#571)
technophile-04 Oct 12, 2023
5cc7b49
Version Packages (#572)
github-actions[bot] Oct 12, 2023
76ec39b
Update README reduced version with link to docs (#577)
Pabl0cks Oct 20, 2023
30d9000
backmerge latest change to cli (#582)
technophile-04 Oct 23, 2023
921476e
Version Packages (#583)
github-actions[bot] Oct 23, 2023
f9d27d1
Merge remote-tracking branch 'origin/main' into cli
technophile-04 Oct 23, 2023
06ba1eb
Weekly CLI backmerge (#593)
carletex Nov 2, 2023
0a2e9af
Version Packages (#595)
github-actions[bot] Nov 2, 2023
0135237
CLI backmerge (#603)
FilipHarald Nov 15, 2023
88af398
Version Packages (#608)
github-actions[bot] Nov 15, 2023
7f7c2a6
Merge branch 'main' into cli
carletex Nov 15, 2023
621c9ac
Show inherited functions in Debug (when deploying with foundry) (#604)
FilipHarald Nov 22, 2023
7c7e7f8
Merge branch 'main' into cli-backmerge
carletex Nov 22, 2023
efbe3fc
Changeset
carletex Nov 22, 2023
650d007
Merge pull request #619 from scaffold-eth/cli-backmerge
carletex Nov 22, 2023
cdfb30d
Version Packages (#618)
github-actions[bot] Nov 22, 2023
357e6b5
Merge branch 'origin/main' into cli-backmerge
technophile-04 Nov 30, 2023
d257942
move RainbowKitCustomConnectButton inside template directory
technophile-04 Nov 30, 2023
fa1970e
Merge branch 'cli' into cli-backmerge
technophile-04 Nov 30, 2023
ca93854
add changeset
technophile-04 Nov 30, 2023
58bf26c
update [address] page to be template
technophile-04 Dec 3, 2023
fccc54e
Merge pull request #635 from scaffold-eth/cli-backmerge
technophile-04 Dec 3, 2023
0114473
Version Packages
github-actions[bot] Dec 3, 2023
411c360
update CHANGELOG.md
technophile-04 Dec 3, 2023
4982b02
Merge pull request #642 from scaffold-eth/changeset-release/cli
technophile-04 Dec 3, 2023
9062e16
Merge remote-tracking branch 'origin/main' into cli-backmerge
technophile-04 Dec 7, 2023
4e2593c
Merge remote-tracking branch 'origin/main' into cli-backmerge
technophile-04 Dec 7, 2023
9054924
Merge branch 'cli' into cli-backmerge
technophile-04 Dec 7, 2023
a9d873d
add changeset
technophile-04 Dec 7, 2023
00a2d71
Merge remote-tracking branch 'origin/main' into cli-backmerge
technophile-04 Dec 7, 2023
764f2e7
update changeset
technophile-04 Dec 7, 2023
2aeb5ee
add note about merging cli-backmerge with Creat a merge commit option…
technophile-04 Dec 7, 2023
f516908
Merge pull request #648 from scaffold-eth/cli-backmerge
carletex Dec 8, 2023
8d8165d
Version Packages (#650)
github-actions[bot] Dec 8, 2023
4b02a3e
Merge remote-tracking branch 'origin/main' into cli-backmerge
technophile-04 Dec 14, 2023
026a446
add changeset
technophile-04 Dec 14, 2023
3804224
Merge pull request #661 from scaffold-eth/cli-backmerge
carletex Dec 14, 2023
6012889
Version Packages (#662)
github-actions[bot] Dec 14, 2023
22e7eab
Merge branch 'origin/main' into backmerge-main
technophile-04 Dec 20, 2023
1e9d713
add changeset
technophile-04 Dec 20, 2023
db3d051
Merge branch 'origin/main' into backmerge-main
technophile-04 Dec 21, 2023
fda4646
update changeset
technophile-04 Dec 21, 2023
b7513d3
Weekly CLI backmerge
technophile-04 Dec 21, 2023
f9e614b
Version Packages (#672)
github-actions[bot] Dec 21, 2023
d73e244
merge origin/main into cli-backmerge
technophile-04 Dec 28, 2023
7d62ce7
add changeset
technophile-04 Dec 28, 2023
f87db11
remove log from contractsData
technophile-04 Dec 29, 2023
42e2766
remove github issue and pr template
technophile-04 Dec 29, 2023
8af19db
update changeset
technophile-04 Dec 29, 2023
7cbd2be
Merge pull request #674 from scaffold-eth/cli-backmerge
technophile-04 Dec 29, 2023
f8f9e65
Version Packages (#676)
github-actions[bot] Dec 29, 2023
a665610
merge origin/main into cli
technophile-04 Jan 14, 2024
10cfcd8
add changeset
technophile-04 Jan 14, 2024
8313792
update base README for verify command
technophile-04 Jan 14, 2024
71be8e7
add constructor args for hardhat-verify contracts
technophile-04 Jan 14, 2024
4ced950
add hardhat-verify for hardhat projects
Pabl0cks Jan 16, 2024
8ba1040
update homepage file url
Pabl0cks Jan 16, 2024
a21d87e
Merge remote-tracking branch 'origin/main' into backmerge-main
technophile-04 Jan 17, 2024
f7e479a
update hardhat-verfiy desc inline with docs
technophile-04 Jan 17, 2024
24e0303
fix zustand import
technophile-04 Jan 17, 2024
936a982
update changeset
technophile-04 Jan 17, 2024
f4c7fa9
Merge pull request #685 from scaffold-eth/backmerge-main
technophile-04 Jan 17, 2024
a36503a
Version Packages
github-actions[bot] Jan 17, 2024
6466604
fix changelog formatting
technophile-04 Jan 17, 2024
6465993
Merge pull request #694 from scaffold-eth/changeset-release/cli
technophile-04 Jan 17, 2024
d0b61c4
adds base sepolia to list of supported networks (foundry) (#697)
JacobHomanics Jan 23, 2024
67188c1
Removes broadcast folder from gitignore in foundry (#708)
JacobHomanics Feb 8, 2024
63f9876
Merge branch 'origin/main' into cli-backmerge
technophile-04 Feb 15, 2024
405e20a
add changeset
technophile-04 Feb 15, 2024
aed52d7
Merge remote-tracking branch 'origin/main' into cli-backmerge
technophile-04 Feb 15, 2024
f610b64
add pr 726 in changeset
technophile-04 Feb 15, 2024
6a25874
Merge pull request #728 from scaffold-eth/cli-backmerge
technophile-04 Feb 15, 2024
e55f4c6
Version Packages (#729)
github-actions[bot] Feb 15, 2024
1694990
Update base README
Pabl0cks Feb 15, 2024
c5f5319
Replace arbitrumGoerli and optimismGoerli with arbitrumSepolia and op…
Pabl0cks Feb 15, 2024
c2a8364
Merge branch 'cli' into cli-backmerge
technophile-04 Feb 15, 2024
15c21c0
cli next template readme + foundry sepolia chains update
technophile-04 Feb 15, 2024
c13fedb
Merge remote-tracking branch 'origin/main' into cli-backmerge
technophile-04 Feb 26, 2024
092f2ad
add changeset
technophile-04 Feb 26, 2024
ec8473d
Merge branch 'cli' into cli-backmerge
technophile-04 Feb 26, 2024
3858a49
merge origin/main
technophile-04 Feb 26, 2024
8b55994
update change set
technophile-04 Feb 26, 2024
d7405f4
Merge pull request #740 from scaffold-eth/cli-backmerge
carletex Feb 27, 2024
898f92f
Version Packages (#744)
github-actions[bot] Feb 27, 2024
b03c011
add prettier task (#750)
technophile-04 Mar 6, 2024
62553fd
add foundry flatten script (#746)
technophile-04 Mar 6, 2024
83ee480
Merge remote-tracking branch 'origin/main' into main-backmerge
technophile-04 Mar 6, 2024
db6dbad
add changeset
technophile-04 Mar 6, 2024
fac4aa9
Merge remote-tracking branch 'origin/main' into main-backmerge
technophile-04 Mar 8, 2024
833d09b
pass msg.value to emit event
technophile-04 Mar 8, 2024
3ff5d00
Merge remote-tracking branch 'origin/main' into main-backmerge
technophile-04 Mar 10, 2024
ac76c4b
update changeset
technophile-04 Mar 10, 2024
a9eb69b
Merge remote-tracking branch 'origin/main' into main-backmerge
technophile-04 Mar 11, 2024
2dc6f4c
update changeset
technophile-04 Mar 11, 2024
a24c841
add next:build to root
technophile-04 Mar 11, 2024
a88112b
merge origin/main
technophile-04 Mar 11, 2024
dc2b2d5
uddate changeset
technophile-04 Mar 11, 2024
af39127
add .vercelignore template (#769)
technophile-04 Mar 11, 2024
0dad6ea
merge origin/main
technophile-04 Mar 11, 2024
ac1d2ac
remove latest and use ~ for @typescript-eslint in hardhat
technophile-04 Mar 11, 2024
ea5e355
update changeset
technophile-04 Mar 11, 2024
a9e8e9e
Merge pull request #756 from scaffold-eth/main-backmerge
technophile-04 Mar 11, 2024
02c543e
Version Packages
github-actions[bot] Mar 11, 2024
6b2a80c
format changelog
technophile-04 Mar 11, 2024
75267de
Merge pull request #754 from scaffold-eth/changeset-release/cli
technophile-04 Mar 11, 2024
988434e
cli: skip prettier formatting if install dependency is skipped (#784)
technophile-04 Mar 23, 2024
8984d74
Create specific README files for foundry and hardhat options (#782)
Pabl0cks Mar 23, 2024
a3d956b
Templatise readme quickstart section (#790)
rin-st Mar 28, 2024
7190701
Merge 'origin/main' into cli-weekly-backmerge
technophile-04 Apr 4, 2024
1156067
remove goerli from foundry.toml
technophile-04 Apr 4, 2024
c19f286
add changeset
technophile-04 Apr 4, 2024
b523c1a
Merge remote-tracking branch 'origin/main' into cli-weekly-backmerge
technophile-04 Apr 5, 2024
2dd3a3b
update changeset
technophile-04 Apr 5, 2024
3be84f9
Merge pull request #796 from scaffold-eth/cli-weekly-backmerge
technophile-04 Apr 8, 2024
c55d258
Version Packages (#803)
github-actions[bot] Apr 8, 2024
a2d236e
Merge remote-tracking branch 'origin/main' into backmerge-wagmiv2
technophile-04 Apr 16, 2024
697aab0
add changeset
technophile-04 Apr 16, 2024
5541563
remove useSCR and useSES
technophile-04 Apr 16, 2024
3a5b515
Fix #805 - Check property exists before using it (#806)
dragonsisdumb Apr 16, 2024
7b401f1
Merge branch 'cli' into backmerge-wagmiv2
technophile-04 Apr 16, 2024
7675de4
Merge pull request #815 from scaffold-eth/backmerge-wagmiv2
technophile-04 Apr 16, 2024
7b2cfd9
Version Packages (#817)
github-actions[bot] Apr 16, 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
12 changes: 7 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
node_modules
/dist

# dependencies, yarn, etc
# yarn / eslint
# Dependency directories
node_modules/

# yarn
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
.eslintcache
.vscode/**

# macos files
.DS_Store
873 changes: 873 additions & 0 deletions .yarn/releases/yarn-3.5.0.cjs

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions .yarnrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--save-exact true
8 changes: 1 addition & 7 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
enableColors: true

nmHoistingLimits: workspaces

nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs
spec: "@yarnpkg/plugin-typescript"

yarnPath: .yarn/releases/yarn-3.2.3.cjs
yarnPath: .yarn/releases/yarn-3.5.0.cjs
253 changes: 253 additions & 0 deletions RFC-extensions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,253 @@
# Main concepts

I propose we treat anything other than "base" as an extension. That way we don't need to make distinctions between solidity frameworks or any other kind of extension.

This change should make it easier to grow the options we provide our users without having to classify extensions by category.

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.

For each extension there is an optional `templates/extensions/{extensionName}/config.json` file providing information about the specific extension.

| ⚠️ Note how the extension config file is a JSON file

## Config files API

### `src/config.ts`

Have a look at `src/types.ts#Config` or the file itself.

Just a quick note to mention that adding `null` as an item in the `extensions` property will show the "None" option to the user. That option doesn't add any extension for the given question.

### `{extension}/config.json`

Since these files can't be .ts, the API is not typed. However, there are certain properties that are used in the code.

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

# Template files

A Template file is a file to which extensions can add content. Removing content is out of scope for this experiment.

## Template files API

### Template file name

All Template file should be named as \`{original-name.with-extension}.template.js\`. This way we can skip those files while copying base and extensions, and process them with the values from the base and the combined extensions.

### Template file contents

All Template files should `export default` a function receiving named arguments and returning a string where those input arguments can be used to do string interpolation.

Given multiple extensions can write to the same templates, each of the name argument should expect to receive an array of strings. Note the array might potentially be empty, which would mean no extension is adding values to that template.

Therefore the exported function signature should always be \`(Record<string, string[]>) => string\`

The values from each file writing to the template are placed in the array in the same order the user selected the extensions. This effectively means nested extensions write last.

Also, receiving an array instead of strings give the template itself more control over the final output. Like how the different values should be joined.

Important to note that named arguments could use any arbitrary name. Because of that, we have to provide default values to all those arguments, otherwise missing values would be parsed as the string "undefined". Because we don't know what are the expected names for each template expects.

## Things to note about Template files

### Default values

It's a bit annoying having to define an empty array as a default value for all the arguments. To solve this, I've created a utility function that receives the template and expected arguments, and takes care of it. You can find it at `templates/utils.js`, the function named `withDefaults`.

As a bonus, using this function will throw an error when an [Args file](#args-file-content) is trying to send an argument with a name not expected by the template.

### Unwanted new lines

Note when you use backticks, "`", to create interpolated strings, new lines are taken as part of the string. Therefore the following string would start and end with extra empty lines:

```ts
const stringWithNewLines = `
woops, there are new lines
`;
```

You can do the following:

```ts
const stringWithoutNewLines = `This string starts without a new line
and ends without new lines`;
```

If you do this, however, prettier will try to indent the backtick. To avoid that you can see I've added a bunch of `// prettier-ignore`s before the template strings.

# Args files

Args files are the files used to add content to Template files.

## Args files API

### Args file name

All Args files should be named as \`{original-name.with-extension}.args.js\`. This way we can check, for a given Template file, if any Args files exist.

Important to note here that the relative path of the Template and Args files **must** be the same. Otherwise the Args file content won't be used. By relative path I mean the path relative to the `base/` path or the `extensions/{extension-name}/` paths. An example:

```
create-dapp-example/
├─ ...
├─ templates/
│ ├─ base/
│ │ ├─ some-folder/
│ │ │ ├─ template-at-folder.md.template.js
│ │ ├─ template-at-root.md.template.js
│ │
│ ├─ extensions/
│ │ ├─ foo/
│ │ │ ├─ some-folder/
│ │ │ │ ├─ template-at-root.md.args.js <-- won't work!
│ │ │ │ ├─ template-at-folder.md.args.js
│ │ │ ├─ template-at-root.md.args.js
│ │ │ ├─ template-at-folder.md.args.js <-- won't work!
dgrcode marked this conversation as resolved.
Show resolved Hide resolved
```

### Args file content

Args files should export an object with key-value pairs where keys are the named argument of the template, and the values are the content you want to send for the given named argument.

This can be accomplished by using named exports instead of explicitly defining the object.

```js
// this
export one = 1
export two = 2

// would be equivalent to
export default { one: 1, two: 2}
```

To avoid issues when named arguments have typos, the `withDefaults` utility will also throw an error when an argument is passed with a name that wasn't expected by the template.

# Args files injection in Template files

For each Template file, we search on the extensions the user selected for the existence of Args files in the exact same relative path. If there are multiple Args files, we combine them into an array

I've thought about how the strings should be joined, but an option is to use [tagged templates](4). We can go as crazy as we want with tagged templates.

# Extension folder anatomy

When creating a new extension, simply create a new folder under `templates/extensions` with the name you want the extension to have.

Inside the folder you will have a mix of normal, templated, and special files and folders.

## Normal files and folders

These are the untouched files and folders you want the extension to add to the final project.
In the case of files, they will be copied to the resulting project and no other extension will be able to touch them.
For folders, they will create the folder with its contents, and other extension will be able to add new files to it.
Templated files can be nested within normal folders to keep the same path in the resulting project.

## Templated files

Templated files are both [Template files](#template-files), and [Args files](#args-files). We use them to write to other files already added by the base project or another extension, or to let other extensions modify a file created by this extension. Just to recap, those files are the ones ending in `*.template.js` (Template file) or `*.args.js` (Args file).

## Special files and folders

The special files and folders are:

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

# Things worth mentioning

## Merging package.json files

The package we use to merge package.json files [merge-packages](3) will use the last version of a dependency given a conflict. For example:

```
version on file one: 1.0.0
version on file two: 0.1.0
resulting version: 0.1.0

version on file one: 0.1.0
version on file two: 1.0.0
resulting version: 1.0.0
```

The first and last files are the first and second arguments when we call the function, so we can choose what version we want to win when there's a conflict.

## Filesystem async methods

This is a possible improvement in the speed of the cli. I've used the sync API to avoid adding extra complexity for the proof of concept, but it might be an improvement helping parallelize tasks. For example processing templates in parallel.

[1]: https://github.com/nextauthjs/next-auth
[2]: https://www.prisma.io/
[3]: https://github.com/zppack/merge-packages
[4]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#tagged_templates
4 changes: 4 additions & 0 deletions bin/create-dapp-se2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#! /usr/bin/env node
import { cli } from "../dist/cli.js";

cli(process.argv);
75 changes: 42 additions & 33 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,48 @@
{
"name": "se-2",
"version": "0.0.1",
"private": true,
"workspaces": {
"packages": [
"packages/hardhat",
"packages/nextjs"
]
},
"name": "create-eth",
"version": "0.0.3",
"description": "Create a Scaffold-ETH-2 app",
"main": "dist/cli.js",
"type": "module",
"bin": "bin/create-dapp-se2.js",
"scripts": {
"account": "yarn workspace @se-2/hardhat account",
"chain": "yarn workspace @se-2/hardhat chain",
"fork": "yarn workspace @se-2/hardhat fork",
"deploy": "yarn workspace @se-2/hardhat deploy",
"verify": "yarn workspace @se-2/hardhat verify",
"compile": "yarn workspace @se-2/hardhat compile",
"generate": "yarn workspace @se-2/hardhat generate",
"hardhat:lint": "yarn workspace @se-2/hardhat lint",
"hardhat:lint-staged": "yarn workspace @se-2/hardhat lint-staged",
"hardhat:test": "yarn workspace @se-2/hardhat test",
"start": "yarn workspace @se-2/nextjs dev",
"next:lint": "yarn workspace @se-2/nextjs lint",
"next:format": "yarn workspace @se-2/nextjs format",
"next:check-types": "yarn workspace @se-2/nextjs check-types",
"postinstall": "husky install",
"precommit": "lint-staged",
"vercel": "yarn workspace @se-2/nextjs vercel",
"vercel:yolo": "yarn workspace @se-2/nextjs vercel:yolo"
"build": "rollup -c rollup.config.js",
"dev": "rollup -c rollup.config.js --watch",
"cli": "rm -rf test && node bin/create-dapp-se2.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"packageManager": "[email protected]",
"keywords": [
"cli",
"ethereum",
"scaffold-eth 2",
"wagmi",
"hardhat",
"foundry",
"viem",
"rainbowkit"
],
"license": "MIT",
"devDependencies": {
"husky": "^8.0.1",
"lint-staged": "^13.0.3"
"@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",
"rollup": "3.21.0",
"rollup-plugin-auto-external": "2.0.0",
"tslib": "2.5.0",
"typescript": "5.0.4"
},
"dependencies": {
"arg": "5.0.2",
"chalk": "5.2.0",
"execa": "7.1.1",
"handlebars": "^4.7.7",
"inquirer": "9.2.0",
"listr": "0.14.3",
"merge-packages": "^0.1.6",
"ncp": "2.0.0",
"pkg-install": "1.0.0"
},
"resolutions": {
"usehooks-ts@^2.7.2": "patch:usehooks-ts@npm:^2.7.2#./.yarn/patches/usehooks-ts-npm-2.7.2-fceffe0e43.patch"
}
"packageManager": "[email protected]"
}
Loading