From 87878fc95c6f3b8fa31625a59849b3779f841547 Mon Sep 17 00:00:00 2001 From: adam-maj Date: Thu, 15 Sep 2022 16:33:14 -0700 Subject: [PATCH 1/3] Reorder CLI commands --- packages/cli/README.md | 114 ++-------------------------------- packages/cli/package.json | 2 +- packages/cli/src/cli/index.ts | 90 +++++++++++++-------------- 3 files changed, 51 insertions(+), 155 deletions(-) diff --git a/packages/cli/README.md b/packages/cli/README.md index 46c046bd965..3256d450c1b 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -1,110 +1,6 @@ -

-
- -
-

-

thirdweb CLI

-

-npm version -Join our Discord! +# thirdweb cli -

-

Publish and deploy smart contracts without dealing with private keys

-
- -## Getting started - -The thirdweb CLI is your one-stop-shop for publishing custom contracts for your team or the world to use. The CLI uploads all necessary data to decentralized storage and makes it available to deploy via the thirdweb sdk or thirdweb dashboard. - -This brings all the capabilities of thirdweb to your own custom contracts. - -## Deploying your contract - -```shell -npx thirdweb@latest deploy -``` - -This command will: - -- auto-detect any contracts in your project -- compile your project -- Upload ABIs to IPFS -- Open the deploy flow in your thirdweb dashboard in a browser - -From the thirdweb dashboard, you can review and deploy your contracts on any supported EVM chain. - -Deploying contracts this way gives you access to: - -- auto generated SDKs for react, node, python, go -- dashboards to manage, monitor and interact with your contracts - -## Releasing your contract - -```shell -npx thirdweb@latest release -``` - -Creates an official release of your contract, along with: - -- author attribution -- contract information -- instructions on how to use and what it's for -- versioning -- release notes - -Creating releases this way gives you shareable URL to let others to deploy your contracts in one click. It lets you manage released versions and get attribution for deployed contracts. Contract releases are registered on-chain (Polygon) and IPFS, for free (gasless). - -Deploying released contracts give deployers access to automatic SDKs to integrate into their app and dashboards to manage and monitor the deployed contracts. - -## Detecting contract extensions - -```shell -npx thirdweb@latest detect -``` - -As you're developing your contracts, you may want to implement [Extensions](https://portal.thirdweb.com/extensions) to unlock functionality on the SDKs (ie. nft minting with automatic upload to IPFS) and the dashboard (ie. generated UI to manage permissions). This command will show what extensions were detected on your contract, unlocking the corresponding functionality on the SDKs and dashboard. - ---- - -## Global installation - -We recommend using npx to always get the latest version. Alternatively, you can install the CLI as a global command on your machine: - -```shell -npm i -g @thirdweb-dev/cli -``` - ---- - -## Supported projects - -To publish, you need to be in a directory that contains a project which the CLI is compatible -with. The projects we support so far: - -- hardhat -- forge -- truffle -- solc - ---- - -## Running the examples - -Clone the repo and run this command after installing the CLI tool: - -```bash -$ cd examples/hardhat -$ npx thirdweb@latest release -``` - -## Local Development - -The simplest way to work on the CLI locally is to: - -1. Install the package locally -2. Run the `build:watch` command to compile any changes in realtime - -```bash -$ npm install -g ./ -$ yarn run build:watch -``` + This is a proxied package of the `@thirdweb-dev/cli` for convenient usage with `npx thirdweb`. + + You can find the actual package [here](https://www.npmjs.com/package/@thirdweb-dev/cli). + \ No newline at end of file diff --git a/packages/cli/package.json b/packages/cli/package.json index 1057e80939a..c8f49325853 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -81,4 +81,4 @@ "sourcemap": true, "clean": true } -} +} \ No newline at end of file diff --git a/packages/cli/src/cli/index.ts b/packages/cli/src/cli/index.ts index f03790621f9..dbb8bef681c 100644 --- a/packages/cli/src/cli/index.ts +++ b/packages/cli/src/cli/index.ts @@ -39,31 +39,34 @@ $$$$$$\\ $$$$$$$\\ $$\\ $$$$$$\\ $$$$$$$ |$$\\ $$\\ $$\\ $$$$$$\\ $$$$ .version(cliVersion, "-v, --version"); program - .command("detect") + .command("create") .description( - "Compile contracts and detect implemented thirdweb contract extensions", + "Create a thirdweb app from any of our official templates. Checkout some examples you can use here: https://github.com/thirdweb-example/", ) - .option("-p, --path ", "path to project", ".") - .option("-d, --debug", "show debug logs") - .option("-a, --all", "run detection on all contracts") - .action(async (options) => { - await detectExtensions(options); - }); - - program - .command("release") - .description( - "Release contracts, making them available for others to deploy and unlocking SDKs, Dashboards and Analytics.", + .option("--app", `Create a thirdweb app.`) + .option("--contract", `Create a thirdweb contracts project.`) + .option("--ts, --typescript", `Initialize as a TypeScript project.`) + .option("--js, --javascript", `Initialize as a JavaScript project.`) + .option("--forge", `Initialize as a Forge project.`) + .option("--hardhat", `Initialize as a Hardhat project.`) + .option("--cra", `Initialize as a Create React App project.`) + .option("--next", `Initialize as a Next.js project.`) + .option("--vite", `Initialize as a Vite project.`) + .option( + "--use-npm", + `Explicitly tell the CLI to bootstrap the app using npm`, + ) + .option( + "--use-pnpm", + `Explicitly tell the CLI to bootstrap the app using pnpm`, + ) + .option("--framework [name]", `The preferred framework.`) + .option( + "-t, --template [name]", + `A template to start your project from. You can use an template repository name from the official thirdweb-example org.`, ) - .option("-p, --path ", "path to project", ".") - .option("--dry-run", "dry run (skip actually publishing)") - .option("-d, --debug", "show debug logs") - .option("--ci", "Continuous Integration mode") .action(async (options) => { - const url = await processProject(options, "release"); - info(`Open this link to release your contracts:`); - logger.info(chalk.blueBright(url.toString())); - open(url.toString()); + await twCreate(options); }); program @@ -111,34 +114,31 @@ $$$$$$\\ $$$$$$$\\ $$\\ $$$$$$\\ $$$$$$$ |$$\\ $$\\ $$\\ $$$$$$\\ $$$$ }); program - .command("create") + .command("release") .description( - "Create a thirdweb app from any of our official templates. Checkout some examples you can use here: https://github.com/thirdweb-example/", - ) - .option("--app", `Create a thirdweb app.`) - .option("--contract", `Create a thirdweb contracts project.`) - .option("--ts, --typescript", `Initialize as a TypeScript project.`) - .option("--js, --javascript", `Initialize as a JavaScript project.`) - .option("--forge", `Initialize as a Forge project.`) - .option("--hardhat", `Initialize as a Hardhat project.`) - .option("--cra", `Initialize as a Create React App project.`) - .option("--next", `Initialize as a Next.js project.`) - .option("--vite", `Initialize as a Vite project.`) - .option( - "--use-npm", - `Explicitly tell the CLI to bootstrap the app using npm`, - ) - .option( - "--use-pnpm", - `Explicitly tell the CLI to bootstrap the app using pnpm`, + "Release contracts, making them available for others to deploy and unlocking SDKs, Dashboards and Analytics.", ) - .option("--framework [name]", `The preferred framework.`) - .option( - "-t, --template [name]", - `A template to start your project from. You can use an template repository name from the official thirdweb-example org.`, + .option("-p, --path ", "path to project", ".") + .option("--dry-run", "dry run (skip actually publishing)") + .option("-d, --debug", "show debug logs") + .option("--ci", "Continuous Integration mode") + .action(async (options) => { + const url = await processProject(options, "release"); + info(`Open this link to release your contracts:`); + logger.info(chalk.blueBright(url.toString())); + open(url.toString()); + }); + + program + .command("detect") + .description( + "Compile contracts and detect implemented thirdweb contract extensions", ) + .option("-p, --path ", "path to project", ".") + .option("-d, --debug", "show debug logs") + .option("-a, --all", "run detection on all contracts") .action(async (options) => { - await twCreate(options); + await detectExtensions(options); }); program From e021ca623a8a3a48a87466203c48fbccccd34cde Mon Sep 17 00:00:00 2001 From: adam-maj Date: Thu, 15 Sep 2022 16:35:15 -0700 Subject: [PATCH 2/3] Update README.md back --- packages/cli/README.md | 114 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 109 insertions(+), 5 deletions(-) diff --git a/packages/cli/README.md b/packages/cli/README.md index 3256d450c1b..46c046bd965 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -1,6 +1,110 @@ -# thirdweb cli +

+
+ +
+

+

thirdweb CLI

+

+npm version +Join our Discord! - This is a proxied package of the `@thirdweb-dev/cli` for convenient usage with `npx thirdweb`. - - You can find the actual package [here](https://www.npmjs.com/package/@thirdweb-dev/cli). - \ No newline at end of file +

+

Publish and deploy smart contracts without dealing with private keys

+
+ +## Getting started + +The thirdweb CLI is your one-stop-shop for publishing custom contracts for your team or the world to use. The CLI uploads all necessary data to decentralized storage and makes it available to deploy via the thirdweb sdk or thirdweb dashboard. + +This brings all the capabilities of thirdweb to your own custom contracts. + +## Deploying your contract + +```shell +npx thirdweb@latest deploy +``` + +This command will: + +- auto-detect any contracts in your project +- compile your project +- Upload ABIs to IPFS +- Open the deploy flow in your thirdweb dashboard in a browser + +From the thirdweb dashboard, you can review and deploy your contracts on any supported EVM chain. + +Deploying contracts this way gives you access to: + +- auto generated SDKs for react, node, python, go +- dashboards to manage, monitor and interact with your contracts + +## Releasing your contract + +```shell +npx thirdweb@latest release +``` + +Creates an official release of your contract, along with: + +- author attribution +- contract information +- instructions on how to use and what it's for +- versioning +- release notes + +Creating releases this way gives you shareable URL to let others to deploy your contracts in one click. It lets you manage released versions and get attribution for deployed contracts. Contract releases are registered on-chain (Polygon) and IPFS, for free (gasless). + +Deploying released contracts give deployers access to automatic SDKs to integrate into their app and dashboards to manage and monitor the deployed contracts. + +## Detecting contract extensions + +```shell +npx thirdweb@latest detect +``` + +As you're developing your contracts, you may want to implement [Extensions](https://portal.thirdweb.com/extensions) to unlock functionality on the SDKs (ie. nft minting with automatic upload to IPFS) and the dashboard (ie. generated UI to manage permissions). This command will show what extensions were detected on your contract, unlocking the corresponding functionality on the SDKs and dashboard. + +--- + +## Global installation + +We recommend using npx to always get the latest version. Alternatively, you can install the CLI as a global command on your machine: + +```shell +npm i -g @thirdweb-dev/cli +``` + +--- + +## Supported projects + +To publish, you need to be in a directory that contains a project which the CLI is compatible +with. The projects we support so far: + +- hardhat +- forge +- truffle +- solc + +--- + +## Running the examples + +Clone the repo and run this command after installing the CLI tool: + +```bash +$ cd examples/hardhat +$ npx thirdweb@latest release +``` + +## Local Development + +The simplest way to work on the CLI locally is to: + +1. Install the package locally +2. Run the `build:watch` command to compile any changes in realtime + +```bash +$ npm install -g ./ +$ yarn run build:watch +``` From bee6d7fdb8de49c2070932b57e27671a096ccbf1 Mon Sep 17 00:00:00 2001 From: adam-maj Date: Thu, 15 Sep 2022 16:36:27 -0700 Subject: [PATCH 3/3] Add changeset --- .changeset/tame-ladybugs-hug.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/tame-ladybugs-hug.md diff --git a/.changeset/tame-ladybugs-hug.md b/.changeset/tame-ladybugs-hug.md new file mode 100644 index 00000000000..bea1353b635 --- /dev/null +++ b/.changeset/tame-ladybugs-hug.md @@ -0,0 +1,5 @@ +--- +"thirdweb": patch +--- + +Update ordering of commands in npx thirdweb