create-dapp-example v0.0.13
🏗️ create-dapp-example
Testing the best way to have a create-app cli tool.
yarn create dapp-example
# or
npx create-dapp-example
You can also pass flags to skip prompts.
yarn create dapp-example my-example-dapp --template se-2-hardhat
# or
yarn create dapp-example my-example-dapp --yes
Understanding the structure :
src/cli.ts
is the entry point for the cli.
src/main.ts
defines the task using listr and executes them.
src/tasks
holds each task logic for example one of the task in src/main.ts
is "Initialize git repo" and the logic for it is present at src/tasks/init-git-repo
src/utils
holds utility / helpers function like parsing cli args, checking for correct template name, showing welcome and outro messages etc.
src/types.ts
holds all the type
Trying out locally :
Clone and get into working directory :
git clone https://github.com/carletex/create-dapp-example
cd create-dapp-example
Option 1. Dev & cli
Get Rollup watching for changes:
yarn dev
Edit files as you want. When you want to run the cli tool, just do:
yarn cli
This script automatically deletes the test/
folder. Therefore, a convenient command to run for iterating without having to manually delete folders would be:
yarn cli test -s
Which generates the output in the test/
folder and skips installing dependencies. That test/
folder would then be deleted in the following yarn cli
run.
Option 2. Build & npx
yarn build && npx .
Option 3. Linking package locally and running watch mode:
# Make sure you are in create-dapp-se2 directory
yarn link
# This will watch and compile as you edit files
yarn dev
Testing :
# In new terminal
cd ..
mkdir test-dapp-se2
# Running this will execute the local bin file
create-dapp-se2