@@ -48,12 +48,10 @@ async function resolveConfig(): Promise<
4848
4949 // Validate that both importMap and imports are not present
5050 if ( config . importMap && config . imports ) {
51- error ( 'Error: deno.json contains both "importMap" and "imports"' ) ;
52- error ( "" ) ;
51+ error ( 'deno.json contains both "importMap" and "imports"\n' ) ;
5352 error (
54- 'deno.json can use either "importMap" (path to file) OR "imports" (inline mappings), but not both.' ,
53+ 'deno.json can use either "importMap" (path to file) OR "imports" (inline mappings), but not both.\n ' ,
5554 ) ;
56- error ( "" ) ;
5755 error ( "Please remove one of these fields from your deno.json." ) ;
5856 Deno . exit ( 1 ) ;
5957 }
@@ -65,8 +63,7 @@ async function resolveConfig(): Promise<
6563 const defaultConfigPath = resourcePath ( "extension-build/deno.json" ) ;
6664
6765 if ( ! existsSync ( defaultConfigPath ) ) {
68- error ( "Error: Could not find default extension-build configuration." ) ;
69- error ( "" ) ;
66+ error ( "Could not find default extension-build configuration.\n" ) ;
7067 error ( "This may indicate that Quarto was not built correctly." ) ;
7168 error ( "Expected config at: " + defaultConfigPath ) ;
7269 Deno . exit ( 1 ) ;
@@ -86,12 +83,10 @@ async function autoDetectEntryPoint(
8683
8784 // Check if src/ exists
8885 if ( ! existsSync ( srcDir ) ) {
89- error ( "Error: No src/ directory found." ) ;
90- error ( "" ) ;
86+ error ( "No src/ directory found.\n" ) ;
9187 error ( "Create a TypeScript file in src/:" ) ;
9288 error ( " mkdir -p src" ) ;
93- error ( " touch src/my-engine.ts" ) ;
94- error ( "" ) ;
89+ error ( " touch src/my-engine.ts\n" ) ;
9590 error ( "Or specify entry point as argument or in deno.json:" ) ;
9691 error ( " quarto dev-call build-ts-extension src/my-engine.ts" ) ;
9792 error ( " OR in deno.json:" ) ;
@@ -107,7 +102,7 @@ async function autoDetectEntryPoint(
107102 if ( configEntryPoint ) {
108103 if ( ! existsSync ( configEntryPoint ) ) {
109104 error (
110- `Error: Entry point specified in deno.json does not exist: ${ configEntryPoint } ` ,
105+ `Entry point specified in deno.json does not exist: ${ configEntryPoint } ` ,
111106 ) ;
112107 Deno . exit ( 1 ) ;
113108 }
@@ -124,8 +119,7 @@ async function autoDetectEntryPoint(
124119
125120 // Resolution logic
126121 if ( tsFiles . length === 0 ) {
127- error ( "Error: No .ts files found in src/" ) ;
128- error ( "" ) ;
122+ error ( "No .ts files found in src/\n" ) ;
129123 error ( "Create a TypeScript file:" ) ;
130124 error ( " touch src/my-engine.ts" ) ;
131125 Deno . exit ( 1 ) ;
@@ -140,17 +134,15 @@ async function autoDetectEntryPoint(
140134 return join ( srcDir , "mod.ts" ) ;
141135 }
142136
143- error ( `Error: Multiple .ts files found in src/: ${ tsFiles . join ( ", " ) } ` ) ;
144- error ( "" ) ;
137+ error ( `Multiple .ts files found in src/: ${ tsFiles . join ( ", " ) } \n` ) ;
145138 error ( "Specify entry point as argument or in deno.json:" ) ;
146139 error ( " quarto dev-call build-ts-extension src/my-engine.ts" ) ;
147140 error ( " OR in deno.json:" ) ;
148141 error ( " {" ) ;
149142 error ( ' "bundle": {' ) ;
150143 error ( ' "entryPoint": "src/my-engine.ts"' ) ;
151144 error ( " }" ) ;
152- error ( " }" ) ;
153- error ( "" ) ;
145+ error ( " }\n" ) ;
154146 error ( "Or rename one file to mod.ts:" ) ;
155147 error ( ` mv src/${ tsFiles [ 0 ] } src/mod.ts` ) ;
156148 Deno . exit ( 1 ) ;
@@ -169,8 +161,7 @@ function inferOutputPath(outputFilename: string): string {
169161 // Find the extension directory by looking for _extension.yml
170162 const extensionsDir = "_extensions" ;
171163 if ( ! existsSync ( extensionsDir ) ) {
172- error ( "Error: No _extensions/ directory found." ) ;
173- error ( "" ) ;
164+ error ( "No _extensions/ directory found.\n" ) ;
174165 error (
175166 "Extension projects must have an _extensions/ directory with _extension.yml." ,
176167 ) ;
@@ -187,8 +178,7 @@ function inferOutputPath(outputFilename: string): string {
187178 }
188179
189180 if ( extensionYmlFiles . length === 0 ) {
190- error ( "Error: No _extension.yml found in _extensions/ subdirectories." ) ;
191- error ( "" ) ;
181+ error ( "No _extension.yml found in _extensions/ subdirectories.\n" ) ;
192182 error (
193183 "Extension projects must have _extension.yml in a subdirectory of _extensions/." ,
194184 ) ;
@@ -202,17 +192,12 @@ function inferOutputPath(outputFilename: string): string {
202192 path . replace ( "_extensions/" , "" )
203193 ) ;
204194 error (
205- `Error: Multiple extension directories found: ${
206- extensionNames . join ( ", " )
207- } `,
195+ `Multiple extension directories found: ${ extensionNames . join ( ", " ) } \n` ,
208196 ) ;
209- error ( "" ) ;
210197 error ( "Specify the output path in deno.json:" ) ;
211198 error ( " {" ) ;
212199 error ( ' "bundle": {' ) ;
213- error (
214- ` "outputFile": "${ extensionYmlFiles [ 0 ] } /${ outputFilename } "` ,
215- ) ;
200+ error ( ` "outputFile": "${ extensionYmlFiles [ 0 ] } /${ outputFilename } "` ) ;
216201 error ( " }" ) ;
217202 error ( " }" ) ;
218203 Deno . exit ( 1 ) ;
@@ -285,7 +270,7 @@ async function bundle(
285270 } ) ;
286271
287272 if ( ! result . success ) {
288- error ( "Error: deno bundle failed" ) ;
273+ error ( "deno bundle failed" ) ;
289274 if ( result . stderr ) {
290275 error ( result . stderr ) ;
291276 }
@@ -317,14 +302,10 @@ function validateExtensionYml(outputPath: string): void {
317302 for ( const engine of engines ) {
318303 const enginePath = typeof engine === "string" ? engine : engine ?. path ;
319304 if ( enginePath && enginePath !== outputFilename ) {
320- warning ( "" ) ;
321305 warning (
322- `Warning: _extension.yml specifies engine path "${ enginePath } " but built file is "${ outputFilename } "` ,
306+ `_extension.yml specifies engine path "${ enginePath } " but built file is "${ outputFilename } "` ,
323307 ) ;
324- warning (
325- ` Update _extension.yml to: path: ${ outputFilename } ` ,
326- ) ;
327- warning ( "" ) ;
308+ warning ( ` Update _extension.yml to: path: ${ outputFilename } ` ) ;
328309 }
329310 }
330311 }
@@ -338,11 +319,10 @@ async function initializeConfig(): Promise<void> {
338319
339320 // Check if deno.json already exists
340321 if ( existsSync ( configPath ) ) {
341- error ( "Error: deno .json already exists ") ;
342- error ( "" ) ;
322+ const importMapPath = resourcePath ( "extension-build/import-map .json") ;
323+ error ( "deno.json already exists\n " ) ;
343324 error ( "To use Quarto's default config, remove the existing deno.json." ) ;
344325 error ( "Or manually add the importMap to your existing config:" ) ;
345- const importMapPath = resourcePath ( "extension-build/import-map.json" ) ;
346326 info ( ` "importMap": "${ importMapPath } "` ) ;
347327 Deno . exit ( 1 ) ;
348328 }
@@ -427,8 +407,7 @@ export const buildTsExtensionCommand = new Command()
427407 cwd : Deno . cwd ( ) ,
428408 } ) ;
429409 if ( ! result . success ) {
430- error ( "Error: Type check failed" ) ;
431- error ( "" ) ;
410+ error ( "Type check failed\n" ) ;
432411 error (
433412 "See errors above. Fix type errors in your code or adjust compilerOptions in deno.json." ,
434413 ) ;
@@ -441,9 +420,9 @@ export const buildTsExtensionCommand = new Command()
441420 }
442421 } catch ( e ) {
443422 if ( e instanceof Error ) {
444- error ( `Error: ${ e . message } ` ) ;
423+ error ( e . message ) ;
445424 } else {
446- error ( `Error: ${ String ( e ) } ` ) ;
425+ error ( String ( e ) ) ;
447426 }
448427 Deno . exit ( 1 ) ;
449428 }
0 commit comments