Skip to content

Commit

Permalink
add dmno and remove/encrypt test-related secrets, swap jest for vitest
Browse files Browse the repository at this point in the history
  • Loading branch information
theoephraim committed Sep 3, 2024
1 parent f874bfe commit 927e9e8
Show file tree
Hide file tree
Showing 18 changed files with 1,898 additions and 1,722 deletions.
48 changes: 48 additions & 0 deletions .dmno/config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { DmnoBaseTypes, defineDmnoService, configPath } from 'dmno';

import { EncryptedVaultDmnoPlugin, EncryptedVaultTypes } from '@dmno/encrypted-vault-plugin';

const SecretsVault = new EncryptedVaultDmnoPlugin('vault', {
key: configPath('DMNO_VAULT_KEY'),
});

export default defineDmnoService({
isRoot: true,
settings: {
redactSensitiveLogs: true,
interceptSensitiveLeakRequests: true,
preventClientLeaks: true,
},
schema: {
DMNO_VAULT_KEY: {
extends: EncryptedVaultTypes.encryptionKey,
},
GOOGLE_API_KEY: {
sensitive: true,
required: true,
value: SecretsVault.item(),
},
GOOGLE_SERVICE_ACCOUNT_EMAIL: {
sensitive: true,
required: true,
extends: DmnoBaseTypes.email,
value: SecretsVault.item(),
},
GOOGLE_SERVICE_ACCOUNT_KEY: {
sensitive: true,
required: true,
value: SecretsVault.item(),
coerce: (val: string) => val.replaceAll('\\n', '\n'),
},
CI: {
extends: 'boolean',
description: 'flag to denote running tests in CI'
},
TEST_DELAY: {
extends: 'number',
required: true,
value: (ctx) => DMNO_CONFIG.CI ? 1000 : 500,
}

},
});
18 changes: 18 additions & 0 deletions .dmno/default.vault.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"version": "0.0.1",
"keyName": "default-2024-08-31",
"items": {
"root!GOOGLE_SERVICE_ACCOUNT_EMAIL": {
"encryptedValue": "GzfuVZ14HAtQY2omwCJv/IlQe5S3p7zkFnslFY7cFNZN6YFOF4N9b/6efvRskT+560Oh3DHtKMDz2N8luozaEOyKWW2r9MFHUTuoZN/VfY8wJD2AQqw7wCRXD/CA+1JqciRwIsSzcIRw",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v/VTRgq8TvknfuMXY4z3ryZRJvQzeq91HSTOsh1IPfpLcEVW/MDNbx0KRiyzrOMsJ5H5CV/aRK/WRcNZyOjMsqd2SVJbgFy2Pl9D+D90BinJtjzcu+5k/UCzcf4zDY4YzYE/jhxbpowJsWwvvlm5dfJVXuFytB7boYFpdzbXuAryMX3klphoQf28x35den42Ru013F7f8jVs3hmmfG84ygJaPz1rvvaABjA+Z1qK+3ppcmXtE9giG+Mvk7G67lxoYxyJsMAYS5F27n0HpLIMmjsEAbnyLRmhyeC4=",
"updatedAt": "2024-08-31T21:41:14.313Z"
},
"root!GOOGLE_API_KEY": {
"encryptedValue": "iniwEDUzy+Sgr53pbm7Bh0a0F9COHWQcHHfrm0GhOXKHkmuSfOIO/MNt3zkLKJ+MzktUSs3C6OgDKpfBdRD3ymeREh7K",
"updatedAt": "2024-08-31T21:42:08.303Z"
}
}
}
12 changes: 12 additions & 0 deletions .dmno/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"compilerOptions": {
"strict": true,
"moduleResolution": "Bundler",
"module": "ESNext",
"lib": [ "ESNext" ]
},
"include": [
"./**/*.mts",
"./.typegen/global.d.ts"
]
}
9 changes: 1 addition & 8 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,9 @@ module.exports = {

},
overrides: [
{ // extra jest related rules for tests
{ // extra rules for tests
files: 'test/*',
plugins: ['jest'],
extends: ['plugin:jest/recommended'],
env: {
'jest/globals': true,
},
rules: {
'jest/consistent-test-it': 'error',
'jest/expect-expect': 0, // sometimes the lack of an error thrown is a good test
'no-await-in-loop': 0,
}
},
Expand Down
14 changes: 13 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,16 @@ src/ignore/
.DS_Store
examples/
TODO
dist
dist

# dmno files ###
# local cache for resolved values
**/.dmno/cache.json
# encryption key used for cache
**/.dmno/cache-key.json
# generated type files
**/.dmno/.typegen
# iconify cache used in generated types
**/.dmno/.icon-cache
# local config overrides
**/.dmno/.env.local
14 changes: 0 additions & 14 deletions jest.config.cjs

This file was deleted.

18 changes: 8 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,20 @@
"changelog": "auto-changelog --commit-limit false --unreleased-only --stdout",
"release": "pnpm run build && release-it",
"runscript": "NODE_NO_WARNINGS=1 node --experimental-specifier-resolution=node --loader ts-node/esm",
"test": "jest --runInBand"
"test": "dmno run -- vitest --no-file-parallelism"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
},
"dependencies": {
"axios": "^1.7.6",
"axios": "^1.7.7",
"lodash": "^4.17.21"
},
"devDependencies": {
"@dmno/encrypted-vault-plugin": "^0.0.5",
"@swc/core": "^1.3.60",
"@swc/jest": "^0.2.26",
"@types/jest": "^29.5.1",
"@types/lodash": "^4.14.195",
"@types/node": "^20.2.5",
"@typescript-eslint/eslint-plugin": "^5.59.7",
Expand All @@ -75,20 +74,19 @@
"commitizen": "^4.3.0",
"cz-conventional-changelog": "^3.3.0",
"delay": "^4.3.0",
"dmno": "^0.0.22",
"docsify-cli": "^4.4.3",
"eslint": "^8.41.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-airbnb-typescript": "^17.0.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jest": "^27.2.1",
"eslint-plugin-no-floating-promise": "^1.0.2",
"google-auth-library": "^9.14.0",
"jest": "^29.5.0",
"jest-junit": "^16.0.0",
"release-it": "^15.11.0",
"ts-node": "^10.9.1",
"typescript": "^4.9.5",
"unbuild": "^1.2.1"
"typescript": "^5.5.4",
"unbuild": "^1.2.1",
"vitest": "^2.0.5"
},
"peerDependencies": {
"google-auth-library": "^8.8.0 || ^9.0.0"
Expand All @@ -99,6 +97,6 @@
}
},
"volta": {
"node": "18.16.0"
"node": "20.17.0"
}
}
Loading

0 comments on commit 927e9e8

Please sign in to comment.