Skip to content

Commit

Permalink
fixup! Feat(analytics): Introduce Twig scanner
Browse files Browse the repository at this point in the history
  • Loading branch information
literat committed Nov 14, 2023
1 parent 24551c5 commit ac2ecb9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions packages/analytics/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default async function cli(args: string[]) {
.example('-o path/to/folder')
.option('-c --config', 'Path to scanner config')
.example('-c path/to/scanner.config.js')
.action(({ output, config, source }) => {
.action(async ({ output, config, source }) => {
if (config && !fs.existsSync(config)) {
errorMessage('Could not find config file');
process.exit(1);
Expand All @@ -35,7 +35,8 @@ export default async function cli(args: string[]) {
scanner({ source, outputPath: output, config });
infoMessage(`Start scanning: ${source}`);
} else {
scanner({ source: ROOT_PATH, outputPath: output, config });
const { default: loadedConfig } = await import(config);
scanner({ source: ROOT_PATH, outputPath: output, config: loadedConfig });
infoMessage('Start scanning from default scope');
}
})
Expand Down
6 changes: 3 additions & 3 deletions packages/analytics/src/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ interface ProjectOutput {

type Runner = (config: string, source: string) => ProjectOutput;

const getTrackedData = async ({ config, source }: { config: string; source: string }): ProjectOutput => {
const getTrackedData = async ({ config, source }: { config: unknown; source: string }): ProjectOutput => {
const crawlFrom = path.resolve(source) || path.resolve(ROOT_PATH);
const spiritVersion = await getVersions(crawlFrom);

const reactOutput = await reactScanner({ config, crawlFrom });
const reactOutput = await reactScanner({ ...config, crawlFrom });

const twigResult = await twigScanner({ config, crawlFrom });
const twigResult = await twigScanner({ ...config, crawlFrom });

return {
spiritVersion,
Expand Down

0 comments on commit ac2ecb9

Please sign in to comment.