From 87e29488067b0354e2733498d4b471a999551932 Mon Sep 17 00:00:00 2001 From: Dev Date: Sat, 14 Oct 2023 09:48:24 +0100 Subject: [PATCH] Remove scripts content from imported mods package data --- project/src/loaders/PreAkiModLoader.ts | 11 +++++++++-- project/src/models/spt/mod/IPackageJsonData.ts | 3 +++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/project/src/loaders/PreAkiModLoader.ts b/project/src/loaders/PreAkiModLoader.ts index 7c952400..245c9ed8 100644 --- a/project/src/loaders/PreAkiModLoader.ts +++ b/project/src/loaders/PreAkiModLoader.ts @@ -384,6 +384,10 @@ export class PreAkiModLoader implements IModLoader } } + /** + * Compile mod and add into class property "imported" + * @param mod Name of mod to compile/add + */ protected async addMod(mod: string): Promise { const modPath = this.getModPath(mod); @@ -414,11 +418,14 @@ export class PreAkiModLoader implements IModLoader else { // rename the mod entry point to .ts if it's set to .js because G_MODS_TRANSPILE_TS is set to false - packageData.main = (packageData.main as string).replace(".js", ".ts"); + packageData.main = (packageData.main).replace(".js", ".ts"); } } - // add mod to imported list + // Purge scripts data from package object + packageData.scripts = {}; + + // Add mod to imported list this.imported[mod] = {...packageData, dependencies: packageData.modDependencies}; this.logger.info(this.localisationService.getText("modloader-loaded_mod", {name: packageData.name, version: packageData.version, author: packageData.author})); } diff --git a/project/src/models/spt/mod/IPackageJsonData.ts b/project/src/models/spt/mod/IPackageJsonData.ts index ee32afaf..11968008 100644 --- a/project/src/models/spt/mod/IPackageJsonData.ts +++ b/project/src/models/spt/mod/IPackageJsonData.ts @@ -7,6 +7,9 @@ export interface IPackageJsonData author: string version: string akiVersion: string + /** We deliberately purge this data */ + scripts: Record + devDependencies: Record licence: string main: string isBundleMod: boolean