Skip to content

Commit abe86e7

Browse files
authored
feat: rebuild the cli package (#207)
## Summary by Sourcery Rebuild the CLI package by removing numerous commands and libraries, and enhance the utils package with new environment management features. Update the CI workflow to stop publishing certain SDK packages. New Features: - Introduce environment management utilities with functions to load and write environment variables using dotenvx, including validation with a new DotEnv schema. Enhancements: - Enhance the utils package by exporting new modules for environment management and filesystem operations. CI: - Remove the publishing steps for the SDK Next and SDK Config packages from the CI workflow.
1 parent 9c589b1 commit abe86e7

File tree

107 files changed

+865
-4332
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+865
-4332
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -172,16 +172,6 @@ jobs:
172172
strategy: all
173173
tag: ${{ env.TAG }}
174174

175-
- name: Publish SDK Next package
176-
uses: JS-DevTools/npm-publish@v3
177-
with:
178-
token: ${{ secrets.NPM_TOKEN }}
179-
package: ./packages/next/package.json
180-
access: public
181-
provenance: false
182-
strategy: all
183-
tag: ${{ env.TAG }}
184-
185175
- name: Publish SDK Cli package
186176
uses: JS-DevTools/npm-publish@v3
187177
with:
@@ -192,16 +182,6 @@ jobs:
192182
strategy: all
193183
tag: ${{ env.TAG }}
194184

195-
- name: Publish SDK Config package
196-
uses: JS-DevTools/npm-publish@v3
197-
with:
198-
token: ${{ secrets.NPM_TOKEN }}
199-
package: ./packages/config/package.json
200-
access: public
201-
provenance: false
202-
strategy: all
203-
tag: ${{ env.TAG }}
204-
205185
- name: Create or update PR comment
206186
if: ${{ github.event_name == 'pull_request' }}
207187
uses: taoliujun/action-unique-comment@v1
@@ -212,8 +192,6 @@ jobs:
212192
| Package | Version |
213193
| ------- | -------------------- |
214194
| SDK Cli | `@settlemint/sdk-cli@${{ env.VERSION }}` |
215-
| SDK Config | `@settlemint/sdk-config@${{ env.VERSION }}` |
216-
| SDK Next | `@settlemint/sdk-next@${{ env.VERSION }}` |
217195
| SDK The Graph | `@settlemint/sdk-thegraph@${{ env.VERSION }}` |
218196
| SDK Hasura | `@settlemint/sdk-hasura@${{ env.VERSION }}` |
219197
| SDK JS | `@settlemint/sdk-js@${{ env.VERSION }}` |
@@ -225,5 +203,5 @@ jobs:
225203
with:
226204
commit_message: "chore: update package versions [skip ci]"
227205
branch: main
228-
file_pattern: 'package.json schema.graphql'
206+
file_pattern: 'package.json **/package.json **/schema.graphql'
229207

.vscode/extensions.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"biomejs.biome",
55
"graphql.vscode-graphql-syntax",
66
"inlang.vs-code-extension",
7-
"oven.bun-vscode"
7+
"oven.bun-vscode",
8+
"dotenv.dotenv-vscode"
89
]
910
}

bun.lockb

-436 KB
Binary file not shown.

packages/cli/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.env*

packages/cli/package.json

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -45,29 +45,16 @@
4545
"test:coverage": "bun test --coverage",
4646
"typecheck": "tsc --noEmit"
4747
},
48-
"devDependencies": {
49-
"@types/cross-spawn": "^6",
50-
"@types/npmcli__package-json": "^4"
51-
},
48+
"devDependencies": {},
5249
"dependencies": {
5350
"@commander-js/extra-typings": "^12",
54-
"@graphql-codegen/cli": "^5",
55-
"@graphql-codegen/schema-ast": "^4",
56-
"@graphql-codegen/typescript": "^4",
57-
"@graphql-codegen/typescript-graphql-request": "^6",
58-
"@graphql-codegen/typescript-operations": "^4",
59-
"@inquirer/prompts": "^6.0.0",
60-
"@npmcli/package-json": "^6.0.0",
61-
"@settlemint/sdk-config": "workspace:*",
62-
"commander": "^12",
63-
"cross-spawn": "^7",
64-
"dotenv": "^16",
65-
"giget": "^1",
66-
"graphql": "^16",
67-
"openapi-typescript": "^7",
68-
"ts-deepmerge": "^7",
69-
"viem": "^2",
70-
"yocto-spinner": "^0.1",
51+
"@inquirer/confirm": "^4",
52+
"@inquirer/input": "^3",
53+
"@inquirer/password": "^3",
54+
"@inquirer/select": "^3",
55+
"@settlemint/sdk-js": "workspace:*",
56+
"@settlemint/sdk-utils": "workspace:*",
57+
"is-in-ci": "^1.0.0",
7158
"yoctocolors": "^2"
7259
},
7360
"peerDependencies": {},

packages/cli/src/cli.ts

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,12 @@
1212
* ```
1313
*/
1414

15-
import { codegenCommand } from "@/commands/codegen";
1615
import { connectCommand } from "@/commands/connect";
17-
import { createCommand } from "@/commands/create";
1816
import { Command } from "@commander-js/extra-typings";
19-
import dotenv from "dotenv";
17+
import { ascii } from "@settlemint/sdk-utils/terminal";
2018
import pkg from "../package.json";
21-
import { customDeploymentCommand } from "./commands/custom-deployment";
22-
import { forgeCommand } from "./commands/forge";
23-
import { printCancel } from "./lib/cli-message";
2419

25-
// Load environment variables from .env.local and .env files
26-
// Override existing env vars with those found in the files
27-
dotenv.config({
28-
path: [
29-
...(process.env.NODE_ENV !== "production" ? [".env.development", "../.env.development"] : []),
30-
".env.local",
31-
"../.env.local",
32-
".env",
33-
"../.env",
34-
],
35-
override: true,
36-
});
20+
ascii();
3721

3822
/**
3923
* The main Command instance for the SettleMint CLI.
@@ -53,10 +37,6 @@ sdkcli
5337

5438
// Add commands to the CLI
5539
sdkcli.addCommand(connectCommand());
56-
sdkcli.addCommand(codegenCommand());
57-
sdkcli.addCommand(createCommand());
58-
sdkcli.addCommand(forgeCommand());
59-
sdkcli.addCommand(customDeploymentCommand());
6040

6141
/**
6242
* Parses command line arguments and executes the appropriate command.
@@ -73,12 +53,4 @@ sdkcli.addCommand(customDeploymentCommand());
7353
* });
7454
* ```
7555
*/
76-
sdkcli.parseAsync(process.argv).catch(async (reason) => {
77-
// If an error occurs:
78-
// 1. Cancel the current operation
79-
printCancel("An unexpected error occurred. Please report it as a bug:");
80-
// 2. Log the error to the console
81-
console.error(reason);
82-
// 3. Exit the process with an error code
83-
process.exit(1);
84-
});
56+
sdkcli.parseAsync(process.argv);

packages/cli/src/commands/codegen.ts

Lines changed: 0 additions & 200 deletions
This file was deleted.

0 commit comments

Comments
 (0)