File tree Expand file tree Collapse file tree 3 files changed +12
-9
lines changed
packages/create-cloudflare/src/wrangler Expand file tree Collapse file tree 3 files changed +12
-9
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " create-cloudflare " : patch
3+ ---
4+
5+ fix(create-cloudflare): add a newline character to the line prepended to wrangler.toml
Original file line number Diff line number Diff line change @@ -73,10 +73,9 @@ describe("updateWranglerToml", () => {
7373 await updateWranglerToml ( ctx ) ;
7474
7575 const newToml = vi . mocked ( writeFile ) . mock . calls [ 0 ] [ 1 ] ;
76- expect ( newToml ) . toMatch ( `name = "${ ctx . project . name } "` ) ;
77- expect ( newToml ) . toMatch ( `main = "src/index.ts"` ) ;
7876 expect ( newToml ) . toBe (
79- `compatibility_date = "2024-01-17"name = "test"\n` +
77+ `compatibility_date = "${ mockCompatDate } "\n` +
78+ `name = "${ ctx . project . name } "\n` +
8079 `main = "src/index.ts"` ,
8180 ) ;
8281 } ) ;
@@ -88,11 +87,10 @@ describe("updateWranglerToml", () => {
8887 await updateWranglerToml ( ctx ) ;
8988
9089 const newToml = vi . mocked ( writeFile ) . mock . calls [ 0 ] [ 1 ] ;
91- expect ( newToml ) . toMatch ( `name = "${ ctx . project . name } "` ) ;
92- expect ( newToml ) . toMatch ( `main = "src/index.ts"` ) ;
93- expect ( newToml ) . toMatch ( `compatibility_date = "${ mockCompatDate } "` ) ;
9490 expect ( newToml ) . toBe (
95- `name = "test"compatibility_date = "2024-01-17"main = "src/index.ts"` ,
91+ `name = "${ ctx . project . name } "\n` +
92+ `compatibility_date = "${ mockCompatDate } "\n` +
93+ `main = "src/index.ts"` ,
9694 ) ;
9795 } ) ;
9896
Original file line number Diff line number Diff line change @@ -31,15 +31,15 @@ export const updateWranglerToml = async (ctx: C3Context) => {
3131 }
3232 } else {
3333 newToml . prepend (
34- `compatibility_date = "${ await getWorkerdCompatibilityDate ( ) } "` ,
34+ `compatibility_date = "${ await getWorkerdCompatibilityDate ( ) } "\n ` ,
3535 ) ;
3636 }
3737
3838 const nameRe = / ^ n a m e \s * = .* / m;
3939 if ( wranglerToml . match ( nameRe ) ) {
4040 newToml . replace ( nameRe , `name = "${ ctx . project . name } "` ) ;
4141 } else {
42- newToml . prepend ( `name = "${ ctx . project . name } "` ) ;
42+ newToml . prepend ( `name = "${ ctx . project . name } "\n ` ) ;
4343 }
4444
4545 writeWranglerToml ( ctx , newToml . toString ( ) ) ;
You can’t perform that action at this time.
0 commit comments