git-slot-machine 2.4.0 → 2.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.
@@ -10,9 +10,8 @@ function clearLine() {
10
10
  process.stdout.write('\r\x1b[K');
11
11
  }
12
12
  function drawSlotMachine(chars, spinning, highlightIndices = [], flash = false) {
13
- // Casino color palette: red borders, white title
13
+ // Casino color palette: red borders
14
14
  const borderColor = chalk.rgb(220, 20, 60); // Crimson red
15
- const titleColor = chalk.white; // White
16
15
  const borderWidth = 39;
17
16
  const border = '═'.repeat(borderWidth);
18
17
  const topBorder = borderColor('╔' + border + '╗');
package/dist/api.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export interface PlayData {
2
2
  commit_hash: string;
3
- commit_full_hash: string;
3
+ commit_full_hash?: string;
4
4
  pattern_type: string;
5
5
  pattern_name: string;
6
6
  payout: number;
@@ -11,8 +11,10 @@ export interface PlayData {
11
11
  github_username: string;
12
12
  repo_owner: string;
13
13
  repo_name: string;
14
+ suspicious?: boolean;
15
+ amend_count?: number;
14
16
  }
15
- export interface ApiResponse<T = any> {
17
+ export interface ApiResponse<T = unknown> {
16
18
  success: boolean;
17
19
  data?: T;
18
20
  message?: string;
package/dist/api.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import { getApiUrl, getApiToken, isSyncEnabled } from './config.js';
2
- import { getFetch } from './utils/fetch-polyfill.js';
3
2
  // Fallback domains to try in order (if primary fails)
4
3
  const FALLBACK_DOMAINS = [
5
4
  'https://gitslotmachinecom-main-vilmm1.laravel.cloud',
@@ -23,7 +22,6 @@ export function isApiAvailable() {
23
22
  // Helper to try API call with fallback domains
24
23
  async function fetchWithFallback(endpoint, options) {
25
24
  const configuredUrl = getApiUrl();
26
- const fetchFn = await getFetch();
27
25
  // Build list of URLs to try: configured URL first, then fallbacks (excluding duplicates)
28
26
  const urlsToTry = [
29
27
  configuredUrl,
@@ -32,7 +30,7 @@ async function fetchWithFallback(endpoint, options) {
32
30
  for (const baseUrl of urlsToTry) {
33
31
  try {
34
32
  const url = `${baseUrl.replace(/\/api$/, '')}/api${endpoint}`;
35
- const response = await fetchFn(url, options);
33
+ const response = await fetch(url, options);
36
34
  if (response.ok) {
37
35
  return response;
38
36
  }
package/dist/balance.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import * as fs from 'fs';
2
2
  import * as path from 'path';
3
3
  import * as os from 'os';
4
+ import { execSync } from 'child_process';
4
5
  const BALANCE_FILE = path.join(os.homedir(), '.git-slot-machine-balance.json');
5
6
  function getRepoPath() {
6
7
  try {
7
- const { execSync } = require('child_process');
8
8
  return execSync('git rev-parse --show-toplevel', {
9
9
  encoding: 'utf-8',
10
10
  stdio: ['pipe', 'pipe', 'pipe']
@@ -34,11 +34,12 @@ export async function configSetCommand(key, value) {
34
34
  setApiUrl(value);
35
35
  console.log(chalk.green(`API URL set to: ${value}`));
36
36
  break;
37
- case 'sync-enabled':
37
+ case 'sync-enabled': {
38
38
  const enabled = value.toLowerCase() === 'true' || value === '1';
39
39
  setSyncEnabled(enabled);
40
40
  console.log(chalk.green(`Sync ${enabled ? 'enabled' : 'disabled'}`));
41
41
  break;
42
+ }
42
43
  default:
43
44
  console.error(chalk.red(`Unknown config key: ${key}`));
44
45
  console.log('Available keys: api-url, sync-enabled');
package/dist/index.js CHANGED
File without changes
package/dist/utils/git.js CHANGED
@@ -8,7 +8,7 @@ export function getCurrentCommitHash() {
8
8
  return fullHash.substring(0, 7);
9
9
  }
10
10
  catch (error) {
11
- throw new Error('Not a git repository or no commits yet');
11
+ throw new Error('Not a git repository or no commits yet', { cause: error });
12
12
  }
13
13
  }
14
14
  export function getCurrentCommitFullHash() {
@@ -20,7 +20,7 @@ export function getCurrentCommitFullHash() {
20
20
  return fullHash;
21
21
  }
22
22
  catch (error) {
23
- throw new Error('Not a git repository or no commits yet');
23
+ throw new Error('Not a git repository or no commits yet', { cause: error });
24
24
  }
25
25
  }
26
26
  export function isGitRepo() {
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "git-slot-machine",
3
- "version": "2.4.0",
3
+ "version": "2.4.1",
4
4
  "description": "Turn your git commits into a slot machine game! CLI tool with global leaderboards and win streaks.",
5
5
  "type": "module",
6
+ "packageManager": "pnpm@11.4.0",
6
7
  "main": "dist/index.js",
7
8
  "bin": {
8
9
  "git-slot-machine": "dist/index.js"
@@ -24,7 +25,8 @@
24
25
  "build": "tsc",
25
26
  "dev": "tsc --watch",
26
27
  "test": "jest",
27
- "lint": "eslint src --ext .ts",
28
+ "lint": "eslint src",
29
+ "prepublishOnly": "npm run build",
28
30
  "postinstall": "node scripts/postinstall.js"
29
31
  },
30
32
  "keywords": [
@@ -40,20 +42,21 @@
40
42
  ],
41
43
  "author": "Than Tibbetts <https://github.com/than>",
42
44
  "license": "MIT",
45
+ "engines": {
46
+ "node": ">=18"
47
+ },
43
48
  "devDependencies": {
49
+ "@eslint/js": "^10.0.1",
44
50
  "@types/jest": "^30.0.0",
45
- "@types/node": "^20.0.0",
46
- "@types/node-fetch": "^2.6.11",
47
- "@typescript-eslint/eslint-plugin": "^6.0.0",
48
- "@typescript-eslint/parser": "^6.0.0",
49
- "eslint": "^8.0.0",
50
- "jest": "^29.0.0",
51
- "ts-jest": "^29.0.0",
52
- "typescript": "^5.0.0"
51
+ "@types/node": "^22.19.19",
52
+ "eslint": "^10.4.0",
53
+ "jest": "^30.4.2",
54
+ "ts-jest": "^29.4.11",
55
+ "typescript": "^6.0.3",
56
+ "typescript-eslint": "^8.60.0"
53
57
  },
54
58
  "dependencies": {
55
59
  "chalk": "^5.3.0",
56
- "commander": "^11.0.0",
57
- "node-fetch": "^3.3.2"
60
+ "commander": "^14.0.3"
58
61
  }
59
62
  }
@@ -1,2 +0,0 @@
1
- export declare function getFetch(): Promise<typeof fetch>;
2
- //# sourceMappingURL=fetch-polyfill.d.ts.map
@@ -1,12 +0,0 @@
1
- // Polyfill fetch for Node.js < 18
2
- // Node 18+ has native fetch, older versions need node-fetch
3
- export async function getFetch() {
4
- // Check if native fetch exists (Node 18+)
5
- if (typeof globalThis.fetch !== 'undefined') {
6
- return globalThis.fetch;
7
- }
8
- // Fall back to node-fetch for Node < 18
9
- const nodeFetch = await import('node-fetch');
10
- return nodeFetch.default;
11
- }
12
- //# sourceMappingURL=fetch-polyfill.js.map