@pump-inc/cli 0.0.4 → 0.0.6

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.
@@ -1,8 +1,7 @@
1
1
  const require_chunk = require('../../chunk-CbDLau6x.cjs');
2
2
  const require_fix_event_emitter = require('../../fix-event-emitter-uhRntilb.cjs');
3
- const require_base_command = require('../../base-command-GfDxcqx6.cjs');
4
- const require_api = require('../../api-XWM8zKbb.cjs');
5
- const require_api_client = require('../../api-client-bnV0ib_r.cjs');
3
+ const require_base_command = require('../../base-command-CQh0hr7U.cjs');
4
+ const require_api_client = require('../../api-client-Bt30TRdD.cjs');
6
5
  let __oclif_core = require("@oclif/core");
7
6
 
8
7
  //#region src/commands/project/create.ts
@@ -20,6 +19,7 @@ var ProjectCreate = class ProjectCreate extends require_base_command.BaseCommand
20
19
  "<%= config.bin %> <%= command.id %> \"My Project\" --json"
21
20
  ];
22
21
  static flags = {
22
+ ...require_base_command.BaseCommand.baseFlags,
23
23
  description: __oclif_core.Flags.string({
24
24
  char: "d",
25
25
  description: "Project description"
@@ -34,15 +34,11 @@ var ProjectCreate = class ProjectCreate extends require_base_command.BaseCommand
34
34
  ],
35
35
  default: "active"
36
36
  }),
37
- apikey: __oclif_core.Flags.string({
38
- char: "k",
39
- description: "API key to use for authentication (overrides API_KEY env variable)"
40
- }),
41
37
  json: __oclif_core.Flags.boolean({ description: "Output result as JSON" })
42
38
  };
43
39
  async run() {
44
40
  const { args, flags } = await this.parse(ProjectCreate);
45
- const apiClient = new require_api_client.ApiClient(require_api.getApiUrl(), flags.apikey || process.env.API_KEY);
41
+ const apiClient = new require_api_client.ApiClient(this.resolveApiUrl(flags), this.resolveApiKey(flags));
46
42
  const projectData = {
47
43
  name: args.name,
48
44
  ...flags.description && { description: flags.description },
package/dist/util/api.cjs CHANGED
@@ -1,3 +1,16 @@
1
- const require_api = require('../api-XWM8zKbb.cjs');
2
1
 
3
- exports.getApiUrl = require_api.getApiUrl;
2
+ //#region src/util/api.ts
3
+ const getApiUrl = () => {
4
+ let apiUrl = process.env.PUMP_API_URL;
5
+ const defaultUrl = "http://localhost:8000";
6
+ if (!apiUrl) apiUrl = defaultUrl;
7
+ try {
8
+ new URL(apiUrl);
9
+ } catch (error) {
10
+ if (error instanceof TypeError) throw new Error(`Invalid PUMP_API_URL format: ${apiUrl}. Please set a valid URL in the environment variable PUMP_API_URL.`);
11
+ }
12
+ return apiUrl;
13
+ };
14
+
15
+ //#endregion
16
+ exports.getApiUrl = getApiUrl;
@@ -1,4 +1,3 @@
1
- const require_base_command = require('../base-command-GfDxcqx6.cjs');
2
- require('../api-XWM8zKbb.cjs');
1
+ const require_base_command = require('../base-command-CQh0hr7U.cjs');
3
2
 
4
3
  exports.BaseCommand = require_base_command.BaseCommand;