Skip to content

Commit

Permalink
Merge pull request #133 from BUTR/dev
Browse files Browse the repository at this point in the history
Release 1.1.0
  • Loading branch information
Aragas authored Jun 29, 2024
2 parents 52f6c86 + db2153b commit bd89d8c
Show file tree
Hide file tree
Showing 149 changed files with 4,907 additions and 3,327 deletions.
112 changes: 58 additions & 54 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,65 +1,69 @@
{
"name": "NodeJS & Powershell & 7z",
"build": {
"dockerfile": "Dockerfile",
"cacheFrom": [
"ghcr.io/butr/game-mount-and-blade2-devcontainer:latest"
]
},
"features": {
"ghcr.io/butr/devcontainer/upgrade:1": {

},
"ghcr.io/devcontainers/features/git:1": {
"version": "latest",
"ppa": "false"
"name": "NodeJS & Powershell & 7z",
"build": {
"dockerfile": "Dockerfile",
"cacheFrom": [
"ghcr.io/butr/game-mount-and-blade2-devcontainer:latest"
]
},
"ghcr.io/butr/devcontainer/7z:1": {
"features": {
"ghcr.io/butr/devcontainer/upgrade:1": {

},
"ghcr.io/devcontainers/features/git:1": {
"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/python:1": {

},
"ghcr.io/devcontainers/features/powershell:1": {
"version": "7.4.2"
}
},
"ghcr.io/devcontainers/features/powershell:1": {
"version": "latest"
}
},
"overrideFeatureInstallOrder": [
"ghcr.io/butr/devcontainer/upgrade",
"ghcr.io/devcontainers/features/git",
"ghcr.io/butr/devcontainer/7z",
"ghcr.io/devcontainers/features/node",
"ghcr.io/devcontainers/features/powershell"
],
"overrideFeatureInstallOrder": [
"ghcr.io/butr/devcontainer/upgrade",
"ghcr.io/devcontainers/features/git",
"ghcr.io/butr/devcontainer/7z",
"ghcr.io/devcontainers/features/node",
"ghcr.io/devcontainers/features/python",
"ghcr.io/devcontainers/features/powershell"
],
"mounts": [
{
"source":"${localEnv:HOME}${localEnv:USERPROFILE}/AppData/Roaming/Vortex/plugins",
"target":"/vortex-plugins",
"type":"bind"
}
],
"postAttachCommand": "yarn install",
"customizations": {
"vscode": {
"extensions": [
"editorconfig.editorconfig",
"dbaeumer.vscode-eslint",
"github.vscode-github-actions",
"ms-vscode.powershell",
"ms-azuretools.vscode-docker"
],
"settings": {
"terminal.integrated.defaultProfile.linux": "pwsh",
"terminal.integrated.profiles.linux": {
"path": {
"path": "/usr/local/bin/pwsh"
}
},
"powershell.powerShellAdditionalExePaths": {
"pwsh": "/usr/local/bin/pwsh"
}
}
}
}
],
"postAttachCommand": "yarn install",
"customizations": {
"vscode": {
"extensions": [
"editorconfig.editorconfig",
"dbaeumer.vscode-eslint",
"github.vscode-github-actions",
"ms-vscode.powershell",
"ms-azuretools.vscode-docker"
],
"settings": {
"terminal.integrated.defaultProfile.linux": "pwsh",
"terminal.integrated.profiles.linux": {
"path": {
"path": "/usr/local/bin/pwsh"
}
},
"powershell.powerShellAdditionalExePaths": {
"pwsh": "/usr/local/bin/pwsh"
}
}
}
}
}
3 changes: 1 addition & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Project-specific editor formatting options
[*]
charset = utf-8
insert_final_newline = true
indent_style = space
indent_size = 2
indent_size = 2
61 changes: 59 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"project": "./tsconfig.json"
},
"env": {
"browser": true,
Expand All @@ -24,7 +25,7 @@
"plugin:prettier/recommended",
"plugin:@typescript-eslint/recommended"
],
"plugins": ["prettier", "react", "react-hooks", "@typescript-eslint"],
"plugins": ["prettier", "react", "react-hooks", "@typescript-eslint", "import"],
"rules": {
"eqeqeq": "error",
"no-console": "warn",
Expand All @@ -38,6 +39,50 @@
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",

"require-await": "off",
"@typescript-eslint/require-await": "error",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/explicit-function-return-type": "error",
"@typescript-eslint/strict-boolean-expressions":
[
"error",
{
"allowString": true,
"allowNumber": true,
"allowNullableObject": true,
"allowNullableBoolean": false,
"allowNullableString": false,
"allowNullableNumber": false,
"allowNullableEnum": false,
"allowAny": false
}
],

"sort-imports":
[
"error",
{
"ignoreCase": true,
"ignoreDeclarationSort": true
}
],

"import/order": [
1,
{
"groups":
[
"external",
"builtin",
"internal",
"sibling",
"parent",
"index"
]
}
],

"@typescript-eslint/naming-convention": [
"warn",
{
Expand All @@ -48,7 +93,19 @@
"match": true
}
}
// ,
// {
// "selector": "method",
// "format": ["camelCase"],
// "leadingUnderscore": "allow",
// "trailingUnderscore": "allow",
// "custom": {
// "regex": "^.*Async$",
// "match": true
// }
// }
],

"no-restricted-imports": [
"warn",
{
Expand Down
6 changes: 6 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
---------------------------------------------------------------------------------------------------
Version: 1.1.0
* Added back collection support
* Old collections will now set the Load Order on install
* New collections will be able to include MCM settings
* The extension should now see symbolic links
---------------------------------------------------------------------------------------------------
Version: 1.0.13
* Added mandatory folders for manual game path hint
* Fixed undefined tools bug
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,18 @@
"@types/react-redux": "^7.1.9",
"@types/redux": "^3.6.0",
"@types/webpack": "^5.28.5",
"@typescript-eslint/eslint-plugin": "7.0.0",
"@typescript-eslint/parser": "^6",
"@typescript-eslint/eslint-plugin": "7.2.0",
"@typescript-eslint/parser": "7.2.0",
"bluebird": "^3.7.2",
"collections": "git+https://github.com/Nexus-Mods/extension-collections",
"copy-webpack-plugin": "^12.0.1",
"eslint": "^8.34.0",
"eslint-config-prettier": "^9",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-prettier": "^5",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react": "^7.34.3",
"eslint-plugin-react-hooks": "^4.6.2",
"i18next": "^19.0.1",
"lint-staged": "^12.3.5",
"native-addon-loader": "^2.0.1",
"prettier": "^3",
"react": "^16.12.0",
Expand All @@ -55,10 +54,11 @@
"redux-act": "^1.7.7",
"ts-loader": "^9.2.6",
"ts-node": "^10.7.0",
"typescript": "^5.3.3",
"turbowalk": "git+https://github.com/Nexus-Mods/node-turbowalk",
"typescript": "^5.4.5",
"vortex-api": "git+https://github.com/Nexus-Mods/vortex-api",
"vortex-ext-common": "^0.4.0",
"webpack": "^5.76.0",
"webpack": "^5.92.1",
"webpack-cli": "^5.1.4",
"webpack-node-externals": "^3.0.0"
},
Expand Down
47 changes: 47 additions & 0 deletions src/blse/events.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { actions, types } from 'vortex-api';
import { findBLSEMod } from './utils';
import { hasSettingsInterfacePrimaryTool } from '../vortex';
import { GAME_ID } from '../common';

export const didDeployBLSE = (api: types.IExtensionApi): Promise<void> => {
const state = api.getState();

if (!hasSettingsInterfacePrimaryTool(state.settings.interface)) {
return Promise.resolve();
}

const primaryTool = state.settings.interface.primaryTool.mountandblade2bannerlord;

const blseMod = findBLSEMod(state);
if (blseMod && primaryTool === undefined) {
api.store?.dispatch(actions.setPrimaryTool(GAME_ID, 'blse-cli'));
}
if (!blseMod && primaryTool === 'blse-cli') {
api.store?.dispatch(actions.setPrimaryTool(GAME_ID, undefined!));
}

return Promise.resolve();
};

/**
* Event function, be careful
*/
export const didPurgeBLSE = (api: types.IExtensionApi): Promise<void> => {
const state = api.getState();

if (!hasSettingsInterfacePrimaryTool(state.settings.interface)) {
return Promise.resolve();
}

const primaryTool = state.settings.interface.primaryTool.mountandblade2bannerlord;
if (primaryTool !== 'blse-cli') {
return Promise.resolve();
}

const blseMod = findBLSEMod(state);
if (blseMod) {
api.store?.dispatch(actions.setPrimaryTool(GAME_ID, undefined!));
}

return Promise.resolve();
};
1 change: 1 addition & 0 deletions src/utils/blse/index.ts → src/blse/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export * from './events';
export * from './installer';
export * from './modType';
export * from './utils';
export * from './vortex';
18 changes: 9 additions & 9 deletions src/utils/blse/installer.ts → src/blse/installer.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import path from 'path';
import { selectors, types } from 'vortex-api';
import { isStoreXbox } from '..';
import { GAME_ID, BLSE_CLI_EXE, BINARY_FOLDER_XBOX, BINARY_FOLDER_STANDARD } from '../../common';
import path from 'path';
import { isStoreXbox } from '../vortex';
import { BINARY_FOLDER_STANDARD, BINARY_FOLDER_XBOX, BLSE_CLI_EXE, GAME_ID } from '../common';

export const installBLSE = async (api: types.IExtensionApi, files: string[]): Promise<types.IInstallResult> => {
const discovery = selectors.currentGameDiscovery(api.getState());
if (!discovery) {
export const installBLSE = (api: types.IExtensionApi, files: string[]): Promise<types.IInstallResult> => {
const discovery: types.IDiscoveryResult | undefined = selectors.currentGameDiscovery(api.getState());
if (discovery === undefined) {
return Promise.resolve({
instructions: [],
});
Expand All @@ -21,13 +21,13 @@ export const installBLSE = async (api: types.IExtensionApi, files: string[]): Pr
source: file,
destination: file,
}));
return {
return Promise.resolve({
instructions: instructions,
};
});
};

export const testBLSE = (files: string[], gameId: string): Promise<types.ISupportedResult> => {
const supported = gameId === GAME_ID && !!files.find((file) => path.basename(file) === BLSE_CLI_EXE);
const supported = gameId === GAME_ID && files.find((file) => path.basename(file) === BLSE_CLI_EXE) !== undefined;
return Promise.resolve({
supported,
requiredFiles: [],
Expand Down
6 changes: 4 additions & 2 deletions src/utils/blse/modType.ts → src/blse/modType.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { selectors, types } from 'vortex-api';
import { BLSE_CLI_EXE } from '../../common';
import { BLSE_CLI_EXE } from '../common';

export const getInstallPathBLSE = (api: types.IExtensionApi, game: types.IGame): string => {
const discovery: types.IDiscoveryResult | undefined = selectors.discoveryByGame(api.getState(), game.id);
return discovery?.path ?? ``;
};

export const isModTypeBLSE = (instructions: types.IInstruction[]): boolean => {
return instructions.some((inst) => inst.type === 'copy' && inst.source && inst.source.endsWith(BLSE_CLI_EXE));
return instructions.some(
(inst) => inst.type === 'copy' && inst.source !== undefined && inst.source.endsWith(BLSE_CLI_EXE)
);
};
Loading

0 comments on commit bd89d8c

Please sign in to comment.