Skip to content

Commit

Permalink
[CLI] allow adding contracts to existing projects (#428)
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-maj committed Dec 1, 2022
1 parent e684d7e commit 6e20d1f
Show file tree
Hide file tree
Showing 6 changed files with 363 additions and 206 deletions.
5 changes: 5 additions & 0 deletions .changeset/orange-turkeys-grow.md
@@ -0,0 +1,5 @@
---
"thirdweb": patch
---

Update CLI to enable create contract inside contracts project
1 change: 1 addition & 0 deletions packages/cli/constants/constants.ts
@@ -1,6 +1,7 @@
export const CREATE_MESSAGES = {
typeOfProject: "What type of project do you want to create?",
projectName: "What is your project named?",
contractName: "What will be the name of your new smart contract?",
chain: "Which blockchain do you want to use?",
framework: "What framework do you want to use?",
language: "What language do you want to use?",
Expand Down
4 changes: 4 additions & 0 deletions packages/cli/e2e/detect.test.ts
Expand Up @@ -19,6 +19,10 @@ describe("npx thirdweb detect", () => {
await create.waitForText(CREATE_MESSAGES.framework);
// select hardhat
await create.pressKey("enter");
await create.waitForText(CREATE_MESSAGES.contractName);
// set contract name
await create.writeText("Contract");
await create.pressKey("enter");
await create.waitForText(CREATE_MESSAGES.contract);
// select ERC721
await create.pressKey("arrowDown");
Expand Down
4 changes: 4 additions & 0 deletions packages/cli/src/cli/index.ts
Expand Up @@ -68,6 +68,10 @@ $$$$$$\\ $$$$$$$\\ $$\\ $$$$$$\\ $$$$$$$ |$$\\ $$\\ $$\\ $$$$$$\\ $$$$
"-t, --template [name]",
"A template to start your project from. You can use an template repository name from the official thirdweb-example org.",
)
.option(
"-c, --contract-name [name]",
"Name of the new smart contract to create",
)
.action(async (type, path, options) => {
await twCreate(type, path, options);
});
Expand Down

0 comments on commit 6e20d1f

Please sign in to comment.