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(ruleset-bundler): add ruleset loader #1988

Merged
merged 9 commits into from
Dec 14, 2021

Conversation

P0lip
Copy link
Contributor

@P0lip P0lip commented Dec 6, 2021

Closes #1956

Checklist

  • Tests added / updated
  • Docs added / updated

Does this PR introduce a breaking change?

  • Yes
  • No

@P0lip P0lip added the enhancement New feature or request label Dec 6, 2021
@P0lip P0lip self-assigned this Dec 6, 2021
@P0lip P0lip force-pushed the feat/ruleset-bundler/add-loader branch from 61c7bad to 5b0cf6a Compare December 6, 2021 17:00
@P0lip P0lip marked this pull request as ready for review December 7, 2021 18:32
@P0lip P0lip requested a review from a team December 7, 2021 18:33
Copy link
Contributor

@marbemac marbemac left a comment

Choose a reason for hiding this comment

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

excellent work, mostly just a couple of questions

@@ -72,7 +72,7 @@ commands:
- run: yarn pretest
- run:
name: Run node tests
command: yarn test.jest --coverage --maxWorkers=<< parameters.max-workers >>
Copy link
Contributor

Choose a reason for hiding this comment

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

This removal of --coverage intentional? (ok if it is, just double checking)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, it's already gone in develop branch


## Loading YAML/JSON Ruleset

It is assumed you have [@stoplight/spectral-ruleset-migrator](https://www.npmjs.com/package/@stoplight/spectral-ruleset-migrator) installed.
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason to not have this as a dependency if it's always required? Env issue, dedupe issue, something else?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Any reason to not have this as a dependency if it's always required? Env issue, dedupe issue, something else?

hmmm, yeah, we could have it installed, why not.

Comment on lines +22 to +24
"default": "./dist/loader/node.js",
"node": "./dist/loader/node.js",
"browser": "./dist/loader/browser.js"
Copy link
Contributor

Choose a reason for hiding this comment

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

👌

export async function bundle(rulesetFile: string, bundleOptions: BundleOptions, { fs }: IO): Promise<string> {
try {
if (isBasicRuleset(rulesetFile)) {
const migratedRuleset = await migrateRuleset(rulesetFile, {
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah I think I see - migrateRuleset naming confused me. More like a ruleset transformer in this case, to transform from plain object format to esm format.

@P0lip P0lip merged commit a2c84dc into develop Dec 14, 2021
@P0lip P0lip deleted the feat/ruleset-bundler/add-loader branch December 14, 2021 22:20
stoplight-bot pushed a commit that referenced this pull request Dec 15, 2021
# [@stoplight/spectral-ruleset-bundler-v1.1.0](https://github.com/stoplightio/spectral/compare/@stoplight/spectral-ruleset-bundler-v1.0.1...@stoplight/spectral-ruleset-bundler-v1.1.0) (2021-12-15)

### Features

* **ruleset-bundler:** add ruleset loader ([#1988](#1988)) ([a2c84dc](a2c84dc))
stoplight-bot pushed a commit that referenced this pull request Dec 15, 2021
# [@stoplight/spectral-ruleset-migrator-v1.6.0](https://github.com/stoplightio/spectral/compare/@stoplight/spectral-ruleset-migrator-v1.5.2...@stoplight/spectral-ruleset-migrator-v1.6.0) (2021-12-15)

### Features

* **ruleset-bundler:** add ruleset loader ([#1988](#1988)) ([a2c84dc](a2c84dc))
stoplight-bot pushed a commit that referenced this pull request Dec 15, 2021
# [@stoplight/spectral-ruleset-bundler-v1.1.0](https://github.com/stoplightio/spectral/compare/@stoplight/spectral-ruleset-bundler-v1.0.1...@stoplight/spectral-ruleset-bundler-v1.1.0) (2021-12-15)

### Features

* **ruleset-bundler:** add ruleset loader ([#1988](#1988)) ([a2c84dc](a2c84dc))
stoplight-bot pushed a commit that referenced this pull request Dec 15, 2021
# [@stoplight/spectral-ruleset-migrator-v1.6.0](https://github.com/stoplightio/spectral/compare/@stoplight/spectral-ruleset-migrator-v1.5.2...@stoplight/spectral-ruleset-migrator-v1.6.0) (2021-12-15)

### Features

* **ruleset-bundler:** add ruleset loader ([#1988](#1988)) ([a2c84dc](a2c84dc))
stoplight-bot pushed a commit that referenced this pull request Dec 15, 2021
# [@stoplight/spectral-ruleset-bundler-v1.1.0](https://github.com/stoplightio/spectral/compare/@stoplight/spectral-ruleset-bundler-v1.0.1...@stoplight/spectral-ruleset-bundler-v1.1.0) (2021-12-15)

### Features

* **ruleset-bundler:** add ruleset loader ([#1988](#1988)) ([a2c84dc](a2c84dc))
@stoplight-bot
Copy link
Collaborator

🎉 This PR is included in version @stoplight/spectral-ruleset-bundler-v1.1.0 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

stoplight-bot pushed a commit that referenced this pull request Dec 15, 2021
# [@stoplight/spectral-ruleset-migrator-v1.6.0](https://github.com/stoplightio/spectral/compare/@stoplight/spectral-ruleset-migrator-v1.5.2...@stoplight/spectral-ruleset-migrator-v1.6.0) (2021-12-15)

### Features

* **ruleset-bundler:** add ruleset loader ([#1988](#1988)) ([a2c84dc](a2c84dc))
@stoplight-bot
Copy link
Collaborator

🎉 This PR is included in version @stoplight/spectral-ruleset-migrator-v1.6.0 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expose Javascript function to load custom ruleset from file
3 participants