Skip to content
This repository has been archived by the owner on Oct 10, 2023. It is now read-only.

feat: add code for alizer npm package #27

Merged
merged 6 commits into from
Jul 2, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,8 @@ nb-configuration.xml

# Local environment
.env

# node
lib/
node_modules/
.npmignore
53 changes: 53 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,59 @@ alizer-cli-$version-runner analyze [-o json] <path>
alizer-cli-$version-runner devfile [-o json] [-r registry-url] <path>
```

### NPM Package

Alizer also offers a NPM package providing helpers for recognize languages/frameworks in a project. It still doesn't support devfile selection.
The syntax is the following:

```
import * as recognizer from 'language-recognizer';

.....

const languages = await recognizer.detectLanguages('my_project_folder');

.....

```

### Outputs

Quarkus project output example

```
[
{ name: 'java', builder: 'maven', frameworks: [ 'quarkus' ] },
{ name: 'gcc machine description' }
]
```

SpringBoot project output example

```
[
{ name: 'java', builder: 'maven', frameworks: [ 'springboot' ] },
{ name: 'plsql' },
{ name: 'plpgsql' },
{ name: 'sqlpl' },
{ name: 'tsql' },
{ name: 'javascript' },
{ name: 'batchfile' },
{ name: 'gcc machine description' }
]
```

Django project output example

```
[
{ name: 'python', frameworks: [ 'django' ] },
{ name: 'gcc machine description' },
{ name: 'shell' }
]
```


Contributing
============
This is an open source project open to anyone. This project welcomes contributions and suggestions!
Expand Down
231 changes: 231 additions & 0 deletions js/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions js/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "language-recognizer",
"version": "0.0.1",
"description": "",
"main": "lib/recognizer.js",
"scripts": {
"compile": "tsc -p ."
},
"author": "Red Hat",
"license": "MIT",
"dependencies": {
"@types/node": "^14.14.7",
"glob": "^7.1.6",
"js-yaml": "^3.14.0"
},
"devDependencies": {
"typescript": "^4.0.5"
}
}
Loading