@hiyve/cli 1.0.12 → 1.0.13
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.
- package/package.json +1 -1
- package/src/commands/list.js +21 -2
- package/src/commands/login.js +21 -2
- package/src/config.js +8 -0
package/package.json
CHANGED
package/src/commands/list.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import chalk from 'chalk';
|
|
8
8
|
import ora from 'ora';
|
|
9
|
-
import { getApiUrl } from '../config.js';
|
|
9
|
+
import { getApiUrl, isDevMode } from '../config.js';
|
|
10
10
|
import { getCurrentConfig } from '../utils/npmrc.js';
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -16,6 +16,9 @@ export async function list() {
|
|
|
16
16
|
console.log('');
|
|
17
17
|
console.log(chalk.cyan('Available @hiyve Packages'));
|
|
18
18
|
console.log(chalk.gray('─'.repeat(40)));
|
|
19
|
+
if (isDevMode()) {
|
|
20
|
+
console.log(chalk.yellow(' Mode: development (--dev)'));
|
|
21
|
+
}
|
|
19
22
|
console.log('');
|
|
20
23
|
|
|
21
24
|
// Get current config for auth token
|
|
@@ -41,6 +44,14 @@ export async function list() {
|
|
|
41
44
|
const error = await response.json().catch(() => ({ error: 'Unknown error' }));
|
|
42
45
|
console.log('');
|
|
43
46
|
console.log(chalk.red(` ${error.error || 'Failed to fetch packages'}`));
|
|
47
|
+
if (isDevMode()) {
|
|
48
|
+
console.log(chalk.gray(' You are using --dev mode (development registry).'));
|
|
49
|
+
console.log(chalk.gray(' If you meant to use production, run without --dev:'));
|
|
50
|
+
console.log(chalk.cyan(' npx @hiyve/cli list'));
|
|
51
|
+
} else {
|
|
52
|
+
console.log(chalk.gray(' If you meant to use the development registry, use --dev:'));
|
|
53
|
+
console.log(chalk.cyan(' npx @hiyve/cli --dev list'));
|
|
54
|
+
}
|
|
44
55
|
process.exit(1);
|
|
45
56
|
}
|
|
46
57
|
|
|
@@ -74,7 +85,15 @@ export async function list() {
|
|
|
74
85
|
spinner.fail('Connection failed');
|
|
75
86
|
console.log('');
|
|
76
87
|
console.log(chalk.red(` ${err.message}`));
|
|
77
|
-
console.log(chalk.gray(' Please check your internet connection'));
|
|
88
|
+
console.log(chalk.gray(' Please check your internet connection.'));
|
|
89
|
+
if (isDevMode()) {
|
|
90
|
+
console.log(chalk.gray(' You are using --dev mode (development registry).'));
|
|
91
|
+
console.log(chalk.gray(' If you meant to use production, run without --dev:'));
|
|
92
|
+
console.log(chalk.cyan(' npx @hiyve/cli list'));
|
|
93
|
+
} else {
|
|
94
|
+
console.log(chalk.gray(' If you meant to use the development registry, use --dev:'));
|
|
95
|
+
console.log(chalk.cyan(' npx @hiyve/cli --dev list'));
|
|
96
|
+
}
|
|
78
97
|
process.exit(1);
|
|
79
98
|
}
|
|
80
99
|
}
|
package/src/commands/login.js
CHANGED
|
@@ -8,7 +8,7 @@ import prompts from 'prompts';
|
|
|
8
8
|
import chalk from 'chalk';
|
|
9
9
|
import ora from 'ora';
|
|
10
10
|
import { configureNpmrc } from '../utils/npmrc.js';
|
|
11
|
-
import { getApiUrl, getRegistryUrl } from '../config.js';
|
|
11
|
+
import { getApiUrl, getRegistryUrl, isDevMode } from '../config.js';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Login to Hiyve and configure npm
|
|
@@ -21,6 +21,9 @@ export async function login(options) {
|
|
|
21
21
|
console.log('');
|
|
22
22
|
console.log(chalk.cyan('Hiyve SDK Authentication'));
|
|
23
23
|
console.log(chalk.gray('─'.repeat(40)));
|
|
24
|
+
if (isDevMode()) {
|
|
25
|
+
console.log(chalk.yellow(' Mode: development (--dev)'));
|
|
26
|
+
}
|
|
24
27
|
console.log('');
|
|
25
28
|
|
|
26
29
|
// Prompt for API key if not provided
|
|
@@ -86,6 +89,14 @@ export async function login(options) {
|
|
|
86
89
|
spinner.fail('API key verification failed');
|
|
87
90
|
console.log('');
|
|
88
91
|
console.log(chalk.red(` ${error.error || 'Invalid API key'}`));
|
|
92
|
+
if (isDevMode()) {
|
|
93
|
+
console.log(chalk.gray(' You are using --dev mode (development registry).'));
|
|
94
|
+
console.log(chalk.gray(' If you meant to use production, run without --dev:'));
|
|
95
|
+
console.log(chalk.cyan(' npx @hiyve/cli login'));
|
|
96
|
+
} else {
|
|
97
|
+
console.log(chalk.gray(' If you are using a test key (pk_test_*), use --dev mode:'));
|
|
98
|
+
console.log(chalk.cyan(' npx @hiyve/cli --dev login'));
|
|
99
|
+
}
|
|
89
100
|
process.exit(1);
|
|
90
101
|
}
|
|
91
102
|
|
|
@@ -99,7 +110,15 @@ export async function login(options) {
|
|
|
99
110
|
spinner.fail('Connection failed');
|
|
100
111
|
console.log('');
|
|
101
112
|
console.log(chalk.red(` ${err.message}`));
|
|
102
|
-
console.log(chalk.gray(' Please check your internet connection'));
|
|
113
|
+
console.log(chalk.gray(' Please check your internet connection.'));
|
|
114
|
+
if (isDevMode()) {
|
|
115
|
+
console.log(chalk.gray(' You are using --dev mode (development registry).'));
|
|
116
|
+
console.log(chalk.gray(' If you meant to use production, run without --dev:'));
|
|
117
|
+
console.log(chalk.cyan(' npx @hiyve/cli login'));
|
|
118
|
+
} else {
|
|
119
|
+
console.log(chalk.gray(' If you meant to use the development registry, use --dev:'));
|
|
120
|
+
console.log(chalk.cyan(' npx @hiyve/cli --dev login'));
|
|
121
|
+
}
|
|
103
122
|
process.exit(1);
|
|
104
123
|
}
|
|
105
124
|
|
package/src/config.js
CHANGED
|
@@ -34,6 +34,13 @@ export function getRegistryUrl() {
|
|
|
34
34
|
return _devMode ? DEV_API_URL : PROD_API_URL;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Check if dev mode is currently active.
|
|
39
|
+
*/
|
|
40
|
+
export function isDevMode() {
|
|
41
|
+
return _devMode;
|
|
42
|
+
}
|
|
43
|
+
|
|
37
44
|
// Backwards-compatible named export
|
|
38
45
|
export const REGISTRY_URL = PROD_API_URL;
|
|
39
46
|
|
|
@@ -42,4 +49,5 @@ export default {
|
|
|
42
49
|
getApiUrl,
|
|
43
50
|
getRegistryUrl,
|
|
44
51
|
setDevMode,
|
|
52
|
+
isDevMode,
|
|
45
53
|
};
|