diff --git a/.changeset/many-planes-taste.md b/.changeset/many-planes-taste.md new file mode 100644 index 000000000000..06858f8d07e2 --- /dev/null +++ b/.changeset/many-planes-taste.md @@ -0,0 +1,5 @@ +--- +'create-svelte': patch +--- + +[feat] extract and export types from create-svelte diff --git a/packages/create-svelte/index.js b/packages/create-svelte/index.js index 737318815d4b..58a215dd5c21 100755 --- a/packages/create-svelte/index.js +++ b/packages/create-svelte/index.js @@ -2,12 +2,7 @@ import fs from 'fs'; import path from 'path'; import { mkdirp, copy, dist } from './utils.js'; -/** - * Create a new SvelteKit project. - * - * @param {string} cwd - Path to the directory to create - * @param {import('./types/internal').Options} options - */ +/** @type {import('./types/index').create} */ export async function create(cwd, options) { mkdirp(cwd); diff --git a/packages/create-svelte/package.json b/packages/create-svelte/package.json index 6847cd929cfa..70181b3e20b1 100644 --- a/packages/create-svelte/package.json +++ b/packages/create-svelte/package.json @@ -42,7 +42,9 @@ "index.js", "dist", "bin.js", - "utils.js" + "utils.js", + "types" ], + "types": "types/index.d.ts", "type": "module" } diff --git a/packages/create-svelte/types/index.d.ts b/packages/create-svelte/types/index.d.ts new file mode 100644 index 000000000000..ef78af4797b1 --- /dev/null +++ b/packages/create-svelte/types/index.d.ts @@ -0,0 +1,8 @@ +import { Options } from './internal'; + +/** + * Create a new SvelteKit project. + * @param {string} cwd - Path to the directory to create + * @param {import('./internal').Options} options + */ +export function create(cwd: string, options: Options): Promise;