Update mods
This commit is contained in:
parent
98286c0da3
commit
7c812fcbf8
@ -1,6 +1,6 @@
|
||||
import { inject, injectable } from "tsyringe";
|
||||
import type { ILogger } from "../types/models/spt/utils/ILogger";
|
||||
import type { Processing } from "./Processing";
|
||||
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
|
||||
import { Processing } from "./Processing";
|
||||
|
||||
@injectable()
|
||||
export class MyMod
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { inject, injectable } from "tsyringe";
|
||||
import type { ILogger } from "../types/models/spt/utils/ILogger";
|
||||
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
|
||||
|
||||
@injectable()
|
||||
export class Processing
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { DependencyContainer, Lifecycle } from "tsyringe";
|
||||
import type { IMod } from "../types/models/external/mod";
|
||||
import { IMod } from "@spt-aki/models/external/mod";
|
||||
import { MyMod } from "./MyMod";
|
||||
import { Processing } from "./Processing";
|
||||
|
||||
|
@ -8,8 +8,12 @@
|
||||
"downlevelIteration": true,
|
||||
"experimentalDecorators": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"resolveJsonModule": true,
|
||||
"outDir": "out"
|
||||
"resolveJsonModule": true,
|
||||
"outDir": "tmp",
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@spt-aki/*": ["./types/*"]
|
||||
}
|
||||
},
|
||||
"lib": [
|
||||
"es2020"
|
||||
|
9
TypeScript/11BundleLoadingSample/.eslintignore
Normal file
9
TypeScript/11BundleLoadingSample/.eslintignore
Normal file
@ -0,0 +1,9 @@
|
||||
# Exclude these folders from linting
|
||||
node_modules
|
||||
dist/
|
||||
types/
|
||||
|
||||
# Exclude these filetypes from linting
|
||||
*.json
|
||||
*.txt
|
||||
*.exe
|
75
TypeScript/11BundleLoadingSample/.eslintrc.json
Normal file
75
TypeScript/11BundleLoadingSample/.eslintrc.json
Normal file
@ -0,0 +1,75 @@
|
||||
{
|
||||
"root": true,
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"plugins": [
|
||||
"@typescript-eslint"
|
||||
],
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:@typescript-eslint/eslint-recommended",
|
||||
"plugin:@typescript-eslint/recommended"
|
||||
],
|
||||
"rules": {
|
||||
"@typescript-eslint/no-explicit-any": 0,
|
||||
"@typescript-eslint/no-unused-vars": 1,
|
||||
"@typescript-eslint/no-empty-interface": 0,
|
||||
"@typescript-eslint/no-namespace": 0,
|
||||
"@typescript-eslint/comma-dangle": 1,
|
||||
"@typescript-eslint/func-call-spacing": 2,
|
||||
"@typescript-eslint/quotes": 1,
|
||||
"@typescript-eslint/brace-style": [
|
||||
"warn",
|
||||
"allman"
|
||||
],
|
||||
"@typescript-eslint/naming-convention": [
|
||||
"warn",
|
||||
{
|
||||
"selector": "default",
|
||||
"format": ["camelCase"],
|
||||
"leadingUnderscore": "allow"
|
||||
},
|
||||
{
|
||||
"selector": "typeLike",
|
||||
"format": ["PascalCase"]
|
||||
},
|
||||
{
|
||||
"selector": "objectLiteralProperty",
|
||||
"format": ["PascalCase", "camelCase"],
|
||||
"leadingUnderscore": "allow"
|
||||
},
|
||||
{
|
||||
"selector": "typeProperty",
|
||||
"format": ["PascalCase", "camelCase"],
|
||||
"leadingUnderscore": "allow"
|
||||
},
|
||||
{
|
||||
"selector": "enumMember",
|
||||
"format": ["UPPER_CASE"]
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/indent": [
|
||||
"warn",
|
||||
4
|
||||
],
|
||||
"@typescript-eslint/no-unused-expressions": [
|
||||
"warn",
|
||||
{
|
||||
"allowShortCircuit": false,
|
||||
"allowTernary": false
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/keyword-spacing": [
|
||||
"warn",
|
||||
{
|
||||
"before": true,
|
||||
"after": true
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/explicit-module-boundary-types": [
|
||||
"warn",
|
||||
{
|
||||
"allowArgumentsExplicitlyTypedAsAny": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
64
TypeScript/11BundleLoadingSample/README.md
Normal file
64
TypeScript/11BundleLoadingSample/README.md
Normal file
@ -0,0 +1,64 @@
|
||||
|
||||
This project was created to automate most parts of building and setting up an environment.
|
||||
|
||||
## **NodeJS 14.15.3:**
|
||||
|
||||
The first step would be to install nodejs on your pc, the version you NEED is **14.15.3**
|
||||
|
||||
That version is the one that has been used to test the mod templates and build scripts.
|
||||
|
||||
It can be downloaded from here: https://nodejs.org/download/release/v14.15.3/
|
||||
|
||||
A system reboot may be needed after install.
|
||||
|
||||
## **IDE:**
|
||||
|
||||
The second step is having an IDE ready. For the currect purpose we've setup a VSCodium workspace file.
|
||||
|
||||
You CAN use Visual Studio Code if you so desire, just keep in mind that our dev tests on the mod files was done using VSCodium.
|
||||
|
||||
You can get VSCodium here: https://vscodium.com/#install
|
||||
|
||||
## **Workspace:**
|
||||
|
||||
Once you have NodeJS and VSCodium ready, open the mod.code-workspace file with VSCodium (File->Open Worspace from File...).
|
||||
|
||||
Once the project loads into VSCodium you will be recommended to install the ESLint plugin. This is HIGHLY recommended.
|
||||
|
||||
## **Environment Setup:**
|
||||
|
||||
There is a task that will automatically setup your environment to use typescript.
|
||||
|
||||
To run it, you just need to go to:
|
||||
|
||||
> Terminal->Run Task...->Show All Tasks...->npm: install
|
||||
|
||||
After running this task, your environment will be ready to start coding.
|
||||
|
||||
DO NOT remove the node_modules folder, this is an auto generated directory that has the required dependencies to be able to use typescript and more.
|
||||
|
||||
## **IMPORTANT:**
|
||||
|
||||
Before starting to work on your mod, we suggest you read about Dependency Injection and Inversion of Control as this is the adopted architecture SPT-AKI has adopted.
|
||||
|
||||
It will be difficult to understand some of the problems you may be having if you dont understand the basics of it.
|
||||
|
||||
A guide explaining all the essentials will be available on the hub on release for you to read about.
|
||||
|
||||
## **Coding:**
|
||||
|
||||
All your work should be centered around the mod.ts file as an entry point.
|
||||
You can ONLY change the following properties from the package.json file: `"name"`, `"version"`, `"license"`: `"MIT"`, `"author"`, `"akiVersion"`.
|
||||
|
||||
If you have never used typescript before, you can read about it here: https://www.typescriptlang.org/docs/
|
||||
|
||||
## **Distributing your mod:**
|
||||
|
||||
The project has been set up with an automatic task that will copy and zip ALL required files for your mod to work on SPT-AKI.
|
||||
To run this task you just need to go to:
|
||||
|
||||
> Terminal->Run Task...->Show All Tasks...->npm: build:zip
|
||||
|
||||
The output will be a mod.zip file that will appear on the root of the project.
|
||||
|
||||
Always verify that all files were included into the zip file.
|
12
TypeScript/11BundleLoadingSample/mod.code-workspace
Normal file
12
TypeScript/11BundleLoadingSample/mod.code-workspace
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"folders": [
|
||||
{
|
||||
"path": "."
|
||||
}
|
||||
],
|
||||
"extensions": {
|
||||
"recommendations": [
|
||||
"dbaeumer.vscode-eslint"
|
||||
]
|
||||
}
|
||||
}
|
@ -1,9 +1,26 @@
|
||||
{
|
||||
"name": "Bundle Loading Sample",
|
||||
"author": "JustNU",
|
||||
"name": "BundleLoading",
|
||||
"version": "1.0.0",
|
||||
"license": "does it really matter lol",
|
||||
"author": "Chomp",
|
||||
"license": "MIT",
|
||||
"main": "src/mod.js",
|
||||
"akiVersion": "3.0.0",
|
||||
"isBundleMod": true
|
||||
"isBundleMod": true,
|
||||
"scripts": {
|
||||
"setup:environment": "npm i",
|
||||
"build:unzipped": "copyfiles -e \"./node_modules/**/*.*\" -e \"./dist/**/*.*\" -e \"./package-lock.json\" -e \"./tsconfig.json\" -e \"./README.txt\" -e \"./mod.code-workspace\" ./**/*.* ./dist",
|
||||
"zip:files": "cd dist/ && bestzip ../mod.zip *",
|
||||
"build:zip": "npm run clean:environment && npm run build:unzipped && npm run zip:files",
|
||||
"clean:environment": "node -e \"require('fs').rm('mod.zip', ()=>{})\" && node -e \"require('fs').rmdir('./dist/',{recursive:true},()=>{})\""
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^14.15.3",
|
||||
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
||||
"@typescript-eslint/parser": "^4.33.0",
|
||||
"copyfiles": "2.4.1",
|
||||
"eslint": "7.26.0",
|
||||
"tsyringe": "4.6.0",
|
||||
"typescript": "4.6.4",
|
||||
"bestzip": "2.2.1"
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
import type { DependencyContainer } from "tsyringe";
|
||||
import { IMod } from "../types/models/external/mod";
|
||||
import { ILogger } from "../types/models/spt/utils/ILogger";
|
||||
import { DependencyContainer } from "tsyringe";
|
||||
import { IMod } from "@spt-aki/models/external/mod";
|
||||
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
|
||||
|
||||
class Mod implements IMod
|
||||
{
|
||||
|
25
TypeScript/11BundleLoadingSample/tsconfig.json
Normal file
25
TypeScript/11BundleLoadingSample/tsconfig.json
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
"module": "CommonJS",
|
||||
"target": "es2020",
|
||||
"moduleResolution": "node",
|
||||
"esModuleInterop": true,
|
||||
"downlevelIteration": true,
|
||||
"experimentalDecorators": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"resolveJsonModule": true,
|
||||
"outDir": "tmp",
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@spt-aki/*": ["./types/*"]
|
||||
}
|
||||
},
|
||||
"lib": [
|
||||
"es2020"
|
||||
],
|
||||
"include": [
|
||||
"src/*",
|
||||
"src/**/*"
|
||||
]
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
import type { DependencyContainer } from "tsyringe";
|
||||
import type { IMod } from "../types/models/external/mod";
|
||||
import type { ILogger } from "../types/models/spt/utils/ILogger";
|
||||
import { DependencyContainer } from "tsyringe";
|
||||
import { IMod } from "@spt-aki/models/external/mod";
|
||||
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
|
||||
|
||||
class Mod implements IMod
|
||||
{
|
||||
|
@ -8,8 +8,12 @@
|
||||
"downlevelIteration": true,
|
||||
"experimentalDecorators": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"resolveJsonModule": true,
|
||||
"outDir": "out"
|
||||
"resolveJsonModule": true,
|
||||
"outDir": "tmp",
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@spt-aki/*": ["./types/*"]
|
||||
}
|
||||
},
|
||||
"lib": [
|
||||
"es2020"
|
||||
|
@ -1,7 +1,7 @@
|
||||
import type { DependencyContainer } from "tsyringe";
|
||||
import { DependencyContainer } from "tsyringe";
|
||||
|
||||
import type { IMod } from "../types/models/external/mod";
|
||||
import type { DatabaseServer } from "../types/servers/DatabaseServer";
|
||||
import { IMod } from "@spt-aki/models/external/mod";
|
||||
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
|
||||
|
||||
class Mod implements IMod
|
||||
{
|
||||
|
@ -8,8 +8,12 @@
|
||||
"downlevelIteration": true,
|
||||
"experimentalDecorators": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"resolveJsonModule": true,
|
||||
"outDir": "out"
|
||||
"resolveJsonModule": true,
|
||||
"outDir": "tmp",
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@spt-aki/*": ["./types/*"]
|
||||
}
|
||||
},
|
||||
"lib": [
|
||||
"es2020"
|
||||
|
@ -1,10 +1,10 @@
|
||||
import type { DependencyContainer } from "tsyringe";
|
||||
import type { IMod } from "../types/models/external/mod";
|
||||
import { DependencyContainer } from "tsyringe";
|
||||
import { IMod } from "@spt-aki/models/external/mod";
|
||||
|
||||
import type { ILogger } from "../types/models/spt/utils/ILogger";
|
||||
import type { ConfigServer } from "../types/servers/ConfigServer";
|
||||
import { ConfigTypes } from "../types/models/enums/ConfigTypes";
|
||||
import type { IBotConfig } from "../types/models/spt/config/IBotConfig";
|
||||
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
|
||||
import { ConfigServer } from "@spt-aki/servers/ConfigServer";
|
||||
import { ConfigTypes } from "@spt-aki/models/enums/ConfigTypes";
|
||||
import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig";
|
||||
|
||||
class Mod implements IMod
|
||||
{
|
||||
|
@ -8,8 +8,12 @@
|
||||
"downlevelIteration": true,
|
||||
"experimentalDecorators": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"resolveJsonModule": true,
|
||||
"outDir": "out"
|
||||
"resolveJsonModule": true,
|
||||
"outDir": "tmp",
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@spt-aki/*": ["./types/*"]
|
||||
}
|
||||
},
|
||||
"lib": [
|
||||
"es2020"
|
||||
|
@ -1,7 +1,7 @@
|
||||
import type { DependencyContainer } from "tsyringe";
|
||||
import { DependencyContainer } from "tsyringe";
|
||||
|
||||
import type { IMod } from "../types/models/external/mod";
|
||||
import type { ILogger } from "../types/models/spt/utils/ILogger";
|
||||
import { IMod } from "@spt-aki/models/external/mod";
|
||||
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
|
||||
|
||||
class Mod implements IMod
|
||||
{
|
||||
|
@ -8,8 +8,12 @@
|
||||
"downlevelIteration": true,
|
||||
"experimentalDecorators": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"resolveJsonModule": true,
|
||||
"outDir": "out"
|
||||
"resolveJsonModule": true,
|
||||
"outDir": "tmp",
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@spt-aki/*": ["./types/*"]
|
||||
}
|
||||
},
|
||||
"lib": [
|
||||
"es2020"
|
||||
|
@ -1,10 +1,10 @@
|
||||
import type { DependencyContainer } from "tsyringe";
|
||||
import type { IMod } from "../types/models/external/mod";
|
||||
import type { LauncherController } from "../types/controllers/LauncherController";
|
||||
import type { DatabaseServer } from "../types/servers/DatabaseServer";
|
||||
import type { ILoginRequestData } from "../types/models/eft/launcher/ILoginRequestData";
|
||||
import type { ILogger } from "../types/models/spt/utils/ILogger";
|
||||
import type { SaveServer } from "../types/servers/SaveServer";
|
||||
import { DependencyContainer } from "tsyringe";
|
||||
import { IMod } from "@spt-aki/models/external/mod";
|
||||
import { LauncherController } from "@spt-aki/controllers/LauncherController";
|
||||
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
|
||||
import { ILoginRequestData } from "@spt-aki/models/eft/launcher/ILoginRequestData";
|
||||
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
|
||||
import { SaveServer } from "@spt-aki/servers/SaveServer";
|
||||
|
||||
class Mod implements IMod
|
||||
{
|
||||
|
@ -8,8 +8,12 @@
|
||||
"downlevelIteration": true,
|
||||
"experimentalDecorators": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"resolveJsonModule": true,
|
||||
"outDir": "out"
|
||||
"resolveJsonModule": true,
|
||||
"outDir": "tmp",
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@spt-aki/*": ["./types/*"]
|
||||
}
|
||||
},
|
||||
"lib": [
|
||||
"es2020"
|
||||
|
@ -1,7 +1,7 @@
|
||||
import type { DependencyContainer } from "tsyringe";
|
||||
import { DependencyContainer } from "tsyringe";
|
||||
|
||||
import type { IMod } from "../types/models/external/mod";
|
||||
import type { ILogger } from "../types/models/spt/utils/ILogger";
|
||||
import { IMod } from "@spt-aki/models/external/mod";
|
||||
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
|
||||
import {MoreCode } from "./MoreCode";
|
||||
|
||||
class Mod implements IMod
|
||||
|
@ -8,8 +8,12 @@
|
||||
"downlevelIteration": true,
|
||||
"experimentalDecorators": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"resolveJsonModule": true,
|
||||
"outDir": "out"
|
||||
"resolveJsonModule": true,
|
||||
"outDir": "tmp",
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@spt-aki/*": ["./types/*"]
|
||||
}
|
||||
},
|
||||
"lib": [
|
||||
"es2020"
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { DependencyContainer } from "tsyringe";
|
||||
import type { IMod } from "../types/models/external/mod"
|
||||
import type { ILogger } from "../types/models/spt/utils/ILogger"
|
||||
import type { OnLoadModService } from "../types/services/mod/onLoad/OnLoadModService"
|
||||
import { IMod } from "@spt-aki/models/external/mod"
|
||||
import { ILogger } from "@spt-aki/models/spt/utils/ILogger"
|
||||
import { OnLoadModService } from "@spt-aki/services/mod/onLoad/OnLoadModService"
|
||||
|
||||
class Mod implements IMod
|
||||
{
|
||||
|
@ -8,8 +8,12 @@
|
||||
"downlevelIteration": true,
|
||||
"experimentalDecorators": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"resolveJsonModule": true,
|
||||
"outDir": "out"
|
||||
"resolveJsonModule": true,
|
||||
"outDir": "tmp",
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@spt-aki/*": ["./types/*"]
|
||||
}
|
||||
},
|
||||
"lib": [
|
||||
"es2020"
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { DependencyContainer } from "tsyringe";
|
||||
import type { IMod } from "../types/models/external/mod"
|
||||
import type { ILogger } from "../types/models/spt/utils/ILogger"
|
||||
import type { OnUpdateModService } from "../types/services/mod/onUpdate/OnUpdateModService"
|
||||
import { IMod } from "@spt-aki/models/external/mod"
|
||||
import { ILogger } from "@spt-aki/models/spt/utils/ILogger"
|
||||
import { OnUpdateModService } from "@spt-aki/services/mod/onUpdate/OnUpdateModService"
|
||||
|
||||
class Mod implements IMod
|
||||
{
|
||||
|
@ -8,8 +8,12 @@
|
||||
"downlevelIteration": true,
|
||||
"experimentalDecorators": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"resolveJsonModule": true,
|
||||
"outDir": "out"
|
||||
"resolveJsonModule": true,
|
||||
"outDir": "tmp",
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@spt-aki/*": ["./types/*"]
|
||||
}
|
||||
},
|
||||
"lib": [
|
||||
"es2020"
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { DependencyContainer } from "tsyringe";
|
||||
import type { IMod } from "../types/models/external/mod";
|
||||
import type { ILogger } from "../types/models/spt/utils/ILogger";
|
||||
import type {DynamicRouterModService} from "../types/services/mod/dynamicRouter/DynamicRouterModService";
|
||||
import type {StaticRouterModService} from "../types/services/mod/staticRouter/StaticRouterModService";
|
||||
import type { IMod } from "@spt-aki/models/external/mod";
|
||||
import type { ILogger } from "@spt-aki/models/spt/utils/ILogger";
|
||||
import type {DynamicRouterModService} from "@spt-aki/services/mod/dynamicRouter/DynamicRouterModService";
|
||||
import type {StaticRouterModService} from "@spt-aki/services/mod/staticRouter/StaticRouterModService";
|
||||
|
||||
class Mod implements IMod
|
||||
{
|
||||
|
@ -8,8 +8,12 @@
|
||||
"downlevelIteration": true,
|
||||
"experimentalDecorators": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"resolveJsonModule": true,
|
||||
"outDir": "out"
|
||||
"resolveJsonModule": true,
|
||||
"outDir": "tmp",
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@spt-aki/*": ["./types/*"]
|
||||
}
|
||||
},
|
||||
"lib": [
|
||||
"es2020"
|
||||
|
Loading…
x
Reference in New Issue
Block a user