From 28f285563b1d2ed86a13312c87c29e776b46f842 Mon Sep 17 00:00:00 2001 From: Tatsinnit Date: Wed, 14 May 2025 07:19:00 +1200 Subject: [PATCH] Fix types, and update node version. (#181) * Fix types, and update node version. Signed-off-by: Tatsat Mishra * Prettier Fix for this repo. Signed-off-by: Tatsat Mishra --------- Signed-off-by: Tatsat Mishra --- .github/workflows/prettify-code.yml | 4 +-- CHANGELOG.md | 12 ++++---- CODE_OF_CONDUCT.md | 6 ++-- SECURITY.md | 14 +++++----- src/run.test.ts | 43 ++++++++++++++++------------- 5 files changed, 41 insertions(+), 38 deletions(-) diff --git a/.github/workflows/prettify-code.yml b/.github/workflows/prettify-code.yml index 0c8c8dc..d318786 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 . diff --git a/CHANGELOG.md b/CHANGELOG.md index c16abdf..1ff2402 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 d7321aa..f9ba8cf 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 729db0d..60551ad 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 8b02210..78ef64b 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,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