Skip to content

Commit

Permalink
scripts/unpinnedNpmPackageInstallVersions.fsx: add
Browse files Browse the repository at this point in the history
Add unpinnedNpmPackageInstallVersions.fsx script and specify
package versions in npm install commands in GitHubCI.
  • Loading branch information
tehraninasab committed Jul 13, 2023
1 parent 6b83e51 commit bd8be73
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
sudo apt install --yes --no-install-recommends npm curl
# need to update nodejs because with ubuntu's default nodejs version we would get this error:
# error @jest/core@29.4.1: The engine "node" is incompatible with this module. Expected version "^14.15.0 || ^16.10.0 || >=18.0.0". Got "12.22.9"
sudo npm install --global n
sudo npm install --global n@9.1.0
sudo n lts
- name: Print versions
run: |
Expand All @@ -86,12 +86,12 @@ jobs:
npm --version
- name: Install yarn
run: |
npm install --global yarn
npm install --global yarn@1.22.19
yarn add --dev jest typescript ts-jest @types/jest
- name: Install commitlint
run: |
npm install conventional-changelog-conventionalcommits
npm install commitlint@latest
npm install conventional-changelog-conventionalcommits@6.1.0
npm install commitlint@17.6.6
- name: Print versions
run: |
git --version
Expand Down Expand Up @@ -130,7 +130,7 @@ jobs:
# at wrapSafe (internal/modules/cjs/loader.js:915:16)
# ...
# ```
sudo npm install --global n
sudo npm install --global n@9.1.0
sudo n lts
- uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -179,6 +179,8 @@ jobs:
run: dotnet fsi scripts/unpinnedNugetPackageReferenceVersions.fsx
- name: Check there are no unpinned versions in `dotnet tool install` commands
run: dotnet fsi scripts/unpinnedDotnetToolInstallVersions.fsx
- name: Check there are no unpinned versions in `npm install` commands
run: dotnet fsi scripts/unpinnedNpmPackageInstallVersions.fsx
- name: Check commits 1 by 1
if: github.event_name == 'pull_request'
run: dotnet fsi scripts/checkCommits1by1.fsx
Expand Down
20 changes: 20 additions & 0 deletions scripts/unpinnedNpmPackageInstallVersions.fsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env -S dotnet fsi

open System
open System.IO

#load "../src/FileConventions/Library.fs"
#load "../src/FileConventions/Helpers.fs"

let rootDir = Path.Combine(__SOURCE_DIRECTORY__, "..") |> DirectoryInfo

let invalidFiles =
Helpers.GetInvalidFiles
rootDir
"*.yml"
FileConventions.DetectUnpinnedNpmPackageInstallVersions

let message =
"Please define the package version number in the `npm install` commands."

Helpers.AssertNoInvalidFiles invalidFiles message

0 comments on commit bd8be73

Please sign in to comment.