-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
30 lines (23 loc) · 1009 Bytes
/
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
process.on('unhandledRejection', (reason, p) => {
console.log('Unhandled Rejection at: Promise', p, 'reason:', reason)
})
import '@babel/polyfill'
import Codebase from './src/Codebase'
import Framework from './src/Framework'
import { getConfig, getAbsolutePath } from './src/Util'
(async () => {
let { sourceDir, targetDir, sdkFilePath, frameworkTargetDir, words } = getConfig()
let framework = await Framework.loadSnapshot('framework', { sourceDir: sdkFilePath, targetDir: frameworkTargetDir }),
codebase = await Codebase.factory({ sourceDir, targetDir, words, parentCodebase: framework })
await codebase.saveSnapshot('codebase')
if(process.env.ACTION === 'classnames'){
codebase.classNames.forEach(className => console.log(className))
return
}
if(process.env.ACTION === 'methodcalls'){
codebase.methodCalls.forEach(methodCall => console.log(`${methodCall.count} => ${methodCall.method}`))
return
}
await codebase.transpile()
await framework.transpile()
})()