giget 2.0.0 → 3.0.0
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/README.md +6 -6
- package/dist/_chunks/giget.mjs +271 -0
- package/dist/_chunks/libs/@isaacs/fs-minipass.mjs +1 -0
- package/dist/_chunks/libs/chownr.mjs +1 -0
- package/dist/_chunks/libs/citty.mjs +5 -0
- package/dist/_chunks/libs/minizlib.mjs +1 -0
- package/dist/_chunks/libs/nypm.mjs +2 -0
- package/dist/_chunks/libs/tar.mjs +3 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +87 -109
- package/dist/index.d.mts +41 -35
- package/dist/index.mjs +8 -22
- package/package.json +24 -36
- package/dist/shared/giget.OCaTp9b-.mjs +0 -468
package/dist/cli.mjs
CHANGED
|
@@ -1,112 +1,90 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import 'path';
|
|
10
|
-
import 'events';
|
|
11
|
-
import 'stream';
|
|
12
|
-
import 'string_decoder';
|
|
13
|
-
import 'buffer';
|
|
14
|
-
import 'zlib';
|
|
15
|
-
import 'process';
|
|
16
|
-
import 'fs';
|
|
17
|
-
import 'util';
|
|
18
|
-
import 'crypto';
|
|
19
|
-
import 'pathe';
|
|
20
|
-
import 'defu';
|
|
21
|
-
import 'nypm';
|
|
22
|
-
import 'node:stream';
|
|
23
|
-
import 'node:child_process';
|
|
24
|
-
import 'node:os';
|
|
25
|
-
import 'node:util';
|
|
26
|
-
import 'node-fetch-native/proxy';
|
|
2
|
+
import "./_chunks/libs/@isaacs/fs-minipass.mjs";
|
|
3
|
+
import "./_chunks/libs/tar.mjs";
|
|
4
|
+
import "./_chunks/libs/minizlib.mjs";
|
|
5
|
+
import "./_chunks/libs/chownr.mjs";
|
|
6
|
+
import { i as relative } from "./_chunks/libs/nypm.mjs";
|
|
7
|
+
import { r as startShell, t as downloadTemplate } from "./_chunks/giget.mjs";
|
|
8
|
+
import { n as runMain, t as defineCommand } from "./_chunks/libs/citty.mjs";
|
|
27
9
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
name: name,
|
|
33
|
-
version: version,
|
|
34
|
-
description: description};
|
|
10
|
+
//#region package.json
|
|
11
|
+
var name = "giget";
|
|
12
|
+
var version = "2.0.0";
|
|
13
|
+
var description = "Download templates and git repositories with pleasure!";
|
|
35
14
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
runMain(mainCommand);
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/cli.ts
|
|
17
|
+
runMain(defineCommand({
|
|
18
|
+
meta: {
|
|
19
|
+
name,
|
|
20
|
+
version,
|
|
21
|
+
description
|
|
22
|
+
},
|
|
23
|
+
args: {
|
|
24
|
+
template: {
|
|
25
|
+
type: "positional",
|
|
26
|
+
required: true,
|
|
27
|
+
description: "Template name or a URI describing provider, repository, subdir, and branch/ref"
|
|
28
|
+
},
|
|
29
|
+
dir: {
|
|
30
|
+
type: "positional",
|
|
31
|
+
description: "A relative or absolute path where to extract the template",
|
|
32
|
+
required: false
|
|
33
|
+
},
|
|
34
|
+
auth: {
|
|
35
|
+
type: "string",
|
|
36
|
+
description: "Custom Authorization token to use for downloading template. (Can be overridden with `GIGET_AUTH` environment variable)"
|
|
37
|
+
},
|
|
38
|
+
cwd: {
|
|
39
|
+
type: "string",
|
|
40
|
+
description: "Set current working directory to resolve dirs relative to it"
|
|
41
|
+
},
|
|
42
|
+
force: {
|
|
43
|
+
type: "boolean",
|
|
44
|
+
description: "Clone to existing directory even if exists"
|
|
45
|
+
},
|
|
46
|
+
forceClean: {
|
|
47
|
+
type: "boolean",
|
|
48
|
+
description: "Remove any existing directory or file recursively before cloning"
|
|
49
|
+
},
|
|
50
|
+
offline: {
|
|
51
|
+
type: "boolean",
|
|
52
|
+
description: "Do not attempt to download and use cached version"
|
|
53
|
+
},
|
|
54
|
+
preferOffline: {
|
|
55
|
+
type: "boolean",
|
|
56
|
+
description: "Use cache if exists otherwise try to download"
|
|
57
|
+
},
|
|
58
|
+
shell: {
|
|
59
|
+
type: "boolean",
|
|
60
|
+
description: "Open a new shell with the current working directory set to the cloned directory (experimental)"
|
|
61
|
+
},
|
|
62
|
+
install: {
|
|
63
|
+
type: "boolean",
|
|
64
|
+
description: "Install dependencies after cloning"
|
|
65
|
+
},
|
|
66
|
+
verbose: {
|
|
67
|
+
type: "boolean",
|
|
68
|
+
description: "Show verbose debugging info"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
run: async ({ args }) => {
|
|
72
|
+
if (args.verbose) process.env.DEBUG = process.env.DEBUG || "true";
|
|
73
|
+
const r = await downloadTemplate(args.template, {
|
|
74
|
+
dir: args.dir,
|
|
75
|
+
force: args.force,
|
|
76
|
+
forceClean: args.forceClean,
|
|
77
|
+
offline: args.offline,
|
|
78
|
+
preferOffline: args.preferOffline,
|
|
79
|
+
auth: args.auth,
|
|
80
|
+
install: args.install
|
|
81
|
+
});
|
|
82
|
+
const _from = r.name || r.url;
|
|
83
|
+
const _to = relative(process.cwd(), r.dir) || "./";
|
|
84
|
+
console.log(`✨ Successfully cloned \`${_from}\` to \`${_to}\`\n`);
|
|
85
|
+
if (args.shell) startShell(r.dir);
|
|
86
|
+
}
|
|
87
|
+
}));
|
|
88
|
+
|
|
89
|
+
//#endregion
|
|
90
|
+
export { };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,49 +1,55 @@
|
|
|
1
|
+
import "node:http";
|
|
2
|
+
|
|
3
|
+
//#region src/types.d.ts
|
|
1
4
|
interface GitInfo {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
provider: "github" | "gitlab" | "bitbucket" | "sourcehut";
|
|
6
|
+
repo: string;
|
|
7
|
+
subdir: string;
|
|
8
|
+
ref: string;
|
|
6
9
|
}
|
|
7
10
|
interface TemplateInfo {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
name: string;
|
|
12
|
+
tar: string;
|
|
13
|
+
version?: string;
|
|
14
|
+
subdir?: string;
|
|
15
|
+
url?: string;
|
|
16
|
+
defaultDir?: string;
|
|
17
|
+
headers?: Record<string, string | undefined>;
|
|
18
|
+
source?: never;
|
|
19
|
+
dir?: never;
|
|
20
|
+
[key: string]: any;
|
|
18
21
|
}
|
|
19
22
|
type TemplateProvider = (input: string, options: {
|
|
20
|
-
|
|
23
|
+
auth?: string;
|
|
21
24
|
}) => TemplateInfo | Promise<TemplateInfo> | null;
|
|
22
|
-
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/giget.d.ts
|
|
23
27
|
interface DownloadTemplateOptions {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
provider?: string;
|
|
29
|
+
force?: boolean;
|
|
30
|
+
forceClean?: boolean;
|
|
31
|
+
offline?: boolean;
|
|
32
|
+
preferOffline?: boolean;
|
|
33
|
+
providers?: Record<string, TemplateProvider>;
|
|
34
|
+
dir?: string;
|
|
35
|
+
registry?: false | string;
|
|
36
|
+
cwd?: string;
|
|
37
|
+
auth?: string;
|
|
38
|
+
install?: boolean;
|
|
39
|
+
silent?: boolean;
|
|
36
40
|
}
|
|
37
41
|
type DownloadTemplateResult = Omit<TemplateInfo, "dir" | "source"> & {
|
|
38
|
-
|
|
39
|
-
|
|
42
|
+
dir: string;
|
|
43
|
+
source: string;
|
|
40
44
|
};
|
|
41
45
|
declare function downloadTemplate(input: string, options?: DownloadTemplateOptions): Promise<DownloadTemplateResult>;
|
|
42
|
-
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region src/registry.d.ts
|
|
43
48
|
declare const registryProvider: (registryEndpoint?: string, options?: {
|
|
44
|
-
|
|
49
|
+
auth?: string;
|
|
45
50
|
}) => TemplateProvider;
|
|
46
|
-
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/_utils.d.ts
|
|
47
53
|
declare function startShell(cwd: string): void;
|
|
48
|
-
|
|
49
|
-
export {
|
|
54
|
+
//#endregion
|
|
55
|
+
export { DownloadTemplateOptions, DownloadTemplateResult, GitInfo, TemplateInfo, TemplateProvider, downloadTemplate, registryProvider, startShell };
|
package/dist/index.mjs
CHANGED
|
@@ -1,22 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import 'buffer';
|
|
10
|
-
import 'zlib';
|
|
11
|
-
import 'process';
|
|
12
|
-
import 'fs';
|
|
13
|
-
import 'util';
|
|
14
|
-
import 'crypto';
|
|
15
|
-
import 'pathe';
|
|
16
|
-
import 'defu';
|
|
17
|
-
import 'nypm';
|
|
18
|
-
import 'node:stream';
|
|
19
|
-
import 'node:child_process';
|
|
20
|
-
import 'node:os';
|
|
21
|
-
import 'node:util';
|
|
22
|
-
import 'node-fetch-native/proxy';
|
|
1
|
+
import "./_chunks/libs/@isaacs/fs-minipass.mjs";
|
|
2
|
+
import "./_chunks/libs/tar.mjs";
|
|
3
|
+
import "./_chunks/libs/minizlib.mjs";
|
|
4
|
+
import "./_chunks/libs/chownr.mjs";
|
|
5
|
+
import "./_chunks/libs/nypm.mjs";
|
|
6
|
+
import { n as registryProvider, r as startShell, t as downloadTemplate } from "./_chunks/giget.mjs";
|
|
7
|
+
|
|
8
|
+
export { downloadTemplate, registryProvider, startShell };
|
package/package.json
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "giget",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Download templates and git repositories with pleasure!",
|
|
5
5
|
"repository": "unjs/giget",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"sideEffects": false,
|
|
8
8
|
"type": "module",
|
|
9
9
|
"exports": {
|
|
10
|
-
".":
|
|
11
|
-
"types": "./dist/index.d.mts",
|
|
12
|
-
"default": "./dist/index.mjs"
|
|
13
|
-
}
|
|
10
|
+
".": "./dist/index.mjs"
|
|
14
11
|
},
|
|
15
12
|
"types": "./dist/index.d.mts",
|
|
16
13
|
"bin": {
|
|
@@ -20,43 +17,34 @@
|
|
|
20
17
|
"dist"
|
|
21
18
|
],
|
|
22
19
|
"scripts": {
|
|
23
|
-
"build": "
|
|
20
|
+
"build": "obuild",
|
|
24
21
|
"dev": "vitest dev",
|
|
25
|
-
"giget": "
|
|
22
|
+
"giget": "node ./src/cli.ts",
|
|
26
23
|
"lint": "eslint . && prettier -c src test",
|
|
27
24
|
"lint:fix": "eslint . --fix && prettier -w src test",
|
|
28
|
-
"prepack": "unbuild",
|
|
29
25
|
"play": "pnpm giget --force-clean --verbose unjs .tmp/clone",
|
|
30
|
-
"release": "pnpm test && changelogen --release && npm publish && git push --follow-tags",
|
|
31
|
-
"test": "pnpm lint && vitest run --coverage"
|
|
32
|
-
|
|
33
|
-
"dependencies": {
|
|
34
|
-
"citty": "^0.1.6",
|
|
35
|
-
"consola": "^3.4.0",
|
|
36
|
-
"defu": "^6.1.4",
|
|
37
|
-
"node-fetch-native": "^1.6.6",
|
|
38
|
-
"nypm": "^0.6.0",
|
|
39
|
-
"pathe": "^2.0.3"
|
|
26
|
+
"release": "pnpm test && pnpm build && changelogen --release && npm publish && git push --follow-tags",
|
|
27
|
+
"test": "pnpm lint && pnpm test:types && vitest run --coverage",
|
|
28
|
+
"test:types": "tsgo --noEmit"
|
|
40
29
|
},
|
|
41
30
|
"devDependencies": {
|
|
42
|
-
"@types/node": "^
|
|
31
|
+
"@types/node": "^25.0.9",
|
|
43
32
|
"@types/tar": "^6.1.13",
|
|
44
|
-
"@
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"eslint
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
33
|
+
"@typescript/native-preview": "7.0.0-dev.20260120.1",
|
|
34
|
+
"@vitest/coverage-v8": "^4.0.17",
|
|
35
|
+
"changelogen": "^0.6.2",
|
|
36
|
+
"citty": "^0.2.0",
|
|
37
|
+
"eslint": "^9.39.2",
|
|
38
|
+
"eslint-config-unjs": "^0.6.2",
|
|
39
|
+
"nypm": "^0.6.3",
|
|
40
|
+
"obuild": "^0.4.18",
|
|
41
|
+
"pathe": "^2.0.3",
|
|
42
|
+
"prettier": "^3.8.0",
|
|
43
|
+
"rolldown": "1.0.0-beta.60",
|
|
44
|
+
"tar": "^7.5.4",
|
|
45
|
+
"typescript": "^5.9.3",
|
|
46
|
+
"unbuild": "^3.6.1",
|
|
47
|
+
"vitest": "^4.0.17"
|
|
55
48
|
},
|
|
56
|
-
"packageManager": "pnpm@10.
|
|
57
|
-
"pnpm": {
|
|
58
|
-
"patchedDependencies": {
|
|
59
|
-
"tar": "patches/tar.patch"
|
|
60
|
-
}
|
|
61
|
-
}
|
|
49
|
+
"packageManager": "pnpm@10.28.1"
|
|
62
50
|
}
|