Skip to content
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

Development: Make environment variables in npm commands platform-independent #10322

Merged
merged 6 commits into from
Feb 15, 2025

Conversation

tobias-lippert
Copy link
Contributor

@tobias-lippert tobias-lippert commented Feb 13, 2025

Checklist

General

Motivation and Context

Some npm commands such as webapp:prod cannot be executed on Windows because Powershell doesn't recognize the environment variables contained in the command.

We should aim for platform-independent commands.

Description

Added the cross-env npm package.
Preceded the env variable in webapp:prod with cross-env to make it platform-independent.

Steps for Testing

  1. Checkout this branch locally
  2. Run npm install
  3. Run npm run webapp:prod
  4. Make sure the command can be successfully executed.
  5. Optional (when you are on Windows) checkout develop and see that the 3. step cannot be successfully executed.

Review Progress

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Summary by CodeRabbit

  • Chores
    • Added several new development dependencies to improve linting and build processes.
    • Modified the production build script for consistent execution of environment variables across different operating systems.

Copy link

coderabbitai bot commented Feb 13, 2025

Warning

Rate limit exceeded

@krusche has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 8 minutes and 59 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 900d6d7 and 32097c6.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (1)
  • package.json (2 hunks)

Walkthrough

The pull request modifies the package.json file by adding several new development dependencies, including @typescript-eslint/eslint-plugin, @typescript-eslint/parser, angular-eslint, cross-env, and eslint. Additionally, the existing versions of these dependencies have been updated. The webapp:prod script has been altered to utilize cross-env for setting the NG_BUILD_OPTIMIZE_CHUNKS environment variable, replacing the previous direct assignment method to ensure consistent execution across different operating systems.

Changes

File Changes
package.json - Added "@typescript-eslint/eslint-plugin": "8.23.0" to devDependencies
- Added "@typescript-eslint/parser": "8.23.0" to devDependencies
- Added "angular-eslint": "19.0.2" to devDependencies
- Added "cross-env": "7.0.3" to devDependencies
- Added "eslint": "9.19.0" to devDependencies
- Modified the webapp:prod script to use cross-env for setting NG_BUILD_OPTIMIZE_CHUNKS=1

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Developer
    participant NPM as npm
    participant CrossEnv as cross-env
    participant NG as Angular CLI (ng)

    Dev->>NPM: Execute "npm run webapp:prod"
    NPM->>NPM: Run "clean-www"
    NPM->>NPM: Run "prebuild"
    NPM->>CrossEnv: Set NG_BUILD_OPTIMIZE_CHUNKS=1 and trigger build
    CrossEnv->>NG: Run "ng build --configuration production"
Loading

Suggested labels

documentation


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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@tobias-lippert tobias-lippert changed the title Development: Make Environment variables in npm commands platform-independent Development: Make environment variables in npm commands platform-independent Feb 13, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bfdec65 and a8cd4a0.

📒 Files selected for processing (1)
  • package.json (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: client-tests-selected
  • GitHub Check: client-tests
  • GitHub Check: client-style
  • GitHub Check: server-style
  • GitHub Check: server-tests
  • GitHub Check: Call Build Workflow / Build and Push Docker Image
  • GitHub Check: Call Build Workflow / Build .war artifact
  • GitHub Check: Analyse
🔇 Additional comments (1)
package.json (1)

220-220: LGTM! The environment variable is now platform-independent.

The webapp:prod script has been correctly modified to use cross-env, which will ensure that the NG_BUILD_OPTIMIZE_CHUNKS environment variable works consistently across different operating systems, including Windows.

package.json Show resolved Hide resolved
coderabbitai[bot]
coderabbitai bot previously approved these changes Feb 13, 2025
HanyangXu0508
HanyangXu0508 previously approved these changes Feb 14, 2025
Copy link

@HanyangXu0508 HanyangXu0508 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested locally and worked as expected. Windows

coolchock
coolchock previously approved these changes Feb 14, 2025
Copy link
Contributor

@coolchock coolchock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a8cd4a0 and 900d6d7.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (1)
  • package.json (2 hunks)
🔇 Additional comments (1)
package.json (1)

224-225: Enhance Platform Compatibility with cross-env
The "webapp:prod" script has been correctly updated to use cross-env for setting the NG_BUILD_OPTIMIZE_CHUNKS environment variable. This change will allow the command to execute properly on Windows as well as Unix-based systems.

package.json Outdated Show resolved Hide resolved
coderabbitai[bot]
coderabbitai bot previously approved these changes Feb 15, 2025
@krusche krusche added this to the 7.10.1 milestone Feb 15, 2025
@krusche krusche merged commit 16e12eb into develop Feb 15, 2025
13 of 15 checks passed
@krusche krusche deleted the chore/cross-env-variables-webapp branch February 15, 2025 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

4 participants