@curl-runner/cli 1.16.0 → 1.16.2

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.
Files changed (40) hide show
  1. package/package.json +2 -2
  2. package/src/ci-exit.test.ts +0 -216
  3. package/src/cli.ts +0 -1351
  4. package/src/commands/upgrade.ts +0 -262
  5. package/src/diff/baseline-manager.test.ts +0 -181
  6. package/src/diff/baseline-manager.ts +0 -266
  7. package/src/diff/diff-formatter.ts +0 -316
  8. package/src/diff/index.ts +0 -3
  9. package/src/diff/response-differ.test.ts +0 -330
  10. package/src/diff/response-differ.ts +0 -489
  11. package/src/executor/max-concurrency.test.ts +0 -139
  12. package/src/executor/profile-executor.test.ts +0 -132
  13. package/src/executor/profile-executor.ts +0 -167
  14. package/src/executor/request-executor.ts +0 -663
  15. package/src/parser/yaml.test.ts +0 -480
  16. package/src/parser/yaml.ts +0 -271
  17. package/src/snapshot/index.ts +0 -3
  18. package/src/snapshot/snapshot-differ.test.ts +0 -358
  19. package/src/snapshot/snapshot-differ.ts +0 -296
  20. package/src/snapshot/snapshot-formatter.ts +0 -170
  21. package/src/snapshot/snapshot-manager.test.ts +0 -204
  22. package/src/snapshot/snapshot-manager.ts +0 -342
  23. package/src/types/bun-yaml.d.ts +0 -11
  24. package/src/types/config.ts +0 -638
  25. package/src/utils/colors.ts +0 -30
  26. package/src/utils/condition-evaluator.test.ts +0 -415
  27. package/src/utils/condition-evaluator.ts +0 -327
  28. package/src/utils/curl-builder.test.ts +0 -165
  29. package/src/utils/curl-builder.ts +0 -209
  30. package/src/utils/installation-detector.test.ts +0 -52
  31. package/src/utils/installation-detector.ts +0 -123
  32. package/src/utils/logger.ts +0 -856
  33. package/src/utils/response-store.test.ts +0 -213
  34. package/src/utils/response-store.ts +0 -108
  35. package/src/utils/stats.test.ts +0 -161
  36. package/src/utils/stats.ts +0 -151
  37. package/src/utils/version-checker.ts +0 -158
  38. package/src/version.ts +0 -43
  39. package/src/watcher/file-watcher.test.ts +0 -186
  40. package/src/watcher/file-watcher.ts +0 -140
@@ -1,52 +0,0 @@
1
- import { describe, expect, test } from 'bun:test';
2
- import { getUpgradeCommand, getUpgradeCommandWindows, isWindows } from './installation-detector';
3
-
4
- describe('getUpgradeCommand', () => {
5
- test('returns bun command for bun source', () => {
6
- expect(getUpgradeCommand('bun')).toBe('bun install -g @curl-runner/cli@latest');
7
- });
8
-
9
- test('returns npm command for npm source', () => {
10
- expect(getUpgradeCommand('npm')).toBe('npm install -g @curl-runner/cli@latest');
11
- });
12
-
13
- test('returns curl command for curl source', () => {
14
- expect(getUpgradeCommand('curl')).toBe(
15
- 'curl -fsSL https://www.curl-runner.com/install.sh | bash',
16
- );
17
- });
18
-
19
- test('returns curl command for standalone source', () => {
20
- expect(getUpgradeCommand('standalone')).toBe(
21
- 'curl -fsSL https://www.curl-runner.com/install.sh | bash',
22
- );
23
- });
24
- });
25
-
26
- describe('getUpgradeCommandWindows', () => {
27
- test('returns bun command for bun source', () => {
28
- expect(getUpgradeCommandWindows('bun')).toBe('bun install -g @curl-runner/cli@latest');
29
- });
30
-
31
- test('returns npm command for npm source', () => {
32
- expect(getUpgradeCommandWindows('npm')).toBe('npm install -g @curl-runner/cli@latest');
33
- });
34
-
35
- test('returns PowerShell command for curl source', () => {
36
- expect(getUpgradeCommandWindows('curl')).toBe(
37
- 'irm https://www.curl-runner.com/install.ps1 | iex',
38
- );
39
- });
40
-
41
- test('returns PowerShell command for standalone source', () => {
42
- expect(getUpgradeCommandWindows('standalone')).toBe(
43
- 'irm https://www.curl-runner.com/install.ps1 | iex',
44
- );
45
- });
46
- });
47
-
48
- describe('isWindows', () => {
49
- test('returns boolean based on platform', () => {
50
- expect(typeof isWindows()).toBe('boolean');
51
- });
52
- });
@@ -1,123 +0,0 @@
1
- // Installation source detection for curl-runner upgrade command
2
-
3
- export type InstallationSource = 'bun' | 'npm' | 'curl' | 'standalone';
4
-
5
- export interface DetectionResult {
6
- source: InstallationSource;
7
- path: string;
8
- canAutoUpgrade: boolean;
9
- }
10
-
11
- const CURL_INSTALL_PATHS = [
12
- `${process.env.HOME}/.local/bin/curl-runner`,
13
- `${process.env.USERPROFILE}\\.local\\bin\\curl-runner.exe`,
14
- ];
15
-
16
- export function detectInstallationSource(): DetectionResult {
17
- const execPath = process.execPath;
18
- const argv0 = process.argv[0];
19
-
20
- // Check for bun installation
21
- if (isBunInstall(execPath)) {
22
- return {
23
- source: 'bun',
24
- path: execPath,
25
- canAutoUpgrade: true,
26
- };
27
- }
28
-
29
- // Check for npm installation
30
- if (isNpmInstall(execPath, argv0)) {
31
- return {
32
- source: 'npm',
33
- path: execPath,
34
- canAutoUpgrade: true,
35
- };
36
- }
37
-
38
- // Check for curl installation (binary in ~/.local/bin)
39
- if (isCurlInstall(execPath)) {
40
- return {
41
- source: 'curl',
42
- path: execPath,
43
- canAutoUpgrade: true,
44
- };
45
- }
46
-
47
- // Standalone binary
48
- return {
49
- source: 'standalone',
50
- path: execPath,
51
- canAutoUpgrade: true,
52
- };
53
- }
54
-
55
- function isBunInstall(execPath: string): boolean {
56
- // Check if running from bun's global install directory
57
- if (execPath.includes('.bun')) {
58
- return true;
59
- }
60
- if (process.env.BUN_INSTALL && execPath.includes(process.env.BUN_INSTALL)) {
61
- return true;
62
- }
63
-
64
- // Check for bun-specific paths
65
- const bunPaths = ['/bun/install/', '/.bun/bin/', '/bun/bin/'];
66
- return bunPaths.some((p) => execPath.includes(p));
67
- }
68
-
69
- function isNpmInstall(execPath: string, argv0: string): boolean {
70
- // Check for npm global install indicators
71
- if (execPath.includes('node_modules')) {
72
- return true;
73
- }
74
- if (argv0.includes('node_modules')) {
75
- return true;
76
- }
77
-
78
- // Check for npm config env vars (set when running via npm)
79
- if (process.env.npm_config_prefix) {
80
- return true;
81
- }
82
- if (process.env.npm_execpath) {
83
- return true;
84
- }
85
-
86
- // Check common npm global paths
87
- const npmPaths = ['/lib/node_modules/', '/node_modules/.bin/'];
88
- return npmPaths.some((p) => execPath.includes(p) || argv0.includes(p));
89
- }
90
-
91
- function isCurlInstall(execPath: string): boolean {
92
- // Check if binary is in curl installer's default location
93
- return CURL_INSTALL_PATHS.some((p) => execPath === p || execPath.startsWith(p));
94
- }
95
-
96
- export function getUpgradeCommand(source: InstallationSource): string {
97
- switch (source) {
98
- case 'bun':
99
- return 'bun install -g @curl-runner/cli@latest';
100
- case 'npm':
101
- return 'npm install -g @curl-runner/cli@latest';
102
- case 'curl':
103
- return 'curl -fsSL https://www.curl-runner.com/install.sh | bash';
104
- case 'standalone':
105
- return 'curl -fsSL https://www.curl-runner.com/install.sh | bash';
106
- }
107
- }
108
-
109
- export function getUpgradeCommandWindows(source: InstallationSource): string {
110
- switch (source) {
111
- case 'bun':
112
- return 'bun install -g @curl-runner/cli@latest';
113
- case 'npm':
114
- return 'npm install -g @curl-runner/cli@latest';
115
- case 'curl':
116
- case 'standalone':
117
- return 'irm https://www.curl-runner.com/install.ps1 | iex';
118
- }
119
- }
120
-
121
- export function isWindows(): boolean {
122
- return process.platform === 'win32';
123
- }