From fc282b54113471b703d6555dea5cdf86e7125553 Mon Sep 17 00:00:00 2001 From: Tatsat Mishra Date: Tue, 13 May 2025 21:58:04 +1200 Subject: [PATCH 1/3] Fix types, and update node version. Signed-off-by: Tatsat Mishra --- package-lock.json | 8 ++++---- package.json | 2 +- src/run.test.ts | 38 +++++++++++++++++++------------------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/package-lock.json b/package-lock.json index 910ec0d2..35324a6c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,7 +18,7 @@ }, "devDependencies": { "@types/jest": "^29.5.14", - "@types/node": "^22.15.3", + "@types/node": "^22.15.17", "@vercel/ncc": "^0.38.3", "jest": "^29.7.0", "prettier": "^3.5.3", @@ -1365,9 +1365,9 @@ } }, "node_modules/@types/node": { - "version": "22.15.3", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.15.3.tgz", - "integrity": "sha512-lX7HFZeHf4QG/J7tBZqrCAXwz9J5RD56Y6MpP0eJkka8p+K0RY/yBTW7CYFJ4VGCclxqOLKmiGP5juQc6MKgcw==", + "version": "22.15.17", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.15.17.tgz", + "integrity": "sha512-wIX2aSZL5FE+MR0JlvF87BNVrtFWf6AE6rxSE9X7OwnVvoyCQjpzSRJ+M87se/4QCkCiebQAqrJ0y6fwIyi7nw==", "dev": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 43184496..5900cd32 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ }, "devDependencies": { "@types/jest": "^29.5.14", - "@types/node": "^22.15.3", + "@types/node": "^22.15.17", "@vercel/ncc": "^0.38.3", "jest": "^29.7.0", "prettier": "^3.5.3", diff --git a/src/run.test.ts b/src/run.test.ts index 8b022108..54bbe50e 100644 --- a/src/run.test.ts +++ b/src/run.test.ts @@ -99,20 +99,20 @@ describe('run.ts', () => { jest.spyOn(fs, 'readdirSync').mockImplementation((file, _) => { if (file == 'mainFolder') return [ - 'file1' as unknown as fs.Dirent, - 'file2' as unknown as fs.Dirent, - 'folder1' as unknown as fs.Dirent, - 'folder2' as unknown as fs.Dirent + 'file1' as unknown as fs.Dirent>, + 'file2' as unknown as fs.Dirent>, + 'folder1' as unknown as fs.Dirent>, + 'folder2' as unknown as fs.Dirent> ] if (file == path.join('mainFolder', 'folder1')) return [ - 'file11' as unknown as fs.Dirent, - 'file12' as unknown as fs.Dirent + 'file11' as unknown as fs.Dirent>, + 'file12' as unknown as fs.Dirent> ] if (file == path.join('mainFolder', 'folder2')) return [ - 'file21' as unknown as fs.Dirent, - 'file22' as unknown as fs.Dirent + 'file21' as unknown as fs.Dirent>, + 'file22' as unknown as fs.Dirent> ] return [] }) @@ -134,20 +134,20 @@ describe('run.ts', () => { jest.spyOn(fs, 'readdirSync').mockImplementation((file, _) => { if (file == 'mainFolder') return [ - 'file1' as unknown as fs.Dirent, - 'file2' as unknown as fs.Dirent, - 'folder1' as unknown as fs.Dirent, - 'folder2' as unknown as fs.Dirent + 'file1' as unknown as fs.Dirent>, + 'file2' as unknown as fs.Dirent>, + 'folder1' as unknown as fs.Dirent>, + 'folder2' as unknown as fs.Dirent> ] if (file == path.join('mainFolder', 'folder1')) return [ - 'file11' as unknown as fs.Dirent, - 'file12' as unknown as fs.Dirent + 'file11' as unknown as fs.Dirent>, + 'file12' as unknown as fs.Dirent> ] if (file == path.join('mainFolder', 'folder2')) return [ - 'file21' as unknown as fs.Dirent, - 'file22' as unknown as fs.Dirent + 'file21' as unknown as fs.Dirent>, + 'file22' as unknown as fs.Dirent> ] return [] }) @@ -166,7 +166,7 @@ describe('run.ts', () => { test('findHelm() - change access permissions and find the helm in given directory', () => { jest.spyOn(fs, 'chmodSync').mockImplementation(() => {}) jest.spyOn(fs, 'readdirSync').mockImplementation((file, _) => { - if (file == 'mainFolder') return ['helm.exe' as unknown as fs.Dirent] + if (file == 'mainFolder') return ['helm.exe' as unknown as fs.Dirent>] return [] }) jest.spyOn(fs, 'statSync').mockImplementation((file) => { @@ -208,7 +208,7 @@ describe('run.ts', () => { jest.spyOn(toolCache, 'cacheDir').mockResolvedValue('pathToCachedDir') jest .spyOn(fs, 'readdirSync') - .mockImplementation((file, _) => ['helm.exe' as unknown as fs.Dirent]) + .mockImplementation((file, _) => ['helm.exe' as unknown as fs.Dirent>]) jest.spyOn(fs, 'statSync').mockImplementation((file) => { const isDirectory = (file as string).indexOf('folder') == -1 ? false : true @@ -254,7 +254,7 @@ describe('run.ts', () => { jest.spyOn(fs, 'chmodSync').mockImplementation(() => {}) jest .spyOn(fs, 'readdirSync') - .mockReturnValue(['helm.exe' as unknown as fs.Dirent]) + .mockReturnValue(['helm.exe' as unknown as fs.Dirent>]) jest.spyOn(fs, 'statSync').mockImplementation((file) => { const isDirectory = (file as string).indexOf('folder') == -1 ? false : true From 32e4133192253a0b7bd90b10fe448c8404dd2e63 Mon Sep 17 00:00:00 2001 From: Tatsat Mishra Date: Tue, 13 May 2025 22:01:00 +1200 Subject: [PATCH 2/3] Prettier Fix for this repo. Signed-off-by: Tatsat Mishra --- CHANGELOG.md | 12 ++++++------ CODE_OF_CONDUCT.md | 6 +++--- SECURITY.md | 14 +++++++------- src/run.test.ts | 11 ++++++++--- 4 files changed, 24 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c16abdf0..1ff2402e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,18 +2,18 @@ ## [4.3.0] - 2025-02-15 -- #152 feat: log when restoring from cache -- #157 Dependencies Update -- #137 Add dependabot +- #152 feat: log when restoring from cache +- #157 Dependencies Update +- #137 Add dependabot ## [4.2.0] - 2024-04-15 -- #124 Fix OS detection and download OS-native archive extension +- #124 Fix OS detection and download OS-native archive extension ## [4.1.0] - 2024-03-01 -- #130 switches to use Helm published file to read latest version instead of using GitHub releases +- #130 switches to use Helm published file to read latest version instead of using GitHub releases ## [4.0.0] - 2024-02-12 -- #121 update to node20 as node16 is deprecated +- #121 update to node20 as node16 is deprecated diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index d7321aa5..f9ba8cf6 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -4,6 +4,6 @@ This project has adopted the [Microsoft Open Source Code of Conduct](https://ope Resources: -- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/) -- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) -- Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns +- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/) +- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +- Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns diff --git a/SECURITY.md b/SECURITY.md index 729db0d5..60551ad6 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -18,13 +18,13 @@ You should receive a response within 24 hours. If for some reason you do not, pl Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: -- Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.) -- Full paths of source file(s) related to the manifestation of the issue -- The location of the affected source code (tag/branch/commit or direct URL) -- Any special configuration required to reproduce the issue -- Step-by-step instructions to reproduce the issue -- Proof-of-concept or exploit code (if possible) -- Impact of the issue, including how an attacker might exploit the issue +- Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.) +- Full paths of source file(s) related to the manifestation of the issue +- The location of the affected source code (tag/branch/commit or direct URL) +- Any special configuration required to reproduce the issue +- Step-by-step instructions to reproduce the issue +- Proof-of-concept or exploit code (if possible) +- Impact of the issue, including how an attacker might exploit the issue This information will help us triage your report more quickly. diff --git a/src/run.test.ts b/src/run.test.ts index 54bbe50e..78ef64b6 100644 --- a/src/run.test.ts +++ b/src/run.test.ts @@ -166,7 +166,8 @@ describe('run.ts', () => { test('findHelm() - change access permissions and find the helm in given directory', () => { jest.spyOn(fs, 'chmodSync').mockImplementation(() => {}) jest.spyOn(fs, 'readdirSync').mockImplementation((file, _) => { - if (file == 'mainFolder') return ['helm.exe' as unknown as fs.Dirent>] + if (file == 'mainFolder') + return ['helm.exe' as unknown as fs.Dirent>] return [] }) jest.spyOn(fs, 'statSync').mockImplementation((file) => { @@ -208,7 +209,9 @@ describe('run.ts', () => { jest.spyOn(toolCache, 'cacheDir').mockResolvedValue('pathToCachedDir') jest .spyOn(fs, 'readdirSync') - .mockImplementation((file, _) => ['helm.exe' as unknown as fs.Dirent>]) + .mockImplementation((file, _) => [ + 'helm.exe' as unknown as fs.Dirent> + ]) jest.spyOn(fs, 'statSync').mockImplementation((file) => { const isDirectory = (file as string).indexOf('folder') == -1 ? false : true @@ -254,7 +257,9 @@ describe('run.ts', () => { jest.spyOn(fs, 'chmodSync').mockImplementation(() => {}) jest .spyOn(fs, 'readdirSync') - .mockReturnValue(['helm.exe' as unknown as fs.Dirent>]) + .mockReturnValue([ + 'helm.exe' as unknown as fs.Dirent> + ]) jest.spyOn(fs, 'statSync').mockImplementation((file) => { const isDirectory = (file as string).indexOf('folder') == -1 ? false : true From 36f1cc783f57c3b4a1f6d5b617f922de6c07eec2 Mon Sep 17 00:00:00 2001 From: Tatsat Mishra Date: Wed, 14 May 2025 06:52:41 +1200 Subject: [PATCH 3/3] Consistent usage of npx prettier check. Signed-off-by: Tatsat Mishra --- .github/workflows/prettify-code.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/prettify-code.yml b/.github/workflows/prettify-code.yml index 0c8c8dc5..d3187862 100644 --- a/.github/workflows/prettify-code.yml +++ b/.github/workflows/prettify-code.yml @@ -13,6 +13,4 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Enforce Prettier - uses: actionsx/prettier@3d9f7c3fa44c9cb819e68292a328d7f4384be206 # v3 - with: - args: --check . + run: npx prettier --check .