fix: ui core secondary entry points for buildable library

This commit is contained in:
Rahul R.
2024-06-19 13:37:47 +05:30
parent d7cdf2c29d
commit 9ba704dd42
1426 changed files with 956 additions and 499 deletions
+12 -12
View File
@@ -38,7 +38,7 @@
"polyfills": "apps/gauzy/src/polyfills.ts",
"tsConfig": "apps/gauzy/tsconfig.app.json",
"stylePreprocessorOptions": {
"includePaths": ["packages/ui-core/src/lib/static/styles"]
"includePaths": ["packages/ui-core/static/styles"]
},
"assets": [
"apps/gauzy/src/favicon.ico",
@@ -47,7 +47,7 @@
"apps/gauzy/src/silent-refresh.html",
{
"glob": "**/*",
"input": "packages/ui-core/src/lib/i18n/assets/i18n",
"input": "packages/ui-core/i18n/assets/i18n",
"output": "assets/i18n/"
}
],
@@ -62,7 +62,7 @@
"node_modules/nebular-icons/scss/nebular-icons.scss",
"node_modules/@ali-hm/angular-tree-component/css/angular-tree-component.css",
"node_modules/leaflet/dist/leaflet.css",
"packages/ui-core/src/lib/static/styles/styles.scss",
"packages/ui-core/static/styles/styles.scss",
"node_modules/@ng-select/ng-select/themes/default.theme.css"
],
"scripts": [
@@ -216,7 +216,7 @@
}
}
},
"@gauzy/ui-core": {
"ui-core": {
"projectType": "library",
"root": "packages/ui-core",
"sourceRoot": "packages/ui-core",
@@ -225,7 +225,7 @@
"build": {
"builder": "@angular-devkit/build-angular:ng-packagr",
"options": {
"project": "packages/ui-core/src/lib/ng-package.json"
"project": "packages/ui-core/ng-package.json"
},
"configurations": {
"production": {
@@ -470,7 +470,7 @@
"polyfills": "apps/gauzy/src/polyfills.ts",
"tsConfig": "apps/gauzy/tsconfig.app.json",
"stylePreprocessorOptions": {
"includePaths": ["packages/ui-core/src/lib/static/styles"]
"includePaths": ["packages/ui-core/static/styles"]
},
"assets": [
"apps/gauzy/src/favicon.ico",
@@ -485,7 +485,7 @@
},
{
"glob": "**/*",
"input": "packages/ui-core/src/lib/i18n/assets/i18n",
"input": "packages/ui-core/i18n/assets/i18n",
"output": "assets/i18n/"
}
],
@@ -499,7 +499,7 @@
"node_modules/nebular-icons/scss/nebular-icons.scss",
"node_modules/@ali-hm/angular-tree-component/css/angular-tree-component.css",
"node_modules/leaflet/dist/leaflet.css",
"packages/ui-core/src/lib/static/styles/styles.scss",
"packages/ui-core/static/styles/styles.scss",
"node_modules/@ng-select/ng-select/themes/default.theme.css"
],
"scripts": [
@@ -630,7 +630,7 @@
"node_modules/@ali-hm/angular-tree-component/css/angular-tree-component.css",
"node_modules/leaflet/dist/leaflet.css",
"apps/desktop/src/assets/styles/styles.scss",
"packages/ui-core/src/lib/static/styles/styles.scss",
"packages/ui-core/static/styles/styles.scss",
"node_modules/@ng-select/ng-select/themes/default.theme.css"
],
"scripts": []
@@ -1041,7 +1041,7 @@
"polyfills": "apps/gauzy/src/polyfills.ts",
"tsConfig": "apps/gauzy/tsconfig.app.json",
"stylePreprocessorOptions": {
"includePaths": ["packages/ui-core/src/lib/static/styles"]
"includePaths": ["packages/ui-core/static/styles"]
},
"assets": [
"apps/gauzy/src/favicon.ico",
@@ -1050,7 +1050,7 @@
"apps/gauzy/src/silent-refresh.html",
{
"glob": "**/*",
"input": "packages/ui-core/src/lib/i18n/assets/i18n",
"input": "packages/ui-core/i18n/assets/i18n",
"output": "assets/i18n/"
}
],
@@ -1064,7 +1064,7 @@
"node_modules/nebular-icons/scss/nebular-icons.scss",
"node_modules/@ali-hm/angular-tree-component/css/angular-tree-component.css",
"node_modules/leaflet/dist/leaflet.css",
"packages/ui-core/src/lib/static/styles/styles.scss",
"packages/ui-core/static/styles/styles.scss",
"node_modules/@ng-select/ng-select/themes/default.theme.css"
],
"scripts": [
+3 -3
View File
@@ -28,10 +28,10 @@ import { FeatureToggleModule } from 'ngx-feature-toggle';
import { NgxPermissionsModule } from 'ngx-permissions';
import { ColorPickerService } from 'ngx-color-picker';
import * as Sentry from '@sentry/angular-ivy';
import moment from 'moment';
import * as moment from 'moment';
import { IFeatureToggle, LanguagesEnum, WeekDaysEnum } from '@gauzy/contracts';
import { UiCoreModule } from '@gauzy/ui-core';
import { GAUZY_ENV, UiConfigModule, environment } from '@gauzy/ui-config';
import { IFeatureToggle, LanguagesEnum, WeekDaysEnum } from '@gauzy/contracts';
import {
APIInterceptor,
AppInitService,
@@ -90,7 +90,6 @@ const isProd = environment.production;
NbEvaIconsModule,
UiConfigModule.forRoot(),
UiCoreModule.forRoot(),
I18nTranslateModule.forRoot(),
CommonModule.forRoot(),
CoreModule.forRoot(),
ThemeModule.forRoot(),
@@ -102,6 +101,7 @@ const isProd = environment.production;
deps: [HttpClient]
}
}),
I18nTranslateModule.forRoot(),
CloudinaryModule,
FileUploadModule,
TimeTrackerModule.forRoot(),
+2 -2
View File
@@ -1,5 +1,5 @@
files:
- source: /packages/ui-core/src/lib/i18n/assets/i18n/en.json
translation: /packages/ui-core/src/lib/i18n/assets/i18n/%two_letters_code%.json
- source: /packages/ui-core/i18n/assets/i18n/en.json
translation: /packages/ui-core/i18n/assets/i18n/%two_letters_code%.json
- source: /apps/api/src/assets/i18n/en/*.json
translation: /apps/api/src/assets/i18n/%two_letters_code%/%original_file_name%
+3 -9
View File
@@ -1,11 +1,5 @@
import { getJestProjects } from '@nrwl/jest';
export default {
testMatch: ['**/+(*.)+(spec|test).+(ts|js)?(x)'],
transform: {
'^.+\\.(ts|js|html)$': 'ts-jest'
},
resolver: '@nrwl/jest/plugins/resolver',
moduleFileExtensions: ['ts', 'js', 'html'],
collectCoverage: true,
coverageReporters: ['html'],
projects: ['<rootDir>/apps/gauzy', '<rootDir>/apps/api', '<rootDir>/apps/desktop', '<rootDir>/libs/desktop-ui-lib']
projects: getJestProjects()
};
+4 -4
View File
@@ -57,16 +57,16 @@
"e2eTestRunner": "cypress"
},
"@nrwl/angular:component": {
"prefix": "ngx",
"style": "scss"
"style": "scss",
"prefix": "ngx"
},
"@nrwl/angular:directive": {
"prefix": "ngx"
},
"@nrwl/angular:library": {
"style": "scss",
"linter": "eslint",
"unitTestRunner": "jest"
"unitTestRunner": "jest",
"style": "scss"
}
},
"defaultProject": "gauzy",
+13 -3
View File
@@ -321,7 +321,9 @@
"lodash-es": "^4.17.21",
"parse5": "^7.1.2",
"rxjs": "^7.4.0",
"yargs": "^17.5.0"
"tslib": "^2.3.0",
"yargs": "^17.5.0",
"zone.js": "~0.12.0"
},
"devDependencies": {
"@angular-devkit/architect": "^0.1602.11",
@@ -330,6 +332,7 @@
"@angular-devkit/schematics": "16.2.11",
"@angular-eslint/eslint-plugin": "^16.2.0",
"@angular-eslint/eslint-plugin-template": "^16.2.0",
"@angular-eslint/template-parser": "~15.0.0",
"@angular/cli": "^16.2.11",
"@angular/compiler-cli": "^16.2.12",
"@commitlint/cli": "^17.6.6",
@@ -344,6 +347,7 @@
"@nrwl/cypress": "15.9.4",
"@nrwl/eslint-plugin-nx": "15.9.4",
"@nrwl/jest": "15.9.4",
"@nrwl/js": "15.9.4",
"@nrwl/linter": "15.9.4",
"@nrwl/nest": "15.9.4",
"@nrwl/node": "15.9.4",
@@ -356,13 +360,14 @@
"@nstudio/web": "^15.0.3",
"@nstudio/web-angular": "^15.0.3",
"@nstudio/xplat": "^15.0.3",
"semantic-release": "^22.0.12",
"@schematics/angular": "^16.2.11",
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"@semantic-release/github": "^9.2.6",
"@semantic-release/npm": "^11.0.0",
"@types/jest": "^29.4.4",
"@types/jsdom": "^21.1.6",
"@types/node": "16.11.7",
"@types/webpack": "^5.28.5",
"@types/yargs": "^15.0.9",
"ajv-formats": "^2.1.1",
@@ -396,18 +401,23 @@
"lerna-changelog": "^1.0.1",
"lighthouse": "^6.3.0",
"lint-staged": "^10.4.0",
"ng-packagr": "16.2.3",
"ng-packagr": "~16.0.0",
"node-gyp": "^9.3.1",
"npm-run-all": "^4.1.5",
"nx": "15.9.4",
"nx-cloud": "^16.5.2",
"pkg": "^5.3.0",
"png-to-ico": "^2.1.8",
"postcss": "^8.4.5",
"postcss-import": "~14.1.0",
"postcss-preset-env": "~7.5.0",
"postcss-url": "~10.1.3",
"prettier": "^2.8.4",
"prettier-tslint": "^0.4.2",
"pretty-quick": "^3.1.0",
"protractor": "^7.0.0",
"rimraf": "^3.0.2",
"semantic-release": "^22.0.12",
"simple-git": "^3.20.0",
"stylelint": "^15.10.1",
"ts-jest": "29.1.1",
+1 -2
View File
@@ -43,8 +43,7 @@
"devDependencies": {
"@types/node": "^17.0.33",
"rimraf": "^3.0.2",
"typescript": "5.1.6",
"ng-packagr": "16.2.3"
"typescript": "5.1.6"
},
"repository": {
"type": "git",
+33
View File
@@ -0,0 +1,33 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts"],
"rules": {
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "gauzy",
"style": "camelCase"
}
],
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "gauzy",
"style": "kebab-case"
}
]
},
"extends": ["plugin:@nrwl/nx/angular", "plugin:@angular-eslint/template/process-inline-templates"]
},
{
"files": ["*.html"],
"extends": ["plugin:@nrwl/nx/angular-template"],
"rules": {}
}
]
}
+3 -21
View File
@@ -1,25 +1,7 @@
# UI Core
# ui-core
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 16.2.11.
## Code scaffolding
Run `ng generate component component-name --project ui-core` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project ui-core`.
> Note: Don't forget to add `--project ui-core` or else it will be added to the default project in your `angular.json` file.
## Build
Run `ng build ui-core` to build the project. The build artifacts will be stored in the `dist/` directory.
## Publishing
After building your library with `ng build ui-core`, go to the dist folder `cd dist` and run `npm publish`.
This library was generated with [Nx](https://nx.dev).
## Running unit tests
Run `ng test ui-core` to execute the unit tests via [Karma](https://karma-runner.github.io).
## Further help
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
Run `nx test ui-core` to execute the unit tests.
+3
View File
@@ -0,0 +1,3 @@
# @gauzy/ui-core/common
Secondary entry point of `@gauzy/ui-core`. It can be used by importing from `@gauzy/ui-core/common`.
+6
View File
@@ -0,0 +1,6 @@
{
"lib": {
"entryFile": "src/index.ts",
"styleIncludePaths": ["../static/styles"]
}
}
+8
View File
@@ -0,0 +1,8 @@
/*
* Public API Surface of @gauzy/ui-core/common
*/
export * from './lib/common.module';
export * from './lib/constants';
export * from './lib/interfaces';
export * from './lib/providers/services';
export * from './lib/utils/shared-utils';
@@ -107,14 +107,14 @@ export class PersistStore extends AkitaStore<PersistState> {
@Injectable({ providedIn: 'root' })
export class AppQuery extends Query<AppState> {
constructor(protected readonly store: AppStore) {
constructor(store: AppStore) {
super(store);
}
}
@Injectable({ providedIn: 'root' })
export class PersistQuery extends Query<PersistState> {
constructor(protected readonly store: PersistStore) {
constructor(store: PersistStore) {
super(store);
}
}
@@ -3,7 +3,7 @@ import { HttpClient } from '@angular/common/http';
import { firstValueFrom, Observable, timer } from 'rxjs';
import { filter, tap } from 'rxjs/operators';
import { BehaviorSubject } from 'rxjs/internal/BehaviorSubject';
import moment from 'moment';
import * as moment from 'moment';
import { StoreConfig, Store, Query } from '@datorama/akita';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { environment } from '@gauzy/ui-config';
@@ -66,7 +66,7 @@ export class TimerStore extends Store<TimerState> {
@Injectable({ providedIn: 'root' })
export class TimerQuery extends Query<TimerState> {
constructor(protected readonly store: TimerStore) {
constructor(store: TimerStore) {
super(store);
}
}
@@ -324,8 +324,8 @@ export class TimeTrackerService implements OnDestroy {
this.currentSessionDuration = data.session;
this.duration = data.todayWorked;
};
} catch (err) {
console.log('Invalid Time Tracker worker configuration', err.message);
} catch (error: any) {
console.log('Invalid Time Tracker worker configuration', error?.message);
}
} else {
console.log('Web worker does not supported on your browser');
@@ -1,5 +1,5 @@
import { HttpParams } from '@angular/common/http';
import moment from 'moment';
import * as moment from 'moment';
import * as timezone from 'moment-timezone';
import { Observable } from 'rxjs';
import { distinctUntilChanged } from 'rxjs/operators';
@@ -172,7 +172,7 @@ export function retrieveNameFromEmail(email: string): string {
if (email) {
return ucFirst(email.substring(0, email.lastIndexOf('@')), true);
}
return;
return '';
}
// convert local time to another timezone
@@ -377,7 +377,7 @@ export function employeeMapper(row: any): {
*/
export function addTrailingSlash(str: string) {
if (!str) {
return;
return str;
}
const slashChar = str.startsWith('/') ? '' : '/';
return slashChar + str;
@@ -392,7 +392,7 @@ export function addTrailingSlash(str: string) {
*/
export function removeTrailingSlash(str: string) {
if (!str) {
return;
return str;
}
return str.endsWith('/') ? str.replace(/\/+$/, '') : str;
}
+3
View File
@@ -0,0 +1,3 @@
# @gauzy/ui-core/core
Secondary entry point of `@gauzy/ui-core`. It can be used by importing from `@gauzy/ui-core/core`.
+6
View File
@@ -0,0 +1,6 @@
{
"lib": {
"entryFile": "src/index.ts",
"styleIncludePaths": ["../static/styles"]
}
}
+15
View File
@@ -0,0 +1,15 @@
/*
* Public API Surface of @gauzy/ui-core/core
*/
export * from './lib/auth';
export * from './lib/components';
export * from './lib/core.module';
export * from './lib/guards';
export * from './lib/interceptors';
export * from './lib/module-import-guard';
export * from './lib/moment-extend';
export * from './lib/resolvers';
export * from './lib/sentry-error.handler';
export * from './lib/services';
export * from './lib/utils';
export * from './lib/validators';

Some files were not shown because too many files have changed in this diff Show More