diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml index b36fb33..0503971 100644 --- a/.github/workflows/ci-linux.yml +++ b/.github/workflows/ci-linux.yml @@ -33,8 +33,5 @@ jobs: - name: Installing Dependencies run: npm ci - - name: Building the Lib - run: npm run build -- --noEmit - - name: Running Tests run: npm run test diff --git a/.prettierrc b/.prettierrc index 37fb01d..8093459 100755 --- a/.prettierrc +++ b/.prettierrc @@ -13,5 +13,14 @@ "htmlWhitespaceSensitivity": "css", "endOfLine": "auto", "embeddedLanguageFormatting": "auto", - "singleAttributePerLine": false + "singleAttributePerLine": false, + "overrides": [ + { + "files": ["src/**/*.d.ts"], + "options": { + "singleQuote": false, + "tabWidth": 4 + } + } + ] } diff --git a/CHANGELOG.md b/CHANGELOG.md index 1500112..7962145 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.1.1](https://github.com/mysqljs/aws-ssl-profiles/compare/v1.1.0...v1.1.1) (2024-07-15) + + +### Bug Fixes + +* resolve imports manually ([#23](https://github.com/mysqljs/aws-ssl-profiles/issues/23)) ([e1b0ae7](https://github.com/mysqljs/aws-ssl-profiles/commit/e1b0ae778f991ba325fbe834f5102c611045ec18)) + ## [1.1.0](https://github.com/mysqljs/aws-ssl-profiles/compare/v1.0.0...v1.1.0) (2024-07-15) diff --git a/biome.json b/biome.json index 63940fc..f4ee567 100644 --- a/biome.json +++ b/biome.json @@ -48,12 +48,15 @@ "rules": { "nursery": { "useTopLevelRegex": "off" + }, + "correctness": { + "noNodejsModules": "off" } } } }, { - "include": ["src/index.ts"], + "include": ["src/index.ts", "src/index.d.ts"], "linter": { "rules": { "style": { @@ -61,6 +64,16 @@ } } } + }, + { + "include": ["**/**/*.cjs"], + "linter": { + "rules": { + "suspicious": { + "noRedundantUseStrict": "off" + } + } + } } ] } diff --git a/package-lock.json b/package-lock.json index d7cf259..257eeeb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,16 @@ { "name": "aws-ssl-profiles", - "version": "1.1.0", + "version": "1.1.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "aws-ssl-profiles", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "devDependencies": { "@biomejs/biome": "^1.8.3", + "@types/node": "^20.14.10", "@types/x509.js": "^1.0.3", "poku": "^2.0.0", "prettier": "^3.3.3", @@ -576,6 +577,16 @@ "node": ">=12" } }, + "node_modules/@types/node": { + "version": "20.14.10", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.10.tgz", + "integrity": "sha512-MdiXf+nDuMvY0gJKxyfZ7/6UFsETO7mGKF54MVD/ekJS6HdFtpZFBgrh6Pseu64XTb2MLyFPlbW6hj8HYRQNOQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~5.26.4" + } + }, "node_modules/@types/x509.js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/@types/x509.js/-/x509.js-1.0.3.tgz", @@ -730,6 +741,13 @@ "node": ">=14.17" } }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true, + "license": "MIT" + }, "node_modules/x509.js": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/x509.js/-/x509.js-1.0.0.tgz", diff --git a/package.json b/package.json index cd3b296..8ef0e31 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aws-ssl-profiles", - "version": "1.1.0", + "version": "1.1.1", "main": "lib/index.js", "author": "https://github.com/wellwelwel", "description": "AWS RDS SSL certificates bundles.", @@ -14,6 +14,7 @@ }, "devDependencies": { "@biomejs/biome": "^1.8.3", + "@types/node": "^20.14.10", "@types/x509.js": "^1.0.3", "poku": "^2.0.0", "prettier": "^3.3.3", @@ -41,9 +42,11 @@ ], "scripts": { "build": "npx tsc", + "postbuild": "cp src/index.d.ts lib/index.d.ts", "lint": "npx @biomejs/biome lint && prettier --check .", "lint:fix": "npx @biomejs/biome lint --write . && prettier --write .", + "pretest": "npm run build", "test": "poku --parallel ./test", - "test:ci": "npm run lint && npm run build -- --noEmit && npm run test" + "test:ci": "npm run lint && npm run test" } } diff --git a/src/index.d.ts b/src/index.d.ts new file mode 100644 index 0000000..18d181b --- /dev/null +++ b/src/index.d.ts @@ -0,0 +1,8 @@ +import type { Profiles } from "./@types/profiles.js"; +export declare const proxyBundle: Profiles; +declare const profiles: Profiles; +declare module "aws-ssl-profiles" { + const profiles: Profiles & { proxyBundle: Profiles }; + export = profiles; +} +export default profiles; diff --git a/src/index.ts b/src/index.ts index 379e54e..1c8db15 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,7 +2,7 @@ import type { Profiles } from './@types/profiles.js'; import { defaults } from './profiles/ca/defaults.js'; import { proxies } from './profiles/ca/proxies.js'; -export const proxyBundle: Profiles = { +const proxyBundle: Profiles = { ca: proxies, }; @@ -10,4 +10,7 @@ const profiles: Profiles = { ca: [...defaults, ...proxies], }; -export default profiles; +exports.default = profiles; + +module.exports = profiles; +module.exports.proxyBundle = proxyBundle; diff --git a/test/e2e/import.test.mjs b/test/e2e/import.test.mjs new file mode 100644 index 0000000..43eff9a --- /dev/null +++ b/test/e2e/import.test.mjs @@ -0,0 +1,11 @@ +import { test, strict } from 'poku'; +import awsCaBundle, { proxyBundle } from '../../lib/index.js'; + +test('Testing import (ESM)', () => { + strict(typeof awsCaBundle?.ca?.length === 'number', 'Default import'); + strict(typeof proxyBundle?.ca?.length === 'number', '"proxyBundle" import'); + strict( + typeof awsCaBundle.proxyBundle?.ca?.length === 'number', + '"proxyBundle" from default import' + ); +}); diff --git a/test/e2e/require.test.cjs b/test/e2e/require.test.cjs new file mode 100644 index 0000000..3ca0e71 --- /dev/null +++ b/test/e2e/require.test.cjs @@ -0,0 +1,14 @@ +'use strict'; + +const { test, strict } = require('poku'); +const awsCaBundle = require('../../lib/index.js'); +const { proxyBundle } = require('../../lib/index.js'); + +test('Testing require (CJS)', () => { + strict(typeof awsCaBundle?.ca?.length === 'number', 'Default require'); + strict(typeof proxyBundle?.ca?.length === 'number', '"proxyBundle" require'); + strict( + typeof awsCaBundle.proxyBundle?.ca?.length === 'number', + '"proxyBundle" from default require' + ); +}); diff --git a/test/e2e/typings.test.ts b/test/e2e/typings.test.ts new file mode 100644 index 0000000..f1f2573 --- /dev/null +++ b/test/e2e/typings.test.ts @@ -0,0 +1,9 @@ +import { test, strict } from 'poku'; +import { readFile } from 'node:fs/promises'; + +test('Ensure index.d.ts Typings', async () => { + const src = await readFile('./src/index.d.ts', 'utf-8'); + const lib = await readFile('./lib/index.d.ts', 'utf-8'); + + strict.strictEqual(src, lib, '"src" and "lib" should be the same the same'); +}); diff --git a/tsconfig.json b/tsconfig.json index ab04c3e..ac020d4 100755 --- a/tsconfig.json +++ b/tsconfig.json @@ -15,6 +15,7 @@ "forceConsistentCasingInFileNames": true, "declaration": true, "declarationDir": "lib", - "outDir": "lib" + "outDir": "lib", + "allowSyntheticDefaultImports": true } }