@regressionproof/cli 0.4.1 → 0.5.0
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/AcceptInvite.js +1 -14
- package/build/components/Init.js +2 -16
- package/build/components/Init.tsx +2 -17
- package/build/config/ConfigManager.d.ts +1 -0
- package/build/config/ConfigManager.js +12 -0
- package/build/esm/commands/invite/AcceptInvite.js +1 -14
- package/build/esm/components/Init.js +2 -16
- package/build/esm/config/ConfigManager.d.ts +1 -0
- package/build/esm/config/ConfigManager.js +12 -0
- package/package.json +3 -3
|
@@ -3,7 +3,6 @@ import fs from 'fs';
|
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import ConfigManager from '../../config/ConfigManager.js';
|
|
5
5
|
import { toSlug } from '../../utilities/slug.js';
|
|
6
|
-
import { getCliVersion } from '../../utilities/version.js';
|
|
7
6
|
const API_URL = process.env.REGRESSIONPROOF_API_URL ?? 'https://api.regressionproof.ai';
|
|
8
7
|
export default async function acceptInvite(token) {
|
|
9
8
|
const response = await fetch(`${API_URL}/invites/accept`, {
|
|
@@ -24,7 +23,7 @@ export default async function acceptInvite(token) {
|
|
|
24
23
|
url: data.url,
|
|
25
24
|
token: data.token,
|
|
26
25
|
});
|
|
27
|
-
writeLocalConfig(
|
|
26
|
+
configManager.writeLocalConfig(projectName, data.url);
|
|
28
27
|
ensureMirrorCloned(configManager.getConfigDir(projectName), data.url, data.token);
|
|
29
28
|
console.log('Project URL:', data.url);
|
|
30
29
|
console.log('Project token:', data.token);
|
|
@@ -37,18 +36,6 @@ function deriveProjectNameFromUrl(url) {
|
|
|
37
36
|
}
|
|
38
37
|
return name;
|
|
39
38
|
}
|
|
40
|
-
function writeLocalConfig(cwd, projectName, url) {
|
|
41
|
-
const configPath = path.join(cwd, '.regressionproof.json');
|
|
42
|
-
const version = getCliVersion();
|
|
43
|
-
const payload = {
|
|
44
|
-
version,
|
|
45
|
-
projectName,
|
|
46
|
-
remote: {
|
|
47
|
-
url,
|
|
48
|
-
},
|
|
49
|
-
};
|
|
50
|
-
fs.writeFileSync(configPath, JSON.stringify(payload, null, 2));
|
|
51
|
-
}
|
|
52
39
|
function ensureMirrorCloned(configDir, url, token) {
|
|
53
40
|
const mirrorPath = path.join(configDir, 'mirror');
|
|
54
41
|
if (fs.existsSync(mirrorPath)) {
|
package/build/components/Init.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { spawnSync } from 'node:child_process';
|
|
2
|
-
import { existsSync, readFileSync
|
|
3
|
-
import path from 'node:path';
|
|
2
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
4
3
|
import { buildRegressionProofClient } from '@regressionproof/client';
|
|
5
4
|
import { Box, Text, useApp } from 'ink';
|
|
6
5
|
import BigText from 'ink-big-text';
|
|
@@ -9,7 +8,6 @@ import React from 'react';
|
|
|
9
8
|
import ConfigManager from '../config/ConfigManager.js';
|
|
10
9
|
import JestConfigurator from '../jest/JestConfigurator.js';
|
|
11
10
|
import { getRepoNameFromGit, toSlug } from '../utilities/slug.js';
|
|
12
|
-
import { getCliVersion } from '../utilities/version.js';
|
|
13
11
|
const API_URL = process.env.REGRESSIONPROOF_API_URL ?? 'https://api.regressionproof.ai';
|
|
14
12
|
class InitComponent extends React.Component {
|
|
15
13
|
checkTimeout = null;
|
|
@@ -116,7 +114,7 @@ class InitComponent extends React.Component {
|
|
|
116
114
|
const credentials = await this.apiClient.registerProject({ name });
|
|
117
115
|
this.setState({ credentials });
|
|
118
116
|
this.configManager.saveCredentials(name, credentials);
|
|
119
|
-
this.writeLocalConfig(name, credentials.url);
|
|
117
|
+
this.configManager.writeLocalConfig(name, credentials.url);
|
|
120
118
|
await this.installAndConfigure();
|
|
121
119
|
}
|
|
122
120
|
catch (err) {
|
|
@@ -181,18 +179,6 @@ class InitComponent extends React.Component {
|
|
|
181
179
|
}
|
|
182
180
|
return { success: true };
|
|
183
181
|
}
|
|
184
|
-
writeLocalConfig(projectName, url) {
|
|
185
|
-
const configPath = path.join(process.cwd(), '.regressionproof.json');
|
|
186
|
-
const version = getCliVersion();
|
|
187
|
-
const payload = {
|
|
188
|
-
version,
|
|
189
|
-
projectName,
|
|
190
|
-
remote: {
|
|
191
|
-
url,
|
|
192
|
-
},
|
|
193
|
-
};
|
|
194
|
-
writeFileSync(configPath, JSON.stringify(payload, null, 2));
|
|
195
|
-
}
|
|
196
182
|
getPackageManager() {
|
|
197
183
|
if (existsSync('pnpm-lock.yaml')) {
|
|
198
184
|
return { command: 'pnpm', args: ['add', '-D'] };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { spawnSync } from 'node:child_process'
|
|
2
|
-
import { existsSync, readFileSync
|
|
3
|
-
import path from 'node:path'
|
|
2
|
+
import { existsSync, readFileSync } from 'node:fs'
|
|
4
3
|
import type { RegressionProofClient } from '@regressionproof/client'
|
|
5
4
|
import { buildRegressionProofClient } from '@regressionproof/client'
|
|
6
5
|
import { Box, Text, useApp } from 'ink'
|
|
@@ -10,7 +9,6 @@ import React from 'react'
|
|
|
10
9
|
import ConfigManager, { Credentials } from '../config/ConfigManager.js'
|
|
11
10
|
import JestConfigurator, { JestConfigResult } from '../jest/JestConfigurator.js'
|
|
12
11
|
import { getRepoNameFromGit, toSlug } from '../utilities/slug.js'
|
|
13
|
-
import { getCliVersion } from '../utilities/version.js'
|
|
14
12
|
|
|
15
13
|
const API_URL =
|
|
16
14
|
process.env.REGRESSIONPROOF_API_URL ?? 'https://api.regressionproof.ai'
|
|
@@ -137,7 +135,7 @@ class InitComponent extends React.Component<Props, State> {
|
|
|
137
135
|
this.setState({ credentials })
|
|
138
136
|
|
|
139
137
|
this.configManager.saveCredentials(name, credentials)
|
|
140
|
-
this.writeLocalConfig(name, credentials.url)
|
|
138
|
+
this.configManager.writeLocalConfig(name, credentials.url)
|
|
141
139
|
await this.installAndConfigure()
|
|
142
140
|
} catch (err) {
|
|
143
141
|
this.setState({
|
|
@@ -228,19 +226,6 @@ class InitComponent extends React.Component<Props, State> {
|
|
|
228
226
|
return { success: true }
|
|
229
227
|
}
|
|
230
228
|
|
|
231
|
-
private writeLocalConfig(projectName: string, url: string): void {
|
|
232
|
-
const configPath = path.join(process.cwd(), '.regressionproof.json')
|
|
233
|
-
const version = getCliVersion()
|
|
234
|
-
const payload = {
|
|
235
|
-
version,
|
|
236
|
-
projectName,
|
|
237
|
-
remote: {
|
|
238
|
-
url,
|
|
239
|
-
},
|
|
240
|
-
}
|
|
241
|
-
writeFileSync(configPath, JSON.stringify(payload, null, 2))
|
|
242
|
-
}
|
|
243
|
-
|
|
244
229
|
private getPackageManager(): PackageManager {
|
|
245
230
|
if (existsSync('pnpm-lock.yaml')) {
|
|
246
231
|
return { command: 'pnpm', args: ['add', '-D'] }
|
|
@@ -4,6 +4,7 @@ export default class ConfigManager {
|
|
|
4
4
|
getConfigDir(projectName: string): string;
|
|
5
5
|
saveCredentials(projectName: string, credentials: Credentials): void;
|
|
6
6
|
loadCredentials(projectName: string): Credentials | null;
|
|
7
|
+
writeLocalConfig(projectName: string, url: string): void;
|
|
7
8
|
}
|
|
8
9
|
export interface Credentials {
|
|
9
10
|
url: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import os from 'os';
|
|
3
3
|
import path from 'path';
|
|
4
|
+
import { getCliVersion } from '../utilities/version.js';
|
|
4
5
|
export default class ConfigManager {
|
|
5
6
|
baseDir;
|
|
6
7
|
constructor(baseDir = path.join(os.homedir(), '.regressionproof')) {
|
|
@@ -32,4 +33,15 @@ export default class ConfigManager {
|
|
|
32
33
|
token: config.remote.token,
|
|
33
34
|
};
|
|
34
35
|
}
|
|
36
|
+
writeLocalConfig(projectName, url) {
|
|
37
|
+
const configPath = path.join(process.cwd(), '.regressionproof.json');
|
|
38
|
+
const payload = {
|
|
39
|
+
version: getCliVersion(),
|
|
40
|
+
projectName,
|
|
41
|
+
remote: {
|
|
42
|
+
url,
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
fs.writeFileSync(configPath, JSON.stringify(payload, null, 2));
|
|
46
|
+
}
|
|
35
47
|
}
|
|
@@ -13,7 +13,6 @@ import fs from 'fs';
|
|
|
13
13
|
import path from 'path';
|
|
14
14
|
import ConfigManager from '../../config/ConfigManager.js.js';
|
|
15
15
|
import { toSlug } from '../../utilities/slug.js.js';
|
|
16
|
-
import { getCliVersion } from '../../utilities/version.js.js';
|
|
17
16
|
const API_URL = (_a = process.env.REGRESSIONPROOF_API_URL) !== null && _a !== void 0 ? _a : 'https://api.regressionproof.ai';
|
|
18
17
|
export default function acceptInvite(token) {
|
|
19
18
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -35,7 +34,7 @@ export default function acceptInvite(token) {
|
|
|
35
34
|
url: data.url,
|
|
36
35
|
token: data.token,
|
|
37
36
|
});
|
|
38
|
-
writeLocalConfig(
|
|
37
|
+
configManager.writeLocalConfig(projectName, data.url);
|
|
39
38
|
ensureMirrorCloned(configManager.getConfigDir(projectName), data.url, data.token);
|
|
40
39
|
console.log('Project URL:', data.url);
|
|
41
40
|
console.log('Project token:', data.token);
|
|
@@ -50,18 +49,6 @@ function deriveProjectNameFromUrl(url) {
|
|
|
50
49
|
}
|
|
51
50
|
return name;
|
|
52
51
|
}
|
|
53
|
-
function writeLocalConfig(cwd, projectName, url) {
|
|
54
|
-
const configPath = path.join(cwd, '.regressionproof.json');
|
|
55
|
-
const version = getCliVersion();
|
|
56
|
-
const payload = {
|
|
57
|
-
version,
|
|
58
|
-
projectName,
|
|
59
|
-
remote: {
|
|
60
|
-
url,
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
fs.writeFileSync(configPath, JSON.stringify(payload, null, 2));
|
|
64
|
-
}
|
|
65
52
|
function ensureMirrorCloned(configDir, url, token) {
|
|
66
53
|
const mirrorPath = path.join(configDir, 'mirror');
|
|
67
54
|
if (fs.existsSync(mirrorPath)) {
|
|
@@ -9,8 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
var _a;
|
|
11
11
|
import { spawnSync } from 'node:child_process';
|
|
12
|
-
import { existsSync, readFileSync
|
|
13
|
-
import path from 'node:path';
|
|
12
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
14
13
|
import { buildRegressionProofClient } from '@regressionproof/client';
|
|
15
14
|
import { Box, Text, useApp } from 'ink';
|
|
16
15
|
import BigText from 'ink-big-text';
|
|
@@ -19,7 +18,6 @@ import React from 'react';
|
|
|
19
18
|
import ConfigManager from '../config/ConfigManager.js.js';
|
|
20
19
|
import JestConfigurator from '../jest/JestConfigurator.js.js';
|
|
21
20
|
import { getRepoNameFromGit, toSlug } from '../utilities/slug.js.js';
|
|
22
|
-
import { getCliVersion } from '../utilities/version.js.js';
|
|
23
21
|
const API_URL = (_a = process.env.REGRESSIONPROOF_API_URL) !== null && _a !== void 0 ? _a : 'https://api.regressionproof.ai';
|
|
24
22
|
class InitComponent extends React.Component {
|
|
25
23
|
constructor(props) {
|
|
@@ -127,7 +125,7 @@ class InitComponent extends React.Component {
|
|
|
127
125
|
const credentials = yield this.apiClient.registerProject({ name });
|
|
128
126
|
this.setState({ credentials });
|
|
129
127
|
this.configManager.saveCredentials(name, credentials);
|
|
130
|
-
this.writeLocalConfig(name, credentials.url);
|
|
128
|
+
this.configManager.writeLocalConfig(name, credentials.url);
|
|
131
129
|
yield this.installAndConfigure();
|
|
132
130
|
}
|
|
133
131
|
catch (err) {
|
|
@@ -196,18 +194,6 @@ class InitComponent extends React.Component {
|
|
|
196
194
|
}
|
|
197
195
|
return { success: true };
|
|
198
196
|
}
|
|
199
|
-
writeLocalConfig(projectName, url) {
|
|
200
|
-
const configPath = path.join(process.cwd(), '.regressionproof.json');
|
|
201
|
-
const version = getCliVersion();
|
|
202
|
-
const payload = {
|
|
203
|
-
version,
|
|
204
|
-
projectName,
|
|
205
|
-
remote: {
|
|
206
|
-
url,
|
|
207
|
-
},
|
|
208
|
-
};
|
|
209
|
-
writeFileSync(configPath, JSON.stringify(payload, null, 2));
|
|
210
|
-
}
|
|
211
197
|
getPackageManager() {
|
|
212
198
|
if (existsSync('pnpm-lock.yaml')) {
|
|
213
199
|
return { command: 'pnpm', args: ['add', '-D'] };
|
|
@@ -4,6 +4,7 @@ export default class ConfigManager {
|
|
|
4
4
|
getConfigDir(projectName: string): string;
|
|
5
5
|
saveCredentials(projectName: string, credentials: Credentials): void;
|
|
6
6
|
loadCredentials(projectName: string): Credentials | null;
|
|
7
|
+
writeLocalConfig(projectName: string, url: string): void;
|
|
7
8
|
}
|
|
8
9
|
export interface Credentials {
|
|
9
10
|
url: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import os from 'os';
|
|
3
3
|
import path from 'path';
|
|
4
|
+
import { getCliVersion } from '../utilities/version.js.js';
|
|
4
5
|
export default class ConfigManager {
|
|
5
6
|
constructor(baseDir = path.join(os.homedir(), '.regressionproof')) {
|
|
6
7
|
this.baseDir = baseDir;
|
|
@@ -31,4 +32,15 @@ export default class ConfigManager {
|
|
|
31
32
|
token: config.remote.token,
|
|
32
33
|
};
|
|
33
34
|
}
|
|
35
|
+
writeLocalConfig(projectName, url) {
|
|
36
|
+
const configPath = path.join(process.cwd(), '.regressionproof.json');
|
|
37
|
+
const payload = {
|
|
38
|
+
version: getCliVersion(),
|
|
39
|
+
projectName,
|
|
40
|
+
remote: {
|
|
41
|
+
url,
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
fs.writeFileSync(configPath, JSON.stringify(payload, null, 2));
|
|
45
|
+
}
|
|
34
46
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@regressionproof/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
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.
|
|
41
|
+
"@regressionproof/client": "^0.5.0",
|
|
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": "ab68e3b894ee0e1bed01d35bc6f42bd1d4a2487f"
|
|
88
88
|
}
|