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(custom-checks): add common package json fields check #3670

Open
outSH opened this issue Dec 3, 2024 · 1 comment
Open

ci(custom-checks): add common package json fields check #3670

outSH opened this issue Dec 3, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request Flaky-Test-Automation Issues related to test stability (which is a long running issue that can never fully be solved) good-first-issue-400-expert P3 Priority 3: Medium

Comments

@outSH
Copy link
Contributor

outSH commented Dec 3, 2024

Is your feature request related to a problem? Please describe.

We have bunch of custom checks that verify content of package.json and we need to add new ones from time to time. Most recently, we want to verify that:

Describe the solution you'd like
I don't want to add a new script each time a single field has to be checked, I want to have a simple template that will describe what parts of package.json should be assesed, and have a single script that will do the verification (and possibly a fix if applicable).

Example template I have in mind (don't mind the values, it's just an example):

{
  "name": "regexMatch(@hyperledger/.+)",
  "version": "eqal(2.1.0)", // TBD - must check if not causing problems on release
  "private": "eqal(false)",
  "description": "notEmpty()",
  "homepage": "eqal(https://github.com/hyperledger/cacti#readme)",
  "bugs": {
    "url": "eqal(https://github.com/hyperledger-cacti/cacti/issues)"
  },
  "repository": {
    "type": "eqal(git)",
    "url": "eqal(git+https://github.com/hyperledger/cacti.git)"
  },
  "license": "eqal(Apache-2.0)",
  "author": {
    "name": "eqal(Hyperledger Cacti Contributors)",
    "email": "eqal([email protected])",
    "url": "eqal(https://www.hyperledger.org/use/cacti)"
  },
  "scripts": "notEmpty()",
  "publishConfig": {
    "access": "eqal(public)"
  },
  // CUSTOM CHECKS
  "_checkNodeVersion": {
    "node": "18",
    "npm": "8"
  },
  "_checkPackageSorted": true
}

Describe alternatives you've considered
Adding new script isn't hard but still a bit time consuming. Having template-based solution will allow adding new / modifying rules in a matter of minutes.

@petermetz thoughts?

@outSH outSH added the enhancement New feature or request label Dec 3, 2024
@petermetz
Copy link
Contributor

@outSH Agreed, 100%. It would be great to have a single custom-check script responsible for the bulk of the package.json validations that are easy to describe declaratively with a Joi 1 schema for example.

In the interest of time I would skip doing automatic corrections for now, but I also consider that a good idea of course.

@outSH outSH self-assigned this Dec 5, 2024
@outSH outSH added good-first-issue-400-expert Flaky-Test-Automation Issues related to test stability (which is a long running issue that can never fully be solved) P3 Priority 3: Medium labels Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Flaky-Test-Automation Issues related to test stability (which is a long running issue that can never fully be solved) good-first-issue-400-expert P3 Priority 3: Medium
Projects
None yet
Development

No branches or pull requests

2 participants