npm install bc-deeplib
# or
yarn add bc-deeplib
# or
pnpm add bc-deeplibbc-stubs is recommended to be installed as well. It adds typings for the things from BC.
Include the library in your include field in tsconfig.json
{
"include": [
"node_modules/bc-deeplib/**/*.d.ts",
]
}And we good to go!
initMod is the entry point for initializing a mod. Though it has a lot of other options, the bare minimum is:
import { initMod } from "bc-deeplib/deeplib";
initMod({
modInfo: {
info: {
name: 'My Mod',
fullName: 'My Cool First Mod',
version: '1.0.0',
repository: 'https://example.com',
},
},
})This will set up the Mod SDK and prepare storage for your mod. They will be available as sdk and modStorage respectively.
Some other options are:
initFunction- a function to run when mod initializesbeforeLogin- a function to run before loginmodules- an array of modules to registermigrators- an array of migrators to registermainMenuOptions- options for the main menutranslationOptions- options for the localization system
You can surely build it with any bundler you like, but the best way is to use built-in script with configurations:
- Create
deeplib.config.jsin root of your project.
import { defineConfig } from 'bc-deeplib/build';
export default defineConfig({
entry: 'index.ts',
outfile: 'index.js',
globalName: 'ModName',
distDirName: 'dist',
publicDirName: 'public',
scripts: ['./path/to/script.js'],
prodRemoteURL: 'https://example.com/ModName',
devRemoteURL: 'https://example.com/ModName/dev',
target: ['es2020'],
plugins: [], // additional esbuild plugins
defines: {}, // additional esbuild defines (see https://esbuild.github.io/api/#define)
host: 'localhost',
port: 55555,
})-
Run
deeplibwith your package manager to build your mod.
Rundeeplib --helpordeeplib -hto see all available options. -
Now your mod bundle is located at configured path.
distDirName/index.jsby default.