npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

satisfactory-docs-parser

v7.0.1

Published

Parser for Satisfactory's Docs.json file

Downloads

22

Readme

Satisfactory Docs Parser

This is a package for parsing the Docs.json file provided by the developers of the game Satisfactory into a format easily consumable by those interested in developing tools for the game. This Docs.json file can be found at <your-satisfactory-directory>/CommunityResources/Docs/Docs.json and contains metadata about the items, buildables, recipes, etc found in the game. This package aims to parse this file into a format both more human- and script- readable.

Usage

npm install satisfactory-docs-parser

Scripts

Example

import parseDocs from 'satisfactory-docs-parser';

const file = fs.readFileSync('Docs.json'); // read the Docs.json file from wherever
const data = parseDocs(file); // parseDocs accepts either a Buffer or a string

// That's it!

Output Format

data = {
  items, // Includes anything that can go in the player's inventory
  resources, // List of raw resources found in the game
  equipment, // All equippable items
  buildables, // All things buildable with the build gun (this includes vehicles)
  productionRecipes, // All recipes that produce items
  buildableRecipes, // All recipes used by the build gun
  customizerRecipes, // All recipes used by the customizer
  schematics, // All unlockables including milestones, MAM, AWESOME Shop, hard drive researches, and misc progression

  // Extra metadata about the original docs file
  meta: {
    originalDocs: DocsTopLevelClass[], // the original file
    topLevelClassList: string[], // list of the names of all top-level classes provided in Docs.json
    dataClassesByTopLevelClass: { [className: string]: DocsDataClass[] }, // mapping of top-level classes to their data class lists
    dataClassesByCategory: { [category: string]: DocsDataClass[] }, // mapping of the above categories (items, buildables, etc) to their data class lists
  },
}

All data (items, resources, buildables, etc) is provided as an object that maps the item's class name to its info. For example, to get information about iron plates (with internal classname Desc_IronPlate_C), you might do the following:

const ironPlate = data.items['Desc_IronPlate_C'];
console.log(ironPlate.name);

// output:
// 'Iron Plate'

Iteration over data can be done easily using Object.entries() (see MDN). For example to iterate over all items in the game, you could do something like:

for (const [className, itemInfo] of Object.entries(data.items)) {
  console.log(`${className}: ${itemInfo.name}`);
}

// OR (these are equivalent, just different styles)

Object.entries(data.items).forEach(([className, itemInfo]) => {
  console.log(`${className}: ${itemInfo.name}`);
});

// output:
// 'Desc_IronPlate_C: Iron Plate'
// 'Desc_IronRod_C: Iron Rod'
// 'Desc_Wire_C: Wire'
// 'Desc_Cable_C: Cable'
// ...

This is just a quick overview of the formatting to get you started. Full details about the fields of each data class can be found here. Full type declarations are provided with the package so any modern editor's intellisense will help you navigate.

CLI

This package also provides a command line interface for parsing Docs.json via the command parse-docs. The following arguments are accepted:

|Argument(alias)|Description|Type| |-|-|-| |--input-i|Path to the Docs.json file.|path (required)| |--output-o|Directory to output parsed files to.|path (required)| |--single-file-f|Outputs a single data.json file instead of individual files. Optionally a filename may be provided.|flag or filename| |--meta-m|Outputs metadata to <output-directory>/meta. Optionally a path may be provided. Relative paths are relative to output directory.|flag or path| |--meta-only|Same as meta, but only metadata is output.|flag or path|

Example

parse-docs --input data/Docs.json --output parsed-docs/

Contributing

Contributions and PR's are always welcome. The only things to know are

  • This project uses typescript
  • This project uses eslint to help with code style

Installation

git clone https://github.com/lydianlights/satisfactory-docs-parser.git

npm install

To compile use npm run build

To watch for file changes while coding use npm run dev

To test the cli while developing use node ./build/cli.js (for custom options) or npm run test-cli (for default options and maximum laziness)

There are no automated tests or anything since this is a small project. I may add more rigor later if this becomes widely used.

TODO

Currently there's no parsing of image and icon paths but I plan on adding this very soon (tm)

Acknowledgements

Huge huge huge thanks to greeny (github) for their project Satisfactory Tools (repo). The work they had already done in parsing out the data in the satisfactory docs made this project 100x easier.