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

[TRIGGER] npm new release #12149

Merged
merged 1 commit into from
Jun 20, 2024
Merged

Conversation

jcortes
Copy link
Collaborator

@jcortes jcortes commented May 28, 2024

WHY

Resolves #12070

Summary by CodeRabbit

  • New Features

    • Introduced npm app functionality with methods to construct URLs, make requests, and retrieve package metadata.
    • Added source component to emit events with the latest download counts of npm packages.
    • Added source component to emit events when a new version of an npm package is published.
  • Updates

    • Updated @pipedream/npm package version to 0.4.0.
    • Changed the main file extension to .mjs.
    • Upgraded @pipedream/platform dependency to ^3.0.0.

@jcortes jcortes added the trigger / source New trigger / source request label May 28, 2024
@jcortes jcortes self-assigned this May 28, 2024
Copy link

vercel bot commented May 28, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
docs-v2 ⬜️ Ignored (Inspect) Visit Preview Jun 19, 2024 2:36pm
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) Jun 19, 2024 2:36pm

@jcortes jcortes force-pushed the npm-new-components branch 2 times, most recently from 6ea5118 to 728bf77 Compare May 29, 2024 18:33
Copy link

vercel bot commented Jun 17, 2024

@jcortes is attempting to deploy a commit to the Pipedreamers Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

coderabbitai bot commented Jun 17, 2024

Walkthrough

The overall update introduces several new features for the npm component. It adds a constants file for maintaining configuration such as API URLs and webhooks, implements a new app file for handling npm-related operations, updates the npm package version, and introduces two new source components. One source tracks npm package download counts while the other detects and reports new npm package releases.

Changes

Files / Path Change Summary
components/npm/common/constants.mjs Added constants for API URL, webhook IDs, and secrets related to npm operations.
components/npm/npm.app.mjs Introduced methods for constructing URLs, Axios requests, and retrieving package metadata.
components/npm/package.json Updated version, changed main file extension to .mjs, upgraded @pipedream/platform dependency.
components/npm/sources/download-counts/... Introduced source for emitting events with the latest npm package download counts.
components/npm/sources/new-package-version/... Introduced source for emitting events when a new version of an npm package is published.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Source
    participant npm.app.mjs
    participant API

    User->>Source: Configure new package version trigger
    Source->>npm.app.mjs: Fetch package metadata
    npm.app.mjs->>API: GET /package/:name
    API-->>npm.app.mjs: Response with package data
    npm.app.mjs-->>Source: Package metadata
    Source-->>User: Emit event with latest package version
Loading

Assessment against linked issues

Objective Addressed Explanation
Report to Slack on new npm releases (#12070)
Implement new package version trigger (#12070)

Poem

In the land where code does hum,
New constants and URLs have come,
A trigger for npm release,
Packages updated, counts increased,
Rejoice in changes, oh so grand,
Rabbit writes with a keyboard in hand! 🌐✨

Warning

Review ran into problems

Problems (1)
  • Git: Failed to clone repository. Please contact CodeRabbit support.

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between c40f0cd and 5fa18c4.

Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Files selected for processing (5)
  • components/npm/common/constants.mjs (1 hunks)
  • components/npm/npm.app.mjs (1 hunks)
  • components/npm/package.json (2 hunks)
  • components/npm/sources/download-counts/download-counts.mjs (1 hunks)
  • components/npm/sources/new-package-version/new-package-version.mjs (1 hunks)
Files skipped from review due to trivial changes (2)
  • components/npm/common/constants.mjs
  • components/npm/package.json
Additional comments not posted (4)
components/npm/npm.app.mjs (2)

11-17: Method implementation for making HTTP requests is correctly handled.


19-29: Fetching package metadata is implemented correctly, with proper headers and dynamic path construction.

components/npm/sources/new-package-version/new-package-version.mjs (1)

1-45: The implementation of the "New Package Version" source component is correct and well-structured.

components/npm/sources/download-counts/download-counts.mjs (1)

1-67: The "New Download Counts" source component is implemented correctly, with appropriate use of methods and constants.

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between c40f0cd and a3382d8.

Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Files selected for processing (5)
  • components/npm/common/constants.mjs (1 hunks)
  • components/npm/npm.app.mjs (1 hunks)
  • components/npm/package.json (2 hunks)
  • components/npm/sources/download-counts/download-counts.mjs (1 hunks)
  • components/npm/sources/new-package-version/new-package-version.mjs (1 hunks)
Files skipped from review due to trivial changes (1)
  • components/npm/package.json
Additional comments not posted (5)
components/npm/common/constants.mjs (1)

1-19: Constants and API configurations are well-defined and correctly exported.

components/npm/npm.app.mjs (3)

8-9: The getUrl method correctly constructs URLs based on the provided parameters.


11-17: The makeRequest method is well-implemented, providing a flexible way to make HTTP requests with dynamic URL and additional parameters.


19-29: The getPackageMetadata method is correctly implemented to fetch metadata from the npm registry with proper headers.

components/npm/sources/new-package-version/new-package-version.mjs (1)

27-45: The run method in new-package-version.mjs is well-structured and effectively handles the emission of events for new package versions.

components/npm/sources/download-counts/download-counts.mjs Outdated Show resolved Hide resolved
lcaresia
lcaresia previously approved these changes Jun 18, 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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between a3382d8 and ea6c0c2.

Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Files selected for processing (5)
  • components/npm/common/constants.mjs (1 hunks)
  • components/npm/npm.app.mjs (1 hunks)
  • components/npm/package.json (2 hunks)
  • components/npm/sources/download-counts/download-counts.mjs (1 hunks)
  • components/npm/sources/new-package-version/new-package-version.mjs (1 hunks)
Files skipped from review as they are similar to previous changes (5)
  • components/npm/common/constants.mjs
  • components/npm/npm.app.mjs
  • components/npm/package.json
  • components/npm/sources/download-counts/download-counts.mjs
  • components/npm/sources/new-package-version/new-package-version.mjs

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between ea6c0c2 and 3a5c84e.

Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Files selected for processing (5)
  • components/npm/common/constants.mjs (1 hunks)
  • components/npm/npm.app.mjs (1 hunks)
  • components/npm/package.json (2 hunks)
  • components/npm/sources/download-counts/download-counts.mjs (1 hunks)
  • components/npm/sources/new-package-version/new-package-version.mjs (1 hunks)
Files skipped from review as they are similar to previous changes (4)
  • components/npm/common/constants.mjs
  • components/npm/npm.app.mjs
  • components/npm/package.json
  • components/npm/sources/new-package-version/new-package-version.mjs
Additional comments not posted (5)
components/npm/sources/download-counts/download-counts.mjs (5)

3-37: The structure and properties of the exported object are well-defined and align with the requirements for a Pipedream source component. Make sure the descriptions and default values are accurate and helpful for end-users.


39-49: The getDownloadCount method is well-implemented. It correctly constructs the request path and delegates the API request to the makeRequest method of the app module, handling both specific packages and general queries.


1-1: Ensure that the imported module ../../npm.app.mjs is correctly providing the expected exports, especially the makeRequest method used later in this file.

#!/bin/bash
# Description: Check for the existence and correct export of `makeRequest` in `npm.app.mjs`.

# Test: Search for the method definition. Expect: Definition of `makeRequest`.
ast-grep --lang javascript --pattern $'export {
  $$$
  makeRequest($_, $_) {
    $$$
  }
  $$$  
}' ../../npm.app.mjs

51-68: The run method correctly orchestrates the download count retrieval and event emission. However, ensure that error handling is robust, especially for API call failures.

#!/bin/bash
# Description: Verify robust error handling in the `run` method.

# Test: Search for error handling patterns. Expect: Proper error handling around the API call.
ast-grep --lang javascript --pattern $'async run($_) {
  $$$
  try {
    $$$
  } catch ($_) {
    $$$
  }
  $$$
}' components/npm/sources/download-counts/download-counts.mjs

65-65: Correct the typo in the summary message as previously noted.

- summary: `New Download Count ${response.downloads}`
+ summary: `New Download Count ${response.downloads}`

Likely invalid or redundant comment.

@jcortes
Copy link
Collaborator Author

jcortes commented Jun 19, 2024

/approve

@jcortes jcortes merged commit 0dd3f83 into PipedreamHQ:master Jun 20, 2024
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
trigger / source New trigger / source request
Projects
Development

Successfully merging this pull request may close these issues.

[TRIGGER] npm new release
2 participants