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

CI Step to run build scripts #561

Merged
merged 4 commits into from
Nov 16, 2024
Merged

CI Step to run build scripts #561

merged 4 commits into from
Nov 16, 2024

Conversation

kotAPI
Copy link
Collaborator

@kotAPI kotAPI commented Nov 16, 2024

This PR adds a build step to run build command to ensure build pipelines are intact so we don't introduce any breaking changes

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced accessibility linting with multiple new rules for better compliance.
    • Introduced a new GitHub Actions workflow to automate the build process for the RAD UI project.
  • Dependency Updates

    • Updated the @radui/ui dependency version to ^0.0.25.
  • Build Process Improvements

    • Streamlined build scripts for clarity and efficiency, including new prebuild steps and renamed scripts.

Copy link
Contributor

coderabbitai bot commented Nov 16, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

This pull request includes changes to enhance accessibility linting in the ESLint configuration by adding multiple rules from the jsx-a11y plugin. Additionally, a new GitHub Actions workflow file has been introduced to automate the build process for the RAD UI project. The package.json files for both the main project and the @radui/ui package have been updated, with dependency version changes and modifications to build scripts for better organization and clarity.

Changes

File Change Summary
.eslintrc.cjs Added multiple accessibility rules under the jsx-a11y plugin; minor formatting change to semi.
.github/workflows/build-rad-ui.yml Introduced a new workflow for automating the build process on pull requests to the main branch.
docs/package.json Updated dependency version of @radui/ui from ^0.0.23 to ^0.0.25.
package.json Modified build scripts: removed build-components and copy-components, added compile-components and process-components, introduced prebuild, and updated the build script for better organization.

Possibly related PRs

🐰 In the garden where the bunnies play,
New rules for access brighten the day.
With builds that run smooth and scripts that align,
We hop with joy, everything's fine!
Let's cheer for the changes, let our voices ring,
For a world that's more friendly, we happily sing! 🎉

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 eslint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

.eslintrc.cjs

Oops! Something went wrong! :(

ESLint: 8.56.0

Error: Failed to load parser '@babel/eslint-parser' declared in '.eslintrc.cjs': Cannot find module '@babel/core/package.json'
Require stack:

  • /node_modules/@babel/eslint-parser/lib/parse.cjs
  • /node_modules/@babel/eslint-parser/lib/index.cjs
  • /node_modules/@eslint/eslintrc/dist/eslintrc.cjs
    at Module._resolveFilename (node:internal/modules/cjs/loader:1248:15)
    at Function.resolve (node:internal/modules/helpers:145:19)
    at Object. (/node_modules/@babel/eslint-parser/lib/parse.cjs:14:19)
    at Module._compile (node:internal/modules/cjs/loader:1546:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1691:10)
    at Module.load (node:internal/modules/cjs/loader:1317:32)
    at Module._load (node:internal/modules/cjs/loader:1127:12)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
    at Module.require (node:internal/modules/cjs/loader:1339:12)

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 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 anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

Copy link
Contributor

@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: 3

🧹 Outside diff range and nitpick comments (4)
.eslintrc.cjs (2)

11-11: Consider configuration redundancy with recommended preset

You're extending plugin:jsx-a11y/recommended while also explicitly defining individual jsx-a11y rules. This could lead to rule conflicts or make it harder to maintain. Consider either:

  1. Using just the recommended preset and overriding specific rules as needed, or
  2. Removing the recommended preset and keeping explicit rule definitions for full control

Also applies to: 22-22


81-81: Consider configuring label-has-associated-control rule

The 'label-has-associated-control' rule often needs configuration to work effectively with custom components.

-        'jsx-a11y/label-has-associated-control': 'warn',
+        'jsx-a11y/label-has-associated-control': ['warn', {
+            labelComponents: ['CustomLabel'],
+            labelAttributes: ['label'],
+            controlComponents: ['CustomInput'],
+            depth: 3,
+        }],
package.json (2)

51-53: Consider making prebuild tests optional

While running tests before builds adds safety, it might slow down development iterations. Consider:

  1. Making the test step optional via an environment variable
  2. Only running tests in CI, not local development

Example implementation:

-    "prebuild": "npm run test && npm run clean",
+    "prebuild": "npm run clean && [ \"$CI\" = \"true\" ] && npm run test || true",

Build outputs missing and exports need verification

The verification process has revealed critical issues:

  • The dist directory and its components are missing, yet they are referenced in package.json exports
  • The build outputs specified in exports (e.g., ./dist/components/Accordion.js) don't exist
  • We need to verify the actual component source files as the current search only revealed test and story files
🔗 Analysis chain

Line range hint 6-34: Verify component build outputs match exports

Let's ensure the build process generates all exported components and that no components are missing from exports.

Also applies to: 54-54


The previous results showed only test and story files. Let's verify the actual component source files and check the dist directory to better understand the build outputs.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify component exports match built files

# Extract component paths from exports
echo "Checking exports consistency..."
jq -r '.exports | to_entries[] | select(.key | startswith("./") and endswith(".js")) | .value' package.json | sort > /tmp/exported_components.txt

# Find actual component files
echo "Checking built components..."
fd -t f -e js . src/components/ | sort > /tmp/source_components.txt

# Compare lists
echo "Comparing source components with exports..."
diff /tmp/source_components.txt /tmp/exported_components.txt

# Verify build outputs
echo "Verifying build outputs..."
while IFS= read -r component; do
  if [[ ! -f "${component#./}" ]]; then
    echo "Missing build output for: $component"
  fi
done < /tmp/exported_components.txt

Length of output: 2719


Script:

#!/bin/bash
# Let's check the actual component source files, not just stories and tests
fd -t f -e jsx -e js . src/components/ui/ | grep -v "stories\|test" | sort

# Also check if there are any components in dist
echo -e "\nChecking dist directory contents:"
fd -t f -e js . dist/components/ | sort

Length of output: 305

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 2092133 and ed73a98.

⛔ Files ignored due to path filters (2)
  • docs/package-lock.json is excluded by !**/package-lock.json
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (4)
  • .eslintrc.cjs (3 hunks)
  • .github/workflows/build-rad-ui.yml (1 hunks)
  • docs/package.json (1 hunks)
  • package.json (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • docs/package.json
🧰 Additional context used
🪛 yamllint
.github/workflows/build-rad-ui.yml

[error] 13-13: trailing spaces

(trailing-spaces)


[error] 19-19: trailing spaces

(trailing-spaces)


[error] 22-22: trailing spaces

(trailing-spaces)

🔇 Additional comments (2)
.eslintrc.cjs (1)

68-97: Verify ESLint configuration in CI pipeline

Since this PR adds CI build steps, verify that these new ESLint rules won't cause unexpected build failures.

✅ Verification successful

Let me try a different approach to verify the ESLint configuration since npx is not available in the sandbox environment.


ESLint configuration is safe for CI builds

The ESLint configuration is properly set up and won't cause CI build failures because:

  • All jsx-a11y rules are set to 'warn' level
  • No rules are configured at 'error' level
  • No overrides are present that could escalate rule severity
  • Most other rules are either set to 'warn' or 'off'
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for existing ESLint errors in the codebase that might affect CI

# Find all JavaScript/TypeScript files
echo "Checking for files that might be affected by new ESLint rules..."
fd -e js -e jsx -e ts -e tsx | while read -r file; do
    # Count potential accessibility issues
    echo "Checking $file..."
    npx eslint --no-eslintrc --config .eslintrc.cjs "$file" -f json \
        | jq -r '.[] | select(.messages | length > 0) | "\(.filePath): \(.messages | length) issues"'
done

Length of output: 114815


Script:

#!/bin/bash
# Check if the ESLint rules are set to 'warn' level which won't fail the build
echo "Checking ESLint configuration severity levels..."
grep -A 30 "'jsx-a11y/" .eslintrc.cjs | grep -v "^--$" | grep -v "^$"

# Check if there are any 'error' level rules that could fail the build
echo -e "\nChecking for any error-level rules..."
grep -B 1 -A 1 "'error'" .eslintrc.cjs

# Check if there's any override configuration that might change the severity
echo -e "\nChecking for any overrides..."
grep -A 10 "overrides:" .eslintrc.cjs

Length of output: 3424

package.json (1)

49-50: LGTM! Improved script naming clarity

The rename from build-components/copy-components to compile-components/process-components better reflects the actual operations being performed.

Comment on lines +68 to +97
'jsx-a11y/accessible-emoji': 'warn',
'jsx-a11y/anchor-has-content': 'warn',
'jsx-a11y/aria-activedescendant-has-tabindex': 'warn',
'jsx-a11y/aria-props': 'warn',
'jsx-a11y/aria-proptypes': 'warn',
'jsx-a11y/aria-role': 'warn',
'jsx-a11y/aria-unsupported-elements': 'warn',
'jsx-a11y/click-events-have-key-events': 'warn',
'jsx-a11y/heading-has-content': 'warn',
'jsx-a11y/html-has-lang': 'warn',
'jsx-a11y/iframe-has-title': 'warn',
'jsx-a11y/img-redundant-alt': 'warn',
'jsx-a11y/interactive-supports-focus': 'warn',
'jsx-a11y/label-has-associated-control': 'warn',
'jsx-a11y/media-has-caption': 'warn',
'jsx-a11y/mouse-events-have-key-events': 'warn',
'jsx-a11y/no-access-key': 'warn',
'jsx-a11y/no-autofocus': 'warn',
'jsx-a11y/no-distracting-elements': 'warn',
'jsx-a11y/no-interactive-element-to-noninteractive-role': 'warn',
'jsx-a11y/no-noninteractive-element-interactions': 'warn',
'jsx-a11y/no-noninteractive-element-to-interactive-role': 'warn',
'jsx-a11y/no-noninteractive-tabindex': 'warn',
'jsx-a11y/no-onchange': 'warn',
'jsx-a11y/no-redundant-roles': 'warn',
'jsx-a11y/no-static-element-interactions': 'warn',
'jsx-a11y/role-has-required-aria-props': 'warn',
'jsx-a11y/role-supports-aria-props': 'warn',
'jsx-a11y/scope': 'warn',
'jsx-a11y/tabindex-no-positive': 'warn'
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Review accessibility rule severity levels

While it's good to start with 'warn' level during initial implementation, consider:

  1. Upgrading critical accessibility rules to 'error' level, such as:
    • aria-props
    • aria-role
    • role-has-required-aria-props
    • alt-text
  2. This ensures critical accessibility issues don't make it to production.

'jsx-a11y/no-noninteractive-element-interactions': 'warn',
'jsx-a11y/no-noninteractive-element-to-interactive-role': 'warn',
'jsx-a11y/no-noninteractive-tabindex': 'warn',
'jsx-a11y/no-onchange': 'warn',
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Remove deprecated 'no-onchange' rule

The 'jsx-a11y/no-onchange' rule is deprecated as onChange events are now well-supported by all browsers and screen readers.

-        'jsx-a11y/no-onchange': 'warn',
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
'jsx-a11y/no-onchange': 'warn',

"build-components": "rollup -c --bundleConfigAsCjs --max-old-space-size=8076",
"copy-components": "mkdirp ./dist/components && cp -r ./dist/temp-cleanup/*js ./dist/components && rimraf dist/temp-cleanup",
"build": "npm run test && npm run clean && npm run build-css && npm run generate-tokens && npm run bundle-tokens && npm run build-components && npm run copy-components --max-old-space-size=4076",
"compile-components": "rollup -c --bundleConfigAsCjs --max-old-space-size=8076",
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Resolve conflicting memory configurations

There's an inconsistency in memory limits:

  • compile-components sets --max-old-space-size=8076 (8GB)
  • build script overrides it to 4GB via NODE_OPTIONS

This could lead to unexpected behavior as NODE_OPTIONS will take precedence.

Suggestions:

  1. Use a consistent memory limit
  2. Move the memory configuration to a single location
-    "compile-components": "rollup -c --bundleConfigAsCjs --max-old-space-size=8076",
+    "compile-components": "rollup -c --bundleConfigAsCjs",
     "build": "npm run prebuild && npm run build:css && NODE_OPTIONS='--max-old-space-size=4076' npm run build:components",

Also applies to: 54-54

@kotAPI kotAPI merged commit 36569a4 into main Nov 16, 2024
4 checks passed
@kotAPI kotAPI deleted the pranay/add-ci-step-for-builds branch November 16, 2024 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[New Feature] CI/Github Actions that check if the builds continue to succeed or fail
1 participant