-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
42 lines (34 loc) · 1.3 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
const DependencyGraph = require('./src/deps/DependencyGraph');
const VFS = require('./src/vfs');
const { getPkgRoot, setPkgRoot } = require('./src/deps/util/getPkgRoot');
const path = require('path');
const { getProfiles } = require('./src/deps/util/profileFn');
setPkgRoot(path.resolve('../airbnb/'));
const deps = new DependencyGraph();
deps.hydrate();
const patterns = [
'app/assets/javascripts/**/*.{test,js,jsx,ts,tsx}',
'spec/javascripts/**/*.{test,js,jsx,ts,tsx}',
'frontend/**/*.{test,js,jsx,ts,tsx}',
];
const createTestPath = (fp) =>
path.join(getPkgRoot(), fp);
const testPath1 = createTestPath('/frontend/luxury-guest/src/components/old-dls/Pdp/sections/PhotoMosaicSection.jsx');
const testPath2 = createTestPath('/app/assets/javascripts/shared/experiences/utils/bootstrapDataUtils.js');
const testPath = (path, graph) => {
console.log(`file: ${path}`);
console.log(`is referred by:`);
console.log([...graph[path]]);
};
VFS.async(patterns, { cwd: getPkgRoot(), exclude: ['**/vendor/**'] }).then((files) => {
files.forEach(file => {
deps.addPath(file.path)
});
const graph = deps.toGraph();
testPath(testPath1, graph);
testPath(testPath2, graph);
testPath('airbnb-dls-web/build/exp/Text', graph);
deps.dump();
console.log(`found ${files.length} files`);
getProfiles();
});