npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@cpelements/cp-comments

v1.0.65

Published

Comments web component made for Red Hat Customer Portal

Downloads

748

Readme

CP-Comments

This web component is intended to be used with the red_hat_comments Drupal module.

This component had a rocky development process and is a bit different from working on most components. It's recommended to develop on this with a local Drupal environment, possibly many Drupal development environments.

Getting Started

See CP Elements Docs for general instructions getting setup, there's helpful info about getting your environment setup and other helpful information.

To get a proper dev setup get CP-comments setup in a Drupal environment:

  • Setup DXP Commenting Platform - Repo instructions: https://gitlab.cee.redhat.com/dxp/customer-portal/dxp-commenting-platform
  • Getting CP Elements plugged into the DXP Commenting Platform: https://docs.google.com/document/d/13KIqOg4XNc0NpTaGKuxDsmCJZKbliGw457usl6cXpaA/edit#

Also see the architecture documentation.

Compiling

From inside this folder run:

npm run dev

From CP Elements git root run:

# Only watches and compiles CP-Comments and it's dependencies
npm run dev cp-comments

# Or this command that launches a web server and watches/compiles all components:
npm start

The web server is not helpful for CP Elements at time of writing, it only works well in a Drupal context.

Dependencies

  • PFelement base class
  • pfe-avatar
  • pfe-button

CSS Variables

| CSS Property Name | Default | Description | | ----------------------------- | ------- | ----------------------- | |--cp-comments__loader__color | #ccc | Color of the loading spinner |

Events

cp-comments:comments-loaded

Fires when the first/another batch of comments have been loaded

  • event.detail.commentCount: Total comments (from all pages)
  • event.detail.cpComments: A reference to the cp-comments element

cp-comments:comment-added

Fires when a comment has been successfully added. Includes:

  • event.detail.commentCount: Total comments (from all pages)
  • event.detail.cpComments: A reference to the cp-comments element

cp-comments:comment-deleted

Fires when a comment is successfully deleted. Includes:

  • event.detail.commentCount: Total comments (from all pages)
  • event.detail.cpComments: A reference to the cp-comments element

pfeconfig-query

Fires when component loads and is ready for config from the host site. See docroot/modules/contrib/red_hat_comments/templates/comments-block.html.twig on the Commenting Platform, which captures the event and sets the config on cp-comments.

Development Process

At time of writing, we're in the middle of heavy development, and need to coordinate multiple folks working on the code, pushing code to QA, and code review.

The process (for now) is:

  1. For new work create a feature branch from epic/cp-comments-1x/integration, it's recommended to use DAT branch naming for consistency:
    feature/USERNAME/TICKET--SHORT-DESCRIPTION
    
    For example:
    feature/wruvalca/CPCORE-9212--fixing-authentication`
  2. You can run npm run dev cp-comments from CP Elements git root, or npm run dev from the CP Comments folder to watch and build code.
  3. Work on your feature in your branch until it's ready for review.
  4. Create an MR in Gitlab against main.
  5. Coordinate with Wes and other devs to create a new version on NPM, so we can push the code to QA.

Releasing to Preprod

Check with devs working on cp-comments to see if they're close to needing a release to combine efforts.

  1. Make sure all code for the release is merged to epic/cp-comments-1x/integration
  2. Push the updated epic/cp-comments-1x/integration to GitLab
  3. Make sure you're on the right version of node (nvm use or similar for CP Elements gitroot)
  4. Go to elements/cp-comments
  5. Run npm version patch (assuming you want a patch and not )
  6. Run npm run build (this ensures the component will report the right version from it's API)
  7. npm publish --access=public
  8. Go to CP Chrome and checkout epic/cp-comments-1x/integration
  9. Update the cp-comments version in j/public_modules/package.json
  10. Commit
  11. Follow the instructions from here starting at step 4: https://docs.engineering.redhat.com/pages/viewpage.action?pageId=310386287
  12. Do a CP Chrome release to Dev and QA, and optionally stage. If you aren't familiar with the process, it is highly recommended to find someone who is, as it's a tedious and confusing release process. Documentation is available though.