git0 0.2.40 → 0.2.55

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/package.json CHANGED
@@ -1,14 +1,17 @@
1
1
  {
2
2
  "name": "git0",
3
3
  "description": "CLI tool to search GitHub repositories, download source & releases for your system, and instantly set up, then install dependencies and open code editor.",
4
- "version": "0.2.40",
4
+ "version": "0.2.55",
5
5
  "author": "vtempest",
6
6
  "scripts": {
7
7
  "build": "bun build src/cli.ts --outdir dist --target node --format esm --sourcemap",
8
8
  "test": "bun test",
9
+ "test:ci": "bun test --reporter=junit --reporter-outfile=./junit.xml --coverage --coverage-reporter=lcov --coverage-dir=./coverage",
9
10
  "docs": "cd docs-config && bun run build:docs",
10
11
  "demo": "bun src/cli.ts react template",
11
- "publish:npm": "npm version patch && npm publish --access public"
12
+ "publish:npm": "npm version patch && npm publish --access public",
13
+ "test:watch": "vitest",
14
+ "coverage": "vitest run --coverage"
12
15
  },
13
16
  "dependencies": {
14
17
  "chalk": "^5.4.1",
@@ -41,5 +44,9 @@
41
44
  "type": "git",
42
45
  "url": "https://github.com/OpenSourceAGI/dev-tools-starter-agent/tree/master/packages/git0-repo-downloader"
43
46
  },
44
- "homepage": "https://github.com/OpenSourceAGI/dev-tools-starter-agent/tree/master/packages/git0-repo-downloader"
47
+ "homepage": "https://github.com/OpenSourceAGI/dev-tools-starter-agent/tree/master/packages/git0-repo-downloader",
48
+ "devDependencies": {
49
+ "@vitest/coverage-v8": "^4.1.0",
50
+ "vitest": "^4.1.0"
51
+ }
45
52
  }
package/readme.md CHANGED
@@ -104,3 +104,9 @@ export GITHUB_TOKEN=your_github_token_here
104
104
  ```
105
105
 
106
106
  Without a token, you're limited to 60 requests per hour. With a token, you get 5,000 requests per hour.
107
+
108
+ ---
109
+
110
+ [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request)
111
+
112
+ Please star this repo for updates! 🌟
@@ -1,4 +1,4 @@
1
- import { describe, test, expect, beforeEach, afterEach } from 'bun:test';
1
+ import { describe, test, expect, beforeEach, afterEach } from 'vitest';
2
2
  import fs from 'fs';
3
3
  import path from 'path';
4
4
  import os from 'os';
@@ -1,4 +1,4 @@
1
- import { describe, test, expect } from 'bun:test';
1
+ import { describe, test, expect } from 'vitest';
2
2
  import GithubAPI from '../src/github-api.ts';
3
3
 
4
4
  describe('GithubAPI.parseURL', () => {
@@ -1,4 +1,4 @@
1
- import { describe, test, expect } from 'bun:test';
1
+ import { describe, test, expect } from 'vitest';
2
2
  import { buildReleaseChoices } from '../src/package-menu.ts';
3
3
  import type { CategorizedRelease, PlatformInfo } from '../src/types.ts';
4
4
 
@@ -1,19 +1,24 @@
1
- import { describe, test, expect, mock, beforeEach, afterEach } from 'bun:test';
1
+ import { describe, test, expect, mock, afterAll } from 'bun:test';
2
2
  import os from 'os';
3
3
 
4
- // We re-import after mocking, so keep a reference to the real values.
5
- const realPlatform = os.platform();
6
- const realArch = os.arch();
4
+ // `mock.module` is process-global and is never rolled back on its own, so a
5
+ // bare `{ platform, arch }` stub here would follow us into every test file
6
+ // that bun happens to run afterwards (download.test.ts calls os.tmpdir()).
7
+ // Keep the real module underneath the two functions we override, and put the
8
+ // untouched module back once this file is done.
9
+ const realOs = os;
7
10
 
8
- describe('getCurrentPlatform', () => {
9
- // Helper: dynamically re-import the module so mocks apply fresh each time.
10
- async function load() {
11
- const mod = await import('../src/platform.ts?t=' + Date.now());
12
- return mod.getCurrentPlatform;
13
- }
11
+ function mockPlatform(platform: string, arch: string) {
12
+ mock.module('os', () => ({ ...realOs, default: { ...realOs, platform: () => platform, arch: () => arch } }));
13
+ }
14
+
15
+ afterAll(() => {
16
+ mock.module('os', () => ({ ...realOs, default: realOs }));
17
+ });
14
18
 
19
+ describe('getCurrentPlatform', () => {
15
20
  test('maps darwin/x64 → macos/x86_64', async () => {
16
- mock.module('os', () => ({ default: { platform: () => 'darwin', arch: () => 'x64' } }));
21
+ mockPlatform('darwin', 'x64');
17
22
  const fn = await load();
18
23
  const p = fn();
19
24
  expect(p.os).toBe('macos');
@@ -23,7 +28,7 @@ describe('getCurrentPlatform', () => {
23
28
  });
24
29
 
25
30
  test('maps win32/ia32 → windows/i386', async () => {
26
- mock.module('os', () => ({ default: { platform: () => 'win32', arch: () => 'ia32' } }));
31
+ mockPlatform('win32', 'ia32');
27
32
  const fn = await load();
28
33
  const p = fn();
29
34
  expect(p.os).toBe('windows');
@@ -31,7 +36,7 @@ describe('getCurrentPlatform', () => {
31
36
  });
32
37
 
33
38
  test('maps linux/arm64 → linux/arm64', async () => {
34
- mock.module('os', () => ({ default: { platform: () => 'linux', arch: () => 'arm64' } }));
39
+ mockPlatform('linux', 'arm64');
35
40
  const fn = await load();
36
41
  const p = fn();
37
42
  expect(p.os).toBe('linux');
@@ -39,7 +44,7 @@ describe('getCurrentPlatform', () => {
39
44
  });
40
45
 
41
46
  test('maps darwin/arm64 → macos/arm64 (Apple Silicon)', async () => {
42
- mock.module('os', () => ({ default: { platform: () => 'darwin', arch: () => 'arm64' } }));
47
+ mockPlatform('darwin', 'arm64');
43
48
  const fn = await load();
44
49
  const p = fn();
45
50
  expect(p.os).toBe('macos');
@@ -47,7 +52,7 @@ describe('getCurrentPlatform', () => {
47
52
  });
48
53
 
49
54
  test('passes through unknown platform/arch as-is', async () => {
50
- mock.module('os', () => ({ default: { platform: () => 'freebsd', arch: () => 'mips' } }));
55
+ mockPlatform('freebsd', 'mips');
51
56
  const fn = await load();
52
57
  const p = fn();
53
58
  expect(p.os).toBe('freebsd');
@@ -55,7 +60,7 @@ describe('getCurrentPlatform', () => {
55
60
  });
56
61
 
57
62
  test('returns raw platform and architecture fields alongside mapped ones', async () => {
58
- mock.module('os', () => ({ default: { platform: () => 'linux', arch: () => 'x64' } }));
63
+ mockPlatform('linux', 'x64');
59
64
  const fn = await load();
60
65
  const p = fn();
61
66
  expect(p.platform).toBe('linux');
@@ -1,4 +1,4 @@
1
- import { describe, test, expect } from 'bun:test';
1
+ import { describe, test, expect } from 'vitest';
2
2
  import { categorizeReleasesByPlatform, filterReleasesByPlatform } from '../src/releases.ts';
3
3
  import type { PlatformInfo } from '../src/types.ts';
4
4
 
@@ -0,0 +1,34 @@
1
+ /// <reference types="vitest/config" />
2
+ import { defineConfig } from "vitest/config";
3
+
4
+ // Per-package Vitest setup. Coverage is written to this package's own
5
+ // ./coverage/lcov.info so Codecov can flag it under "git0-repo-downloader".
6
+ export default defineConfig({
7
+ test: {
8
+ environment: "node",
9
+ include: ["{test,tests,src}/**/*.{test,spec}.{js,mjs,ts,tsx}"],
10
+ exclude: ["**/node_modules/**", "**/dist/**"],
11
+ // Infrastructure is in place before every package has a suite.
12
+ passWithNoTests: true,
13
+ coverage: {
14
+ provider: "v8",
15
+ reporter: ["text", "json", "lcov"],
16
+ reportsDirectory: "./coverage",
17
+ reportOnFailure: true,
18
+ include: [
19
+ "src/**/*.{ts,js}",
20
+ ],
21
+ exclude: [
22
+ "**/node_modules/**",
23
+ "**/dist/**",
24
+ "**/build/**",
25
+ "**/coverage/**",
26
+ "**/demo/**",
27
+ "**/*.d.ts",
28
+ "**/*.config.*",
29
+ "**/*.{test,spec}.*",
30
+ "**/*.template.*",
31
+ ],
32
+ },
33
+ },
34
+ });