@regressionproof/cli 0.7.2 → 0.7.4
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/build/commands/invite/CreateInvite.js +3 -3
- package/build/config/ConfigManager.d.ts +9 -0
- package/build/config/ConfigManager.js +15 -0
- package/build/esm/commands/invite/CreateInvite.js +3 -3
- package/build/esm/config/ConfigManager.d.ts +9 -0
- package/build/esm/config/ConfigManager.js +16 -0
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import ConfigManager from '../../config/ConfigManager.js';
|
|
2
|
-
import {
|
|
2
|
+
import { toSlug } from '../../utilities/slug.js';
|
|
3
3
|
const API_URL = process.env.REGRESSIONPROOF_API_URL ?? 'https://api.regressionproof.ai';
|
|
4
4
|
class InviteCreator {
|
|
5
5
|
configManager;
|
|
@@ -29,9 +29,9 @@ class InviteCreator {
|
|
|
29
29
|
}
|
|
30
30
|
resolveProjectName(projectNameArg) {
|
|
31
31
|
const provided = projectNameArg ? toSlug(projectNameArg) : '';
|
|
32
|
-
const name = provided ||
|
|
32
|
+
const name = provided || this.configManager.getLocalProjectName();
|
|
33
33
|
if (!name) {
|
|
34
|
-
throw new Error('Project name is required. Provide it explicitly or ensure
|
|
34
|
+
throw new Error('Project name is required. Provide it explicitly or ensure .regressionproof.json exists.');
|
|
35
35
|
}
|
|
36
36
|
return name;
|
|
37
37
|
}
|
|
@@ -5,6 +5,8 @@ export default class ConfigManager {
|
|
|
5
5
|
saveCredentials(projectName: string, credentials: Credentials): void;
|
|
6
6
|
loadCredentials(projectName: string): Credentials | null;
|
|
7
7
|
writeLocalConfig(projectName: string, url: string): void;
|
|
8
|
+
readLocalConfig(cwd?: string): LocalConfig | null;
|
|
9
|
+
getLocalProjectName(cwd?: string): string | null;
|
|
8
10
|
}
|
|
9
11
|
export interface Credentials {
|
|
10
12
|
url: string;
|
|
@@ -16,3 +18,10 @@ export interface ProjectConfig {
|
|
|
16
18
|
token: string;
|
|
17
19
|
};
|
|
18
20
|
}
|
|
21
|
+
export interface LocalConfig {
|
|
22
|
+
version?: string;
|
|
23
|
+
projectName?: string;
|
|
24
|
+
remote?: {
|
|
25
|
+
url?: string;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
@@ -44,4 +44,19 @@ export default class ConfigManager {
|
|
|
44
44
|
};
|
|
45
45
|
fs.writeFileSync(configPath, JSON.stringify(payload, null, 2));
|
|
46
46
|
}
|
|
47
|
+
readLocalConfig(cwd = process.cwd()) {
|
|
48
|
+
const configPath = path.join(cwd, '.regressionproof.json');
|
|
49
|
+
if (!fs.existsSync(configPath)) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
try {
|
|
53
|
+
return JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
getLocalProjectName(cwd = process.cwd()) {
|
|
60
|
+
return this.readLocalConfig(cwd)?.projectName ?? null;
|
|
61
|
+
}
|
|
47
62
|
}
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
var _a;
|
|
11
11
|
import ConfigManager from '../../config/ConfigManager.js.js';
|
|
12
|
-
import {
|
|
12
|
+
import { toSlug } from '../../utilities/slug.js.js';
|
|
13
13
|
const API_URL = (_a = process.env.REGRESSIONPROOF_API_URL) !== null && _a !== void 0 ? _a : 'https://api.regressionproof.ai';
|
|
14
14
|
class InviteCreator {
|
|
15
15
|
constructor(configManager = new ConfigManager()) {
|
|
@@ -40,9 +40,9 @@ class InviteCreator {
|
|
|
40
40
|
}
|
|
41
41
|
resolveProjectName(projectNameArg) {
|
|
42
42
|
const provided = projectNameArg ? toSlug(projectNameArg) : '';
|
|
43
|
-
const name = provided ||
|
|
43
|
+
const name = provided || this.configManager.getLocalProjectName();
|
|
44
44
|
if (!name) {
|
|
45
|
-
throw new Error('Project name is required. Provide it explicitly or ensure
|
|
45
|
+
throw new Error('Project name is required. Provide it explicitly or ensure .regressionproof.json exists.');
|
|
46
46
|
}
|
|
47
47
|
return name;
|
|
48
48
|
}
|
|
@@ -5,6 +5,8 @@ export default class ConfigManager {
|
|
|
5
5
|
saveCredentials(projectName: string, credentials: Credentials): void;
|
|
6
6
|
loadCredentials(projectName: string): Credentials | null;
|
|
7
7
|
writeLocalConfig(projectName: string, url: string): void;
|
|
8
|
+
readLocalConfig(cwd?: string): LocalConfig | null;
|
|
9
|
+
getLocalProjectName(cwd?: string): string | null;
|
|
8
10
|
}
|
|
9
11
|
export interface Credentials {
|
|
10
12
|
url: string;
|
|
@@ -16,3 +18,10 @@ export interface ProjectConfig {
|
|
|
16
18
|
token: string;
|
|
17
19
|
};
|
|
18
20
|
}
|
|
21
|
+
export interface LocalConfig {
|
|
22
|
+
version?: string;
|
|
23
|
+
projectName?: string;
|
|
24
|
+
remote?: {
|
|
25
|
+
url?: string;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
@@ -43,4 +43,20 @@ export default class ConfigManager {
|
|
|
43
43
|
};
|
|
44
44
|
fs.writeFileSync(configPath, JSON.stringify(payload, null, 2));
|
|
45
45
|
}
|
|
46
|
+
readLocalConfig(cwd = process.cwd()) {
|
|
47
|
+
const configPath = path.join(cwd, '.regressionproof.json');
|
|
48
|
+
if (!fs.existsSync(configPath)) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
try {
|
|
52
|
+
return JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
|
53
|
+
}
|
|
54
|
+
catch (_a) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
getLocalProjectName(cwd = process.cwd()) {
|
|
59
|
+
var _a, _b;
|
|
60
|
+
return (_b = (_a = this.readLocalConfig(cwd)) === null || _a === void 0 ? void 0 : _a.projectName) !== null && _b !== void 0 ? _b : null;
|
|
61
|
+
}
|
|
46
62
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@regressionproof/cli",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.4",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"watch.tsc": "tsc -w"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@regressionproof/client": "^0.7.
|
|
41
|
+
"@regressionproof/client": "^0.7.4",
|
|
42
42
|
"dotenv": "^17.2.3",
|
|
43
43
|
"ink": "^5.1.0",
|
|
44
44
|
"ink-big-text": "^2.0.0",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"^#spruce/(.*)$": "<rootDir>/build/.spruce/$1"
|
|
85
85
|
}
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "24239d3b750c632947ef71bccb64129c29725250"
|
|
88
88
|
}
|