From c4194b2efdf3a3068e7b065d2d71578751816e6f Mon Sep 17 00:00:00 2001 From: Jesse Youngblood Date: Wed, 14 Feb 2024 20:38:45 -0500 Subject: [PATCH] Maintenance Update --- .github/workflows/ci.yml | 14 +++++++------- .github/workflows/publish.yml | 19 ++++++++++--------- .github/workflows/release.yml | 4 ++-- package.json | 2 +- src/configFileEncryption.ts | 6 +++--- src/configForEnvironment.ts | 2 +- test/encryption/SimpleEncryption.test.ts | 10 ++++++---- 7 files changed, 30 insertions(+), 27 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fcb9449..d3766c7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,11 +8,11 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup Node - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: - node-version: 14.x + node-version: 20.x - name: Install dependencies run: npm install env: @@ -28,7 +28,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v2 with: - node-version: 14.x + node-version: 20.x - name: Install dependencies run: npm install env: @@ -42,12 +42,12 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest] # macos-latest is prohibitively expensive, use sparingly - node: [14.x, 12.x] + node: [16.x, 18.x, 20.x] steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup Node ${{ matrix.node }} - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: node-version: ${{ matrix.node }} - name: Install dependencies diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 00776de..c956666 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -12,11 +12,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 + - name: Setup Node - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: - node-version: 14.x + node-version: 20.x - name: Install dependencies run: npm install env: @@ -29,11 +30,11 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup Node - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: - node-version: 14.x + node-version: 20.x registry-url: 'https://registry.npmjs.org' - name: Install dependencies run: npm install @@ -51,11 +52,11 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup Node - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: - node-version: 14.x + node-version: 20.x registry-url: https://npm.pkg.github.com/ always-auth: true scope: "@jessety" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 37d2f7a..8b7bfc7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,12 +11,12 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 # Git history won't be fetched without this option - name: Setup Node - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 - name: Generate release notes # To change the release notes format, edit RELEASE.md.hbs id: notes diff --git a/package.json b/package.json index ef8b27b..baae17d 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "test": "npm run build && jest" }, "dependencies": { - "env-smart": "^2.2.0", + "env-smart": "^2.3.1", "inquirer": "^8.0.0" }, "devDependencies": { diff --git a/src/configFileEncryption.ts b/src/configFileEncryption.ts index 0dac1d6..a79acc9 100644 --- a/src/configFileEncryption.ts +++ b/src/configFileEncryption.ts @@ -45,9 +45,9 @@ export async function decrypt(environment = 'default', overwriteExisting = false console.log(`Successfully decrypted "${encryptedFilename}" into "${decryptedFilename}"`); - } catch (error) { + } catch (error: unknown) { - console.error(error.message); + console.error(error); throw error; } } @@ -94,7 +94,7 @@ export async function encrypt(environment?: string, overwriteExisting = true): P } catch (error) { - console.error(error.message); + console.error(error); throw error; } } diff --git a/src/configForEnvironment.ts b/src/configForEnvironment.ts index 9c0f326..8535a02 100644 --- a/src/configForEnvironment.ts +++ b/src/configForEnvironment.ts @@ -36,7 +36,7 @@ export function environmentToConfigMap(configFileName = defaultConfigFileName): } catch (error) { - console.warn(`Caught error reading config file ${configFileName}: ${error.message}`); + console.warn(`Caught error reading config file ${configFileName}:`, error); return; } } diff --git a/test/encryption/SimpleEncryption.test.ts b/test/encryption/SimpleEncryption.test.ts index 3ebf4bc..71bdc9c 100644 --- a/test/encryption/SimpleEncryption.test.ts +++ b/test/encryption/SimpleEncryption.test.ts @@ -1,3 +1,5 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ + import SimpleEncryption from '../../src/encryption/SimpleEncryption'; describe('SimpleEncryption', () => { @@ -32,7 +34,7 @@ describe('SimpleEncryption', () => { try { const encryption = new SimpleEncryption('abc123'); encryption.encrypt('def456'); - } catch (error) { + } catch (error: any) { expect(error.code).toBe('KEY_INVALID'); } }); @@ -43,7 +45,7 @@ describe('SimpleEncryption', () => { try { const encryption = new SimpleEncryption('abc123'); encryption.decrypt('abc123'); - } catch (error) { + } catch (error: any) { expect(error.code).toBe('KEY_INVALID'); } }); @@ -54,14 +56,14 @@ describe('SimpleEncryption', () => { try { const encryption = new SimpleEncryption('a1361cb85be840d6a2d762c68e4910e2'); encryption.decrypt('abc123'); - } catch (error) { + } catch (error: any) { expect(error.code).toBe('STRING_INVALID'); } try { const encryption = new SimpleEncryption('a1361cb85be840d6a2d762c68e4910e2'); encryption.decrypt(true as unknown as string); - } catch (error) { + } catch (error: any) { expect(error.code).toBe('STRING_INVALID'); } });