Skip to content

Normalize schema #3

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

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

codejedi365
Copy link

@codejedi365 codejedi365 commented May 20, 2021

Purpose

Improve ease of maintenance and integration with official schema for which this repo is designed around while maintaining the lightweight production use.

Summary of Fixes

  • Fix processing schema to match official repo definitions (version field inaccurately used)
  • Import official schema repo as dependency for tracking purposes
  • Maintain minimalism of project to be downloaded on-the-fly (adoption of webpack) with single individual bundled file
  • Updated test result snapshots to match updates to schema creation

How to Verify

# 1. Add my remote repo & Checkout this branch
$ git remote add codejedi365 https://github.com/codejedi365/gitlab-npm-audit-parser.git
$ git fetch codejedi365
$ git checkout --track codejedi365 codejedi365-normalize-schema

# 2. Install Dependencies from scratch
$ npm ci

# 3. Run build and verify all tests succeed
$ npm run prepublishOnly

# 4. Review/Inspect webpack bundle (for posterity)
$ less ./dist/parse.js

# cleanup
$ git remote remove codejedi365

NOTE: Conflicts with PR #2 as I built this one on an independent branch and unfortunately the run-scripts cause a git conflict. Depending if #2 is accepted or not, will adjust either PR to work with the new master branch. I built them independently to provide you a choice if you would like to merge the features or not.

### Rationale
Provide a better automated method of mapping to a known
and set schema version for when this audit parser is written for.
Also enables direct interaction with the schema definition
### Rationale
Schema might of included this at one point in the past but currently
in version 14, the instances parameter is invalid for when parsing
`npm audit --json` output v1
### Rationale
Given that this library requires a file from the module, it needs to be
a dependency.
### Rationale
The top level version is actually there to define the schema this
output adheres to.  Subsequently to maintain the differentiator of the
npm audit version that is now appended to the scanner name field.
These changes apply to both formats.
### Rationale
With the new changes to normalize the schema, the snapshots had to be
updated to pass the test cases.
### Rationale
Need to maintain simplicity and lightweight use of package but
now have more dependencies so webpack will save the day
### Rationale
Configured to extract only used files, minify and mangle into a final
shell runnable script

Overall, this maintains the simplicity and lightweight use of package
after adding more dependencies
### Rationale
Define the use of webpacking the code through npm pkg run-scripts
### Rationale
Simplify duplicate options
### Rationale
Prepare script is not desired to run on end user machine
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.

None yet

1 participant