diff --git a/package.json b/package.json index b65e18f3..b45012bd 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "@prettier/sync": "^0.5.2", "all-contributors-for-repository": "^0.3.0", "chalk": "^5.3.0", - "create": "0.1.0-alpha.0", + "create": "0.1.0-alpha.1", "execa": "^9.5.1", "get-github-auth-token": "^0.1.0", "git-remote-origin-url": "^4.0.0", @@ -80,7 +80,7 @@ "@vitest/eslint-plugin": "1.1.14", "c8": "10.1.2", "console-fail-test": "0.5.0", - "create-testers": "0.1.0-alpha.0", + "create-testers": "0.1.0-alpha.1", "cspell": "8.16.1", "eslint": "9.16.0", "eslint-plugin-jsdoc": "50.6.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 237448ae..76b42f35 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -21,8 +21,8 @@ importers: specifier: ^5.3.0 version: 5.3.0 create: - specifier: 0.1.0-alpha.0 - version: 0.1.0-alpha.0 + specifier: 0.1.0-alpha.1 + version: 0.1.0-alpha.1 execa: specifier: ^9.5.1 version: 9.5.1 @@ -37,10 +37,10 @@ importers: version: 16.0.0 input-from-file: specifier: 0.1.0-alpha.0 - version: 0.1.0-alpha.0(create@0.1.0-alpha.0) + version: 0.1.0-alpha.0(create@0.1.0-alpha.1) input-from-file-json: specifier: 0.1.0-alpha.1 - version: 0.1.0-alpha.1(create@0.1.0-alpha.0) + version: 0.1.0-alpha.1(create@0.1.0-alpha.1) js-yaml: specifier: ^4.1.0 version: 4.1.0 @@ -121,8 +121,8 @@ importers: specifier: 0.5.0 version: 0.5.0 create-testers: - specifier: 0.1.0-alpha.0 - version: 0.1.0-alpha.0(create@0.1.0-alpha.0) + specifier: 0.1.0-alpha.1 + version: 0.1.0-alpha.1(create@0.1.0-alpha.1) cspell: specifier: 8.16.1 version: 8.16.1 @@ -1883,14 +1883,14 @@ packages: typescript: optional: true - create-testers@0.1.0-alpha.0: - resolution: {integrity: sha512-SZdBwCHlBCoOkBGh6NLpNiFAQipphQb7a4CvYPdpDxSoBHv3w99W2NNQMSZjFIdGma9qgBeMthMHW6Z0u/+5vA==} + create-testers@0.1.0-alpha.1: + resolution: {integrity: sha512-NSkwbkojgeubP5kRUboi81RnZ4X0PS0eE1KEjMP78jabrF/RotD++L2rvesTpr2dJ0pUACNW9bhpDOhMve0Jrw==} engines: {node: '>=18'} peerDependencies: - create: 0.1.0-alpha.0 + create: 0.1.0-alpha.1 - create@0.1.0-alpha.0: - resolution: {integrity: sha512-OqEAIZHN6P53uufGrm8Vmxe0rWghvAAI+6bhpL5fOG2pQ+jfvwHUulyKOpdzxHee4J40zu2KzG0hb14au5dFZw==} + create@0.1.0-alpha.1: + resolution: {integrity: sha512-yk0OhrKutpLKVBKfIwBIfxpLjKyANeG4r7exPpICkRF5wQfnCyPWK5+Ub8SrxrgsMimEfk0xUrlhmsGN6ZY99g==} engines: {node: '>=18'} hasBin: true @@ -5581,11 +5581,11 @@ snapshots: optionalDependencies: typescript: 5.7.2 - create-testers@0.1.0-alpha.0(create@0.1.0-alpha.0): + create-testers@0.1.0-alpha.1(create@0.1.0-alpha.1): dependencies: - create: 0.1.0-alpha.0 + create: 0.1.0-alpha.1 - create@0.1.0-alpha.0: + create@0.1.0-alpha.1: dependencies: execa: 9.5.1 zod: 3.23.8 @@ -6459,15 +6459,15 @@ snapshots: ini@4.1.1: {} - input-from-file-json@0.1.0-alpha.1(create@0.1.0-alpha.0): + input-from-file-json@0.1.0-alpha.1(create@0.1.0-alpha.1): dependencies: - create: 0.1.0-alpha.0 - input-from-file: 0.1.0-alpha.0(create@0.1.0-alpha.0) + create: 0.1.0-alpha.1 + input-from-file: 0.1.0-alpha.0(create@0.1.0-alpha.1) zod: 3.23.8 - input-from-file@0.1.0-alpha.0(create@0.1.0-alpha.0): + input-from-file@0.1.0-alpha.0(create@0.1.0-alpha.1): dependencies: - create: 0.1.0-alpha.0 + create: 0.1.0-alpha.1 zod: 3.23.8 inquirer@9.3.2: diff --git a/src/next/blocks/blockPrettier.ts b/src/next/blocks/blockPrettier.ts index a7448655..6d98d138 100644 --- a/src/next/blocks/blockPrettier.ts +++ b/src/next/blocks/blockPrettier.ts @@ -89,7 +89,7 @@ pnpm format --write files: { ".husky": { ".gitignore": "_", - "pre-commit": "npx lint-staged", + "pre-commit": ["npx lint-staged", { mode: 0x777 }], }, ".prettierignore": ["/.husky", "/lib", "/pnpm-lock.yaml", ...ignores] .sort() diff --git a/src/steps/writing/creation/index.ts b/src/steps/writing/creation/index.ts index e02b58c7..767bdac1 100644 --- a/src/steps/writing/creation/index.ts +++ b/src/steps/writing/creation/index.ts @@ -51,13 +51,12 @@ async function recursivelyFormat(files: CreatedFiles): Promise { const result: Structure = {}; for (const [key, value] of Object.entries(files)) { - switch (typeof value) { - case "object": - result[key] = await recursivelyFormat(value); - break; - case "string": - result[key] = await formatCreatedFile(key, value); - break; + if (Array.isArray(value)) { + result[key] = await formatCreatedFile(key, value[0]); + } else if (typeof value === "string") { + result[key] = await formatCreatedFile(key, value); + } else if (typeof value === "object") { + result[key] = await recursivelyFormat(value); } } diff --git a/src/steps/writing/writeStructure.ts b/src/steps/writing/writeStructure.ts index f6962ffb..1a5531f8 100644 --- a/src/steps/writing/writeStructure.ts +++ b/src/steps/writing/writeStructure.ts @@ -1,3 +1,4 @@ +import { applyFilesToSystem, createWritingFileSystem } from "create"; import { $ } from "execa"; import { isUsingCreateEngine } from "../../shared/isUsingCreateEngine.js"; @@ -6,10 +7,15 @@ import { createStructure } from "./creation/index.js"; import { writeStructureWorker } from "./writeStructureWorker.js"; export async function writeStructure(options: Options) { - await writeStructureWorker( - await createStructure(options, isUsingCreateEngine()), - ".", - ); + const usingCreateEngine = isUsingCreateEngine(); + const structure = await createStructure(options, usingCreateEngine); + + if (usingCreateEngine) { + await applyFilesToSystem(structure, createWritingFileSystem(), "."); + return; + } + + await writeStructureWorker(structure, "."); try { // https://github.com/JoshuaKGoldberg/create-typescript-app/issues/718