@regressionproof/cli 0.4.0 → 0.4.1

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.
@@ -3,6 +3,7 @@ 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';
6
7
  const API_URL = process.env.REGRESSIONPROOF_API_URL ?? 'https://api.regressionproof.ai';
7
8
  export default async function acceptInvite(token) {
8
9
  const response = await fetch(`${API_URL}/invites/accept`, {
@@ -38,7 +39,9 @@ function deriveProjectNameFromUrl(url) {
38
39
  }
39
40
  function writeLocalConfig(cwd, projectName, url) {
40
41
  const configPath = path.join(cwd, '.regressionproof.json');
42
+ const version = getCliVersion();
41
43
  const payload = {
44
+ version,
42
45
  projectName,
43
46
  remote: {
44
47
  url,
@@ -9,6 +9,7 @@ import React from 'react';
9
9
  import ConfigManager from '../config/ConfigManager.js';
10
10
  import JestConfigurator from '../jest/JestConfigurator.js';
11
11
  import { getRepoNameFromGit, toSlug } from '../utilities/slug.js';
12
+ import { getCliVersion } from '../utilities/version.js';
12
13
  const API_URL = process.env.REGRESSIONPROOF_API_URL ?? 'https://api.regressionproof.ai';
13
14
  class InitComponent extends React.Component {
14
15
  checkTimeout = null;
@@ -182,7 +183,9 @@ class InitComponent extends React.Component {
182
183
  }
183
184
  writeLocalConfig(projectName, url) {
184
185
  const configPath = path.join(process.cwd(), '.regressionproof.json');
186
+ const version = getCliVersion();
185
187
  const payload = {
188
+ version,
186
189
  projectName,
187
190
  remote: {
188
191
  url,
@@ -10,6 +10,7 @@ import React from 'react'
10
10
  import ConfigManager, { Credentials } from '../config/ConfigManager.js'
11
11
  import JestConfigurator, { JestConfigResult } from '../jest/JestConfigurator.js'
12
12
  import { getRepoNameFromGit, toSlug } from '../utilities/slug.js'
13
+ import { getCliVersion } from '../utilities/version.js'
13
14
 
14
15
  const API_URL =
15
16
  process.env.REGRESSIONPROOF_API_URL ?? 'https://api.regressionproof.ai'
@@ -229,7 +230,9 @@ class InitComponent extends React.Component<Props, State> {
229
230
 
230
231
  private writeLocalConfig(projectName: string, url: string): void {
231
232
  const configPath = path.join(process.cwd(), '.regressionproof.json')
233
+ const version = getCliVersion()
232
234
  const payload = {
235
+ version,
233
236
  projectName,
234
237
  remote: {
235
238
  url,
@@ -13,6 +13,7 @@ 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';
16
17
  const API_URL = (_a = process.env.REGRESSIONPROOF_API_URL) !== null && _a !== void 0 ? _a : 'https://api.regressionproof.ai';
17
18
  export default function acceptInvite(token) {
18
19
  return __awaiter(this, void 0, void 0, function* () {
@@ -51,7 +52,9 @@ function deriveProjectNameFromUrl(url) {
51
52
  }
52
53
  function writeLocalConfig(cwd, projectName, url) {
53
54
  const configPath = path.join(cwd, '.regressionproof.json');
55
+ const version = getCliVersion();
54
56
  const payload = {
57
+ version,
55
58
  projectName,
56
59
  remote: {
57
60
  url,
@@ -19,6 +19,7 @@ import React from 'react';
19
19
  import ConfigManager from '../config/ConfigManager.js.js';
20
20
  import JestConfigurator from '../jest/JestConfigurator.js.js';
21
21
  import { getRepoNameFromGit, toSlug } from '../utilities/slug.js.js';
22
+ import { getCliVersion } from '../utilities/version.js.js';
22
23
  const API_URL = (_a = process.env.REGRESSIONPROOF_API_URL) !== null && _a !== void 0 ? _a : 'https://api.regressionproof.ai';
23
24
  class InitComponent extends React.Component {
24
25
  constructor(props) {
@@ -197,7 +198,9 @@ class InitComponent extends React.Component {
197
198
  }
198
199
  writeLocalConfig(projectName, url) {
199
200
  const configPath = path.join(process.cwd(), '.regressionproof.json');
201
+ const version = getCliVersion();
200
202
  const payload = {
203
+ version,
201
204
  projectName,
202
205
  remote: {
203
206
  url,
@@ -0,0 +1 @@
1
+ export declare function getCliVersion(): string;
@@ -0,0 +1,9 @@
1
+ import { readFileSync } from 'node:fs';
2
+ export function getCliVersion() {
3
+ const packageUrl = new URL('../../package.json', import.meta.url);
4
+ const packageJson = JSON.parse(readFileSync(packageUrl, 'utf-8'));
5
+ if (!packageJson.version) {
6
+ throw new Error('Unable to determine CLI version from package.json');
7
+ }
8
+ return packageJson.version;
9
+ }
@@ -0,0 +1 @@
1
+ export declare function getCliVersion(): string;
@@ -0,0 +1,9 @@
1
+ import { readFileSync } from 'node:fs';
2
+ export function getCliVersion() {
3
+ const packageUrl = new URL('../../package.json', import.meta.url);
4
+ const packageJson = JSON.parse(readFileSync(packageUrl, 'utf-8'));
5
+ if (!packageJson.version) {
6
+ throw new Error('Unable to determine CLI version from package.json');
7
+ }
8
+ return packageJson.version;
9
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@regressionproof/cli",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
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.4.0",
41
+ "@regressionproof/client": "^0.4.1",
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": "dc7c7eaa3342fcb4fdfae1d3c11a69b7e08dace4"
87
+ "gitHead": "5f4b7535038870bdbd859a12d2c97fceb021b347"
88
88
  }