-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: export EggAppConfig type let plugin can override it (#286)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Type Safety Improvements** - Enhanced type definitions for application configuration - Centralized type management across modules - Introduced more precise type checking for configuration objects - **Code Structure** - Refactored type imports and exports - Updated case style handling with new enum - Simplified type management in loader components - **Testing** - Added type exposure tests - Updated test configurations to reflect new type structures <!-- end of auto-generated comment: release notes by coderabbit.ai -->
- Loading branch information
Showing
9 changed files
with
110 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
export interface EggAppInfo { | ||
/** package.json */ | ||
pkg: Record<string, any>; | ||
/** the application name from package.json */ | ||
name: string; | ||
/** current directory of application */ | ||
baseDir: string; | ||
/** equals to serverEnv */ | ||
env: string; | ||
/** equals to serverScope */ | ||
scope: string; | ||
/** home directory of the OS */ | ||
HOME: string; | ||
/** baseDir when local and unittest, HOME when other environment */ | ||
root: string; | ||
} | ||
|
||
export interface EggPluginInfo { | ||
/** the plugin name, it can be used in `dep` */ | ||
name: string; | ||
/** the package name of plugin */ | ||
package?: string; | ||
version?: string; | ||
/** whether enabled */ | ||
enable: boolean; | ||
implicitEnable?: boolean; | ||
/** the directory of the plugin package */ | ||
path?: string; | ||
/** the dependent plugins, you can use the plugin name */ | ||
dependencies: string[]; | ||
/** the optional dependent plugins. */ | ||
optionalDependencies: string[]; | ||
dependents?: string[]; | ||
/** specify the serverEnv that only enable the plugin in it */ | ||
env: string[]; | ||
/** the file plugin config in. */ | ||
from: string; | ||
} | ||
|
||
export interface CustomLoaderConfigItem { | ||
/** the directory of the custom loader */ | ||
directory: string; | ||
/** the inject object, it can be app or ctx */ | ||
inject: string; | ||
/** whether load unit files */ | ||
loadunit?: boolean; | ||
} | ||
|
||
export interface EggAppConfig extends Record<string, any> { | ||
coreMiddleware: string[]; | ||
middleware: string[]; | ||
customLoader?: Record<string, CustomLoaderConfigItem>; | ||
controller?: { | ||
supportParams?: boolean; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.