sv 0.9.6 → 0.9.7
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/bin.d.ts +1 -0
- package/dist/bin.js +320 -22950
- package/dist/{package-manager-DO5R9a6p.js → create-CyyvJXoi.js} +24847 -26795
- package/dist/install-DE_JOizJ.js +3180 -0
- package/dist/lib/index.d.ts +173 -0
- package/dist/lib/index.js +4 -0
- package/dist/lib/testing.d.ts +51 -0
- package/dist/{testing.js → lib/testing.js} +771 -808
- package/dist/shared.json +2 -2
- package/dist/templates/demo/package.json +7 -7
- package/dist/templates/library/package.json +8 -8
- package/dist/templates/minimal/package.json +5 -5
- package/package.json +6 -6
- package/dist/addons-C1BtYuVp.js +0 -5806
- package/dist/index.d.ts +0 -4
- package/dist/index.js +0 -4
- package/dist/install.d.ts +0 -23
- package/dist/testing.d.ts +0 -31
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
//#region ../create/index.d.ts
|
|
2
|
+
type TemplateType = (typeof templateTypes)[number];
|
|
3
|
+
type LanguageType = (typeof languageTypes)[number];
|
|
4
|
+
declare const templateTypes: readonly ["minimal", "demo", "library"];
|
|
5
|
+
declare const languageTypes: readonly ["typescript", "checkjs", "none"];
|
|
6
|
+
type Options = {
|
|
7
|
+
name: string;
|
|
8
|
+
template: TemplateType;
|
|
9
|
+
types: LanguageType;
|
|
10
|
+
};
|
|
11
|
+
declare function create(cwd: string, options: Options): void;
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region ../core/addon/options.d.ts
|
|
14
|
+
type BooleanQuestion = {
|
|
15
|
+
type: "boolean";
|
|
16
|
+
default: boolean;
|
|
17
|
+
};
|
|
18
|
+
type StringQuestion = {
|
|
19
|
+
type: "string";
|
|
20
|
+
default: string;
|
|
21
|
+
validate?: (value: string | undefined) => string | Error | undefined;
|
|
22
|
+
placeholder?: string;
|
|
23
|
+
};
|
|
24
|
+
type NumberQuestion = {
|
|
25
|
+
type: "number";
|
|
26
|
+
default: number;
|
|
27
|
+
validate?: (value: string | undefined) => string | Error | undefined;
|
|
28
|
+
placeholder?: string;
|
|
29
|
+
};
|
|
30
|
+
type SelectQuestion<Value> = {
|
|
31
|
+
type: "select";
|
|
32
|
+
default: NoInfer<Value>;
|
|
33
|
+
options: Array<{
|
|
34
|
+
value: Value;
|
|
35
|
+
label?: string;
|
|
36
|
+
hint?: string;
|
|
37
|
+
}>;
|
|
38
|
+
};
|
|
39
|
+
type MultiSelectQuestion<Value> = {
|
|
40
|
+
type: "multiselect";
|
|
41
|
+
default: NoInfer<Value[]>;
|
|
42
|
+
options: Array<{
|
|
43
|
+
value: Value;
|
|
44
|
+
label?: string;
|
|
45
|
+
hint?: string;
|
|
46
|
+
}>;
|
|
47
|
+
required: boolean;
|
|
48
|
+
};
|
|
49
|
+
type BaseQuestion<Args extends OptionDefinition> = {
|
|
50
|
+
question: string;
|
|
51
|
+
group?: string;
|
|
52
|
+
/**
|
|
53
|
+
* When this condition explicitly returns `false`, the question's value will
|
|
54
|
+
* always be `undefined` and will not fallback to the specified `default` value.
|
|
55
|
+
*/
|
|
56
|
+
condition?: (options: OptionValues<Args>) => boolean;
|
|
57
|
+
};
|
|
58
|
+
type Question<Args extends OptionDefinition = OptionDefinition> = BaseQuestion<Args> & (BooleanQuestion | StringQuestion | NumberQuestion | SelectQuestion<any> | MultiSelectQuestion<any>);
|
|
59
|
+
type OptionDefinition = Record<string, Question<any>>;
|
|
60
|
+
type OptionValues<Args extends OptionDefinition> = { [K in keyof Args]: Args[K] extends StringQuestion ? string : Args[K] extends BooleanQuestion ? boolean : Args[K] extends NumberQuestion ? number : Args[K] extends SelectQuestion<infer Value> ? Value : Args[K] extends MultiSelectQuestion<infer Value> ? Value[] : "ERROR: The value for this type is invalid. Ensure that the `default` value exists in `options`." };
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region ../core/addon/workspace.d.ts
|
|
63
|
+
type Workspace<Args extends OptionDefinition> = {
|
|
64
|
+
options: OptionValues<Args>;
|
|
65
|
+
cwd: string;
|
|
66
|
+
/**
|
|
67
|
+
* Returns the dependency version declared in the package.json.
|
|
68
|
+
* This may differ from the installed version.
|
|
69
|
+
* Includes both dependencies and devDependencies.
|
|
70
|
+
* Also checks parent package.json files if called in a monorepo.
|
|
71
|
+
* @param pkg the package to check for
|
|
72
|
+
* @returns the dependency version with any leading characters such as ^ or ~ removed
|
|
73
|
+
*/
|
|
74
|
+
dependencyVersion: (pkg: string) => string | undefined;
|
|
75
|
+
typescript: boolean;
|
|
76
|
+
viteConfigFile: string;
|
|
77
|
+
kit: {
|
|
78
|
+
libDirectory: string;
|
|
79
|
+
routesDirectory: string;
|
|
80
|
+
} | undefined;
|
|
81
|
+
packageManager: PackageManager;
|
|
82
|
+
};
|
|
83
|
+
type PackageManager = "npm" | "yarn" | "pnpm" | "bun" | "deno";
|
|
84
|
+
//#endregion
|
|
85
|
+
//#region ../core/addon/config.d.ts
|
|
86
|
+
type SvApi = {
|
|
87
|
+
pnpmBuildDependency: (pkg: string) => void;
|
|
88
|
+
dependency: (pkg: string, version: string) => void;
|
|
89
|
+
devDependency: (pkg: string, version: string) => void;
|
|
90
|
+
execute: (args: string[], stdio: "inherit" | "pipe") => Promise<void>;
|
|
91
|
+
file: (path: string, edit: (content: string) => string) => void;
|
|
92
|
+
};
|
|
93
|
+
type Addon<Args extends OptionDefinition> = {
|
|
94
|
+
id: string;
|
|
95
|
+
alias?: string;
|
|
96
|
+
shortDescription?: string;
|
|
97
|
+
homepage?: string;
|
|
98
|
+
options: Args;
|
|
99
|
+
setup?: (workspace: Workspace<Args> & {
|
|
100
|
+
dependsOn: (name: string) => void;
|
|
101
|
+
unsupported: (reason: string) => void;
|
|
102
|
+
runsAfter: (addonName: string) => void;
|
|
103
|
+
}) => MaybePromise<void>;
|
|
104
|
+
run: (workspace: Workspace<Args> & {
|
|
105
|
+
sv: SvApi;
|
|
106
|
+
}) => MaybePromise<void>;
|
|
107
|
+
nextSteps?: (data: {
|
|
108
|
+
highlighter: Highlighter;
|
|
109
|
+
} & Workspace<Args>) => string[];
|
|
110
|
+
};
|
|
111
|
+
type Highlighter = {
|
|
112
|
+
path: (str: string) => string;
|
|
113
|
+
command: (str: string) => string;
|
|
114
|
+
website: (str: string) => string;
|
|
115
|
+
route: (str: string) => string;
|
|
116
|
+
env: (str: string) => string;
|
|
117
|
+
};
|
|
118
|
+
type AddonSetupResult = {
|
|
119
|
+
dependsOn: string[];
|
|
120
|
+
unsupported: string[];
|
|
121
|
+
runsAfter: string[];
|
|
122
|
+
};
|
|
123
|
+
type MaybePromise<T> = Promise<T> | T;
|
|
124
|
+
//#endregion
|
|
125
|
+
//#region lib/install.d.ts
|
|
126
|
+
type InstallOptions<Addons extends AddonMap> = {
|
|
127
|
+
cwd: string;
|
|
128
|
+
addons: Addons;
|
|
129
|
+
options: OptionMap<Addons>;
|
|
130
|
+
packageManager?: PackageManager;
|
|
131
|
+
};
|
|
132
|
+
type AddonMap = Record<string, Addon>;
|
|
133
|
+
type OptionMap<Addons extends AddonMap> = { [K in keyof Addons]: Partial<OptionValues<Addons[K]["options"]>> };
|
|
134
|
+
declare function installAddon<Addons extends AddonMap>({
|
|
135
|
+
addons,
|
|
136
|
+
cwd,
|
|
137
|
+
options,
|
|
138
|
+
packageManager
|
|
139
|
+
}: InstallOptions<Addons>): Promise<ReturnType<typeof applyAddons>>;
|
|
140
|
+
type ApplyAddonOptions = {
|
|
141
|
+
addons: AddonMap;
|
|
142
|
+
options: OptionMap<AddonMap>;
|
|
143
|
+
workspace: Workspace<any>;
|
|
144
|
+
addonSetupResults: Record<string, AddonSetupResult>;
|
|
145
|
+
};
|
|
146
|
+
declare function applyAddons({
|
|
147
|
+
addons,
|
|
148
|
+
workspace,
|
|
149
|
+
addonSetupResults,
|
|
150
|
+
options
|
|
151
|
+
}: ApplyAddonOptions): Promise<{
|
|
152
|
+
filesToFormat: string[];
|
|
153
|
+
pnpmBuildDependencies: string[];
|
|
154
|
+
}>;
|
|
155
|
+
//#endregion
|
|
156
|
+
//#region ../addons/_config/official.d.ts
|
|
157
|
+
type OfficialAddons = {
|
|
158
|
+
prettier: Addon<any>;
|
|
159
|
+
eslint: Addon<any>;
|
|
160
|
+
vitest: Addon<any>;
|
|
161
|
+
playwright: Addon<any>;
|
|
162
|
+
tailwindcss: Addon<any>;
|
|
163
|
+
sveltekitAdapter: Addon<any>;
|
|
164
|
+
devtoolsJson: Addon<any>;
|
|
165
|
+
drizzle: Addon<any>;
|
|
166
|
+
lucia: Addon<any>;
|
|
167
|
+
mdsvex: Addon<any>;
|
|
168
|
+
paraglide: Addon<any>;
|
|
169
|
+
storybook: Addon<any>;
|
|
170
|
+
};
|
|
171
|
+
declare const officialAddons: OfficialAddons;
|
|
172
|
+
//#endregion
|
|
173
|
+
export { type AddonMap, type InstallOptions, type LanguageType, type OptionMap, type TemplateType, create, installAddon, officialAddons };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/package-manager-detector@0.2.11/node_modules/package-manager-detector/dist/shared/package-manager-detector.ncFwAKgD.d.mts
|
|
2
|
+
type AgentName = 'npm' | 'yarn' | 'pnpm' | 'bun' | 'deno';
|
|
3
|
+
//#endregion
|
|
4
|
+
//#region utils/package-manager.d.ts
|
|
5
|
+
|
|
6
|
+
declare function addPnpmBuildDependencies(cwd: string, packageManager: AgentName | null | undefined, allowedPackages: string[]): void;
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region lib/testing.d.ts
|
|
9
|
+
type ProjectVariant = "kit-js" | "kit-ts" | "vite-js" | "vite-ts";
|
|
10
|
+
type CreateProject = (options: {
|
|
11
|
+
testId: string;
|
|
12
|
+
variant: ProjectVariant;
|
|
13
|
+
/** @default true */
|
|
14
|
+
clean?: boolean;
|
|
15
|
+
}) => string;
|
|
16
|
+
type SetupOptions = {
|
|
17
|
+
cwd: string;
|
|
18
|
+
variants: readonly ProjectVariant[];
|
|
19
|
+
/** @default false */
|
|
20
|
+
clean?: boolean;
|
|
21
|
+
};
|
|
22
|
+
declare function setup({
|
|
23
|
+
cwd,
|
|
24
|
+
clean,
|
|
25
|
+
variants
|
|
26
|
+
}: SetupOptions): Promise<{
|
|
27
|
+
templatesDir: string;
|
|
28
|
+
}>;
|
|
29
|
+
type CreateOptions = {
|
|
30
|
+
cwd: string;
|
|
31
|
+
testName: string;
|
|
32
|
+
templatesDir: string;
|
|
33
|
+
};
|
|
34
|
+
declare function createProject({
|
|
35
|
+
cwd,
|
|
36
|
+
testName,
|
|
37
|
+
templatesDir
|
|
38
|
+
}: CreateOptions): CreateProject;
|
|
39
|
+
type PreviewOptions = {
|
|
40
|
+
cwd: string;
|
|
41
|
+
command?: string;
|
|
42
|
+
};
|
|
43
|
+
declare function startPreview({
|
|
44
|
+
cwd,
|
|
45
|
+
command
|
|
46
|
+
}: PreviewOptions): Promise<{
|
|
47
|
+
url: string;
|
|
48
|
+
close: () => Promise<void>;
|
|
49
|
+
}>;
|
|
50
|
+
//#endregion
|
|
51
|
+
export { CreateProject, ProjectVariant, addPnpmBuildDependencies, createProject, setup, startPreview };
|