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

feat: Added NPM publish workflow for ADS package #37787

Closed
wants to merge 10 commits into from

Conversation

albinAppsmith
Copy link
Collaborator

@albinAppsmith albinAppsmith commented Nov 28, 2024

Description

This PR adds the NPM publish workflow for publishing design system package.

Fixes #

Automation

/ok-to-test tags="@tag.Sanity"

🔍 Cypress test results

Warning

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/12398167479
Commit: a9be8d7
Cypress dashboard.
Tags: @tag.Sanity
Spec:
It seems like no tests ran 😔. We are not able to recognize it, please check workflow here.


Wed, 18 Dec 2024 17:33:03 UTC

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

  • New Features

    • Introduced an automated workflow for publishing releases of the design system package to npm.
    • Added a README file for the Changesets tool to assist users with versioning and publishing.
    • Implemented a new Rollup configuration for building the design system package.
  • Improvements

    • Streamlined the process for building and publishing packages with defined steps for dependency management and authentication.
    • Updated package versions and added new scripts to enhance the build process.
    • Made several packages private to restrict public access.

Copy link
Contributor

coderabbitai bot commented Nov 28, 2024

Walkthrough

This pull request introduces a new GitHub Actions workflow file, npm-publish.yml, aimed at automating the release process for a design system package. The workflow is triggered by pushes to the release branch, specifically for changes in the app/client/packages/design-system/ads/ directory. It includes steps for setting up the environment, caching dependencies, building packages, and publishing them to npm. Additionally, several configuration and README files related to the Changesets tool are added to facilitate versioning and documentation.

Changes

File Change Summary
.github/workflows/npm-publish.yml Added a new workflow for automating npm package publishing.
app/client/.changeset/README.md New README file added for Changesets tool introduction.
app/client/.changeset/config.json New configuration file for Changesets added.
app/client/package.json Added dependency @changesets/cli for versioning.
app/client/packages/design-system/ads-old/package.json Added "private": true to indicate internal use only.
app/client/packages/design-system/ads/.npmignore Updated to ignore specific files when publishing.
app/client/packages/design-system/ads/CHANGELOG.md New entry added for version 2.1.44.
app/client/packages/design-system/ads/package.json Updated version and added build script and dependencies.
app/client/packages/design-system/ads/rollup.config.cjs New Rollup configuration file added.
app/client/packages/design-system/ads/src/List/List.stories.tsx Updated import paths for components.
app/client/packages/design-system/ads/src/Menu/Menu.types.ts Changed _MenuItemProps to exported interface.
app/client/packages/design-system/headless/package.json Added "private": true for internal use only.
app/client/packages/design-system/theming/package.json Added "private": true for internal use only.
app/client/packages/design-system/widgets-old/package.json Added "private": true for internal use only.
app/client/packages/design-system/widgets/package.json Added "private": true for internal use only.
app/client/packages/icons/package.json Added "private": true for internal use only.
app/client/packages/storybook/package.json Added "private": true for internal use only.
app/client/packages/utils/package.json Added "private": true for internal use only.

Possibly related PRs

Suggested labels

Task, skip-changelog, Git Product, Git Platform

Suggested reviewers

  • jsartisan
  • ApekshaBhosale
  • sharat87
  • sagar-qa007

🌟 In the land of code where workflows bloom,
A new path for publishing dispels all the gloom.
With Yarn and Node, the packages build,
Automated releases, oh what a thrill!
Push to release, let the magic unfold,
A design system's story, beautifully told! 🌟


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between bfeef0e and a9be8d7.

📒 Files selected for processing (1)
  • app/client/package.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/client/package.json

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 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.

@github-actions github-actions bot added the Enhancement New feature or request label Nov 28, 2024
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: 5

🧹 Outside diff range and nitpick comments (1)
.github/workflows/npm-publish.yml (1)

3-9: Consider adding specific file patterns to the path filter.

The current path filter might trigger unnecessarily for non-source files. Consider being more specific:

 paths:
   - "app/client/packages/design-system/ads/**"
+  - "app/client/packages/design-system/ads/package.json"
+  - "app/client/packages/design-system/ads/src/**"
🧰 Tools
🪛 yamllint (1.35.1)

[error] 9-9: trailing spaces

(trailing-spaces)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 7615cd0 and 53178bc.

📒 Files selected for processing (1)
  • .github/workflows/npm-publish.yml (1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/npm-publish.yml

18-18: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)


22-22: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


28-28: the runner of "actions/setup-node@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


34-34: the runner of "actions/cache@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🪛 yamllint (1.35.1)
.github/workflows/npm-publish.yml

[error] 9-9: trailing spaces

(trailing-spaces)


[error] 19-19: trailing spaces

(trailing-spaces)


[error] 25-25: trailing spaces

(trailing-spaces)


[error] 31-31: trailing spaces

(trailing-spaces)


[error] 40-40: trailing spaces

(trailing-spaces)


[error] 44-44: trailing spaces

(trailing-spaces)


[error] 50-50: trailing spaces

(trailing-spaces)


[error] 59-59: trailing spaces

(trailing-spaces)


[error] 74-74: no new line character at the end of file

(new-line-at-end-of-file)

🔇 Additional comments (1)
.github/workflows/npm-publish.yml (1)

1-74: Verify workflow uniqueness.

Let's ensure this workflow doesn't conflict with existing npm publish workflows.

✅ Verification successful

Workflow is unique for its purpose

The npm-publish.yml workflow is the only one handling NPM package publishing for the design system. While there are other release-related workflows, they serve different purposes (Docker images, Helm charts, etc.). The workflow is properly scoped to only trigger on changes to "app/client/packages/design-system/ads/**" in the release branch.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for other npm publish workflows
echo "Checking for existing npm publish workflows..."
fd -e yml -e yaml . .github/workflows/ -x grep -l "npm.*publish" {}

Length of output: 174


Script:

#!/bin/bash
# Let's try a different approach to find npm publish related workflows
# First, let's list all workflow files
echo "Workflow files:"
fd -e yml -e yaml . .github/workflows/

# Then, let's examine their content for npm publish related patterns
echo -e "\nChecking workflow contents:"
fd -e yml -e yaml . .github/workflows/ -x cat {} | grep -i "npm\|publish\|release" -B2 -A2

Length of output: 22195

🧰 Tools
🪛 actionlint (1.7.4)

18-18: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)


22-22: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


28-28: the runner of "actions/setup-node@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


34-34: the runner of "actions/cache@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🪛 yamllint (1.35.1)

[error] 9-9: trailing spaces

(trailing-spaces)


[error] 19-19: trailing spaces

(trailing-spaces)


[error] 25-25: trailing spaces

(trailing-spaces)


[error] 31-31: trailing spaces

(trailing-spaces)


[error] 40-40: trailing spaces

(trailing-spaces)


[error] 44-44: trailing spaces

(trailing-spaces)


[error] 50-50: trailing spaces

(trailing-spaces)


[error] 59-59: trailing spaces

(trailing-spaces)


[error] 74-74: no new line character at the end of file

(new-line-at-end-of-file)

.github/workflows/npm-publish.yml Outdated Show resolved Hide resolved
.github/workflows/npm-publish.yml Show resolved Hide resolved
.github/workflows/npm-publish.yml Outdated Show resolved Hide resolved
.github/workflows/npm-publish.yml Outdated Show resolved Hide resolved
.github/workflows/npm-publish.yml Outdated Show resolved Hide resolved
@albinAppsmith albinAppsmith added the ok-to-test Required label for CI label Nov 28, 2024
- name: Setup Node js version
uses: actions/setup-node@v3
with:
node-version: 16.x
Copy link
Contributor

Choose a reason for hiding this comment

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

For appsmith we have node of version ^20.11.1 restriction, so you may want to use it here as well.

Copy link
Collaborator

Choose a reason for hiding this comment

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

We usually do it like this

uses: actions/setup-node@v4
with:
   node-version-file: app/client/package.json

commit: "ci(changesets): version packages"
title: "ci(changesets): version packages"
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Should it be APPSMITH_NPM_PUBLISH_KEY or NPM_TOKEN? Because in npm config you've used APPSMITH_NPM_PUBLISH_KEY. If both exist, then just pick a single key for consistence.

- name: Setup Node js version
uses: actions/setup-node@v3
with:
node-version: 16.x
Copy link
Collaborator

Choose a reason for hiding this comment

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

We usually do it like this

uses: actions/setup-node@v4
with:
   node-version-file: app/client/package.json

.github/workflows/npm-publish.yml Outdated Show resolved Hide resolved
.github/workflows/npm-publish.yml Outdated Show resolved Hide resolved
git config user.email github-actions@github.com

# Configure npm
- name: Configure npm
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we need this step?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is to authenticate with NPM key

albinAppsmith and others added 2 commits December 2, 2024 11:20
Co-authored-by: Valera Melnikov <valera@appsmith.com>
Co-authored-by: Valera Melnikov <valera@appsmith.com>
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: 1

🧹 Outside diff range and nitpick comments (1)
.github/workflows/npm-publish.yml (1)

3-9: Add package.json to path filters.

Consider including package.json changes in the path filters to ensure version updates trigger the workflow:

 paths:
   - "app/client/packages/design-system/ads/**"
+  - "app/client/packages/design-system/ads/package.json"
🧰 Tools
🪛 yamllint (1.35.1)

[error] 9-9: trailing spaces

(trailing-spaces)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 53178bc and 02cd4e5.

📒 Files selected for processing (1)
  • .github/workflows/npm-publish.yml (1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/npm-publish.yml

18-18: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)


22-22: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


28-28: the runner of "actions/setup-node@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🪛 yamllint (1.35.1)
.github/workflows/npm-publish.yml

[error] 9-9: trailing spaces

(trailing-spaces)


[error] 19-19: trailing spaces

(trailing-spaces)


[error] 25-25: trailing spaces

(trailing-spaces)


[error] 31-31: trailing spaces

(trailing-spaces)


[error] 40-40: trailing spaces

(trailing-spaces)


[error] 44-44: trailing spaces

(trailing-spaces)


[error] 50-50: trailing spaces

(trailing-spaces)


[error] 59-59: trailing spaces

(trailing-spaces)


[error] 74-74: no new line character at the end of file

(new-line-at-end-of-file)

🔇 Additional comments (2)
.github/workflows/npm-publish.yml (2)

27-31: Use node-version-file instead of hardcoded version.

As suggested in previous comments, use the version specified in package.json:

 uses: actions/setup-node@v4
 with:
-  node-version: 16.x
+  node-version-file: app/client/package.json
🧰 Tools
🪛 actionlint (1.7.4)

28-28: the runner of "actions/setup-node@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🪛 yamllint (1.35.1)

[error] 31-31: trailing spaces

(trailing-spaces)


51-59: ⚠️ Potential issue

Standardize NPM token usage and add token verification.

  1. Use consistent token name across steps
  2. Add a token verification step before publishing
-NPM_TOKEN: ${{ secrets.APPSMITH_NPM_PUBLISH_KEY }}
+NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

Add before the publish step:

- name: Verify NPM token
  run: npm whoami
  env:
    NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

Also applies to: 72-74

🧰 Tools
🪛 yamllint (1.35.1)

[error] 59-59: trailing spaces

(trailing-spaces)

Comment on lines +64 to +71
# Create PR & publish to NPM
- name: Create release Pull Request or publish to NPM
id: changesets
uses: changesets/action@v1
with:
publish: yarn release
commit: "ci(changesets): version packages"
title: "ci(changesets): version packages"
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

Add version validation before publishing.

Add a step to validate package version before publishing to prevent accidental releases:

- name: Validate version
  run: |
    CURRENT_VERSION=$(node -p "require('./app/client/packages/design-system/ads/package.json').version")
    NPM_VERSION=$(npm view @design-system/ads version 2>/dev/null || echo "0.0.0")
    if [ "$(printf '%s\n' "$NPM_VERSION" "$CURRENT_VERSION" | sort -V | head -n1)" = "$CURRENT_VERSION" ]; then
      echo "Error: New version ($CURRENT_VERSION) must be greater than published version ($NPM_VERSION)"
      exit 1
    fi

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: 1

🧹 Outside diff range and nitpick comments (1)
.github/workflows/npm-publish.yml (1)

5-6: Consider more specific path patterns.

The current path pattern might trigger unnecessarily for non-package files. Consider being more specific:

-      - "app/client/packages/design-system/ads/**"
+      - "app/client/packages/design-system/ads/package.json"
+      - "app/client/packages/design-system/ads/src/**"
+      - "app/client/packages/design-system/ads/dist/**"
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 02cd4e5 and 7c200b5.

📒 Files selected for processing (1)
  • .github/workflows/npm-publish.yml (1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/npm-publish.yml

21-21: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)

🪛 yamllint (1.35.1)
.github/workflows/npm-publish.yml

[error] 9-9: trailing spaces

(trailing-spaces)


[error] 22-22: trailing spaces

(trailing-spaces)


[error] 28-28: trailing spaces

(trailing-spaces)


[error] 34-34: trailing spaces

(trailing-spaces)


[error] 43-43: trailing spaces

(trailing-spaces)


[error] 47-47: trailing spaces

(trailing-spaces)


[error] 53-53: trailing spaces

(trailing-spaces)


[error] 62-62: trailing spaces

(trailing-spaces)


[error] 77-77: no new line character at the end of file

(new-line-at-end-of-file)

🔇 Additional comments (3)
.github/workflows/npm-publish.yml (3)

19-21: ⚠️ Potential issue

Update deprecated workflow command.

The set-output command is deprecated. Use the new GITHUB_OUTPUT approach:

-run: echo "::set-output name=dir::$(yarn cache dir)"
+run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
🧰 Tools
🪛 actionlint (1.7.4)

21-21: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)


55-61: ⚠️ Potential issue

Standardize NPM token usage.

The NPM token secret name should be consistent throughout the workflow. Choose either APPSMITH_NPM_PUBLISH_KEY or NPM_TOKEN and use it consistently:

-NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
+NPM_TOKEN: ${{ secrets.APPSMITH_NPM_PUBLISH_KEY }}

67-77: 🛠️ Refactor suggestion

Add version validation before publishing.

Add a step to validate the package version before publishing to prevent accidental releases:

- name: Validate version
  run: |
    CURRENT_VERSION=$(node -p "require('./packages/design-system/ads/package.json').version")
    NPM_VERSION=$(npm view @design-system/ads version 2>/dev/null || echo "0.0.0")
    if [ "$(printf '%s\n' "$NPM_VERSION" "$CURRENT_VERSION" | sort -V | head -n1)" = "$CURRENT_VERSION" ]; then
      echo "Error: New version ($CURRENT_VERSION) must be greater than published version ($NPM_VERSION)"
      exit 1
    fi
🧰 Tools
🪛 yamllint (1.35.1)

[error] 77-77: no new line character at the end of file

(new-line-at-end-of-file)

.github/workflows/npm-publish.yml Show resolved Hide resolved
KelvinOm
KelvinOm previously approved these changes Dec 3, 2024
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: 1

🧹 Outside diff range and nitpick comments (3)
.github/workflows/npm-publish.yml (3)

14-17: Add working directory validation

Add a check to ensure the working directory exists before proceeding.

     defaults:
       run:
         working-directory: app/client
+    - name: Validate working directory
+      run: |
+        if [ ! -d "app/client" ]; then
+          echo "Error: Working directory app/client does not exist"
+          exit 1
+        fi

66-68: Add support for dry run mode

Consider adding a dry run mode for testing the release process:

         env:
           NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          DRY_RUN: ${{ github.event_name == 'pull_request' }}
🧰 Tools
🪛 yamllint (1.35.1)

[error] 68-68: no new line character at the end of file

(new-line-at-end-of-file)


11-13: Add error notifications

Consider adding error notifications (e.g., Slack) for build and publish failures:

   release:
     name: Release
     runs-on: ubuntu-latest
+    if: ${{ always() }}
+    steps:
+      - name: Notify on failure
+        if: ${{ failure() }}
+        uses: slackapi/slack-github-action@v1.24.0
+        with:
+          payload: |
+            {
+              "text": "❌ NPM publish workflow failed"
+            }
+        env:
+          SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 7c200b5 and adffe0e.

📒 Files selected for processing (1)
  • .github/workflows/npm-publish.yml (1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/npm-publish.yml

21-21: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)

🪛 yamllint (1.35.1)
.github/workflows/npm-publish.yml

[error] 9-9: trailing spaces

(trailing-spaces)


[error] 22-22: trailing spaces

(trailing-spaces)


[error] 28-28: trailing spaces

(trailing-spaces)


[error] 34-34: trailing spaces

(trailing-spaces)


[error] 43-43: trailing spaces

(trailing-spaces)


[error] 47-47: trailing spaces

(trailing-spaces)


[error] 53-53: trailing spaces

(trailing-spaces)


[error] 68-68: no new line character at the end of file

(new-line-at-end-of-file)

🔇 Additional comments (3)
.github/workflows/npm-publish.yml (3)

1-9: Add explicit permissions to the workflow

The workflow needs explicit permissions to function correctly.

🧰 Tools
🪛 yamllint (1.35.1)

[error] 9-9: trailing spaces

(trailing-spaces)


18-22: Update deprecated workflow command

The set-output command is deprecated.

🧰 Tools
🪛 actionlint (1.7.4)

21-21: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)

🪛 yamllint (1.35.1)

[error] 22-22: trailing spaces

(trailing-spaces)


54-57: Add version validation before publishing

Add a validation step to prevent accidental releases of invalid versions.

Comment on lines +58 to +68
# Create PR & publish to NPM
- name: Create release Pull Request or publish to NPM
id: changesets
uses: changesets/action@v1
with:
publish: yarn release
commit: "ci(changesets): version packages"
title: "ci(changesets): version packages"
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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

Add retry mechanism for npm publish

NPM registry operations can be flaky. Consider adding retry mechanism:

       - name: Create release Pull Request or publish to NPM
         id: changesets
         uses: changesets/action@v1
         with:
-          publish: yarn release
+          publish: npx --no-install retry-cli@0.7.0 -- yarn release
           commit: "ci(changesets): version packages"
           title: "ci(changesets): version packages"
📝 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
# Create PR & publish to NPM
- name: Create release Pull Request or publish to NPM
id: changesets
uses: changesets/action@v1
with:
publish: yarn release
commit: "ci(changesets): version packages"
title: "ci(changesets): version packages"
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Create PR & publish to NPM
- name: Create release Pull Request or publish to NPM
id: changesets
uses: changesets/action@v1
with:
publish: npx --no-install retry-cli@0.7.0 -- yarn release
commit: "ci(changesets): version packages"
title: "ci(changesets): version packages"
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
🧰 Tools
🪛 yamllint (1.35.1)

[error] 68-68: no new line character at the end of file

(new-line-at-end-of-file)

@albinAppsmith albinAppsmith requested a review from a team as a code owner December 11, 2024 04:37
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: 1

🧹 Outside diff range and nitpick comments (5)
app/client/package.json (1)

65-65: Consider moving @changesets/cli to devDependencies

The @changesets/cli package is a development tool used for version management and changelog generation. It's not required at runtime, so it should be in devDependencies instead of dependencies.

Apply this change:

-    "@changesets/cli": "^2.27.10",

Add to devDependencies section:

+    "@changesets/cli": "^2.27.10",
app/client/packages/design-system/ads/package.json (1)

14-16: Consider including additional package files

The files field should include other essential files like README, LICENSE, and type definitions.

  "files": [
-   "build"
+   "build",
+   "README.md",
+   "LICENSE",
+   "*.d.ts"
  ],
app/client/packages/design-system/ads/src/Menu/Menu.types.ts (1)

Consider documenting this API change and removing the underscore prefix

The interface _MenuItemProps appears to be only used internally within the Menu component files. Making it public is indeed a breaking change that should be documented. Since it's becoming part of the public API:

  1. Remove the underscore prefix to follow TypeScript naming conventions for public interfaces
  2. Add an entry in CHANGELOG.md under a "Breaking Changes" section
  3. Consider adding more detailed JSDoc comments to document the interface properties
🔗 Analysis chain

Line range hint 25-35: Consider documenting this API change

Making _MenuItemProps public is a breaking change that should be documented in the changelog. The underscore prefix typically indicates internal/private usage, consider removing it if this interface is now part of the public API.


Let me check if this interface is used in other files or if there are similar patterns in the codebase.


Let me check the actual usage of this interface and the changelog content.


Let me check how this interface is used in the Menu component and look for any existing changelog entries.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for existing usage of _MenuItemProps to assess impact
rg -l "_MenuItemProps" --type ts

Length of output: 93


Script:

#!/bin/bash
# Check for similar underscore-prefixed exported types
ast-grep --pattern 'export interface _$_'

# Check if this file is imported elsewhere
rg -l "from ['\"].*Menu\.types['\"]" --type ts

# Look for any changelog files
fd "CHANGELOG" --type f

Length of output: 410


Script:

#!/bin/bash
# Check how _MenuItemProps is used in Menu.tsx
ast-grep --pattern '$_: _MenuItemProps'

# Check the changelog content
cat app/client/packages/design-system/ads/CHANGELOG.md

Length of output: 111023


Script:

#!/bin/bash
# Check how _MenuItemProps is used in Menu.tsx
rg -A 5 "_MenuItemProps" app/client/packages/design-system/ads/src/Menu/Menu.tsx

# Check recent changelog entries
head -n 50 app/client/packages/design-system/ads/CHANGELOG.md

Length of output: 208

app/client/packages/design-system/ads/rollup.config.cjs (2)

22-23: Improve external dependencies configuration

The current external function is too broad. Consider explicitly listing external dependencies or using a more specific pattern matching.

-  external: (id) =>
-    !id.startsWith(".") && !id.startsWith("/") && !id.includes("src"),
+  external: [
+    'react',
+    'react-dom',
+    '@radix-ui/react-dropdown-menu',
+    // Add other specific external dependencies
+    /^@appsmith\//,  // All @appsmith scoped packages
+  ],

29-34: Consider adding PostCSS configuration file

Move PostCSS configuration to a separate postcss.config.js file for better maintainability and reusability.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between adffe0e and bfeef0e.

⛔ Files ignored due to path filters (1)
  • app/client/yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (17)
  • app/client/.changeset/README.md (1 hunks)
  • app/client/.changeset/config.json (1 hunks)
  • app/client/package.json (1 hunks)
  • app/client/packages/design-system/ads-old/package.json (1 hunks)
  • app/client/packages/design-system/ads/.npmignore (1 hunks)
  • app/client/packages/design-system/ads/CHANGELOG.md (1 hunks)
  • app/client/packages/design-system/ads/package.json (1 hunks)
  • app/client/packages/design-system/ads/rollup.config.cjs (1 hunks)
  • app/client/packages/design-system/ads/src/List/List.stories.tsx (1 hunks)
  • app/client/packages/design-system/ads/src/Menu/Menu.types.ts (1 hunks)
  • app/client/packages/design-system/headless/package.json (1 hunks)
  • app/client/packages/design-system/theming/package.json (1 hunks)
  • app/client/packages/design-system/widgets-old/package.json (1 hunks)
  • app/client/packages/design-system/widgets/package.json (1 hunks)
  • app/client/packages/icons/package.json (1 hunks)
  • app/client/packages/storybook/package.json (1 hunks)
  • app/client/packages/utils/package.json (1 hunks)
✅ Files skipped from review due to trivial changes (12)
  • app/client/packages/design-system/widgets/package.json
  • app/client/packages/design-system/headless/package.json
  • app/client/packages/design-system/widgets-old/package.json
  • app/client/packages/design-system/ads-old/package.json
  • app/client/packages/design-system/theming/package.json
  • app/client/.changeset/README.md
  • app/client/packages/design-system/ads/CHANGELOG.md
  • app/client/packages/icons/package.json
  • app/client/packages/utils/package.json
  • app/client/.changeset/config.json
  • app/client/packages/design-system/ads/.npmignore
  • app/client/packages/storybook/package.json
🧰 Additional context used
🪛 Biome (1.9.4)
app/client/packages/design-system/ads/rollup.config.cjs

[error] 1-1: Illegal use of an import declaration outside of a module

not allowed inside scripts

(parse)


[error] 1-2: Illegal use of an import declaration outside of a module

not allowed inside scripts

(parse)


[error] 2-3: Illegal use of an import declaration outside of a module

not allowed inside scripts

(parse)


[error] 3-4: Illegal use of an import declaration outside of a module

not allowed inside scripts

(parse)


[error] 4-5: Illegal use of an import declaration outside of a module

not allowed inside scripts

(parse)


[error] 5-6: Illegal use of an import declaration outside of a module

not allowed inside scripts

(parse)


[error] 6-7: Illegal use of an import declaration outside of a module

not allowed inside scripts

(parse)


[error] 7-8: Illegal use of an import declaration outside of a module

not allowed inside scripts

(parse)


[error] 8-9: Illegal use of an import declaration outside of a module

not allowed inside scripts

(parse)


[error] 9-10: Illegal use of an import declaration outside of a module

not allowed inside scripts

(parse)


[error] 11-47: Illegal use of an export declaration outside of a module

not allowed inside scripts

(parse)

🔇 Additional comments (5)
app/client/packages/design-system/ads/src/List/List.stories.tsx (1)

3-4: LGTM! Import paths updated for NPM package structure.

The relative imports align with the NPM package publishing requirements.

Let's verify the import pattern consistency across other story files:

✅ Verification successful

The previous command didn't find any @appsmith/ads imports, which actually supports that the imports have been updated consistently. However, let's verify this by checking the actual import patterns in all story files and specifically looking for relative imports to confirm the consistency of the changes.


Import paths are consistently using relative paths across all story files

The verification shows that all story files in the design system are consistently using relative imports (using "./", "../") instead of absolute paths. The changes in List.stories.tsx align with this pattern, making it suitable for NPM package publishing.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if other story files follow the same import pattern
rg -g '*.stories.tsx' -A 1 'import.*from.*@appsmith/ads' app/client/packages/design-system/ads/src/

Length of output: 101


Script:

#!/bin/bash
# Let's check all story files in the design system for their import patterns
fd '.stories.tsx$' app/client/packages/design-system/ads/src/ --exec head -n 10 {}

# Also check specifically for relative imports in stories
rg -g '*.stories.tsx' 'import.*from "\.' app/client/packages/design-system/ads/src/

Length of output: 22076

app/client/packages/design-system/ads/package.json (3)

11-12: Verify rollup configuration and build output

The build script references a rollup config, but we need to ensure it's properly set up.

✅ Verification successful

Rollup configuration is properly set up

The rollup configuration is well-structured with:

  • ESM output format with sourcemaps
  • TypeScript support with declaration files
  • Proper handling of assets (CSS, images, fonts)
  • Minification and optimization enabled
  • Correct peer dependencies handling
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check rollup config existence and format
fd -t f rollup.config.cjs app/client/packages/design-system/ads/

Length of output: 122


Script:

#!/bin/bash
# Check rollup config content
cat app/client/packages/design-system/ads/rollup.config.cjs

Length of output: 1594


3-3: Verify version compatibility with npm publish workflow

The alpha version suggests this is a pre-release. Ensure the npm publish workflow is configured to handle pre-release versions correctly.

✅ Verification successful

Alpha version is appropriate for pre-release package

The version bump to 2.1.44-alpha.4 is correct for this package. The package is marked as non-private and the alpha tag indicates this is a pre-release version, which is appropriate for a design system package undergoing changes with the new rollup build configuration.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if the workflow handles alpha releases
rg -A 5 "npm.*publish" .github/workflows/

Length of output: 43


Script:

#!/bin/bash
# Let's check for npm publish related configurations in package.json files
rg -g "package.json" "publishConfig|\"private\":|\"public\":" -A 2

# Also check for any npm related workflow files
fd workflow .github/

Length of output: 3126


Script:

#!/bin/bash
# Let's check the specific package.json for the ads package
cat app/client/packages/design-system/ads/package.json

# Also check for any npm related workflow files in more detail
fd -t f . .github/workflows/ -x cat {}

Length of output: 67834


21-32: Review dependency versions for updates

Some rollup plugins are using older versions. Consider updating to the latest stable versions for security and features.

✅ Verification successful

Let me check the versions of other rollup-related dependencies to get a complete picture.


Dependencies are up to date

All rollup-related dependencies in package.json are using their latest stable versions. No updates are required at this time.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check latest versions of rollup plugins
for pkg in @rollup/plugin-commonjs @rollup/plugin-typescript @rollup/plugin-terser; do
  echo "Checking $pkg..."
  npm view $pkg version
done

Length of output: 646


Script:

#!/bin/bash
# Check latest versions of remaining rollup plugins
for pkg in @rollup/plugin-image @rollup/plugin-url @svgr/rollup rollup-plugin-copy rollup-plugin-peer-deps-external rollup-plugin-postcss rollup; do
  echo "Checking $pkg..."
  npm view $pkg version
done

Length of output: 1837

app/client/packages/design-system/ads/rollup.config.cjs (1)

42-44: Verify font files existence

Ensure the font files exist in the specified source directory and consider adding error handling for the copy operation.

✅ Verification successful

Font files are present and correctly located

The font files exist in the correct source directory app/client/packages/design-system/ads/src/__assets__/fonts/ with multiple font variants (regular, bold, light, medium, semi-bold) in both .woff and .woff2 formats. The copy operation in the rollup config is properly configured.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if font files exist
fd . "src/__assets__/fonts" -t f

Length of output: 140


Script:

#!/bin/bash
# Let's first check if the directory structure exists at a different level
fd "__assets__" -t d

# Also check for any font files in the repository
fd -e ttf -e woff -e woff2 -e eot -e otf

Length of output: 10475

"description": "This is the package for the design system that powers the Appsmith platform",
"main": "src/index.ts",
"sideEffects": false,
"scripts": {
"generate:component": "plop component",
"lint": "yarn g:lint",
"prettier": "yarn g:prettier",
"test:unit": "yarn g:jest"
"test:unit": "yarn g:jest",
"build": "rm -rf build && rollup -c --bundleConfigAsCjs"
Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems that bundleConfigAsCjs flag contradicts what is specified in the config. Please check it out.

Copy link

This PR has not seen activitiy for a while. It will be closed in 7 days unless further activity is detected.

@github-actions github-actions bot added the Stale label Dec 27, 2024
Copy link

github-actions bot commented Jan 5, 2025

This PR has been closed because of inactivity.

@github-actions github-actions bot closed this Jan 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request ok-to-test Required label for CI Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants