-
Notifications
You must be signed in to change notification settings - Fork 97
fix: resolve npx double package install failure #848
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
base: main
Are you sure you want to change the base?
Changes from all commits
47e0e2b
1a2c0e5
a81c066
41fb4b5
bb338cc
98cc91d
030a164
66a94d5
608a257
269635d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,30 @@ | ||||||
| /** | ||||||
| * Copyright 2017 - 2025 IBM Corporation. | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| * SPDX-License-Identifier: Apache2.0 | ||||||
| */ | ||||||
|
|
||||||
| 'use strict'; | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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 semver = require('semver'); | ||||||
|
|
||||||
| const validatorPkg = require('../../../package.json'); | ||||||
| const rulesetPkg = require('../../../../ruleset/package.json'); | ||||||
| const spectralRulesetsPkg = require('../../../../../node_modules/@stoplight/spectral-rulesets/package.json'); | ||||||
|
Comment on lines
+10
to
+12
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These relative paths look a bit fragile. Do you think something like this would work? |
||||||
|
|
||||||
| // The version of @stoplight/spectral-core declared in each package.json. | ||||||
| // These must stay in sync to avoid an instanceof Ruleset mismatch. | ||||||
| const validatorPin = validatorPkg.dependencies['@stoplight/spectral-core']; | ||||||
| const rulesetDevPin = rulesetPkg.devDependencies['@stoplight/spectral-core']; | ||||||
| const spectralRulesetsRange = | ||||||
| spectralRulesetsPkg.dependencies['@stoplight/spectral-core']; | ||||||
|
|
||||||
| describe('spectral-core version sync', function () { | ||||||
| it('validator and ruleset devDependency should pin the same spectral-core version', function () { | ||||||
| expect(validatorPin).toEqual(rulesetDevPin); | ||||||
| }); | ||||||
|
|
||||||
| it('validator spectral-core pin should satisfy the range required by spectral-rulesets', function () { | ||||||
| const satisfies = semver.satisfies(validatorPin, spectralRulesetsRange); | ||||||
| expect(satisfies).toBe(true); | ||||||
| }); | ||||||
| }); | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding the
--prefer-onlineflag would be helpful to avoid reusing stale cached data. According to the NPM docs it does the following: