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

fix(build): build executables with correct dependency versions #654

Merged
merged 1 commit into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"files": "package-lock.json|^.secrets.baseline$",
"lines": null
},
"generated_at": "2023-09-22T21:09:16Z",
"generated_at": "2024-03-22T15:15:27Z",
"plugins_used": [
{
"name": "AWSKeyDetector"
Expand Down Expand Up @@ -106,7 +106,7 @@
}
]
},
"version": "0.13.1+ibm.61.dss",
"version": "0.13.1+ibm.62.dss",
"word_list": {
"file": null,
"hash": null
Expand Down
13,680 changes: 1,904 additions & 11,776 deletions package-lock.json

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions packages/ruleset/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@
},
"dependencies": {
"@ibm-cloud/openapi-ruleset-utilities": "1.3.1",
"@stoplight/spectral-formats": "^1.5.0",
"@stoplight/spectral-formats": "^1.6.0",
Copy link
Member Author

Choose a reason for hiding this comment

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

Seemed like a good time to bump some of our dependencies. This addressed the "ip"-related vulnerability that npm install was reporting.

"@stoplight/spectral-functions": "^1.7.2",
"@stoplight/spectral-rulesets": "^1.16.0",
"chalk": "^4.1.1",
"@stoplight/spectral-rulesets": "^1.18.1",
"chalk": "^4.1.2",
"lodash": "^4.17.21",
"loglevel": "^1.8.1",
"loglevel": "^1.9.1",
"loglevel-plugin-prefix": "0.8.4",
"minimatch": "^6.1.6",
"validator": "^13.7.0"
"minimatch": "^6.2.0",
"validator": "^13.11.0"
},
"devDependencies": {
"@stoplight/spectral-core": "^1.18.0",
"@stoplight/spectral-core": "^1.18.3",
"jest": "^27.4.5"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion packages/utilities/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"pkg": "echo no executables to build in this package"
},
"devDependencies": {
"@stoplight/spectral-core": "^1.18.0",
"@stoplight/spectral-core": "^1.18.3",
"jest": "^27.4.5"
},
"engines": {
Expand Down
2 changes: 2 additions & 0 deletions packages/validator/.releaserc
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"branches": "main",
"debug": true,
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
Expand Down
15 changes: 6 additions & 9 deletions packages/validator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@
},
"dependencies": {
"@ibm-cloud/openapi-ruleset": "1.15.4",
"@stoplight/spectral-cli": "^6.8.0",
"@stoplight/spectral-core": "^1.18.0",
"@stoplight/spectral-parsers": "^1.0.2",
"@stoplight/spectral-cli": "^6.11.0",
"@stoplight/spectral-core": "^1.18.3",
"@stoplight/spectral-parsers": "^1.0.3",
"ajv": "^8.12.0",
"chalk": "^4.1.1",
"commander": "^10.0.0",
"chalk": "^4.1.2",
"commander": "^10.0.1",
"find-up": "5.0.0",
"globby": "^11.0.4",
"js-yaml": "^3.14.1",
"json-dup-key-validator": "^1.0.3",
"lodash": "^4.17.21",
"pad": "^2.3.0",
"semver": "^7.5.3"
"semver": "^7.6.0"
},
"devDependencies": {
"jest": "^27.4.5",
Expand All @@ -50,9 +50,6 @@
"node": ">=16.0.0",
"npm": ">=8.3.0"
},
"pkg": {
Copy link
Member Author

Choose a reason for hiding this comment

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

This change gets rid of the warnings that are displayed by "pkg".

"scripts": "src/**/*.js"
},
"jest": {
"collectCoverage": true,
"coverageDirectory": "./coverage/",
Expand Down
24 changes: 23 additions & 1 deletion scripts/create-binaries.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,32 @@
#!/bin/bash

# Enable shell debug mode so we get a few additional details in the build log.
set -x

# This script will be run when "npm run pkg" is executed from within
# the "packages/validator" directory.
# The commands below assume that the current directory is packages/validator.

# Before creating the executables, we need to remove the "openapi-ruleset"
# and "openapi-ruleset-utilities" dependencies from the packages/validator/node_modules
# and packages/ruleset/node_modules directories (respectively).
# We need to do this because those locations will actually contain the prior version
# of the dependency if we've published a new release of it during the same build.
# By removing them from the packages/[validator,ruleset] directories, we ensure that
# the correct version of these dependencies is obtained from the project's top-level
# node_modules directory instead.
if [[ -e "node_modules/@ibm-cloud" ]]; then
rm -fr "node_modules/@ibm-cloud"
fi

if [[ -e "../ruleset/node_modules/@ibm-cloud" ]]; then
rm -fr "../ruleset/node_modules/@ibm-cloud"
fi

# Create the executables
../../node_modules/.bin/pkg --out-path=./bin ./package.json


# Rename the executables and set their execute bit.
cd ./bin
mv ibm-openapi-validator-macos lint-openapi-macos
mv ibm-openapi-validator-linux lint-openapi-linux
Expand Down