create-tsdown 0.15.8 → 0.15.10
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/index.d.mts +19 -2
- package/dist/index.mjs +2 -2
- package/dist/run.mjs +3 -3
- package/dist/{src-B4P8WTtN.mjs → src-DhcPpNe4.mjs} +26 -30
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
//#region src/index.d.ts
|
|
2
|
+
declare const templateOptions: readonly [{
|
|
3
|
+
readonly value: "default";
|
|
4
|
+
readonly label: "Default";
|
|
5
|
+
}, {
|
|
6
|
+
readonly value: "minimal";
|
|
7
|
+
readonly label: "Minimal";
|
|
8
|
+
}, {
|
|
9
|
+
readonly value: "vue";
|
|
10
|
+
readonly label: "Vue";
|
|
11
|
+
}, {
|
|
12
|
+
readonly value: "react";
|
|
13
|
+
readonly label: "React";
|
|
14
|
+
}, {
|
|
15
|
+
readonly value: "solid";
|
|
16
|
+
readonly label: "Solid";
|
|
17
|
+
}];
|
|
18
|
+
type TemplateOption = (typeof templateOptions)[number]["value"];
|
|
2
19
|
interface Options {
|
|
3
|
-
template?:
|
|
20
|
+
template?: TemplateOption;
|
|
4
21
|
path?: string;
|
|
5
22
|
}
|
|
6
23
|
type ResolvedOptions = Required<Options>;
|
|
@@ -15,4 +32,4 @@ declare function create(path: string | undefined, options: Options): Promise<voi
|
|
|
15
32
|
*/
|
|
16
33
|
declare function resolveOptions(options: Options): Promise<ResolvedOptions>;
|
|
17
34
|
//#endregion
|
|
18
|
-
export { Options, ResolvedOptions, create, resolveOptions };
|
|
35
|
+
export { Options, ResolvedOptions, create, resolveOptions, templateOptions };
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as resolveOptions, r as templateOptions, t as create } from "./src-DhcPpNe4.mjs";
|
|
2
2
|
|
|
3
|
-
export { create, resolveOptions };
|
|
3
|
+
export { create, resolveOptions, templateOptions };
|
package/dist/run.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { create } from "./src-
|
|
2
|
+
import { r as templateOptions, t as create } from "./src-DhcPpNe4.mjs";
|
|
3
3
|
import process from "node:process";
|
|
4
4
|
import { log } from "@clack/prompts";
|
|
5
5
|
import { cac } from "cac";
|
|
6
6
|
|
|
7
7
|
//#region package.json
|
|
8
|
-
var version = "0.15.
|
|
8
|
+
var version = "0.15.10";
|
|
9
9
|
|
|
10
10
|
//#endregion
|
|
11
11
|
//#region src/cli.ts
|
|
@@ -14,7 +14,7 @@ cli.help().version(version);
|
|
|
14
14
|
cli.command("[path]", "Create a tsdown project", {
|
|
15
15
|
ignoreOptionDefaultValue: true,
|
|
16
16
|
allowUnknownOptions: true
|
|
17
|
-
}).option("-t, --template <template>",
|
|
17
|
+
}).option("-t, --template <template>", `Available templates: ${templateOptions.map((option) => option.value).join(", ")}`, { default: "default" }).action((path, options) => create(path, options));
|
|
18
18
|
async function runCLI() {
|
|
19
19
|
cli.parse(process.argv, { run: false });
|
|
20
20
|
try {
|
|
@@ -5,6 +5,28 @@ import { downloadTemplate } from "giget";
|
|
|
5
5
|
import { getUserAgent } from "package-manager-detector";
|
|
6
6
|
|
|
7
7
|
//#region src/index.ts
|
|
8
|
+
const templateOptions = [
|
|
9
|
+
{
|
|
10
|
+
value: "default",
|
|
11
|
+
label: "Default"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
value: "minimal",
|
|
15
|
+
label: "Minimal"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
value: "vue",
|
|
19
|
+
label: "Vue"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
value: "react",
|
|
23
|
+
label: "React"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
value: "solid",
|
|
27
|
+
label: "Solid"
|
|
28
|
+
}
|
|
29
|
+
];
|
|
8
30
|
/**
|
|
9
31
|
* Create a tsdown project.
|
|
10
32
|
*/
|
|
@@ -41,38 +63,12 @@ async function resolveOptions(options) {
|
|
|
41
63
|
}
|
|
42
64
|
let template = options.template;
|
|
43
65
|
if (template) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"minimal",
|
|
47
|
-
"vue",
|
|
48
|
-
"react",
|
|
49
|
-
"solid"
|
|
50
|
-
].includes(template)) throw new Error(`Invalid template "${template}". Available templates: default, vue, react, solid`);
|
|
66
|
+
const templateOptionsValues = templateOptions.map((option) => option.value);
|
|
67
|
+
if (!templateOptionsValues.includes(template)) throw new Error(`Invalid template "${template}". Available templates: ${templateOptionsValues.join(", ")}`);
|
|
51
68
|
} else {
|
|
52
69
|
template = await select({
|
|
53
70
|
message: "Which template do you want to use?",
|
|
54
|
-
options: [
|
|
55
|
-
{
|
|
56
|
-
value: "default",
|
|
57
|
-
label: "Default"
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
value: "minimal",
|
|
61
|
-
label: "Minimal"
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
value: "vue",
|
|
65
|
-
label: "Vue"
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
value: "react",
|
|
69
|
-
label: "React"
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
value: "solid",
|
|
73
|
-
label: "Solid"
|
|
74
|
-
}
|
|
75
|
-
],
|
|
71
|
+
options: [...templateOptions],
|
|
76
72
|
initialValue: "default"
|
|
77
73
|
});
|
|
78
74
|
if (isCancel(template)) {
|
|
@@ -87,4 +83,4 @@ async function resolveOptions(options) {
|
|
|
87
83
|
}
|
|
88
84
|
|
|
89
85
|
//#endregion
|
|
90
|
-
export {
|
|
86
|
+
export { resolveOptions as n, templateOptions as r, create as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-tsdown",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.10",
|
|
4
4
|
"description": "Create a new tsdown project",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@clack/prompts": "^0.11.0",
|
|
45
45
|
"cac": "^6.7.14",
|
|
46
46
|
"giget": "^2.0.0",
|
|
47
|
-
"package-manager-detector": "^1.
|
|
47
|
+
"package-manager-detector": "^1.5.0"
|
|
48
48
|
},
|
|
49
49
|
"engines": {
|
|
50
50
|
"node": ">=20.19.0"
|