-
-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: ✏️ update README for the packages
- Loading branch information
1 parent
c0ab855
commit 76492e6
Showing
7 changed files
with
196 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,53 @@ | ||
# `@jscpd/core` | ||
|
||
> TODO: description | ||
> core package for detect duplicates, depends only on eventemmiter3. | ||
## Usage | ||
## Installation | ||
|
||
``` | ||
const core = require('@jscpd/core'); | ||
npm install @jscpd/core --save | ||
``` | ||
|
||
## Usage | ||
|
||
```typescript | ||
import {Tokenizer} from '@jscpd/tokenizer'; | ||
import { | ||
Detector, | ||
MemoryStore, | ||
IOptions, | ||
IClone, | ||
IStore, | ||
ITokenizer | ||
} from '@jscpd/core'; | ||
|
||
const options: IOptions = { | ||
minLines: 5, | ||
maxLines: 500, | ||
} | ||
|
||
const tokenizer: ITokenizer = new Tokenizer(); | ||
|
||
// here you can use any store what implement IStore interface | ||
const store: IStore = new MemoryStore(); | ||
|
||
// list of validators, implemented IValidator interface, validate clones | ||
const validators = []; | ||
|
||
const detector = new Detector(tokenizer, store, validators, options); | ||
|
||
( async () => { | ||
const format = 'javascript'; | ||
const code: string = '...string with code...'; | ||
const clones: IClone[] = await detector.detect('source_id', code, format); | ||
|
||
console.log(clones); | ||
})(); | ||
|
||
// TODO: DEMONSTRATE API | ||
``` | ||
|
||
![ga tracker](https://www.google-analytics.com/collect?v=1&a=257770996&t=pageview&dl=https%3A%2F%2Fgithub.com%2Fkucherenko%2Fjscpd&ul=en-us&de=UTF-8&cid=978224512.1377738459&tid=UA-730549-17&z=887657232 "ga tracker") | ||
|
||
## License | ||
|
||
[MIT](LICENSE) © Andrey Kucherenko |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,49 @@ | ||
# `@jscpd/finder` | ||
|
||
> TODO: description | ||
> core package for detect duplicates, depends only on eventemmiter3. | ||
## Usage | ||
## Installation | ||
|
||
``` | ||
const core = require('@jscpd/finder'); | ||
npm install @jscpd/finder --save | ||
``` | ||
|
||
## Usage | ||
|
||
```typescript | ||
import {Tokenizer} from '@jscpd/tokenizer'; | ||
import { | ||
MemoryStore, | ||
IOptions, | ||
IClone, | ||
IStore, | ||
ITokenizer | ||
} from '@jscpd/core'; | ||
import {EntryWithContent, getFilesToDetect, InFilesDetector} from '@jscpd/finder'; | ||
|
||
const options: IOptions = { | ||
minLines: 5, | ||
maxLines: 500, | ||
path: ['list of folders and files to analyse for clones'] | ||
} | ||
|
||
const tokenizer: ITokenizer = new Tokenizer(); | ||
// here you can use any store what implement IStore interface | ||
const store: IStore = new MemoryStore(); | ||
const statistic = new Statistic(options); | ||
|
||
// TODO: DEMONSTRATE API | ||
const files: EntryWithContent[] = getFilesToDetect(options); | ||
|
||
const detector = new InFilesDetector(tokenizer, store, statistic, options); | ||
|
||
( async () => { | ||
const clones: IClone[] = await detector.detect(files); | ||
})(); | ||
``` | ||
|
||
|
||
![ga tracker](https://www.google-analytics.com/collect?v=1&a=257770996&t=pageview&dl=https%3A%2F%2Fgithub.com%2Fkucherenko%2Fjscpd&ul=en-us&de=UTF-8&cid=978224512.1377738459&tid=UA-730549-17&z=887657232 "ga tracker") | ||
|
||
## License | ||
|
||
[MIT](LICENSE) © Andrey Kucherenko |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,41 @@ | ||
# `@jscpd/core` | ||
# `@jscpd/leveldb-store` | ||
|
||
> TODO: description | ||
> store for jscpd, used for large repositories | ||
## Installation | ||
|
||
``` | ||
npm install @jscpd/leveldb-store --save | ||
``` | ||
|
||
## Usage | ||
|
||
``` | ||
const core = require('@jscpd/core'); | ||
import {Tokenizer} from '@jscpd/tokenizer'; | ||
import { | ||
Detector, | ||
IOptions, | ||
IClone, | ||
IStore, | ||
ITokenizer | ||
} from '@jscpd/core'; | ||
import LeveldbStore from '@jscpd/leveldb-store'; | ||
const options: IOptions = { | ||
minLines: 5, | ||
maxLines: 500, | ||
} | ||
const tokenizer: ITokenizer = new Tokenizer(); | ||
const store: IStore = new LeveldbStore(); | ||
const detector = new Detector(tokenizer, store, [], options); | ||
// TODO: DEMONSTRATE API | ||
``` | ||
|
||
![ga tracker](https://www.google-analytics.com/collect?v=1&a=257770996&t=pageview&dl=https%3A%2F%2Fgithub.com%2Fkucherenko%2Fjscpd&ul=en-us&de=UTF-8&cid=978224512.1377738459&tid=UA-730549-17&z=887657232 "ga tracker") | ||
|
||
## License | ||
|
||
[MIT](LICENSE) © Andrey Kucherenko |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,43 @@ | ||
# `@jscpd/core` | ||
# `@jscpd/leveldb-store` | ||
|
||
> TODO: description | ||
**!NOT implemented yet** | ||
|
||
> store for jscpd, used [redis](https://redis.io/) data store for hashes | ||
## Installation | ||
|
||
``` | ||
npm install @jscpd/redis-store --save | ||
``` | ||
|
||
## Usage | ||
|
||
``` | ||
const core = require('@jscpd/core'); | ||
import {Tokenizer} from '@jscpd/tokenizer'; | ||
import { | ||
Detector, | ||
IOptions, | ||
IClone, | ||
IStore, | ||
ITokenizer | ||
} from '@jscpd/core'; | ||
import RedisdbStore from '@jscpd/redis-store'; | ||
const options: IOptions = { | ||
minLines: 5, | ||
maxLines: 500, | ||
} | ||
const tokenizer: ITokenizer = new Tokenizer(); | ||
const store: IStore = new RedisdbStore(); | ||
const detector = new Detector(tokenizer, store, [], options); | ||
// TODO: DEMONSTRATE API | ||
``` | ||
|
||
![ga tracker](https://www.google-analytics.com/collect?v=1&a=257770996&t=pageview&dl=https%3A%2F%2Fgithub.com%2Fkucherenko%2Fjscpd&ul=en-us&de=UTF-8&cid=978224512.1377738459&tid=UA-730549-17&z=887657232 "ga tracker") | ||
|
||
## License | ||
|
||
[MIT](LICENSE) © Andrey Kucherenko |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,29 @@ | ||
# `@jscpd/tokenizer` | ||
|
||
> TODO: description | ||
> tokenizer is package from @jscpd used for convert programming code to list of tokens | ||
|
||
## Installation | ||
|
||
``` | ||
npm install @jscpd/tokenizer --save | ||
``` | ||
|
||
## Usage | ||
|
||
``` | ||
const core = require('@jscpd/tokenizer'); | ||
import {IOptions, ITokensMap} from '@jscpd/core'; | ||
import {Tokenizer} from '@jscpd/tokenizer'; | ||
const tokenizer = new Tokenizer(); | ||
const options: IOptions = {}; | ||
const maps: ITokensMap[] = tokenizer.generateMaps('source_id', 'let a = "11"', 'javascript', options); | ||
// TODO: DEMONSTRATE API | ||
``` | ||
|
||
![ga tracker](https://www.google-analytics.com/collect?v=1&a=257770996&t=pageview&dl=https%3A%2F%2Fgithub.com%2Fkucherenko%2Fjscpd&ul=en-us&de=UTF-8&cid=978224512.1377738459&tid=UA-730549-17&z=887657232 "ga tracker") | ||
|
||
## License | ||
|
||
[MIT](LICENSE) © Andrey Kucherenko |