UNPKG

@haloduck/core

Version:
117 lines (100 loc) 2.71 kB
# @haloduck/core HaloDuck Core Library is a core library for Angular-based applications. ## Installation ```bash npm install @haloduck/core ``` ## Post Installation ### Copy scripts Copy script files to `scripts` folder in the root folder. ```bash npx haloduck-copy-scripts ``` ### Update `package.json` ```bash "scripts": { ... "prebuild": "ts-node scripts/generate-build-timestamp.ts" } ``` ## Key Features - **Authentication Service**: AWS Amplify-based authentication management - **API Service**: Basic service for RESTful API communication - **State Management**: NgRx-based global state management - **Guards**: Authentication guards for route protection - **Interceptors**: HTTP request/response processing - **Pipes**: Utility pipes for data transformation - **Models**: Type definitions and interfaces ## Usage ### Basic Configuration ```typescript Amplify.configure({ Auth: { Cognito: awsCognito as CognitoUserPoolConfig, }, }); export const appConfig: ApplicationConfig = { providers: [ // ... provideHttpClient( withInterceptors([idTokenInterceptor, dummyMemberIdInterceptor]), ), // ... provideStore({ global: globalReducer, }), provideEffects(GlobalEffects), provideStoreDevtools({ maxAge: 25, logOnly: !isDevMode() }), // ... provideQuillConfig({ modules: { syntax: false, }, }), // ... provideServiceWorker('ngsw-worker.js', { enabled: environment.usePwa, registrationStrategy: 'registerWhenStable:30000', }), // ... provideTransloco({ config: { availableLangs: ['en', 'ko', 'ja'], defaultLang: 'en', // Remove this option if your application doesn't support changing language in runtime. reRenderOnLangChange: true, prodMode: !isDevMode(), }, loader: TranslocoHttpLoader, }), provideHaloduckTransloco(), // ... provideHaloduckCoreConfig({ stage: environment.stage, appName: environment.appName, defaultLanguage: 'en', dateFormat: { long: 'yyyy-MM-dd', short: 'yyMMdd', }, apiUrl: environment.service.apiUrl, cdnUrl: environment.service.cdnUrl, map: { googleApiKey: environment.service.google.apiKey, mapId: environment.service.google.id, defaultLngLat: environment.service.google.defaultLngLat, }, }), /// ... ], }; ``` ## Dependencies - Angular 19.2.0+ - RxJS 7.8.0+ - NgRx 19.0.0+ - AWS Amplify 6.12.1+ ## License MIT License ## Support If you have any issues or questions, please register them in [GitHub Issues](https://github.com/haloduck/haloduck-frontend/issues)