giget 2.0.0 → 3.1.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.
@@ -0,0 +1,20 @@
1
+ import "node:module";
2
+
3
+ //#region rolldown:runtime
4
+ var __defProp = Object.defineProperty;
5
+ var __exportAll = (all, symbols) => {
6
+ let target = {};
7
+ for (var name in all) {
8
+ __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ }
13
+ if (symbols) {
14
+ __defProp(target, Symbol.toStringTag, { value: "Module" });
15
+ }
16
+ return target;
17
+ };
18
+
19
+ //#endregion
20
+ export { __exportAll as t };
package/dist/cli.d.mts ADDED
@@ -0,0 +1 @@
1
+ export { };
package/dist/cli.mjs CHANGED
@@ -1,112 +1,86 @@
1
1
  #!/usr/bin/env node
2
- import { relative } from 'node:path';
3
- import { defineCommand, runMain } from 'citty';
4
- import { consola } from 'consola';
5
- import { d as downloadTemplate, s as startShell } from './shared/giget.OCaTp9b-.mjs';
6
- import 'node:fs/promises';
7
- import 'node:fs';
8
- import 'assert';
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 { i as relative } from "./_chunks/libs/nypm.mjs";
3
+ import { r as startShell, t as downloadTemplate } from "./_chunks/giget.mjs";
4
+ import { n as runMain, t as defineCommand } from "./_chunks/libs/citty.mjs";
27
5
 
28
- const name = "giget";
29
- const version = "2.0.0";
30
- const description = "Download templates and git repositories with pleasure!";
31
- const pkg = {
32
- name: name,
33
- version: version,
34
- description: description};
6
+ //#region package.json
7
+ var name = "giget";
8
+ var version = "3.1.0";
9
+ var description = "Download templates and git repositories with pleasure!";
35
10
 
36
- const mainCommand = defineCommand({
37
- meta: {
38
- name: pkg.name,
39
- version: pkg.version,
40
- description: pkg.description
41
- },
42
- args: {
43
- // TODO: Make it `-t` in the next major version
44
- template: {
45
- type: "positional",
46
- description: "Template name or a a URI describing provider, repository, subdir, and branch/ref"
47
- },
48
- dir: {
49
- type: "positional",
50
- description: "A relative or absolute path where to extract the template",
51
- required: false
52
- },
53
- auth: {
54
- type: "string",
55
- description: "Custom Authorization token to use for downloading template. (Can be overriden with `GIGET_AUTH` environment variable)"
56
- },
57
- cwd: {
58
- type: "string",
59
- description: "Set current working directory to resolve dirs relative to it"
60
- },
61
- force: {
62
- type: "boolean",
63
- description: "Clone to existing directory even if exists"
64
- },
65
- forceClean: {
66
- type: "boolean",
67
- description: "Remove any existing directory or file recusively before cloning"
68
- },
69
- offline: {
70
- type: "boolean",
71
- description: "o not attempt to download and use cached version"
72
- },
73
- preferOffline: {
74
- type: "boolean",
75
- description: "Use cache if exists otherwise try to download"
76
- },
77
- shell: {
78
- type: "boolean",
79
- description: "Open a new shell with current working "
80
- },
81
- install: {
82
- type: "boolean",
83
- description: "Install dependencies after cloning"
84
- },
85
- verbose: {
86
- type: "boolean",
87
- description: "Show verbose debugging info"
88
- }
89
- },
90
- run: async ({ args }) => {
91
- if (args.verbose) {
92
- process.env.DEBUG = process.env.DEBUG || "true";
93
- }
94
- const r = await downloadTemplate(args.template, {
95
- dir: args.dir,
96
- force: args.force,
97
- forceClean: args.forceClean,
98
- offline: args.offline,
99
- preferOffline: args.preferOffline,
100
- auth: args.auth,
101
- install: args.install
102
- });
103
- const _from = r.name || r.url;
104
- const _to = relative(process.cwd(), r.dir) || "./";
105
- consola.log(`\u2728 Successfully cloned \`${_from}\` to \`${_to}\`
106
- `);
107
- if (args.shell) {
108
- startShell(r.dir);
109
- }
110
- }
111
- });
112
- runMain(mainCommand);
11
+ //#endregion
12
+ //#region src/cli.ts
13
+ runMain(defineCommand({
14
+ meta: {
15
+ name,
16
+ version,
17
+ description
18
+ },
19
+ args: {
20
+ template: {
21
+ type: "positional",
22
+ required: true,
23
+ description: "Template name or a URI describing provider, repository, subdir, and branch/ref"
24
+ },
25
+ dir: {
26
+ type: "positional",
27
+ description: "A relative or absolute path where to extract the template",
28
+ required: false
29
+ },
30
+ auth: {
31
+ type: "string",
32
+ description: "Custom Authorization token to use for downloading template. (Can be overridden with `GIGET_AUTH` environment variable)"
33
+ },
34
+ cwd: {
35
+ type: "string",
36
+ description: "Set current working directory to resolve dirs relative to it"
37
+ },
38
+ force: {
39
+ type: "boolean",
40
+ description: "Clone to existing directory even if exists"
41
+ },
42
+ forceClean: {
43
+ type: "boolean",
44
+ description: "Remove any existing directory or file recursively before cloning"
45
+ },
46
+ offline: {
47
+ type: "boolean",
48
+ description: "Do not attempt to download and use cached version"
49
+ },
50
+ preferOffline: {
51
+ type: "boolean",
52
+ description: "Use cache if exists otherwise try to download"
53
+ },
54
+ shell: {
55
+ type: "boolean",
56
+ description: "Open a new shell with the current working directory set to the cloned directory (experimental)"
57
+ },
58
+ install: {
59
+ type: "boolean",
60
+ description: "Install dependencies after cloning"
61
+ },
62
+ verbose: {
63
+ type: "boolean",
64
+ description: "Show verbose debugging info"
65
+ }
66
+ },
67
+ run: async ({ args }) => {
68
+ if (args.verbose) process.env.DEBUG = process.env.DEBUG || "true";
69
+ const r = await downloadTemplate(args.template, {
70
+ dir: args.dir,
71
+ force: args.force,
72
+ forceClean: args.forceClean,
73
+ offline: args.offline,
74
+ preferOffline: args.preferOffline,
75
+ auth: args.auth,
76
+ install: args.install
77
+ });
78
+ const _from = r.name || r.url;
79
+ const _to = relative(process.cwd(), r.dir) || "./";
80
+ console.log(`✨ Successfully cloned \`${_from}\` to \`${_to}\`\n`);
81
+ if (args.shell) startShell(r.dir);
82
+ }
83
+ }));
84
+
85
+ //#endregion
86
+ export { };
package/dist/index.d.mts CHANGED
@@ -1,49 +1,57 @@
1
+ import { t as installDependencies } from "./_chunks/libs/nypm.mjs";
2
+ import "node:http";
3
+
4
+ //#region src/types.d.ts
1
5
  interface GitInfo {
2
- provider: "github" | "gitlab" | "bitbucket" | "sourcehut";
3
- repo: string;
4
- subdir: string;
5
- ref: string;
6
+ provider: "github" | "gitlab" | "bitbucket" | "sourcehut";
7
+ repo: string;
8
+ subdir: string;
9
+ ref: string;
6
10
  }
7
11
  interface TemplateInfo {
8
- name: string;
9
- tar: string;
10
- version?: string;
11
- subdir?: string;
12
- url?: string;
13
- defaultDir?: string;
14
- headers?: Record<string, string | undefined>;
15
- source?: never;
16
- dir?: never;
17
- [key: string]: any;
12
+ name: string;
13
+ tar: string;
14
+ version?: string;
15
+ subdir?: string;
16
+ url?: string;
17
+ defaultDir?: string;
18
+ headers?: Record<string, string | undefined>;
19
+ source?: never;
20
+ dir?: never;
21
+ [key: string]: any;
18
22
  }
19
23
  type TemplateProvider = (input: string, options: {
20
- auth?: string;
24
+ auth?: string;
21
25
  }) => TemplateInfo | Promise<TemplateInfo> | null;
22
-
26
+ //#endregion
27
+ //#region src/giget.d.ts
28
+ type InstallOptions = Parameters<typeof installDependencies>[0];
23
29
  interface DownloadTemplateOptions {
24
- provider?: string;
25
- force?: boolean;
26
- forceClean?: boolean;
27
- offline?: boolean;
28
- preferOffline?: boolean;
29
- providers?: Record<string, TemplateProvider>;
30
- dir?: string;
31
- registry?: false | string;
32
- cwd?: string;
33
- auth?: string;
34
- install?: boolean;
35
- silent?: boolean;
30
+ provider?: string;
31
+ force?: boolean;
32
+ forceClean?: boolean;
33
+ offline?: boolean;
34
+ preferOffline?: boolean;
35
+ providers?: Record<string, TemplateProvider>;
36
+ dir?: string;
37
+ registry?: false | string;
38
+ cwd?: string;
39
+ auth?: string;
40
+ install?: boolean | InstallOptions;
41
+ silent?: boolean;
36
42
  }
37
43
  type DownloadTemplateResult = Omit<TemplateInfo, "dir" | "source"> & {
38
- dir: string;
39
- source: string;
44
+ dir: string;
45
+ source: string;
40
46
  };
41
47
  declare function downloadTemplate(input: string, options?: DownloadTemplateOptions): Promise<DownloadTemplateResult>;
42
-
48
+ //#endregion
49
+ //#region src/registry.d.ts
43
50
  declare const registryProvider: (registryEndpoint?: string, options?: {
44
- auth?: string;
51
+ auth?: string;
45
52
  }) => TemplateProvider;
46
-
53
+ //#endregion
54
+ //#region src/_utils.d.ts
47
55
  declare function startShell(cwd: string): void;
48
-
49
- export { type DownloadTemplateOptions, type DownloadTemplateResult, type GitInfo, type TemplateInfo, type TemplateProvider, downloadTemplate, registryProvider, startShell };
56
+ //#endregion
57
+ export { DownloadTemplateOptions, DownloadTemplateResult, GitInfo, TemplateInfo, TemplateProvider, downloadTemplate, registryProvider, startShell };
package/dist/index.mjs CHANGED
@@ -1,22 +1,4 @@
1
- export { d as downloadTemplate, r as registryProvider, s as startShell } from './shared/giget.OCaTp9b-.mjs';
2
- import 'node:fs/promises';
3
- import 'node:fs';
4
- import 'assert';
5
- import 'path';
6
- import 'events';
7
- import 'stream';
8
- import 'string_decoder';
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/nypm.mjs";
2
+ import { n as registryProvider, r as startShell, t as downloadTemplate } from "./_chunks/giget.mjs";
3
+
4
+ export { downloadTemplate, registryProvider, startShell };
package/package.json CHANGED
@@ -1,16 +1,13 @@
1
1
  {
2
2
  "name": "giget",
3
- "version": "2.0.0",
3
+ "version": "3.1.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": "unbuild",
20
+ "build": "obuild",
24
21
  "dev": "vitest dev",
25
- "giget": "jiti ./src/cli.ts",
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": "^22.13.5",
31
+ "@types/node": "^25.0.9",
43
32
  "@types/tar": "^6.1.13",
44
- "@vitest/coverage-v8": "^3.0.7",
45
- "changelogen": "^0.5.7",
46
- "esbuild": "^0.25.0",
47
- "eslint": "^9.21.0",
48
- "eslint-config-unjs": "^0.4.2",
49
- "jiti": "^2.4.2",
50
- "prettier": "^3.5.2",
51
- "tar": "^6.2.1",
52
- "typescript": "^5.7.3",
53
- "unbuild": "^3.3.1",
54
- "vitest": "^3.0.7"
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.5.0",
57
- "pnpm": {
58
- "patchedDependencies": {
59
- "tar": "patches/tar.patch"
60
- }
61
- }
49
+ "packageManager": "pnpm@10.28.1"
62
50
  }