Skip to content

Commit 01857b9

Browse files
committed
fix: bugs
1 parent 2f23dfb commit 01857b9

File tree

9 files changed

+37
-26
lines changed

9 files changed

+37
-26
lines changed

package.json

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,31 @@
11
{
2-
"name": "harmony-framework",
3-
"private": true,
4-
"repository": {
5-
"type": "git",
6-
"url": "git+https://github.com/harmony-ts/harmony.git"
7-
},
2+
"name": "harmony",
3+
"version": "0.0.1",
4+
"description": "⚡ Next-gen Discord Bot Framework",
5+
"repository": "harmony-ts/harmony",
86
"license": "MIT",
97
"type": "module",
8+
"exports": {
9+
".": {
10+
"types": "./types.d.ts",
11+
"import": "./dist/index.mjs"
12+
},
13+
"./package.json": "./package.json"
14+
},
15+
"main": "./dist/index.mjs",
16+
"types": "./types.d.ts",
17+
"files": [
18+
"dist",
19+
"*.d.ts"
20+
],
1021
"scripts": {
1122
"prepack": "unbuild",
1223
"start": "node ./bin/index.mjs",
1324
"lint": "prettier --write ."
1425
},
15-
"types": "./dist/index.d.ts",
26+
"resolutions": {
27+
"harmony": "link:."
28+
},
1629
"dependencies": {
1730
"c12": "^1.10.0",
1831
"defu": "^6.1.4",
@@ -32,6 +45,5 @@
3245
"packageManager": "[email protected]",
3346
"engines": {
3447
"node": "^16.0.0 || >=18.0.0"
35-
},
36-
"version": ""
48+
}
3749
}

pnpm-lock.yaml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/commands.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import { filename } from 'pathe/utils'
44
import type {
55
CommandExecute,
66
CommandOptions,
7+
Harmony,
78
HarmonyCommand,
89
HarmonyCommandInput
9-
} from '../types'
10-
import { Harmony } from './harmony'
10+
} from './types'
1111

1212
export const resolveHarmonyCommand = (
1313
cmd: HarmonyCommandInput,
@@ -20,8 +20,8 @@ export const resolveHarmonyCommand = (
2020
const _cmdPath = _jiti.resolve(cmd)
2121
const command = _jiti(_cmdPath) as HarmonyCommand<boolean>
2222
const options: CommandOptions = {
23-
name: filename(_cmdPath).split('.')[0],
24-
category: filename(dirname(_cmdPath)),
23+
name: command.options.name || filename(_cmdPath).split('.')[0],
24+
category: command.options.category || filename(dirname(_cmdPath)),
2525
slash: command.options.slash || filename(_cmdPath).endsWith('.slash'),
2626
...command.options
2727
}

src/events.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import type {
55
DefineEventWithOptions,
66
EventCallback,
77
EventOptions,
8+
Harmony,
89
HarmonyEvent,
910
HarmonyEventInput
10-
} from '../types'
11-
import { Harmony } from './harmony'
11+
} from './types'
1212

1313
export const resolveHarmonyEvent = (
1414
evt: HarmonyEventInput,
@@ -21,7 +21,7 @@ export const resolveHarmonyEvent = (
2121
const _evtPath = _jiti.resolve(evt)
2222
const event = _jiti(_evtPath) as HarmonyEvent
2323
const options: EventOptions = {
24-
name: filename(_evtPath).split('.')[0],
24+
name: event.options.name || filename(_evtPath).split('.')[0],
2525
once: event.options.once || filename(_evtPath).endsWith('.once')
2626
}
2727

src/harmony.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
import { HarmonyConfig, HarmonyOptions } from '../types'
2-
import { loadOptions } from './config'
31
import type { LoadConfigOptions } from 'c12'
2+
import { loadOptions } from './options'
43
import { scanCommands, scanEvents } from './scan'
54
import { resolveHarmonyCommand } from './commands'
65
import { resolveHarmonyEvent } from './events'
7-
8-
export interface Harmony {
9-
options: HarmonyOptions
10-
}
6+
import type { Harmony, HarmonyConfig, HarmonyOptions } from './types'
117

128
export const createHarmony = async (
139
config: HarmonyConfig = {},

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export * from './commands'
22
export * from './events'
3-
export * from './config'
3+
export * from './options'
44
export * from './harmony'
55
export * from './scan'

src/config.ts renamed to src/options.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { LoadConfigOptions, loadConfig } from 'c12'
22
import { resolve } from 'pathe'
3-
import type { HarmonyConfig } from '../types'
3+
import type { HarmonyConfig } from './types'
44

55
const HarmonyDefaults: HarmonyConfig = {
66
scanDirs: [],

src/scan.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { globby } from 'globby'
22
import { join, relative } from 'pathe'
3-
import { Harmony } from './harmony'
3+
import { Harmony } from './types'
44

55
const GLOB_SCAN_PATTERN = '**/*.{js,ts}'
66

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@
1414
"resolveJsonModule": true,
1515
"types": ["node", "./types"]
1616
},
17-
"include": ["src", "types"]
17+
"include": ["src"]
1818
}

0 commit comments

Comments
 (0)