estruct traverses javascript projects and maps all the dependencies and relationships to a JSON. the output can be used to build network visualizations of the project and document the architecture.

EStruct

EStruct traverses javascript projects and maps all the dependencies and relationships to a JSON. The output can be used to build network visualizations of the project and document the architecture.


Getting started

go get github.com/RayLuxembourg/estruct
root := "/path/to/project/src"
labels:= make([]estruct.Label,0) // or create real labels
p:= estruct.NewConfig(root, `(.(js|jsx))$`,labels)
relativePath := "./src"
datasets, fileMap, dependenciesMap := p.Init(relativePath) // the output is the json

Saving output to a json file

jsonName := "application.json"
os.Remove(jsonName)
b, _ := json.Marshal(datasets)

ioutil.WriteFile(jsonName, b, 0666)

Output json structure

[
  {
    "id": "52FDFC07-2182-654F-163F-5F0F9A621D72",
    "path": "/Users/myUser/work/myProject/src/Component.js",
    "dependencies": [
      "__webpack_public_path__",
      "react",
      "react-dom",
      "app-data"
    ],
    "folder": "src",
    "extension": "js",
    "name": "ECMComponent",
    "lines": 106,
    "label": ""
  },
  {
    "id": "9566C74D-1003-7C4D-7BBB-0407D1E2C649",
    "path": "/Users/myUser/work/myProject/src/__webpack_public_path__.js",
    "dependencies": [],
    "folder": "src",
    "extension": "js",
    "name": "__webpack_public_path__",
    "lines": 3,
    "label": ""
  },
  {
    "id": "81855AD8-681D-0D86-D1E9-1E00167939CB",
    "path": "/Users/myUser/work/myProject/src/app-data.jsx",
    "dependencies": [],
    "folder": "src",
    "extension": "jsx",
    "name": "app-data",
    "lines": 4,
    "label": ""
  }
]

EStruct will generate unique id for each mapped file to allow relationship creation using those id's

How is this helpful to your organization ?

Using the output of EStruct, you can visualize your complex large scale JavaScript project using tools like neo4j and then ask real world questions from the graph database.

You can also integrate the EStruct with your devops pipeline to keep track of your project architecture and changes.

Todo list

  • Parse ES Modules
  • Support CommonJS
  • Generate labels based on user patterns (analyze file name and decide which label to give it)
  • Add support for require syntax.
  • Create CLI tool
  • Publish using NPM
  • Read configuration from project root directory .estructrc.json
  • Boost performance
  • Cleaner code
  • make EStruct plugable/extendable to support various project structures
  • use lexer and parsers to support multiple ecmascript versions and retrive more data about the contents of the code.
Owner
Ray Luxembourg
Full Stack Engineer. Passionate about web technologies and large scale architectures. GCP, AWS Kubernetes craftsman. UI+UX ,Frontend ,backend Development
Ray Luxembourg
Similar Resources

Snackbox - Snackbox can make it easier for customers to order snacks and rice boxes and do tracking

Snackbox - Snackbox can make it easier for customers to order snacks and rice boxes and do tracking

Catering Ecommerce Platform API Docs · Wireflow · Use Case Diagram · Entity Rela

Dec 5, 2022

A skip list of arbitrary elements that can be filtered using roaring bitmaps stored in an LRU cache

Skipfilter This package provides a data structure that combines a skiplist with a roaring bitmap cache. This library was created to efficiently filter

Aug 4, 2022

grep utility that searches through zip,jar,ear,tgz,bz2 in any form of nesting; it can also decompile class files

rzgrep - grep for stuff in archives that are embedded within archives This is a small utility, it greps through the contents of an archive file, it al

May 10, 2022

Distributed merge sort for large sets across nodes in a network

distMergeSort An implementation of mergesort distributed across nodes used to sort large sets. Introduction Merge sort partitions sets so that they ca

Jul 8, 2022

Ipcalc-contains - Golang micro-app, which check whether an IP address belongs to a given network

Ipcalc-contains - Golang micro-app, which check whether an IP address belongs to a given network

ipcalc-contains Golang micro-app, which check whether an IP address belongs to a given network I use it as an addition to standard ipcalc binary distr

Jan 6, 2022

Decode / encode XML to/from map[string]interface{} (or JSON); extract values with dot-notation paths and wildcards. Replaces x2j and j2x packages.

mxj - to/from maps, XML and JSON Decode/encode XML to/from map[string]interface{} (or JSON) values, and extract/modify values from maps by key or key-

Dec 22, 2022

Dasel - Select, put and delete data from JSON, TOML, YAML, XML and CSV files with a single tool.

Dasel - Select, put and delete data from JSON, TOML, YAML, XML and CSV files with a single tool.

Select, put and delete data from JSON, TOML, YAML, XML and CSV files with a single tool. Supports conversion between formats and can be used as a Go package.

Jan 1, 2023

Generates data structure definitions from JSON files for any kind of programming language

Overview Archivist generates data structure definitions from JSON files for any kind of programming language. It also provides a library for golang to

Jun 28, 2022

Convert arbitrary formats to Go Struct (including json, toml, yaml, etc.)

go2struct Convert arbitrary formats to Go Struct (including json, toml, yaml, etc.) Installation Run the following command under your project: go get

Nov 15, 2022
Tutorial code for my video Learn to Use Basic Data Structures - Slices, Structs and Maps in Golang

Learn to Use Basic Data Structures - Slices, Structs and Maps in Golang Read text from a file and split into words. Introduction to slices / lists. Co

Jan 26, 2022
Randomly generated tile maps using Oskar Stålberg's wave function collapse algorithm
Randomly generated tile maps using Oskar Stålberg's wave function collapse algorithm

go-wfc Procedurally-generated tile maps using wave function collapse. Demos Live demo (wasm): https://zfedoran.github.io/go-wfc-example/ Live algorith

Dec 26, 2022
A package for Go that can be used for range queries on large number of intervals

go-stree go-stree is a package for Go that can be used to process a large number of intervals. The main purpose of this module is to solve the followi

May 14, 2022
A close implementation of JavaScript's Set written in Go

Set The Set struct allows unique values storing of any type. Initializing a Set s := set.New() // Empty Set s := set.New("hi", 45, Person{name: "Gophe

Dec 20, 2021
Solutions to AlgoExpert Problems in Six Programming Languages: Python, Java, Go, C++, C#, JavaScript/TypeScript
Solutions to AlgoExpert Problems in Six Programming Languages: Python, Java, Go, C++, C#, JavaScript/TypeScript

Solutions to AlgoExpert Problems in Six Programming Languages: Python, Java, Go, C++, C#, JavaScript/TypeScript Discover solutions to AlgoExpert probl

Dec 11, 2022
Document Indexing and Searching Library in Go

Fehrist Fehrist is a pure Go library for indexing different types of documents. Currently it supports only CSV and JSON but flexible architecture give

May 22, 2022
Nullable Go types that can be marshalled/unmarshalled to/from JSON.

Nullable Go types Description This package provides nullable Go types for bool, float64, int64, int32, string and time.Time replacing sql.NullString,

Dec 12, 2022
dagger is a fast, concurrency safe, mutable, in-memory directed graph library with zero dependencies
dagger is a fast, concurrency safe, mutable, in-memory directed graph library with zero dependencies

dagger is a blazing fast, concurrency safe, mutable, in-memory directed graph implementation with zero dependencies

Dec 19, 2022
Go strcut based enum, support all types.

go-ultra-enum go-ultra-enum is an enum generator for Go. It is inspired by the powerful enum types found in Java. go-ultra-enum has the following capa

Dec 21, 2021
A bloom filter is a probabilistic data structure that is used to determine if an element is present in a set

A Go implementation of a bloom filter, with support for boltdb and badgerdb as optional in-memory persistent storage.

Jul 4, 2022