Plugins can now use import path shortcuts
Plugins are now able to use import path shortcuts to import all API classes, utilities and the openticket globals. You can now import everything from "#opendiscord" instead of "../../src/index"
This commit is contained in:
+5
-1
@@ -35,5 +35,9 @@
|
|||||||
"url": "https://github.com/DJj123dj/open-ticket/issues",
|
"url": "https://github.com/DJj123dj/open-ticket/issues",
|
||||||
"email": "support@dj-dj.be"
|
"email": "support@dj-dj.be"
|
||||||
},
|
},
|
||||||
"homepage": "https://openticket.dj-dj.be"
|
"homepage": "https://openticket.dj-dj.be",
|
||||||
|
"imports": {
|
||||||
|
"#opendiscord":"./dist/src/index.js",
|
||||||
|
"#opendiscord-types":"./dist/src/core/api/api.js"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import {api, openticket, utilities} from "../../src/index"
|
import {api, openticket, utilities} from "#opendiscord"
|
||||||
import * as discord from "discord.js"
|
import * as discord from "discord.js"
|
||||||
|
|
||||||
/////////////////////////////////////////////
|
/////////////////////////////////////////////
|
||||||
@@ -9,7 +9,7 @@ import * as discord from "discord.js"
|
|||||||
if (utilities.project != "openticket") throw new api.ODPluginError("This plugin only works in Open Ticket!")
|
if (utilities.project != "openticket") throw new api.ODPluginError("This plugin only works in Open Ticket!")
|
||||||
|
|
||||||
//Add Typescript autocomplete support for plugin data. (!!!OPTIONAL!!!)
|
//Add Typescript autocomplete support for plugin data. (!!!OPTIONAL!!!)
|
||||||
declare module "../../src/core/api/api.js" {
|
declare module "#opendiscord-types" {
|
||||||
export interface ODConfigManagerIds_Default {
|
export interface ODConfigManagerIds_Default {
|
||||||
"example-plugin:config":api.ODJsonConfig
|
"example-plugin:config":api.ODJsonConfig
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-4
@@ -1,10 +1,7 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "ES2022",
|
"target": "ES2022",
|
||||||
"rootDirs":[
|
"rootDir":"./",
|
||||||
"./src",
|
|
||||||
"./plugins"
|
|
||||||
],
|
|
||||||
"outDir": "./dist/",
|
"outDir": "./dist/",
|
||||||
"module": "NodeNext",
|
"module": "NodeNext",
|
||||||
"moduleResolution": "NodeNext",
|
"moduleResolution": "NodeNext",
|
||||||
|
|||||||
Reference in New Issue
Block a user