diff --git a/.changeset/hot-goats-confess.md b/.changeset/hot-goats-confess.md new file mode 100644 index 00000000..3433306f --- /dev/null +++ b/.changeset/hot-goats-confess.md @@ -0,0 +1,6 @@ +--- +"@bfra.me/create": minor +--- + +Update types and call to `run`. + \ No newline at end of file diff --git a/packages/create/src/index.ts b/packages/create/src/index.ts index 6b373112..dadca0ab 100644 --- a/packages/create/src/index.ts +++ b/packages/create/src/index.ts @@ -18,14 +18,17 @@ export async function createPackage(options: CreatePackageOptions) { // Create target directory await fs.mkdir(targetDir, {recursive: true}) - await run(targetDir, { - templates: [ - { - name: 'default', - // Point to the template directory - url: `${templateDir}`, - }, - ], + await run({ + projectPath: targetDir, + config: { + templates: [ + { + name: 'default', + // Point to the template directory + url: `${templateDir}`, + }, + ], + }, }) console.log(`Package created successfully.`) diff --git a/packages/create/src/types.ts b/packages/create/src/types.ts index 5589037a..12525a86 100644 --- a/packages/create/src/types.ts +++ b/packages/create/src/types.ts @@ -1,7 +1,7 @@ import type {run} from '@sxzz/create' import type {Prettify} from 'ts-essentials' -export type Config = Prettify[1]>> +export type Config = Prettify[0]>> export interface CreatePackageOptions { template?: string diff --git a/packages/create/test/index.test.ts b/packages/create/test/index.test.ts index d4a6fab4..93b09dee 100644 --- a/packages/create/test/index.test.ts +++ b/packages/create/test/index.test.ts @@ -35,13 +35,16 @@ describe('createPackage', () => { expect(fs.mkdir).toHaveBeenCalledWith('/test/output', {recursive: true}) // Verify run was called with correct arguments - expect(run).toHaveBeenCalledWith('/test/output', { - templates: [ - { - name: 'default', - url: expect.stringContaining('/templates/default'), - }, - ], + expect(run).toHaveBeenCalledWith({ + config: { + templates: [ + { + name: 'default', + url: expect.stringContaining('/templates/default'), + }, + ], + }, + projectPath: '/test/output', }) }) @@ -54,13 +57,16 @@ describe('createPackage', () => { await createPackage(options) expect(fs.mkdir).toHaveBeenCalledWith('/test/output', {recursive: true}) - expect(run).toHaveBeenCalledWith('/test/output', { - templates: [ - { - name: 'default', - url: expect.stringContaining('/templates/custom'), - }, - ], + expect(run).toHaveBeenCalledWith({ + config: { + templates: [ + { + name: 'default', + url: expect.stringContaining('/templates/custom'), + }, + ], + }, + projectPath: '/test/output', }) }) @@ -71,13 +77,16 @@ describe('createPackage', () => { await createPackage(options) expect(fs.mkdir).toHaveBeenCalledWith(cwd, {recursive: true}) - expect(run).toHaveBeenCalledWith(cwd, { - templates: [ - { - name: 'default', - url: expect.stringContaining('/templates/default'), - }, - ], + expect(run).toHaveBeenCalledWith({ + config: { + templates: [ + { + name: 'default', + url: expect.stringContaining('/templates/default'), + }, + ], + }, + projectPath: cwd, }) })