@zylc369/bw-gh-release-fetch 0.1.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.
@@ -0,0 +1,77 @@
1
+ /**
2
+ * GitHub Release Download Tool
3
+ * Core types and interfaces
4
+ */
5
+ /**
6
+ * Options for download function (excluding repoUrl and patterns which are separate parameters)
7
+ */
8
+ export interface DownloadFunctionOptions {
9
+ /** Output directory for downloaded files (required for SDK usage, optional for CLI) */
10
+ outputDir: string;
11
+ /** Version tag to download (optional, defaults to latest) */
12
+ version?: string;
13
+ /** GitHub token for private repositories (optional) */
14
+ token?: string;
15
+ /** Progress callback for download status updates (optional) */
16
+ onProgress?: (message: string) => void;
17
+ }
18
+ /**
19
+ * @deprecated Use DownloadFunctionOptions instead.
20
+ * This interface is kept for backwards compatibility but note that
21
+ * repoUrl and patterns are separate parameters in the actual function signatures.
22
+ */
23
+ export interface DownloadOptions {
24
+ /** GitHub repository URL (required) */
25
+ repoUrl: string;
26
+ /** Version tag to download (optional, defaults to latest) */
27
+ version?: string;
28
+ /** Glob pattern(s) for files to download (required) */
29
+ patterns: string | string[];
30
+ /** GitHub token for private repositories (optional) */
31
+ token?: string;
32
+ /** Output directory for downloaded files (required for SDK usage, optional for CLI) */
33
+ outputDir: string;
34
+ }
35
+ export interface ReleaseInfo {
36
+ id: number;
37
+ tagName: string;
38
+ name: string | null;
39
+ draft: boolean;
40
+ prerelease: boolean;
41
+ createdAt: string;
42
+ publishedAt: string | null;
43
+ htmlUrl: string;
44
+ assets: ReleaseAsset[];
45
+ }
46
+ export interface ReleaseAsset {
47
+ id: number;
48
+ name: string;
49
+ contentType: string;
50
+ size: number;
51
+ downloadCount: number;
52
+ browserDownloadUrl: string;
53
+ createdAt: string;
54
+ updatedAt: string;
55
+ }
56
+ export interface DownloadResult {
57
+ asset: ReleaseAsset;
58
+ localPath: string;
59
+ size: number;
60
+ }
61
+ export interface MatchedAsset {
62
+ asset: ReleaseAsset;
63
+ matchedPattern: string;
64
+ }
65
+ export interface ParsedRepoUrl {
66
+ owner: string;
67
+ repo: string;
68
+ }
69
+ export interface GitHubReleaseDownloaderConfig {
70
+ /** GitHub API token (optional, for private repos or higher rate limits) */
71
+ token?: string;
72
+ /** Base URL for GitHub API (optional, defaults to https://api.github.com) */
73
+ baseUrl?: string;
74
+ /** User agent for API requests */
75
+ userAgent?: string;
76
+ }
77
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,uFAAuF;IACvF,SAAS,EAAE,MAAM,CAAC;IAElB,6DAA6D;IAC7D,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,uDAAuD;IACvD,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,+DAA+D;IAC/D,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,uCAAuC;IACvC,OAAO,EAAE,MAAM,CAAC;IAEhB,6DAA6D;IAC7D,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,uDAAuD;IACvD,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAE5B,uDAAuD;IACvD,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,uFAAuF;IACvF,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,YAAY,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,YAAY,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,YAAY,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,6BAA6B;IAC5C,2EAA2E;IAC3E,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,6EAA6E;IAC7E,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,kCAAkC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Utility functions
3
+ */
4
+ import { ParsedRepoUrl } from './types.js';
5
+ /**
6
+ * Parse GitHub repository URL to extract owner and repo name
7
+ * Supports various formats:
8
+ * - https://github.com/owner/repo
9
+ * - https://github.com/owner/repo/
10
+ * - github.com/owner/repo
11
+ * - owner/repo
12
+ */
13
+ export declare function parseRepoUrl(url: string): ParsedRepoUrl;
14
+ /**
15
+ * Format bytes to human readable string
16
+ */
17
+ export declare function formatBytes(bytes: number): string;
18
+ /**
19
+ * Ensure directory exists, create if not
20
+ */
21
+ export declare function ensureDir(dir: string): Promise<void>;
22
+ /**
23
+ * Get current working directory
24
+ */
25
+ export declare function getCwd(): string;
26
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CA4BvD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAQjD;AAED;;GAEG;AACH,wBAAsB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAS1D;AAED;;GAEG;AACH,wBAAgB,MAAM,IAAI,MAAM,CAE/B"}
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@zylc369/bw-gh-release-fetch",
3
+ "version": "0.1.1",
4
+ "description": "Fetch files from code hosting platforms with glob pattern support",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "bin": {
9
+ "bw-gh-release-fetch": "dist/cli.js"
10
+ },
11
+ "files": [
12
+ "dist",
13
+ "README.md",
14
+ "LICENSE"
15
+ ],
16
+ "scripts": {
17
+ "build": "bun build ./src/index.ts ./src/cli.ts --outdir ./dist --target node && tsc --emitDeclarationOnly",
18
+ "dev": "bun src/cli.ts",
19
+ "typecheck": "tsc --noEmit",
20
+ "test": "bun test/test.ts",
21
+ "prepublishOnly": "bun run build && bun run typecheck",
22
+ "release": "npm publish",
23
+ "release:dry": "npm publish --dry-run"
24
+ },
25
+ "keywords": [
26
+ "fetch",
27
+ "cli",
28
+ "glob",
29
+ "files"
30
+ ],
31
+ "author": "",
32
+ "license": "MIT",
33
+ "dependencies": {
34
+ "@octokit/rest": "^20.0.2",
35
+ "commander": "^12.0.0",
36
+ "minimatch": "^10.2.4",
37
+ "undici": "^6.6.2"
38
+ },
39
+ "devDependencies": {
40
+ "@types/bun": "latest",
41
+ "@types/minimatch": "^6.0.0",
42
+ "@types/node": "^20.11.0",
43
+ "typescript": "^5.3.3"
44
+ },
45
+ "engines": {
46
+ "node": ">=18"
47
+ },
48
+ "repository": {
49
+ "type": "git",
50
+ "url": "https://github.com/zylc369/gh-release-download"
51
+ },
52
+ "bugs": {
53
+ "url": "https://github.com/zylc369/gh-release-download/issues"
54
+ },
55
+ "homepage": "https://github.com/zylc369/gh-release-download#readme"
56
+ }