-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.js
89 lines (78 loc) · 2.43 KB
/
config.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// Eventually move this to a configuration file
// .module-extractor.rc
const config = {
// sourceDir: '/Users/remyy/Applications/ruby/procore/',
sourceDir: '/Users/georgemichael/Code/Procore/procore',
destinationDir: 'budgetViewer',
toolRoot: 'src/tools/budgetViewer',
extraFiles: [
// NOTE: replace this line with the provider that you use!
// 'src/_shared/decorators/sagaProvider/__tests__/MockComponent.jsx',
],
entryPoints: [
'src/tools/budgetViewer/mounts/projectLevel/View.js',
'src/tools/budgetViewer/mounts/projectLevel/CreateSnapshot.js',
'src/tools/budgetViewer/mounts/projectLevel/DeleteSnapshot.js',
'src/tools/budgetViewer/mounts/companyLevel/Create.js',
'src/tools/budgetViewer/mounts/companyLevel/Edit.js',
],
}
const path = require('path')
const { fromPath, extractNpmDependencies } = require('./src/lib.js')
// MIGRATION CONFIGURATION
// ASSUMING PROCORE STRUCTURE
const wrench = path.join(config.sourceDir, 'wrench')
const hydra = path.join(config.sourceDir, 'hydra_clients')
const wrenchPackageJson = path.join(wrench, 'package.json')
const packages = extractNpmDependencies(wrenchPackageJson)
// extraFiles
// ==========
// we currently only parse JS files because that's what acorn supports
// Because we can't extract imgage imports from those CSS files
// We need to hard code the paths in extraFiles
const extraFiles = [
'src/assets',
'src/_shared/tests',
'.env',
'.eslintrc',
'.eslintignore',
'.gitignore',
'.mocha.opts',
'yarn.lock',
'.hound.yml',
config.toolRoot,
].concat(config.extraFiles)
// entryPoints
// ==========
// Mount points you want to migrate to hydra
// The dependency crawling will start from these files
const migratorConfig = {
hydra,
entryPoints: fromPath(wrench, config.entryPoints),
extraFiles: fromPath(wrench, extraFiles),
rootDir: wrench,
destinationDir: path.join(hydra, config.destinationDir),
// debug: true,
}
// CUSTOM RESOLVER CONFIGURATION
// =============================
// The current resolver is not smart enough to resolve in these paths
// Depending on your tool needs, specify extra paths
const resolverConfig = {
alternatePaths: fromPath(wrench, ['src']),
packageEntries: packages,
packages: Object.keys(packages),
extensions: [
'/index.jsx',
'/index.js',
'.jsx',
'.js',
'.scss',
'.css',
'', // in case the extension is already provided
],
}
module.exports = {
migratorConfig,
resolverConfig,
}