fix(documentation): update readme with comprehensive API documentation and hints file
- Updated readme.md with complete API reference and usage examples - Added readme.hints.md with architecture and implementation details - Improved documentation structure and clarity - Version bump to 5.0.13
This commit is contained in:
@@ -1 +1,23 @@
|
||||
|
||||
# SmartEnv Hints
|
||||
|
||||
## Architecture Overview
|
||||
- Single main class `Smartenv` that provides all functionality
|
||||
- Uses dependency injection pattern with plugins imported from smartenv.plugins.ts
|
||||
- Utilizes @push.rocks/smartpromise for async operations
|
||||
|
||||
## Key Implementation Details
|
||||
- Runtime detection based on checking if `process` is defined
|
||||
- Dynamic module loading using Function constructor for Node.js modules
|
||||
- Script tag injection for browser module loading with duplicate prevention
|
||||
- OS detection uses the native Node.js 'os' module loaded dynamically
|
||||
|
||||
## Testing Approach
|
||||
- Tests use @git.zone/tstest with tap-based testing
|
||||
- Test file demonstrates OS detection and CI environment detection
|
||||
- Tests can run in both Node.js and browser environments
|
||||
|
||||
## Important Notes
|
||||
- The `getSafeNodeModule` uses dynamic import via Function constructor to avoid bundler issues
|
||||
- Browser module loading tracks loaded scripts to prevent duplicate loads
|
||||
- All OS detection methods are async and return false in browser environments
|
||||
- The package is isomorphic and designed for use in both Node.js and browser contexts
|
Reference in New Issue
Block a user