@vercube/cli 0.0.39 → 0.0.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.mjs +61 -2
  2. package/package.json +7 -2
package/dist/index.mjs CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { defineCommand, runMain } from "citty";
3
3
  import { build, createDevServer, createVercube, watch } from "@vercube/devkit";
4
+ import { cliFetch } from "srvx/cli";
4
5
  import { existsSync } from "node:fs";
5
6
  import { consola } from "consola";
6
7
  import { colors } from "consola/utils";
@@ -11,7 +12,7 @@ import { hasTTY } from "std-env";
11
12
  import { x } from "tinyexec";
12
13
 
13
14
  //#region package.json
14
- var version = "0.0.39";
15
+ var version = "0.0.41";
15
16
 
16
17
  //#endregion
17
18
  //#region src/commands/build.ts
@@ -44,6 +45,63 @@ const devCommand = defineCommand({
44
45
  }
45
46
  });
46
47
 
48
+ //#endregion
49
+ //#region src/commands/fetch.ts
50
+ const fetchCommand = defineCommand({
51
+ meta: {
52
+ name: "fetch",
53
+ description: "Fetch a request from the application"
54
+ },
55
+ args: {
56
+ url: {
57
+ type: "positional",
58
+ description: "URL to fetch",
59
+ default: "/"
60
+ },
61
+ entry: {
62
+ type: "string",
63
+ description: "Entry point for the application",
64
+ default: "index.mjs"
65
+ },
66
+ method: {
67
+ type: "string",
68
+ description: "HTTP method (default: GET, or POST if body is provided)",
69
+ default: "GET",
70
+ alias: "X",
71
+ valueHint: "GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS"
72
+ },
73
+ headers: {
74
+ type: "string",
75
+ description: "Add header (format: \"Name: Value, Name: Value, ...\")",
76
+ alias: "H"
77
+ },
78
+ data: {
79
+ type: "string",
80
+ description: "Request body (use @- for stdin, @file for file)",
81
+ alias: "d"
82
+ },
83
+ verbose: {
84
+ type: "boolean",
85
+ description: "Show request and response headers",
86
+ alias: "v",
87
+ default: false
88
+ }
89
+ },
90
+ async run(ctx) {
91
+ const app = await createVercube({ build: { dts: false } });
92
+ await build(app);
93
+ await cliFetch({
94
+ verbose: ctx.args.verbose,
95
+ dir: app.config.build?.output?.dir ?? "dist",
96
+ entry: ctx.args.entry,
97
+ url: ctx.args.url,
98
+ method: ctx.args.method,
99
+ headers: ctx.args.headers?.split(",") ?? [],
100
+ data: ctx.args.data
101
+ });
102
+ }
103
+ });
104
+
47
105
  //#endregion
48
106
  //#region src/utils/logo.ts
49
107
  const startColor = {
@@ -228,7 +286,8 @@ runMain(defineCommand({
228
286
  subCommands: {
229
287
  build: buildCommand,
230
288
  dev: devCommand,
231
- init: initCommand
289
+ init: initCommand,
290
+ fetch: fetchCommand
232
291
  }
233
292
  }));
234
293
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercube/cli",
3
- "version": "0.0.39",
3
+ "version": "0.0.41",
4
4
  "description": "CLI module for Vercube framework",
5
5
  "repository": {
6
6
  "type": "git",
@@ -31,10 +31,15 @@
31
31
  "nypm": "0.6.4",
32
32
  "pathe": "2.0.3",
33
33
  "std-env": "3.10.0",
34
+ "srvx": "npm:srvx-nightly",
34
35
  "tinyexec": "1.0.2",
35
- "@vercube/devkit": "0.0.39"
36
+ "@vercube/devkit": "0.0.41",
37
+ "@vercube/logger": "0.0.41"
36
38
  },
37
39
  "publishConfig": {
38
40
  "access": "public"
41
+ },
42
+ "scripts": {
43
+ "build": "tsdown --config ../../tsdown.config.ts --config-loader=unrun"
39
44
  }
40
45
  }