Skip to content

Commit

Permalink
Feat(analytics): Add a timestamp to the scanner result files
Browse files Browse the repository at this point in the history
  • Loading branch information
literat committed Dec 12, 2023
1 parent 82df19a commit 75b479a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/analytics/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const OUTPUT_FILENAME_PREFIX = 'spirit-analytics';
export const OUTPUT_DIR = '.scanner';
export const ROOT_PATH = '.';
export const REACT_OUTPUT_FILE = 'adoption-data-react.json';
export const TWIG_OUTPUT_FILE = './.scanner/adoption-data-twig.json';
export const REACT_OUTPUT_FILE_NAME = 'adoption-data-react';
export const TWIG_OUTPUT_FILE_NAME = './.scanner/adoption-data-twig';
export const TWIG_CORE_COMPONENTS_PATH = './vendor/lmc/spirit-web-twig-bundle/src/Resources/twig-components';
export const TWIG_CONFIG_FILE = './config/spirit-web-twig.yml';
6 changes: 3 additions & 3 deletions packages/analytics/src/processors/spiritAdoptionProcessor.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { path } from 'zx';
import { OUTPUT_DIR, REACT_OUTPUT_FILE, ROOT_PATH } from '../constants';
import { _dirname, getModuleName } from '../helpers';
import { OUTPUT_DIR, REACT_OUTPUT_FILE_NAME, ROOT_PATH } from '../constants';
import { _dirname, getModuleName, timestamp } from '../helpers';
import { Component } from '../types';

const OUTPUT_FILE = path.resolve(process.cwd(), `${OUTPUT_DIR}/${REACT_OUTPUT_FILE}`);
const OUTPUT_FILE = path.resolve(process.cwd(), `${OUTPUT_DIR}/${REACT_OUTPUT_FILE_NAME}-${timestamp()}.json`);

const getRelativePath = (absolutePath: string) => path.relative(path.resolve(_dirname, ROOT_PATH), absolutePath);

Expand Down
11 changes: 9 additions & 2 deletions packages/analytics/src/scanners/twig-scanner.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
import { ROOT_PATH, TWIG_CONFIG_FILE, TWIG_CORE_COMPONENTS_PATH, TWIG_OUTPUT_FILE } from '../constants';
import {
OUTPUT_DIR,
ROOT_PATH,
TWIG_CONFIG_FILE,
TWIG_CORE_COMPONENTS_PATH,
TWIG_OUTPUT_FILE_NAME,
} from '../constants';
import { timestamp } from '../helpers';

export default {
crawlFrom: ROOT_PATH,
exclude: ['node_modules', 'dist', 'build', 'coverage', 'public', 'vendor', 'storybook-static'],
configFile: TWIG_CONFIG_FILE,
outputFile: TWIG_OUTPUT_FILE,
outputFile: `${OUTPUT_DIR}/${TWIG_OUTPUT_FILE_NAME}-${timestamp()}.json`,
coreComponentsPath: TWIG_CORE_COMPONENTS_PATH,
};

0 comments on commit 75b479a

Please sign in to comment.