Skip to content

Commit d1fb405

Browse files
committed
chore: lint
1 parent dda47df commit d1fb405

File tree

13 files changed

+36
-26
lines changed

13 files changed

+36
-26
lines changed

.vscode/extensions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
"davidanson.vscode-markdownlint",
55
"streetsidesoftware.code-spell-checker"
66
]
7-
}
7+
}

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,4 +141,4 @@
141141
"grammarly.files.exclude": [
142142
"**/dictionary.txt"
143143
]
144-
}
144+
}

.zed/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,4 +136,4 @@
136136
"buddy"
137137
]
138138
}
139-
}
139+
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ import { dynamoDb } from 'dynamodb-tooling'
5353

5454
const port = 8000
5555
// if you want to share with Bun Shell
56-
// eslint-disable-next-line antfu/no-top-level-await
56+
5757
await dynamoDb.launch({
5858
port,
5959
additionalArgs: ['-sharedDb'],

build.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import process from 'node:process'
21
import { $ } from 'bun'
2+
import process from 'node:process'
33
import { dts } from 'bun-plugin-dtsx'
44

55
console.log('Building...')

dynamodb.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import type { Config } from './src/types'
12
import * as os from 'node:os'
23
import * as path from 'node:path'
3-
import type { Config } from './src/types'
44

55
const config: Config = {
66
defaultTableName: 'MyOfflineTable',

eslint.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ const config: ESLintConfig = stacks({
1212
yaml: true,
1313
})
1414

15-
export default config
15+
export default config

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323
"import": "./dist/*"
2424
}
2525
},
26+
"module": "./dist/index.js",
27+
"types": "./dist/index.d.ts",
2628
"bin": {
2729
"dbtooling": "./dist/cli.js"
2830
},
29-
"module": "./dist/index.js",
30-
"types": "./dist/index.d.ts",
3131
"files": ["dist", "src"],
3232
"scripts": {
3333
"build": "bun --bun build.ts && bun --bun run compile",
@@ -36,7 +36,6 @@
3636
"lint": "bunx --bun eslint .",
3737
"lint:fix": "bunx --bun eslint . --fix",
3838
"fresh": "bunx rimraf node_modules/ bun.lock && bun i",
39-
"commit": "git cz",
4039
"changelog": "bunx changelogen --output CHANGELOG.md",
4140
"prepublishOnly": "bun --bun run build",
4241
"release": "bun run changelog && bunx bumpp package.json --all",
@@ -50,9 +49,9 @@
5049
"@stacksjs/storage": "^0.69.3",
5150
"@types/bun": "^1.2.5",
5251
"@types/tar": "^6.1.13",
53-
"bunfig": "^0.8.2",
5452
"bumpp": "^10.1.0",
5553
"bun-plugin-dtsx": "^0.21.9",
54+
"bunfig": "^0.8.2",
5655
"changelogen": "^0.6.1",
5756
"dynamodb-toolbox": "^2.0.0",
5857
"lint-staged": "^15.5.0",

src/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { loadConfig } from 'c12'
21
import type { Config } from './types'
2+
import { loadConfig } from 'c12'
33

44
// Define an async function to load the config
55
async function loadDynamoDBConfig(): Promise<Config> {

src/dynamodb.ts

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1+
import type { Subprocess } from 'bun'
2+
import type { LaunchOptions } from './types'
13
import * as fs from 'node:fs'
24
import * as https from 'node:https'
35
import * as path from 'node:path'
46
import process from 'node:process'
57
import { promisify } from 'node:util'
68
import * as zlib from 'node:zlib'
7-
import type { Subprocess } from 'bun'
89
import Debug from 'debug'
910
import * as tar from 'tar'
1011
import { config } from './config'
11-
import type { LaunchOptions } from './types'
1212
import { exists } from './utils'
1313

1414
const debug = Debug('dynamodb-local')
@@ -27,7 +27,8 @@ export const dynamoDb = {
2727
javaOpts = '',
2828
} = options ?? {}
2929

30-
if (runningProcesses[port]) return runningProcesses[port]
30+
if (runningProcesses[port])
31+
return runningProcesses[port]
3132

3233
const args = [
3334
'-Xrs',
@@ -53,18 +54,23 @@ export const dynamoDb = {
5354
const child = Bun.spawn(['java', ...args], {
5455
cwd: config.installPath,
5556
onExit: (proc, exitCode, signalCode, error) => {
56-
if (exitCode !== 0 && verbose) debug('Local DynamoDB exit code:', exitCode)
57-
if (error) debug('Local DynamoDB error:', error)
57+
if (exitCode !== 0 && verbose)
58+
debug('Local DynamoDB exit code:', exitCode)
59+
if (error)
60+
debug('Local DynamoDB error:', error)
5861
},
5962
})
6063

61-
if (!child.pid) throw new Error('Unable to launch DynamoDBLocal process')
64+
if (!child.pid)
65+
throw new Error('Unable to launch DynamoDBLocal process')
6266

63-
if (!detached) process.on('exit', () => child.kill())
67+
if (!detached)
68+
process.on('exit', () => child.kill())
6469

6570
runningProcesses[port] = child
6671
return child
67-
} catch (error) {
72+
}
73+
catch (error) {
6874
debug('Error launching DynamoDB Local:', error)
6975
throw error
7076
}
@@ -80,12 +86,15 @@ export const dynamoDb = {
8086

8187
async install(): Promise<void> {
8288
const installPathExists = await exists(config.installPath)
83-
if (!installPathExists) await promisify(fs.mkdir)(config.installPath)
89+
if (!installPathExists)
90+
await promisify(fs.mkdir)(config.installPath)
8491

8592
const jarPath = path.join(config.installPath, JARNAME)
8693
const jarExists = await exists(jarPath)
87-
if (jarExists) return
94+
if (jarExists)
95+
return
8896

97+
// eslint-disable-next-line no-console
8998
console.log('Installing DynamoDB locally...')
9099
const downloadUrl = config.downloadUrl
91100
await new Promise((resolve, reject) => {

0 commit comments

Comments
 (0)