Uh oh!
There was an error while loading. Please reload this page.
fix: resolve npx double package install failure - #848
Conversation
Signed-off-by: András Felleg <afelleg@gmail.com>
Signed-off-by: András Felleg <afelleg@gmail.com>
Signed-off-by: András Felleg <afelleg@gmail.com>
Signed-off-by: András Felleg <afelleg@gmail.com>
Signed-off-by: András Felleg <afelleg@gmail.com>
Signed-off-by: András Felleg <afelleg@gmail.com>
Signed-off-by: András Felleg <afelleg@gmail.com>
Signed-off-by: András Felleg <afelleg@gmail.com>
Signed-off-by: András Felleg <afelleg@gmail.com>
pyrooka
left a comment
There was a problem hiding this comment.
I left a few things to address/discuss. Otherwise, the changes look good!
| # Test without a custom ruleset | ||
| npx --yes \ |
There was a problem hiding this comment.
Adding the --prefer-online flag would be helpful to avoid reusing stale cached data. According to the NPM docs it does the following:
If true, staleness checks for cached data will be forced, making the CLI look for updates immediately even for fresh package data.
| # Test without a custom ruleset | |
| npx --yes \ | |
| # Test without a custom ruleset | |
| npx --yes --prefer-online \ |
| @@ -0,0 +1,30 @@ | |||
| /** | |||
| * Copyright 2017 - 2025 IBM Corporation. | |||
There was a problem hiding this comment.
| *Copyright2017-2025IBMCorporation. | |
| *Copyright2026IBMCorporation. |
| * SPDX-License-Identifier: Apache2.0 | ||
| */ | ||
| 'use strict'; |
There was a problem hiding this comment.
I think we don't need to use strict mode here. Actually we don't really use it anymore if you check any of the recent files.
| const validatorPkg = require('../../../package.json'); | ||
| const rulesetPkg = require('../../../../ruleset/package.json'); | ||
| const spectralRulesetsPkg = require('../../../../../node_modules/@stoplight/spectral-rulesets/package.json'); |
There was a problem hiding this comment.
These relative paths look a bit fragile. Do you think something like this would work?
const spectralRulesetsPkg = require(
require.resolve('@stoplight/spectral-rulesets/package.json')
);
Signed-off-by: András Felleg <afelleg@gmail.com>
PR summary
In this commit we fix an issue where installing the
validator with npx would cause ruleset is not an object
failure, due to spectral core version mismatch.
PR Checklist
General checklist
Please make sure that your PR fulfills the following requirements:
.secrets.baselinehas been updated as needednpm run update-utilitieshas been run if any files inpackages/utilities/srchave been updatedChecklist for adding a new validation rule: