Skip to content

Commit

Permalink
Removed node-gyp dependencies
Browse files Browse the repository at this point in the history
The library now ignores the faulty modules but reports them
The extension also ignores faulty saved modules
The extension now displays all validation errors for a module
  • Loading branch information
Aragas committed May 28, 2024
1 parent ab8d994 commit 6f0d625
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 907 deletions.
30 changes: 15 additions & 15 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@

},
"ghcr.io/devcontainers/features/git:1": {
"version": "latest",
"ppa": "false"
},
"version": "latest",
"ppa": "false"
},
"ghcr.io/butr/devcontainer/7z:1": {

},
"ghcr.io/devcontainers/features/node:1": {
"version": "18.17.1",
"nodeGypDependencies": "true"
},
"ghcr.io/devcontainers/features/node:1": {
"version": "18.17.1",
"nodeGypDependencies": "true"
},
"ghcr.io/devcontainers/features/powershell:1": {
"version": "latest"
"version": "latest"
}
},
"overrideFeatureInstallOrder": [
Expand All @@ -32,12 +32,12 @@
"ghcr.io/devcontainers/features/node",
"ghcr.io/devcontainers/features/powershell"
],
"mounts": [
{
"source":"${localEnv:HOME}${localEnv:USERPROFILE}/AppData/Roaming/Vortex/plugins",
"target":"/vortex-plugins",
"type":"bind"
}
"mounts": [
{
"source":"${localEnv:HOME}${localEnv:USERPROFILE}/AppData/Roaming/Vortex/plugins",
"target":"/vortex-plugins",
"type":"bind"
}
],
"postAttachCommand": "yarn install",
"customizations": {
Expand All @@ -62,4 +62,4 @@
}
}
}
}
}
15 changes: 5 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "game-mount-and-blade-ii-bannerlord-butr",
"version": "1.0.2",
"version": "1.0.3",
"description": "A Vortex extension for Mount and Blade II: Bannerlord mod management.",
"author": "BUTR Team & Nexus Mods",
"license": "GPL-3.0+",
Expand Down Expand Up @@ -31,7 +31,6 @@
"@types/react-redux": "^7.1.9",
"@types/redux": "^3.6.0",
"@types/webpack": "^5.28.5",
"@types/xml2js": "^0.4.5",
"@typescript-eslint/eslint-plugin": "7.0.0",
"@typescript-eslint/parser": "^6",
"bluebird": "^3.7.2",
Expand All @@ -56,24 +55,20 @@
"redux-act": "^1.7.7",
"ts-loader": "^9.2.6",
"ts-node": "^10.7.0",
"turbowalk": "git+https://github.com/Nexus-Mods/node-turbowalk",
"typescript": "^5.3.3",
"vortex-api": "git+https://github.com/Nexus-Mods/vortex-api#fblo_api_update",
"vortex-api": "git+https://github.com/Nexus-Mods/vortex-api",
"vortex-ext-common": "^0.4.0",
"webpack": "^5.76.0",
"webpack-cli": "^5.1.4",
"webpack-node-externals": "^3.0.0",
"xml2js": "^0.5.0"
"webpack-node-externals": "^3.0.0"
},
"dependencies": {
"@butr/vortexextensionnative": "1.0.110",
"@butr/vortexextensionnative": "1.0.114",
"ticks-to-date": "^1.0.6"
},
"resolutions": {
"node-gyp": "^9.0.0",
"@types/react": "^16.14.34",
"**/dir-compare/minimatch": "3.0.5",
"winapi-bindings": "git+https://github.com/Nexus-Mods/node-winapi-bindings"
"**/dir-compare/minimatch": "3.0.5"
},
"packageManager": "[email protected]"
}
5 changes: 4 additions & 1 deletion src/utils/loadOrder/persistence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import path from 'path';
import { fs, selectors, types } from 'vortex-api';
import { GAME_ID, LOAD_ORDER_SUFFIX } from '../../common';
import { PersistenceLoadOrderStorage } from '../../types';
import { filterEntryWithInvalidId } from '../util';

const getLoadOrderFileName = (profileId: string): string => {
return `${profileId}${LOAD_ORDER_SUFFIX}`;
Expand All @@ -22,7 +23,9 @@ export const readLoadOrder = (api: types.IExtensionApi): PersistenceLoadOrderSto
const loFileName = getLoadOrderFileName(profileId);
const loFilePath = getLoadOrderFilePath(api, loFileName);
const fileContents = fs.readFileSync(loFilePath, 'utf8');
return JSON.parse(fileContents);

const loadOrder: PersistenceLoadOrderStorage = JSON.parse(fileContents);
return loadOrder.filter((x) => filterEntryWithInvalidId(x));
} catch {
return [];
}
Expand Down
11 changes: 11 additions & 0 deletions src/utils/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,14 @@ export const getPathExistsAsync = async (path: string): Promise<boolean> => {
export const findGame = async (): Promise<types.IGameStoreEntry> => {
return util.GameStoreHelper.findByAppId([EPICAPP_ID, STEAMAPP_ID.toString(), ...GOG_IDS, XBOX_ID]);
};

type HasId = {
id: string;
}
const hasId = (persistent: HasId): persistent is HasId => {
return !!persistent.id && persistent.id !== '';
};

export const filterEntryWithInvalidId = (entry: HasId): boolean => {
return hasId(entry);
};
19 changes: 18 additions & 1 deletion src/utils/vortexLauncherManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
readLoadOrder,
hasPersistentLoadOrder,
libraryToLibraryVM,
filterEntryWithInvalidId,
} from '.';
import { GAME_ID } from '../common';
import { IModuleCache, VortexLoadOrderStorage, VortexStoreIds } from '../types';
Expand Down Expand Up @@ -65,7 +66,7 @@ export class VortexLauncherManager {
if (!Array.isArray(loadOrder)) {
return [];
}
return loadOrder;
return loadOrder.filter((x) => filterEntryWithInvalidId(x));
};

public loadLoadOrderVortex = (): vetypes.LoadOrder => {
Expand Down Expand Up @@ -340,6 +341,22 @@ export class VortexLauncherManager {
displayMS: delayMS,
});
break;
case 'warning':
this._api.sendNotification?.({
id: id,
type: 'warning',
message: message,
displayMS: delayMS,
});
break;
case 'error':
this._api.sendNotification?.({
id: id,
type: 'error',
message: message,
displayMS: delayMS,
});
break;
}
};
/**
Expand Down
8 changes: 4 additions & 4 deletions src/views/LoadOrderItemRenderer/LoadOrderItemRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,16 @@ function renderModuleIcon(item: types.IFBLOLoadOrderEntry<IVortexViewModelData>)

function renderValidationError(props: IBaseProps): JSX.Element | null {
const { invalidEntries, loEntry } = props.item;
const invalidEntry =
const invalidEntryList =
invalidEntries !== undefined
? invalidEntries.find((inv) => inv.id.toLowerCase() === loEntry.id.toLowerCase())
? invalidEntries.filter((inv) => inv.id.toLowerCase() === loEntry.id.toLowerCase()).map(x => x.reason).join('\n')
: undefined;
return invalidEntry !== undefined ? (
return invalidEntryList !== undefined && invalidEntryList !== '' ? (
<tooltip.Icon
className="fblo-invalid-entry"
name="feedback-error"
style={{ width: `1.5em`, height: `1.5em`, }}
tooltip={invalidEntry.reason}>
tooltip={invalidEntryList}>
</tooltip.Icon>
) : null;
}
Expand Down
Loading

0 comments on commit 6f0d625

Please sign in to comment.