-
Notifications
You must be signed in to change notification settings - Fork 572
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(constants): add @gauzy/constants package #8745
Conversation
WalkthroughThis pull request introduces a new Changes
Sequence DiagramsequenceDiagram
participant Dev as Developer
participant Constants as @gauzy/constants
participant Contracts as @gauzy/contracts
participant Components as Application Components
Dev->>Constants: Create new constants package
Constants-->>Contracts: Move default constants
Dev->>Components: Update import statements
Components->>Constants: Import constants
Dev->>Package: Update build scripts
Possibly related PRs
Poem
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
package.json (1)
259-259
: Fix the formatting in docker build script.There's a missing space after
&&
in the build:package:all:docker script between utils:docker and config:docker.- "build:package:all:docker": "yarn run build:package:constants:docker && yarn run build:package:contracts:docker && yarn run build:package:common:docker && yarn run build:package:utils:docker &&yarn run build:package:config:docker && yarn run build:package:plugin:docker && yarn run build:package:auth:docker && yarn run build:package:plugins:pre:docker && yarn run build:package:core:docker && yarn run build:package:plugins:post:docker && yarn run build:package:desktop-lib:docker && yarn run build:package:plugin:integration-wakatime:docker && yarn run build:package:desktop-ui-lib:docker", + "build:package:all:docker": "yarn run build:package:constants:docker && yarn run build:package:contracts:docker && yarn run build:package:common:docker && yarn run build:package:utils:docker && yarn run build:package:config:docker && yarn run build:package:plugin:docker && yarn run build:package:auth:docker && yarn run build:package:plugins:pre:docker && yarn run build:package:core:docker && yarn run build:package:plugins:post:docker && yarn run build:package:desktop-lib:docker && yarn run build:package:plugin:integration-wakatime:docker && yarn run build:package:desktop-ui-lib:docker",
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (35)
.deploy/api/Dockerfile
(2 hunks).deploy/webapp/Dockerfile
(1 hunks)apps/desktop/src/package.json
(1 hunks)apps/gauzy/src/app/pages/employees/edit-employee/edit-employee-profile/edit-employee-settings/edit-employee-other-settings.component.ts
(2 hunks)apps/gauzy/src/app/pages/organizations/edit-organization/edit-organization-settings/edit-organization-other-settings/edit-organization-other-settings.component.ts
(3 hunks)apps/server-api/src/package.json
(2 hunks)apps/server/src/package.json
(2 hunks)package.json
(2 hunks)packages/constants/.dockerignore
(1 hunks)packages/constants/.gitignore
(1 hunks)packages/constants/.npmignore
(1 hunks)packages/constants/CHANGELOG.md
(1 hunks)packages/constants/README.md
(1 hunks)packages/constants/eslint.config.js
(1 hunks)packages/constants/jest.config.ts
(1 hunks)packages/constants/package.json
(1 hunks)packages/constants/project.json
(1 hunks)packages/constants/src/index.ts
(1 hunks)packages/constants/src/lib/organization.ts
(1 hunks)packages/constants/tsconfig.json
(1 hunks)packages/constants/tsconfig.lib.json
(1 hunks)packages/constants/tsconfig.spec.json
(1 hunks)packages/contracts/src/lib/organization.model.ts
(0 hunks)packages/core/package.json
(1 hunks)packages/core/src/lib/employee-statistics/employee-statistics.service.ts
(1 hunks)packages/core/src/lib/invite/invite.service.ts
(1 hunks)packages/core/src/lib/organization/organization.entity.ts
(2 hunks)packages/core/src/lib/organization/organization.seed.ts
(11 hunks)packages/core/src/lib/tenant/tenant.entity.ts
(1 hunks)packages/ui-core/package.json
(1 hunks)packages/ui-core/shared/src/lib/organizations/organizations-step-form/organizations-step-form.component.ts
(1 hunks)packages/ui-core/shared/src/lib/report/charts/line-chart/line-chart.component.ts
(1 hunks)packages/ui-core/shared/src/lib/timesheet/gauzy-filters/timezone-filter/timezone-filter.component.ts
(1 hunks)packages/ui-core/shared/src/lib/user/edit-profile-form/edit-profile-form.component.ts
(2 hunks)tsconfig.json
(1 hunks)
💤 Files with no reviewable changes (1)
- packages/contracts/src/lib/organization.model.ts
✅ Files skipped from review due to trivial changes (21)
- packages/constants/CHANGELOG.md
- packages/constants/.npmignore
- packages/constants/src/index.ts
- packages/constants/.dockerignore
- packages/ui-core/shared/src/lib/organizations/organizations-step-form/organizations-step-form.component.ts
- packages/constants/.gitignore
- packages/ui-core/shared/src/lib/timesheet/gauzy-filters/timezone-filter/timezone-filter.component.ts
- packages/constants/README.md
- apps/gauzy/src/app/pages/employees/edit-employee/edit-employee-profile/edit-employee-settings/edit-employee-other-settings.component.ts
- packages/constants/package.json
- packages/core/src/lib/invite/invite.service.ts
- packages/constants/tsconfig.lib.json
- packages/ui-core/shared/src/lib/user/edit-profile-form/edit-profile-form.component.ts
- packages/core/src/lib/employee-statistics/employee-statistics.service.ts
- packages/constants/tsconfig.json
- packages/ui-core/shared/src/lib/report/charts/line-chart/line-chart.component.ts
- packages/constants/jest.config.ts
- apps/desktop/src/package.json
- packages/constants/project.json
- apps/server/src/package.json
- apps/server-api/src/package.json
👮 Files not reviewed due to content moderation or server errors (3)
- packages/core/src/lib/organization/organization.entity.ts
- packages/core/src/lib/organization/organization.seed.ts
- apps/gauzy/src/app/pages/organizations/edit-organization/edit-organization-settings/edit-organization-other-settings/edit-organization-other-settings.component.ts
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: test
- GitHub Check: build
🔇 Additional comments (13)
packages/constants/eslint.config.js (1)
1-19
: LGTM! ESLint configuration is well structured.The configuration properly extends the base config and correctly sets up JSON file handling with appropriate parser and rules.
packages/constants/src/lib/organization.ts (2)
1-4
: Consider adding validation for time format values.While the time formats array is correct, consider adding runtime validation to ensure only 12 or 24 are used throughout the application.
38-57
: Verify the activity monitoring constants are in sync with UI components.The inactivity limits, proof durations, and screenshot frequencies should align with UI dropdowns and form controls.
✅ Verification successful
Constants are properly synchronized with UI components
The activity monitoring constants are correctly integrated with UI dropdowns in both desktop and organization settings:
- Desktop UI uses screenshot frequency options in period selection dropdown
- Organization settings properly binds all three constants to their respective nb-select dropdowns
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for UI components using these constants rg -g '*.{ts,html}' -e 'DEFAULT_INACTIVITY_TIME_LIMITS' -e 'DEFAULT_ACTIVITY_PROOF_DURATIONS' -e 'DEFAULT_SCREENSHOT_FREQUENCY_OPTIONS'Length of output: 2030
Script:
#!/bin/bash # Check the HTML templates for these components and their usage of the variables echo "=== Desktop UI Settings Template ===" cat packages/desktop-ui-lib/src/lib/settings/settings.component.html || echo "File not found" echo -e "\n=== Organization Settings Template ===" cat apps/gauzy/src/app/pages/organizations/edit-organization/edit-organization-settings/edit-organization-other-settings/edit-organization-other-settings.component.html || echo "File not found" # Also check the component files for any value transformations echo -e "\n=== Component Implementation Details ===" cat packages/desktop-ui-lib/src/lib/settings/settings.component.ts cat apps/gauzy/src/app/pages/organizations/edit-organization/edit-organization-settings/edit-organization-other-settings/edit-organization-other-settings.component.tsLength of output: 87357
Script:
#!/bin/bash # Check specific component implementations echo "=== Desktop Settings Component ===" rg -A 10 "periodOption =" packages/desktop-ui-lib/src/lib/settings/settings.component.ts echo -e "\n=== Organization Settings Component ===" rg -A 10 "listOfInactivityLimits|listOfActivityProofDuration|screenshotFrequencyOptions" apps/gauzy/src/app/pages/organizations/edit-organization/edit-organization-settings/edit-organization-other-settings/edit-organization-other-settings.component.tsLength of output: 1367
packages/core/src/lib/tenant/tenant.entity.ts (1)
4-5
: LGTM! Import statement correctly updated.The constant has been properly imported from the new
@gauzy/constants
package and is correctly used in the entity definition.apps/gauzy/src/app/pages/organizations/edit-organization/edit-organization-settings/edit-organization-other-settings/edit-organization-other-settings.component.ts (2)
10-20
: LGTM! Comprehensive import of required constants.The imports are well-organized and include all necessary constants from the new
@gauzy/constants
package.
88-88
: LGTM! Proper initialization using imported constant.The
screenshotFrequencyOptions
is correctly initialized usingDEFAULT_SCREENSHOT_FREQUENCY_OPTIONS
.packages/constants/tsconfig.spec.json (1)
1-9
: LGTM! Well-structured TypeScript test configuration.The configuration properly:
- Extends the base tsconfig
- Sets up CommonJS module system
- Includes necessary type definitions
- Specifies correct test file patterns
tsconfig.json (1)
12-12
: LGTM! Correct path mapping for the new constants package.The path mapping for
@gauzy/constants
is properly configured and follows the existing pattern used for other packages.packages/ui-core/package.json (1)
55-55
: LGTM! Dependency added correctly.The
@gauzy/constants
dependency is properly added with semantic versioning and correct placement.packages/core/package.json (1)
46-46
: LGTM! Dependency added correctly.The
@gauzy/constants
dependency is properly added with semantic versioning and correct placement..deploy/webapp/Dockerfile (1)
94-94
: LGTM! Package file copied correctly.The
constants
package.json is properly copied with correct permissions and placement in the build process..deploy/api/Dockerfile (1)
139-139
: LGTM! Package file copied correctly in both stages.The
constants
package.json is properly copied in both the dependencies and prodDependencies stages with correct permissions.Also applies to: 195-195
package.json (1)
146-148
: LGTM! Build scripts added correctly.The new build scripts for the constants package follow the established pattern with proper environment variables and memory allocation.
View your CI Pipeline Execution ↗ for commit f02fd16.
☁️ Nx Cloud last updated this comment at |
PR
Please note: we will close your PR without comment if you do not check the boxes above and provide ALL requested information.
Summary by CodeRabbit
Based on the comprehensive changes, here are the release notes:
New Package
@gauzy/constants
package to centralize default configuration valuesConstants Consolidation
@gauzy/contracts
to new@gauzy/constants
packageDependency Updates
@gauzy/constants
Build Configuration
Development Improvements