added check for sentinel.hcl
This commit is contained in:
parent
c8e04d6bf8
commit
bc5c781c70
12
src/main.ts
12
src/main.ts
|
@ -4,6 +4,16 @@ const fs = require("fs");
|
||||||
import {generateHereDoc, functionUrls} from "./configHeredoc";
|
import {generateHereDoc, functionUrls} from "./configHeredoc";
|
||||||
import {ripGrep} from "./ripGrep";
|
import {ripGrep} from "./ripGrep";
|
||||||
|
|
||||||
|
// Check for the presence of sentinel.hcl, or else one gets created
|
||||||
|
const ensureFileExists = async (filename: string) => {
|
||||||
|
try {
|
||||||
|
return await fs.lstatSync(filename).isFile();
|
||||||
|
} catch(e) {
|
||||||
|
console.log(`${filename} not present. Are you running this in the right directory?`);
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const checkForCommonFunctions = async (functionsArray: Array<string>) => {
|
const checkForCommonFunctions = async (functionsArray: Array<string>) => {
|
||||||
// iterate over all common functions by name
|
// iterate over all common functions by name
|
||||||
for (const i of functionsArray) {
|
for (const i of functionsArray) {
|
||||||
|
@ -21,6 +31,8 @@ const checkForCommonFunctions = async (functionsArray: Array<string>) => {
|
||||||
|
|
||||||
const main = async () => {
|
const main = async () => {
|
||||||
console.log('Starting checks');
|
console.log('Starting checks');
|
||||||
|
//make sure you're in the right directory to avoid nonsense
|
||||||
|
ensureFileExists('sentinel.hcl');
|
||||||
checkForCommonFunctions(Object.keys(functionUrls));
|
checkForCommonFunctions(Object.keys(functionUrls));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue