diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 58df779..2fc74e2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,8 +15,6 @@ jobs: - run: pnpm lint test: - needs: - - lint runs-on: ${{matrix.os}} steps: - uses: actions/checkout@v4 diff --git a/src/config.ts b/src/config.ts index ac70ec0..1c1de6d 100644 --- a/src/config.ts +++ b/src/config.ts @@ -2,7 +2,7 @@ import { findUp } from "find-up"; import { pathToFileURL } from "node:url"; import { DocumentName, type File } from "./types.js"; -type Config = { +export type Config = { hooks?: { postGenerate?: (info: { documentName: DocumentName; @@ -31,8 +31,10 @@ export async function getConfig(cwd: string): Promise { try { config = (await import(pathToFileURL(path).toString())).default; - } catch { - throw new Error(`Could not import gember config file at "${path}".`); + } catch (cause) { + throw new Error(`Could not import gember config file at "${path}".`, { + cause, + }); } if (config === undefined) { diff --git a/test/blueprints/v2-addon-hooks/gember.config.js b/test/blueprints/v2-addon-hooks/gember.config.js index 22e55a4..b58f657 100644 --- a/test/blueprints/v2-addon-hooks/gember.config.js +++ b/test/blueprints/v2-addon-hooks/gember.config.js @@ -1,7 +1,9 @@ import { writeFile } from "node:fs/promises"; -import { dirname, join, relative } from "node:path"; +import { EOL } from "node:os"; +import { dirname, join, relative, sep } from "node:path"; import { fileURLToPath } from "node:url"; +/** @type {import('../../../src/config.ts').Config} */ export default { hooks: { postGenerate: async (info) => { @@ -9,8 +11,11 @@ export default { const file = join(directory, "post-generate-info.json"); for (const file of info.files) { + // Support Windows: + file.content = file.content.replace(EOL, "\n"); + // Because the absolute path is different on each machine: - file.path = relative("test/output", file.path); + file.path = relative("test/output", file.path).split(sep).join("/"); } await writeFile(file, JSON.stringify(info, null, 2));