Skip to content

Commit

Permalink
chore: cleanup and improve code and project setup
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianwessel committed Jun 24, 2024
1 parent 02580ba commit e26684d
Show file tree
Hide file tree
Showing 673 changed files with 37,501 additions and 35,442 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,6 @@ lab
__snapshots__

.tshy-build
.tshy
.tshy

gcloud-credentials.json
6 changes: 0 additions & 6 deletions .prettierrc

This file was deleted.

59 changes: 29 additions & 30 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,31 @@
{
"version": "0.2.0",
"configurations": [
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Jest: current file",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": ["${fileBasenameNoExtension}", "--config", "${workspaceFolder}/jest.config.js"],
"console": "integratedTerminal"
},

{
"type": "node",
"request": "launch",
"name": "Jest: current file",
//"env": { "NODE_ENV": "test" },
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": ["${fileBasenameNoExtension}", "--config", "${workspaceFolder}/jest.config.js"],
"console": "integratedTerminal"
},

{
"type": "node",
"request": "launch",
"name": "Jest debug current file",
"program": "${workspaceFolder}/node_modules/jest-cli/bin/jest",
"args": [
"${fileBasename}",
"--verbose",
"-i",
"--no-cache",
"--watchAll",
"--config", "${workspaceFolder}/jest.config.js"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
}
]
}
{
"type": "node",
"request": "launch",
"name": "Jest debug current file",
"program": "${workspaceFolder}/node_modules/jest-cli/bin/jest",
"args": [
"${fileBasename}",
"--verbose",
"-i",
"--no-cache",
"--watchAll",
"--config",
"${workspaceFolder}/jest.config.js"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
}
]
}
8 changes: 4 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"typescript.tsdk": "node_modules/typescript/lib",
"javascript.preferences.importModuleSpecifierEnding":"js",
"editor.formatOnSave": true,
"typescript.tsdk": "node_modules/typescript/lib",
"javascript.preferences.importModuleSpecifierEnding": "js",
"editor.formatOnSave": true,
"editor.defaultFormatter": "biomejs.biome",
"editor.codeActionsOnSave": {
"quickfix.biome": "explicit",
Expand All @@ -16,4 +16,4 @@
"[json]": {
"editor.defaultFormatter": "biomejs.biome"
}
}
}
153 changes: 88 additions & 65 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,74 +3,97 @@
"organizeImports": {
"enabled": true
},
"files": {
"ignore": [
"**/lib/**/*",
"cookieconsent.js",
"cookieconsent-config2.js",
"package-lock.json",
"**/dist/**/*",
"*.d.ts",
"**/coverage/**/*",
"docs/**/*",
"**/.tshy/**/*",
"**/.tshy-build/**/*",
"**/.vitepress/cache/**",
"**/doc/public/**/*",
"examples/fullexample/signoz/**",
"examples/fullexample/grafana/**",
"examples/fullexample/jaeger/**",
"examples/fullexample/teletrace/**",
"examples/fullexample/uptrace/**",
"examples/fullexample/zipkin/**"
]
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"complexity":{
"useArrowFunction": {
"level": "off",
"fix": "none"
},
"useLiteralKeys": {
"level":"warn",
"fix":"safe"
},
"noForEach": {
"level":"off"
},
"noBannedTypes": {
"level":"warn",
"fix":"safe"
}
},
"suspicious": {
"noExplicitAny": {
"level":"warn"
}
},
"performance": {
"noAccumulatingSpread": {
"level":"warn"
}
},
"style":{
"noUnusedTemplateLiteral": {
"level": "warn",
"fix":"safe"
}
}
},
"ignore":["**/lib/**/*","cookieconsent.js","cookieconsent-config2.js","package-lock.json","**/dist/**/*","*.d.ts","**/coverage/**/*","docs/**/*","**/.tshy-build/**/*"]
"complexity": {
"useArrowFunction": {
"level": "off",
"fix": "none"
},
"useLiteralKeys": {
"level": "warn",
"fix": "safe"
},
"noForEach": {
"level": "warn"
},
"noBannedTypes": {
"level": "warn",
"fix": "safe"
}
},
"suspicious": {
"noExplicitAny": {
"level": "off"
}
},
"performance": {
"noAccumulatingSpread": {
"level": "warn"
}
},
"style": {
"noUnusedTemplateLiteral": {
"level": "warn",
"fix": "safe"
}
},
"nursery": {
"noConsole": "error"
}
}
},
"formatter": {
"enabled": true,
"formatWithErrors": false,
"attributePosition": "auto",
"indentStyle": "tab",
"indentWidth": 2,
"lineWidth": 120,
"lineEnding": "lf"
},
"javascript": {
"formatter": {
"quoteStyle": "single",
"arrowParentheses": "asNeeded",
"bracketSameLine": false,
"bracketSpacing": true,
"jsxQuoteStyle": "double",
"quoteProperties": "asNeeded",
"semicolons": "asNeeded",
"trailingCommas": "all",
"lineWidth": 120,
"indentWidth": 2,
"indentStyle": "tab"
}
},
"formatter": {
"enabled": true,
"formatWithErrors": false,
"ignore": ["**/lib/**/*","cookieconsent.js","cookieconsent-config2.js","package-lock.json","**/dist/**/*","*.d.ts","**/coverage/**/*","docs/**/*","**/.tshy-build/**/*"],
"attributePosition": "auto",
"indentStyle": "tab",
"indentWidth": 2,
"lineWidth": 120,
"lineEnding": "lf"
},
"javascript": {
"formatter": {
"quoteStyle":"single",
"arrowParentheses":"asNeeded",
"bracketSameLine": false,
"bracketSpacing": true,
"jsxQuoteStyle": "double",
"quoteProperties": "asNeeded",
"semicolons": "asNeeded",
"trailingCommas": "all",
"lineWidth":120,
"indentWidth":2,
"indentStyle":"tab"
}
},
"json": {
"formatter": {
"trailingCommas": "none"
}
}
"json": {
"formatter": {
"trailingCommas": "none"
}
}
}
Binary file added bun.lockb
Binary file not shown.
6 changes: 3 additions & 3 deletions examples/dapr-example/deployment/customsecrets.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"secret_key":"secret_value",
"emailProviderAuthToken":"auth_token_from_secret_store"
}
"secret_key": "secret_value",
"emailProviderAuthToken": "auth_token_from_secret_store"
}
84 changes: 42 additions & 42 deletions examples/dapr-example/deployment/service-email/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,55 +10,55 @@ import pretty from 'pino-pretty'
import { emailV1Service } from '../../src/service/email/v1/emailV1Service.js'

const main = async () => {
// initialize the logging
const logLevel: LogLevelName = 'debug'
const stream = pretty({
colorize: false,
})
const logger = new DefaultLogger(pino({ level: logLevel }, stream))
// initialize the logging
const logLevel: LogLevelName = 'debug'
const stream = pretty({
colorize: false,
})
const logger = new DefaultLogger(pino({ level: logLevel }, stream))

logger.info('application starts')
logger.info('application starts')

const spanProcessor = new SimpleSpanProcessor(
new ZipkinExporter({
url: 'http://localhost:9411/api/v2/spans',
}),
)
const spanProcessor = new SimpleSpanProcessor(
new ZipkinExporter({
url: 'http://localhost:9411/api/v2/spans',
}),
)

const eventBridge = new DaprEventBridge({
spanProcessor,
logger,
serve,
})
const eventBridge = new DaprEventBridge({
spanProcessor,
logger,
serve,
})

const secretStore = new DaprSecretStore({ logger, secretStoreName: 'local-secret-store' })
const stateStore = new DaprStateStore({ logger, stateStoreName: 'local-state-store' })
const configStore = new DaprConfigStore({
logger,
configStoreName: 'local-config-store',
enableSet: true,
})
const secretStore = new DaprSecretStore({ logger, secretStoreName: 'local-secret-store' })
const stateStore = new DaprStateStore({ logger, stateStoreName: 'local-state-store' })
const configStore = new DaprConfigStore({
logger,
configStoreName: 'local-config-store',
enableSet: true,
})

const emailService = await emailV1Service.getInstance(eventBridge, {
spanProcessor,
logger,
secretStore,
stateStore,
configStore,
})
await emailService.start()
const emailService = await emailV1Service.getInstance(eventBridge, {
spanProcessor,
logger,
secretStore,
stateStore,
configStore,
})
await emailService.start()

await eventBridge.start()
await eventBridge.start()

gracefulShutdown(logger, [
// begin with the event bridge to no longer accept incoming messages
eventBridge,
emailService,
{
name: 'OTSpanProcessor',
destroy: () => spanProcessor.shutdown(),
},
])
gracefulShutdown(logger, [
// begin with the event bridge to no longer accept incoming messages
eventBridge,
emailService,
{
name: 'OTSpanProcessor',
destroy: () => spanProcessor.shutdown(),
},
])
}

main()
Loading

0 comments on commit e26684d

Please sign in to comment.