giget 0.1.3 → 0.1.4
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 +2 -1
- package/dist/cli.cjs +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +1 -1
- package/dist/shared/{giget.4b579418.mjs → giget.1430f5a2.mjs} +3 -2
- package/dist/shared/{giget.2ac4718b.cjs → giget.774476cb.cjs} +3 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -78,8 +78,9 @@ If you want to add your template to the built-in registry, just drop a PR to add
|
|
|
78
78
|
|
|
79
79
|
A custom registry should provide an endpoint with dynamic path `/:template.json` that returns a JSON response with keys same as [custom providers](#custom-providers).
|
|
80
80
|
|
|
81
|
-
- `name`: (required) Name of the template.
|
|
81
|
+
- `name`: (required) Name of the template.
|
|
82
82
|
- `tar` (required) Link to the tar download link.
|
|
83
|
+
- `defaultDir`: (optional) Default cloning directory.
|
|
83
84
|
- `url`: (optional) Webpage of the template.
|
|
84
85
|
- `subpath` (optional) Subpath inside the tar file.
|
|
85
86
|
|
package/dist/cli.cjs
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
const node_path = require('node:path');
|
|
5
5
|
const mri = require('mri');
|
|
6
6
|
const colorette = require('colorette');
|
|
7
|
-
const giget = require('./shared/giget.
|
|
7
|
+
const giget = require('./shared/giget.774476cb.cjs');
|
|
8
8
|
require('node:fs/promises');
|
|
9
9
|
require('node:os');
|
|
10
10
|
require('node:fs');
|
package/dist/cli.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { relative } from 'node:path';
|
|
3
3
|
import mri from 'mri';
|
|
4
4
|
import { cyan } from 'colorette';
|
|
5
|
-
import { d as downloadTemplate, s as startShell } from './shared/giget.
|
|
5
|
+
import { d as downloadTemplate, s as startShell } from './shared/giget.1430f5a2.mjs';
|
|
6
6
|
import 'node:fs/promises';
|
|
7
7
|
import 'node:os';
|
|
8
8
|
import 'node:fs';
|
package/dist/index.cjs
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ interface TemplateInfo {
|
|
|
10
10
|
version?: string;
|
|
11
11
|
subdir?: string;
|
|
12
12
|
url?: string;
|
|
13
|
+
defaultDir?: string;
|
|
13
14
|
source?: never;
|
|
14
15
|
dir?: never;
|
|
15
16
|
[key: string]: any;
|
|
@@ -34,6 +35,7 @@ declare function downloadTemplate(input: string, opts?: DownloadTemplateOptions)
|
|
|
34
35
|
version?: string;
|
|
35
36
|
subdir?: string;
|
|
36
37
|
url?: string;
|
|
38
|
+
defaultDir?: string;
|
|
37
39
|
}>;
|
|
38
40
|
|
|
39
41
|
declare const registryProvider: (registryEndpoint?: string) => TemplateProvider;
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { d as downloadTemplate, r as registryProvider, s as startShell } from './shared/giget.
|
|
1
|
+
export { d as downloadTemplate, r as registryProvider, s as startShell } from './shared/giget.1430f5a2.mjs';
|
|
2
2
|
import 'node:fs/promises';
|
|
3
3
|
import 'node:os';
|
|
4
4
|
import 'node:fs';
|
|
@@ -130,8 +130,9 @@ async function downloadTemplate(input, opts = {}) {
|
|
|
130
130
|
const template = await Promise.resolve().then(() => provider(source)).catch((err) => {
|
|
131
131
|
throw new Error(`Failed to download template from ${providerName}: ${err.message}`);
|
|
132
132
|
});
|
|
133
|
-
template.name = template.name.replace(/[^a-
|
|
134
|
-
|
|
133
|
+
template.name = (template.name || "template").replace(/[^a-z0-9-]/gi, "-");
|
|
134
|
+
template.defaultDir = (template.defaultDir || template.name).replace(/[^a-z0-9-]/gi, "-");
|
|
135
|
+
const extractPath = resolve(opts.dir || template.defaultDir);
|
|
135
136
|
if (opts.forceClean) {
|
|
136
137
|
await rm(extractPath, { recursive: true, force: true });
|
|
137
138
|
}
|
|
@@ -136,8 +136,9 @@ async function downloadTemplate(input, opts = {}) {
|
|
|
136
136
|
const template = await Promise.resolve().then(() => provider(source)).catch((err) => {
|
|
137
137
|
throw new Error(`Failed to download template from ${providerName}: ${err.message}`);
|
|
138
138
|
});
|
|
139
|
-
template.name = template.name.replace(/[^a-
|
|
140
|
-
|
|
139
|
+
template.name = (template.name || "template").replace(/[^a-z0-9-]/gi, "-");
|
|
140
|
+
template.defaultDir = (template.defaultDir || template.name).replace(/[^a-z0-9-]/gi, "-");
|
|
141
|
+
const extractPath = pathe.resolve(opts.dir || template.defaultDir);
|
|
141
142
|
if (opts.forceClean) {
|
|
142
143
|
await promises.rm(extractPath, { recursive: true, force: true });
|
|
143
144
|
}
|