Skip to content

fix: resolve npx double package install failure - #848

Open
Andris28 wants to merge 11 commits into
mainfrom
fa/ruleset-is-not-object
Open

fix: resolve npx double package install failure#848
Andris28 wants to merge 11 commits into
mainfrom
fa/ruleset-is-not-object

Conversation

@Andris28

@Andris28 Andris28 commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

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:

  • The commit message follows the Angular Commit Message Guidelines.
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • Dependencies have been updated as needed
  • .secrets.baseline has been updated as needed
  • npm run update-utilities has been run if any files in packages/utilities/src have been updated

Checklist for adding a new validation rule:

  • Added new validation rule definition (packages/ruleset/src/rules/*.js, index.js)
  • If necessary, added new validation rule implementation (packages/ruleset/src/functions/*.js, updated index.js)
  • Added new rule to default configuration (packages/ruleset/src/ibm-oas.js)
  • Added tests for new rule (packages/ruleset/test/*.test.js)
  • Added docs for new rule (docs/ibm-cloud-rules.md)
  • Added scoring rubric entry for new rule (packages/validator/src/scoring-tool/rubric.js)

Andris28 and others added 7 commits August 7, 2026 12:30
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>
@Andris28 Andris28 changed the title build: add npx install test to build fix: resolve npx double package install failure Aug 10, 2026
@Andris28
Andris28 requested review from diatrcz and pyrooka August 10, 2026 08:44
@Andris28
Andris28 marked this pull request as ready for review August 10, 2026 08:44
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 pyrooka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I left a few things to address/discuss. Otherwise, the changes look good!

Comment thread .github/workflows/build.yaml Outdated
Comment on lines +79 to +80
# Test without a custom ruleset
npx --yes \

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Suggested change
# 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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
* Copyright 2017 - 2025 IBM Corporation.
* Copyright 2026 IBM Corporation.

* SPDX-License-Identifier: Apache2.0
*/

'use strict';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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.

Comment on lines +10 to +12
const validatorPkg = require('../../../package.json');
const rulesetPkg = require('../../../../ruleset/package.json');
const spectralRulesetsPkg = require('../../../../../node_modules/@stoplight/spectral-rulesets/package.json');

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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?

const spectralRulesetsPkg = require(
  require.resolve('@stoplight/spectral-rulesets/package.json')
);

Signed-off-by: András Felleg <afelleg@gmail.com>
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.

2 participants