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/dist/cli.mjs CHANGED
@@ -1,112 +1,90 @@
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 "./_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
- 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};
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
- 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);
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
- provider: "github" | "gitlab" | "bitbucket" | "sourcehut";
3
- repo: string;
4
- subdir: string;
5
- ref: string;
5
+ provider: "github" | "gitlab" | "bitbucket" | "sourcehut";
6
+ repo: string;
7
+ subdir: string;
8
+ ref: string;
6
9
  }
7
10
  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;
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
- auth?: string;
23
+ auth?: string;
21
24
  }) => TemplateInfo | Promise<TemplateInfo> | null;
22
-
25
+ //#endregion
26
+ //#region src/giget.d.ts
23
27
  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;
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
- dir: string;
39
- source: string;
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
- auth?: string;
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 { type DownloadTemplateOptions, type DownloadTemplateResult, type GitInfo, type TemplateInfo, type TemplateProvider, downloadTemplate, registryProvider, startShell };
54
+ //#endregion
55
+ export { DownloadTemplateOptions, DownloadTemplateResult, GitInfo, TemplateInfo, TemplateProvider, downloadTemplate, registryProvider, startShell };
package/dist/index.mjs CHANGED
@@ -1,22 +1,8 @@
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/@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": "2.0.0",
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": "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
  }