generated from dxworks/dxworks-template-node-ts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
55bbb5e
commit e5404a1
Showing
3 changed files
with
66 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import {analyseHistory} from '../src/commands/history/history' | ||
|
||
describe('test history analysis for default plugins', () => { | ||
|
||
it('test history analysis for javascript and ruby', async () => { | ||
await analyseHistory(['...'], { | ||
results: 'results-history', | ||
refresh: false, | ||
plugins: ['npm'], | ||
}) | ||
console.log('done') | ||
}) | ||
}) |
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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import {Command} from 'commander' | ||
import {AnalyseOptions} from '../analyse' | ||
import {getPluginsFromNames} from '../../plugins' | ||
import {DependencyFileContext, DepinderProject} from '../../extension-points/extract' | ||
|
||
export const historyCommand = new Command() | ||
.name('history') | ||
.argument('[folders...]', 'A list of git repositories to analyse') | ||
// .argument('[depext-files...]', 'A list of files to parse for dependency information') | ||
.option('--results, -r', 'The results folder', 'results') | ||
.option('--refresh', 'Refresh the cache', false) | ||
.option('--plugins, -p [plugins...]', 'A list of plugins') | ||
.action(analyseHistory) | ||
|
||
|
||
export async function analyseHistory(folders: string[], options: AnalyseOptions, useCache = true): Promise<void> { | ||
const selectedPlugins = getPluginsFromNames(options.plugins) | ||
|
||
// folders.map(repo => { | ||
// console.log(`Analysing ${repo} with isomorphic Git`) | ||
// const commits: any[] = [] | ||
// commits.forEach(commit => { | ||
// const changes: any[] = [] | ||
// const files = changes | ||
// .filter(it => plugin.extractor.filter ? plugin.extractor.filter(it) : true) | ||
// .filter(it => plugin.extractor.files | ||
// .some(pattern => minimatch(it, pattern, {matchBase: true})) | ||
// ) | ||
// }) | ||
// }) | ||
|
||
const projects: DepinderProject[] = | ||
await Promise.all(selectedPlugins.map(async (plugin: any) => { | ||
console.log(`Running plugin ${plugin.name}`) | ||
const context: DependencyFileContext = {} as DependencyFileContext | ||
return await plugin.parser?.parseDependencyTree(context) | ||
})) | ||
} | ||
|
||
class Repo { | ||
|
||
} | ||
|
||
class Commit { | ||
|
||
} | ||
|
||
class Change { | ||
|
||
} | ||
|
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