Skip to content

Latest commit

 

History

History
129 lines (89 loc) · 4.9 KB

DEVELOP.md

File metadata and controls

129 lines (89 loc) · 4.9 KB

FSG Mod Assistant

License: ISC GitHub release (latest by date) GitHub Release Date Crowdin

Developer information below

Contents

Environment and Requirements

Node.js

Mod Assistant expects to be built using at least Node 16.x, 18.x is preferred.

Yarn

Mod Assistant requires Yarn to build. Note that for windows, you may have to run powershell as Administrator to globally install it correctly

Build and Run

If using VSCode, the build files already exist, just press F5 to run the program. If running from the command line, use

Before running for the first time, you must build the dependencies. Run yarn in the repo folder.

# yarn

Run Development Version

# .\node_modules\.bin\electron .

Build Executable

# npm run dist

Testing

This package provides a number of test cases:

Test everything

# npm test

Check translations against each other

See if translation files match keys

# npm run lang_test

Fix translations

If translation files are mismatched, this will fix it (english is master)

# npm run lang_fix

Check Dependencies

This is for an automated system for checking dependency versions

# npm run depends

Folder Structure

  • modAssist_main.js : Master electron server process
  • F:/build : Build files (icons)
  • F:/lib : Custom libraries for master process
    • ddsLibrary.js : DDS -> PNG conversion
    • ma-logger.js : Logging class
    • savegame-parser.js : Save game file/folder parser
    • single-mod-checker.js : Mod parser
    • translate.js : Localization library
  • F:/renderer : User facing renderer files
    • <window name>.html : Render side HTML
    • F:/img : Image includes
    • F:/inc : 3rd Party scripts and CSS
    • F:/preload : Preload scripts, name is preload-<window name>.js, runs privileged
    • F:/renderJS : Render side script, name is _<window name>_ui.js`, runs sandboxed
      • fsg_util.js : Utility libraries, loaded everywhere (sandboxed)
      • key_lookup_table.js : Used to map keybindings to pretty text, detail screen
      • select_lib_ui.js : Selection library, main screen
  • F:/test : Test files and scripts
  • F:/translations : Localization files

The one exception to the naming scheme is main.html uses assist_ui.js

Utility Classes fsg_util.js

  • getText(key) : Insert localization HTML tag

  • fsgUtil

    • led : Giants LED operation strings
    • byId(id) : Get HTML element by ID
    • query(query) : Run querySelectorAll
    • getIconSVG(type) : Get named SVG Icon
    • getIcon(type,cls) : Get named SVG Icon encapsulated in class
    • buildSelectOpt(value, text, selected, disabled, title) : Built HTML select option
    • getAttribNullError(element, attrib) : Get HTML attribute from element, throw error if it doesn't exist
    • getAttribNullEmpty(element, attrib) : Get HTML attribute from element, return null if it doesn't exist
    • buildBS(name, value) : Build a BootStrap date attribute name, with value
    • bytesToHR(inBytes,locale) : Make byte value human readable using locale
    • basename(name, sep = '\\') : Renderer version of path.basename()
    • iconMaker(icon) : Return base64 icon or placeholder icon
    • notesDefault(notes, collection, key, defaultValue) : Retrieve collection note detail if it exists.
    • escapeDesc( text ) : Escape special characters in the mod description
    • escapeSpecial( text ) : Escape special characters
    • badge : (color, name, fullName = false) : Make localized badge using color class color, with name. If fullName is false, add mod_badge_ to name

Pull Requests

Any pull request is fine, please try and squash atomic commits first, but it's not a deal breaker. Please be verbose in your description of what the pull request does.