test13-framework-detect v0.0.9
Framework Detect
Working with the project
This project is organised as a monorepo and makes use of npm workspaces.
The folders are organised as follows:
packages/
|- browser-extension A WIP browser extension to test framework detection
|- cli A basic CLI that you can use to test framework detection
|- core The core library where the framework logic is implemented
test/ E2E tests
|- fixtures/ Projects fixtures used to test framework detection
First, we need to install the dependencies for the projects. Run this command at the root of the project:
npm install
Then build all the packages with:
npm run build
The core library is the one that is used to detect the framework, and is built in packages/core/dist
.
Testing framework detection
Before running tests, you have to import projects samples generated by this repo.
Use the following command to import the samples:
npm run get-samples
It will download the samples in the test/samples
folder.
Then you can run all the tests with:
npm test
To run only the E2E test you can use:
npm run test:e2e
To run only unit tests you can use:
npm test --workspaces
Using the CLI
To use the CLI you first need to link it globally:
cd packages/cli
npm link
This will make the detect
binary available globally.
Note that if you make changes to the CLI or library, you only have to rebuild it with npm run buil
, there's no need to re-link it.
Then you can use the CLI to detect the frameworks:
detect test/samples 2
Usage
Usage: detect [path] [<folder_depth_to_analyze>]