1.25.0 • Published 1 month ago

@specfy/stack-analyser v1.25.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

Stack Analyser

Main codecov

This library provide a simple way to extract from any repository: dependencies, languages, infrastructure, SaaS, databases, etc.

Detect more than +600 technologies in your code base.

  • Full Support: NodeJS, Docker, Typescript, PHP, Github Actions, Python, Ruby, Rust, Golang
  • Partial Support: Deno, Terraform, Zig, Clojure, c, c++, c#, dart, elixir, java

Look at all supported tech here.


The library dives into any folders, read package.json, docker-compose.yml, go.mod, etc. Determines relationship between folders and services, and output a comprehensive list of dependencies, services and the link between them. The set of rules inside this repos allows the detection of specific technology or saas used.

It is directly used by getstack.dev to create an exhaustive map of all technologies used in the open-source world. It can be helpful for other to get all dependencies or SaaS used in a given git repository.

CLI

npx @specfy/stack-analyser <PATH> [--output=<filename>]
npx @specfy/stack-analyser /my/folder

Programmatic Usage

npm install -E @specfy/stack-analyser
import { analyser, FSProvider, flatten, rules } from "@specfy/stack-analyser"

// /!\ Load default rules
// without this no rules will be enabled by default
import '@specfy/stack-analyser/dist/autoload';

// Analyze a folder
const result = await analyser({
  provider: new FSProvider({
    path: '/my/repository/path/',
  }),
});

// Output to JSON
const json = result.toJson();

// De-nest the output and deduplicate childs
const flat = flatten(result);

GitHub Actions

- name: Stack Analyser
  uses: specfy/stack-analyser@v__VERSION__

Output

Example of output when running the CLI against ./tests/fixtures

The exact types AnalyserJson can be found here

{
  "id": "44xNl6ZWgpp1",
  "name": "flatten",
  "path": ["/"],
  "tech": null,
  "edges": [],
  "inComponent": null,
  "techs": [],
  "languages": {},
  "dependencies": [],
  "childs": [
    {
      "id": "XAPpH2jgrRQq",
      "name": "@fake/api",
      "path": [
        "pkgs/api/package.json"
      ],
      "tech": null,
      "edges": [
        {
          "target": "0ijEqmU6TTVP",
          "read": true,
          "write": true
        }
      ],
      "inComponent": null,
      "childs": [],
      "techs": [ "datadog", "fastify", "nodejs", "prisma", "typescript" ],
      "languages": {
        "JSON": 1
      },
      "dependencies": [
        [ "npm","dd-trace","1.0.1" ],
        [ "npm", "fastify", "4.17.0" ],
        [ "npm", "prisma", "4.13.0" ],
        [ "npm", "typescript", "5.0.4" ]
      ]
    },
    {
      "id": "KDaUcHH5fbvW",
      "name": "@fake/app",
      "path": [
        "pkgs/app/package.json"
      ],
      "tech": null,
      "edges": [
        {
          "target": "XAPpH2jgrRQq",
          "read": true,
          "write": true
        }
      ],
      "inComponent": "MXFXwFMcCeaa",
      "childs": [],
      "techs": [ "html", "nodejs", "react", "scss", "typescript", "vercel", "vite" ],
      "languages": {
        "JSON": 1,
        "HTML": 1,
        "SCSS": 1
      },
      "dependencies": [
        [ "npm", "@fake/api", "1.0.0" ],
        [ "npm", "react", "4.17.0" ],
        [ "npm", "typescript", "5.0.4" ],
        [ "npm", "vite", "4.3.3" ]
      ]
    },
    {
      "id": "GiMSHgVZxp0w",
      "name": "GCP",
      "path": [
        "terraform/.terraform.lock.hcl"
      ],
      "tech": "gcp",
      "edges": [],
      "inComponent": null,
      "childs": [],
      "techs": [],
      "languages": {},
      "dependencies": [
        [ "terraform", "registry.terraform.io/hashicorp/google", "4.61.0" ]
      ]
    },
    {
      "id": "0ijEqmU6TTVP",
      "name": "datadog",
      "path": [
        "pkgs/api/package.json"
      ],
      "tech": "datadog",
      "edges": [],
      "inComponent": null,
      "childs": [],
      "techs": [],
      "languages": {},
      "dependencies": []
    },
    {
      "id": "PLIJw7dSPiYm",
      "name": "db",
      "path": [
        "docker-compose.yml"
      ],
      "tech": "postgresql",
      "edges": [],
      "inComponent": null,
      "childs": [],
      "techs": [],
      "languages": {},
      "dependencies": [
        [ "docker", "postgres", "14.5-alpine" ]
      ]
    },
    {
      "id": "qx9C1IK1eyqQ",
      "name": "fake",
      "path": [
        "package.json"
      ],
      "tech": null,
      "edges": [],
      "inComponent": null,
      "childs": [],
      "techs": [ "docker", "eslint", "nodejs", "prettier", "terraform", "typescript" ],
      "languages": {
        "YAML": 1,
        "JSON": 1,
        "HCL": 1
      },
      "dependencies": [
        [ "npm", "@typescript-eslint/eslint-plugin", "5.57.1" ],
        [ "npm", "@typescript-eslint/parser", "5.57.1" ],
        [ "npm", "eslint", "8.39.0" ],
        [ "npm", "prettier", "2.8.7" ],
        [ "npm", "typescript", "4.9.5" ]
      ]
    },
    {
      "id": "Z7w2sPVvm4uv",
      "name": "redis",
      "path": [
        "docker-compose.yml"
      ],
      "tech": "redis",
      "edges": [],
      "inComponent": null,
      "childs": [],
      "techs": [],
      "languages": {},
      "dependencies": [
        [ "docker", "redis", "7.0.4-alpine" ]
      ]
    },
    {
      "id": "UNzMqaOoqExN",
      "name": "unknown",
      "path": [
        "docker-compose.yml"
      ],
      "tech": null,
      "edges": [],
      "inComponent": null,
      "childs": [],
      "techs": [],
      "languages": {},
      "dependencies": [
        [ "docker", "unknown", "7.17.5" ]
      ]
    },
    {
      "id": "MXFXwFMcCeaa",
      "name": "vercel",
      "path": [
        "pkgs/app/package.json",
        "terraform/.terraform.lock.hcl"
      ],
      "tech": "vercel",
      "edges": [],
      "inComponent": null,
      "childs": [],
      "techs": [ "vercel"],
      "languages": {},
      "dependencies": [
        [ "terraform", "registry.terraform.io/vercel/vercel", "4.61.0" ]
      ]
    }
  ]
}

Contributing

Every contribution is welcome. Check our Contributing guide.

Versioning

There are 2 things versioned in this package:

  • the API
  • the Data extraction.

The API is following semver:

  • Breaking changes in the API will result in a new MAJOR.
  • Anything else will result in a MINOR feat, or a PATCH fix

The Data is following semver without MAJOR:

  • Breaking changes in the Data will result in a new MINOR. A breaking change can be: removal of a tech, change in the tech category, removal of pattern for a tech, new data sources. feat(rules)
  • Anything else will result in a PATCH fix(rules)
1.14.0

2 months ago

1.12.1

2 months ago

1.12.0

3 months ago

1.18.0

2 months ago

1.16.0

2 months ago

1.21.0

2 months ago

1.21.1

2 months ago

1.25.0

1 month ago

1.23.0

1 month ago

1.21.2

2 months ago

1.21.3

2 months ago

1.9.3

3 months ago

1.9.2

3 months ago

1.11.0

3 months ago

1.15.0

2 months ago

1.13.1

2 months ago

1.13.0

2 months ago

1.19.0

2 months ago

1.17.0

2 months ago

1.9.1

3 months ago

1.9.0

3 months ago

1.19.2

2 months ago

1.19.1

2 months ago

1.22.0

2 months ago

1.20.0

2 months ago

1.24.1

1 month ago

1.24.0

1 month ago

1.8.7

4 months ago

1.8.6

4 months ago

1.10.1

3 months ago

1.10.0

3 months ago

1.8.2

2 years ago

1.5.5

2 years ago

1.4.6

2 years ago

1.8.1

2 years ago

1.7.2

2 years ago

1.5.4

2 years ago

1.4.5

2 years ago

1.3.6

2 years ago

1.8.0

2 years ago

1.7.1

2 years ago

1.5.3

2 years ago

1.4.4

2 years ago

1.3.5

2 years ago

1.7.0

2 years ago

1.6.1

2 years ago

1.5.2

2 years ago

1.4.3

2 years ago

1.3.4

2 years ago

1.6.0

2 years ago

1.5.1

2 years ago

1.4.2

2 years ago

1.3.3

2 years ago

1.5.0

2 years ago

1.4.1

2 years ago

1.3.2

2 years ago

1.4.0

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.8.5

2 years ago

1.4.9

2 years ago

1.8.4

2 years ago

1.4.11

2 years ago

1.4.8

2 years ago

1.8.3

2 years ago

1.4.10

2 years ago

1.4.7

2 years ago

1.2.0

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.1

2 years ago