@@ -107,8 +107,11 @@ export interface FeathersBaseContext extends PinionContext {
107107 * @param versions The dependency version list
108108 * @returns A list of dependencies with their versions
109109 */
110- export const addVersions = ( dependencies : string [ ] , versions : DependencyVersions ) =>
111- dependencies . map ( ( dep ) => `${ dep } @${ versions [ dep ] ? versions [ dep ] : 'latest' } ` )
110+ export const addVersions = (
111+ dependencies : string [ ] ,
112+ versions : DependencyVersions ,
113+ defaultVersion = 'latest'
114+ ) : string [ ] => dependencies . map ( ( dep ) => `${ dep } @${ versions [ dep ] || defaultVersion } ` )
112115
113116/**
114117 * Loads the application package.json and populates information like the library and test directory
@@ -138,6 +141,30 @@ export const initializeBaseContext =
138141 feathers : ctx . pkg ?. feathers
139142 } ) )
140143
144+ /**
145+ * A special error that can be thrown by generators. It contains additional
146+ * information about the error that can be used to display a more helpful
147+ * error message to the user.
148+ */
149+ export class FeathersGeneratorError extends Error {
150+ /**
151+ * Additional information about the error. This can include things like
152+ * the reason for the error and suggested actions to take.
153+ */
154+ context ?: Record < string , unknown >
155+
156+ /**
157+ * Creates a new FeathersGeneratorError
158+ * @param message The error message
159+ * @param context Additional information about the error
160+ */
161+ constructor ( message : string , context ?: Record < string , unknown > ) {
162+ super ( message )
163+ this . name = 'FeathersGeneratorError'
164+ this . context = context
165+ }
166+ }
167+
141168/**
142169 * Checks if the current context contains a valid generated application. This is necesary for most
143170 * generators (besides the app generator).
@@ -149,11 +176,11 @@ export const checkPreconditions =
149176 ( ) =>
150177 async < T extends FeathersBaseContext > ( ctx : T ) => {
151178 if ( ! ctx . feathers ) {
152- throw new Error ( `Can not run generator since the current folder does not appear to be a Feathers application.
153- Either your package.json is missing or it does not have \`feathers\` property.
154- ` )
179+ throw new FeathersGeneratorError ( 'Invalid Feathers application context' , {
180+ reason : 'Missing Feathers configuration' ,
181+ suggestedAction : 'Verify package.json contains Feathers metadata'
182+ } )
155183 }
156-
157184 return ctx
158185 }
159186
@@ -203,8 +230,13 @@ export const PRETTIERRC: PrettierOptions = {
203230 printWidth : 110 ,
204231 semi : false ,
205232 trailingComma : 'none' ,
206- singleQuote : true
207- }
233+ singleQuote : true ,
234+ arrowParens : 'avoid' ,
235+ bracketSpacing : true ,
236+ endOfLine : 'auto' ,
237+ jsxSingleQuote : false ,
238+ quoteProps : 'as-needed'
239+ } ;
208240
209241/*
210242 * Format a source file using Prettier. Will use the local configuration, the settings set in
0 commit comments