sv 0.12.8 → 0.13.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.
@@ -35,20 +35,20 @@ type NumberQuestion = {
35
35
  validate?: (value: string | undefined) => string | Error | undefined;
36
36
  placeholder?: string;
37
37
  };
38
- type SelectQuestion<Value$1> = {
38
+ type SelectQuestion<Value> = {
39
39
  type: "select";
40
- default: NoInfer<Value$1>;
40
+ default: NoInfer<Value>;
41
41
  options: Array<{
42
- value: Value$1;
42
+ value: Value;
43
43
  label?: string;
44
44
  hint?: string;
45
45
  }>;
46
46
  };
47
- type MultiSelectQuestion<Value$1> = {
47
+ type MultiSelectQuestion<Value> = {
48
48
  type: "multiselect";
49
- default: NoInfer<Value$1[]>;
49
+ default: NoInfer<Value[]>;
50
50
  options: Array<{
51
- value: Value$1;
51
+ value: Value;
52
52
  label?: string;
53
53
  hint?: string;
54
54
  }>;
@@ -79,13 +79,11 @@ type Workspace = {
79
79
  * @param pkg the package to check for
80
80
  * @returns the dependency version with any leading characters such as ^ or ~ removed
81
81
  */
82
- dependencyVersion: (pkg: string) => string | undefined;
83
- /** to know if the workspace is using typescript or javascript */
82
+ dependencyVersion: (pkg: string) => string | undefined; /** to know if the workspace is using typescript or javascript */
84
83
  language: "ts" | "js";
85
84
  files: {
86
85
  viteConfig: "vite.config.js" | "vite.config.ts";
87
- svelteConfig: "svelte.config.js" | "svelte.config.ts";
88
- /** `${kit.routesDirectory}/layout.css` or `src/app.css` */
86
+ svelteConfig: "svelte.config.js" | "svelte.config.ts"; /** `${kit.routesDirectory}/layout.css` or `src/app.css` */
89
87
  stylesheet: `${string}/layout.css` | "src/app.css";
90
88
  package: "package.json";
91
89
  gitignore: ".gitignore";
@@ -93,8 +91,7 @@ type Workspace = {
93
91
  prettierrc: ".prettierrc";
94
92
  eslintConfig: "eslint.config.js";
95
93
  vscodeSettings: ".vscode/settings.json";
96
- vscodeExtensions: ".vscode/extensions.json";
97
- /** Get the relative path between two files */
94
+ vscodeExtensions: ".vscode/extensions.json"; /** Get the relative path between two files */
98
95
  getRelative: ({
99
96
  from,
100
97
  to
@@ -102,13 +99,11 @@ type Workspace = {
102
99
  from?: string;
103
100
  to: string;
104
101
  }) => string;
105
- };
106
- /** If we are in a kit project, this object will contain the lib and routes directories */
102
+ }; /** If we are in a kit project, this object will contain the lib and routes directories */
107
103
  kit: {
108
104
  libDirectory: string;
109
105
  routesDirectory: string;
110
- } | undefined;
111
- /** The package manager used to install dependencies */
106
+ } | undefined; /** The package manager used to install dependencies */
112
107
  packageManager: AgentName;
113
108
  };
114
109
  type CreateWorkspaceOptions = {
@@ -140,51 +135,38 @@ type Scripts = {
140
135
  condition?: ConditionDefinition;
141
136
  };
142
137
  type SvApi = {
143
- /** Add a package to the pnpm build dependencies. */
144
- pnpmBuildDependency: (pkg: string) => void;
145
- /** Add a package to the dependencies. */
146
- dependency: (pkg: string, version: string) => void;
147
- /** Add a package to the dev dependencies. */
148
- devDependency: (pkg: string, version: string) => void;
149
- /** Execute a command in the workspace. */
150
- execute: (args: string[], stdio: "inherit" | "pipe") => Promise<void>;
151
- /** Edit a file in the workspace. (will create it if it doesn't exist) */
138
+ /** Add a package to the pnpm build dependencies. */pnpmBuildDependency: (pkg: string) => void; /** Add a package to the dependencies. */
139
+ dependency: (pkg: string, version: string) => void; /** Add a package to the dev dependencies. */
140
+ devDependency: (pkg: string, version: string) => void; /** Execute a command in the workspace. */
141
+ execute: (args: string[], stdio: "inherit" | "pipe") => Promise<void>; /** Edit a file in the workspace. (will create it if it doesn't exist) */
152
142
  file: (path: string, edit: (content: string) => string) => void;
153
143
  };
154
- type Addon<Args extends OptionDefinition, Id$1 extends string = string> = {
155
- id: Id$1;
144
+ type Addon<Args extends OptionDefinition, Id extends string = string> = {
145
+ id: Id;
156
146
  alias?: string;
157
147
  shortDescription?: string;
158
- homepage?: string;
159
- /** If true, this addon won't appear in the interactive prompt but can still be used via CLI */
148
+ homepage?: string; /** If true, this addon won't appear in the interactive prompt but can still be used via CLI */
160
149
  hidden?: boolean;
161
- options: Args;
162
- /** Setup the addon. Will be called before the addon is run. */
150
+ options: Args; /** Setup the addon. Will be called before the addon is run. */
163
151
  setup?: (workspace: Workspace & {
164
- /** On what official addons does this addon depend on? */
165
- dependsOn: (name: keyof typeof officialAddons) => void;
152
+ /** On what official addons does this addon depend on? */dependsOn: (name: keyof typeof officialAddons) => void;
166
153
  /** Why is this addon not supported?
167
154
  *
168
155
  * @example
169
156
  * if (!kit) unsupported('Requires SvelteKit');
170
157
  */
171
- unsupported: (reason: string) => void;
172
- /** On what official addons does this addon run after? */
158
+ unsupported: (reason: string) => void; /** On what official addons does this addon run after? */
173
159
  runsAfter: (name: keyof typeof officialAddons) => void;
174
- }) => MaybePromise<void>;
175
- /** Run the addon. The actual execution of the addon... Add files, edit files, etc. */
160
+ }) => MaybePromise<void>; /** Run the addon. The actual execution of the addon... Add files, edit files, etc. */
176
161
  run: (workspace: Workspace & {
177
- /** Add-on options */
178
- options: WorkspaceOptions<Args>;
179
- /** Api to interact with the workspace. */
162
+ /** Add-on options */options: WorkspaceOptions<Args>; /** Api to interact with the workspace. */
180
163
  sv: SvApi;
181
164
  /** Cancel the addon at any time!
182
165
  * @example
183
166
  * return cancel('There is a problem with...');
184
167
  */
185
168
  cancel: (reason: string) => void;
186
- }) => MaybePromise<void>;
187
- /** Next steps to display after the addon is run. */
169
+ }) => MaybePromise<void>; /** Next steps to display after the addon is run. */
188
170
  nextSteps?: (data: Workspace & {
189
171
  options: WorkspaceOptions<Args>;
190
172
  }) => string[];
@@ -192,7 +174,7 @@ type Addon<Args extends OptionDefinition, Id$1 extends string = string> = {
192
174
  /**
193
175
  * The entry point for your addon, It will hold every thing! (options, setup, run, nextSteps, ...)
194
176
  */
195
- declare function defineAddon<const Id$1 extends string, Args extends OptionDefinition>(config: Addon<Args, Id$1>): Addon<Args, Id$1>;
177
+ declare function defineAddon<const Id extends string, Args extends OptionDefinition>(config: Addon<Args, Id>): Addon<Args, Id>;
196
178
  /**
197
179
  * Stage 1: Raw CLI input - what the user typed
198
180
  */
@@ -259,7 +241,7 @@ type SetupResult = {
259
241
  unsupported: string[];
260
242
  runsAfter: string[];
261
243
  };
262
- type AddonDefinition<Id$1 extends string = string> = Addon<Record<string, Question<any>>, Id$1>;
244
+ type AddonDefinition<Id extends string = string> = Addon<Record<string, Question<any>>, Id>;
263
245
  type Tests = {
264
246
  expectProperty: (selector: string, property: string, expectedValue: string) => Promise<void>;
265
247
  elementExists: (selector: string) => Promise<void>;
@@ -295,8 +277,7 @@ type OptionBuilder<T extends OptionDefinition> = {
295
277
  * })
296
278
  * ```
297
279
  */
298
- add<K$1 extends string, const Q extends Question<T & Record<K$1, Q>>>(key: K$1, question: Q): OptionBuilder<T & Record<K$1, Q>>;
299
- /** Finalize all options of your `add-on`. */
280
+ add<K extends string, const Q extends Question<T & Record<K, Q>>>(key: K, question: Q): OptionBuilder<T & Record<K, Q>>; /** Finalize all options of your `add-on`. */
300
281
  build(): Prettify<T>;
301
282
  };
302
283
  /**
@@ -329,8 +310,8 @@ type InstallOptions<Addons extends AddonMap> = {
329
310
  packageManager?: AgentName;
330
311
  };
331
312
  type AddonMap = Record<string, Addon<any, any>>;
332
- type AddonById<Addons extends AddonMap, Id$1 extends string> = Extract<Addons[keyof Addons], {
333
- id: Id$1;
313
+ type AddonById<Addons extends AddonMap, Id extends string> = Extract<Addons[keyof Addons], {
314
+ id: Id;
334
315
  }>;
335
316
  type OptionMap<Addons extends AddonMap> = { [Id in Addons[keyof Addons]["id"]]: Partial<OptionValues<AddonById<Addons, Id>["options"]>> };
336
317
  declare function add<Addons extends AddonMap>({