-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
41 lines (30 loc) · 997 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
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env node
const fs = require('fs')
const path = require('path')
const chalk = require('chalk')
const yargs = require('yargs')
const figlet = require('figlet')
const { getResourcesFromTemplate, getDeployments } = require('./library/utils/armUtils')
const { printResourceAnalytics, printModuleAnalytics } = require('./library/analytics')
const log = console.log
const argv = yargs
.usage('Usage: [file]')
.demandCommand(1)
.argv;
const fileName = argv._[0]
const filePath = path.resolve(fileName);
if (!fs.existsSync(filePath)) {
console.error(`File not found: ${fileName}`);
process.exit(1);
}
log(figlet.textSync('armate', {
font: 'Isometric3'
}))
log(chalk.yellowBright('\n[pre-relase version]\n\n'))
const printAnalytics = (filePath) => {
const resources = getResourcesFromTemplate(filePath)
printResourceAnalytics(resources)
const deploymentModules = getDeployments(resources)
printModuleAnalytics(deploymentModules)
}
printAnalytics(filePath)