File tree Expand file tree Collapse file tree 3 files changed +13
-7
lines changed
test/blueprints/v2-addon-hooks Expand file tree Collapse file tree 3 files changed +13
-7
lines changed Original file line number Diff line number Diff line change 1515 - run : pnpm lint
1616
1717 test :
18- needs :
19- - lint
18+ name : " test (node-version: ${{matrix.node-version}}, os: ${{matrix.os}})"
2019 runs-on : ${{matrix.os}}
2120 steps :
2221 - uses : actions/checkout@v4
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { findUp } from "find-up";
22import { pathToFileURL } from "node:url" ;
33import { DocumentName , type File } from "./types.js" ;
44
5- type Config = {
5+ export type Config = {
66 hooks ?: {
77 postGenerate ?: ( info : {
88 documentName : DocumentName ;
@@ -31,8 +31,10 @@ export async function getConfig(cwd: string): Promise<Config> {
3131
3232 try {
3333 config = ( await import ( pathToFileURL ( path ) . toString ( ) ) ) . default ;
34- } catch {
35- throw new Error ( `Could not import gember config file at "${ path } ".` ) ;
34+ } catch ( cause ) {
35+ throw new Error ( `Could not import gember config file at "${ path } ".` , {
36+ cause,
37+ } ) ;
3638 }
3739
3840 if ( config === undefined ) {
Original file line number Diff line number Diff line change 11import { writeFile } from "node:fs/promises" ;
2- import { dirname , join , relative } from "node:path" ;
2+ import { EOL } from "node:os" ;
3+ import { dirname , join , relative , sep } from "node:path" ;
34import { fileURLToPath } from "node:url" ;
45
6+ /** @type {import('../../../src/config.ts').Config } */
57export default {
68 hooks : {
79 postGenerate : async ( info ) => {
810 const directory = dirname ( fileURLToPath ( import . meta. url ) ) ;
911 const file = join ( directory , "post-generate-info.json" ) ;
1012
1113 for ( const file of info . files ) {
14+ // Support Windows:
15+ file . content = file . content . replace ( EOL , "\n" ) ;
16+
1217 // Because the absolute path is different on each machine:
13- file . path = relative ( "test/output" , file . path ) ;
18+ file . path = relative ( "test/output" , file . path ) . split ( sep ) . join ( "/" ) ;
1419 }
1520
1621 await writeFile ( file , JSON . stringify ( info , null , 2 ) ) ;
You can’t perform that action at this time.
0 commit comments