diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..0ce9d1b --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,11 @@ +{ + "env": { + "node": true, + "es6": true, + "jest": true + }, + "parserOptions": { + "ecmaVersion": 2018 + }, + "extends": "@adobe/eslint-config-aio-lib-config" +} \ No newline at end of file diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index c021c48..6864425 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -14,7 +14,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - node-version: [14.x, 16.x] + node-version: [18.x, 20.x] os: [ubuntu-latest, windows-latest] steps: @@ -31,7 +31,6 @@ jobs: - run: npm test - name: upload coverage if: success() - run: curl -s https://codecov.io/bash | bash - env: - CODECOV_NAME: ${{ runner.os }} node.js ${{ matrix.node-version }} - shell: bash + uses: codecov/codecov-action@v3.1.1 + with: + name: ${{ runner.os }} node.js ${{ matrix.node-version }} diff --git a/.github/workflows/on-push-publish-to-npm.yml b/.github/workflows/on-push-publish-to-npm.yml index e550211..e3ead74 100644 --- a/.github/workflows/on-push-publish-to-npm.yml +++ b/.github/workflows/on-push-publish-to-npm.yml @@ -12,7 +12,7 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-node@v1 with: - node-version: 16 + node-version: 18 - run: npm install - run: npm test - uses: JS-DevTools/npm-publish@v1 diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml index 383f171..b84c30c 100644 --- a/.github/workflows/prerelease.yml +++ b/.github/workflows/prerelease.yml @@ -26,7 +26,7 @@ jobs: git config user.email github-actions@github.com - uses: actions/setup-node@v1 with: - node-version: 16 + node-version: 18 - run: | npm install npm test diff --git a/.github/workflows/publish-branch.yml b/.github/workflows/publish-branch.yml index 8c33c3c..0042596 100644 --- a/.github/workflows/publish-branch.yml +++ b/.github/workflows/publish-branch.yml @@ -19,7 +19,7 @@ jobs: ref: ${{ github.event.inputs.branch }} - uses: actions/setup-node@v1 with: - node-version: 16 + node-version: 18 - run: | npm install npm test diff --git a/package.json b/package.json index 360c422..40790fb 100644 --- a/package.json +++ b/package.json @@ -11,23 +11,22 @@ "node-forge": "^1.3.0" }, "devDependencies": { - "codecov": "^3.2.0", - "eslint": "^6.8.0", + "@adobe/eslint-config-aio-lib-config": "^2.0.2", + "eslint": "^8.56.0", "eslint-config-oclif": "^4.0.0", - "eslint-config-standard": "^14.1.0", - "eslint-plugin-import": "^2.13.10", - "eslint-plugin-jest": "^23.6.0", - "eslint-plugin-node": "^11.0.0", - "eslint-plugin-promise": "^4.0.0", - "eslint-plugin-standard": "^4.0.0", - "jest": "^24.1.0", - "jest-junit": "^10.0.0", - "jest-resolve": "^26.0.0", - "oclif": "^3.2.0", - "stdout-stderr": "^0.1.9" + "eslint-config-standard": "^17.1.0", + "eslint-plugin-import": "^2.29.1", + "eslint-plugin-jest": "^27.6.1", + "eslint-plugin-jsdoc": "^42.0.0", + "eslint-plugin-n": "^15.7.0", + "eslint-plugin-node": "^11.1.0", + "eslint-plugin-promise": "^6.1.1", + "jest": "^29", + "stdout-stderr": "^0.1.9", + "typescript": "^5.3.3" }, "engines": { - "node": "^14.18 || ^16.13 || >=18" + "node": ">=18" }, "files": [ "/oclif.manifest.json", @@ -62,10 +61,6 @@ "coveragePathIgnorePatterns": [ "/tests/fixtures/" ], - "reporters": [ - "default", - "jest-junit" - ], "testEnvironment": "node", "setupFilesAfterEnv": [ "./test/jest.setup.js" diff --git a/src/certificate.js b/src/certificate.js index a1f5c9f..fb476f3 100644 --- a/src/certificate.js +++ b/src/certificate.js @@ -41,20 +41,20 @@ function fingerprint (pemCert) { -newkey rsa:bits generate a new RSA key of 'bits' in size -keyout arg file to send the key to -out arg output file -*/ + */ /** * Generates a certificate and a private key pair * Similar to openssl req -x509 -sha256 -nodes -days 365 -subj "/C=US/" -newkey rsa:2048 * - * @param {string} commonName + * @param {string} commonName the common name of the cert * @param {number} days (integer) * @param {object} [attributes={}] optional certificate attributes - * @param {string} [attributes.country] - * @param {string} [attributes.state] - * @param {string} [attributes.locality] - * @param {string} [attributes.organization] - * @param {string} [attributes.unit] + * @param {string} [attributes.country] the cert country + * @param {string} [attributes.state] the cert state + * @param {string} [attributes.locality] the cert locality + * @param {string} [attributes.organization] the cert organization + * @param {string} [attributes.unit] the cert unit (in the org) * @returns {{privateKey: string, cert: string}} key pair */ function generate (commonName, days, /* istanbul ignore next */ attributes = {}) { @@ -146,7 +146,7 @@ function generate (commonName, days, /* istanbul ignore next */ attributes = {}) * Verifies a valid pem certificate and returns information about its validity * Throws if the input is not a valid pem certificate. * - * @param {string|Buffer} pemCert + * @param {string|Buffer} pemCert the contents of the cert * @returns {{verified: boolean, validUntil: Date, validSince: Date}} key pair */ function verify (pemCert) {