# @azure/web-apps-framework-detection

> Detect, inspect and extract build and deploy configuration from JavaScript frameworks and libraries

Latest version **0.1.3** (published 2025-03-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install @azure/web-apps-framework-detection
pnpm add @azure/web-apps-framework-detection
yarn add @azure/web-apps-framework-detection
bun add @azure/web-apps-framework-detection
```

## Health

**Score 35/100 (D)** — status: maintenance-mode.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.3 |
| Published | 2025-03-17 |
| First published | 2023-03-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=14 |
| Dependencies | 4 |
| Unpacked size | 1.1 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | azure-sdk, microsoft1es |
| Keywords | cloud, serverless, hosting, static, authentication, staticwebapp, framework, ci-cd, deployment, detection, detection-framework |

## Links

- npm: https://www.npmjs.com/package/@azure/web-apps-framework-detection
- Repository: https://github.com/Azure/framework-detect
- Homepage: https://github.com/Azure/framework-detect#readme
- Issues: https://github.com/Azure/framework-detect/issues
- npm.io page: https://npm.io/package/@azure/web-apps-framework-detection

## Dependencies (4)

- [globrex](https://npm.io/package/globrex.md) ^0.1.2
- [jsonpath](https://npm.io/package/jsonpath.md) ^1.1.1
- [node-fetch](https://npm.io/package/node-fetch.md) ^3.3.2
- [@octokit/core](https://npm.io/package/@octokit/core.md) ^6.0.2

## Alternatives

- [@clerk/clerk-expo](https://npm.io/package/@clerk/clerk-expo.md) — 133.6K weekly downloads
- [@pothos/plugin-authz](https://npm.io/package/@pothos/plugin-authz.md) — 12.4K weekly downloads
- [@bounded-sh/client](https://npm.io/package/@bounded-sh/client.md) — 3.2K weekly downloads
- [@oxyhq/services](https://npm.io/package/@oxyhq/services.md) — 2.3K weekly downloads
- [@luigi-project/plugin-auth-oauth2](https://npm.io/package/@luigi-project/plugin-auth-oauth2.md) — 2.3K weekly downloads

## Recent versions

- 0.1.3 (latest) — 2025-03-17
- 0.1.2 (0.1.2) — 2024-07-30
- 0.1.1 (0.1.1) — 2024-07-26
- 0.1.0 — 2023-11-29
- 0.0.9 — 2023-11-09
- 0.0.8 — 2023-05-31
- 0.0.7 — 2023-05-23
- 0.0.6 — 2023-05-04
- 0.0.5 — 2023-05-02
- 0.0.4 — 2023-04-02
- 0.0.3 — 2023-04-02
- 0.0.2 — 2023-03-30
- 0.0.1 — 2023-03-20

## README

# Framework Detect

This project is a framework detection tool. It detects the frameworks used in a project by analyzing code structure and dependencies.

- Detect different root repositories 
- Detect used frameworks for remote repositories hosted on GitHub or Azure DevOps
- Detect frameworks used on local projects
- Detect if represented framework is app or API framework

## Important Notes

If you have suggestions or you encounter issues, please report them or help us fix them. Your contributions are very much appreciated. 🙏

## Working with the project

This project is the source for the npm package **@azure/framework-detect**

The files are organized as follows:
```
src/lib
|- detect.ts         The core framework detect logic 
|- frameworks        Framework definitions in JSON format and file helper
|- providers         Client logic to read data from GitHub, DevOps or Local files
```

## Functions 

### detectProjectFolders
Detects and returns all framework represented in the repository

Parameters:
1. projectPath:  the full path the project to be analyzed. This can either be a local path or a full url containing the provider host (e.g.https://github.com/{owner}/{repository})
2. apiKey: PAT (Personal Access Token) with read access to the references repository. Only required in case of remote repository.  
1. filterDescendantFolders: decides is descendant folders should be filtered (defaults to true). 
1. customFrameworkDefinitions: use custom framework definitions as source for detection. Must be passed in as list of framework definitions.
1. customFrameworkDefinitionsUrl: use custom framework definitions url as source for detection. Must be passed in as valid URL.

*Sample:*
  ```
[
    {
    "id": "custom",
    "name": "Custom Name",
    "kind": "app",
    "config": {
      "outputLocation": "."
    },
    "files": ["@(index.htm|default.htm)?(l)"]
  }
]
  ```
4. customFrameworkDefinitionsUrl: use custom framework definitions as source of truth for detection. Url must link to plain JSON containing list of framework definitions. 

*Sample:* https://raw.githubusercontent.com/annikel/additional-framework-definitions/main/frameworks.json

**Example Usage**

```
const { detectProjectFolders } = require("@azure/framework-detect");

async function detect(rootPath, apiToken, additionalFrameworks, additionalFrameworksUrl) {
  const folders = await detectProjectFolders(rootPath, apiToken, additionalFrameworks, additionalFrameworksUrl);
  return JSON.stringify(folders);
}
```


### formatDetectedFolders

Formats the detected folders

Parameters:
1. folders: the folders to be formatted

### printSupportedFrameworks

Returns all supported frameworks wit definition 

Parameters:
1. showList: when set to true will console log the framework defintions

## Contribute 

To add missing frameworks or update existing ones simply edit the *frameworks.json* file under *src\lib\frameworks* and create a pull requests. Framework Definition do not require a new npm package version since we point to the file hosted on GitHub. Objects added to app.json for framework detections follow the interface defined in /src/types.ts, function FrameworkDefinition.

## Testing framework detection

Before running tests, you have to import projects samples generated by [this repo](https://github.com/sinedied/frameworks-playground).

Use the following command to import the samples:
```bash
npm run get-samples
```

It will download the samples in the `test/samples` folder.

Then you can run all the tests with:
```bash
npm run build && npm test
```

all tests in `test/remote-detect.spec.js` require a valid PAT and repositories the PAT has access to

---
_Source: https://npm.io/package/@azure/web-apps-framework-detection · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
