added git attributes for eol file handling. added import as pre-start step so local devs see data. stopped error on importer hot fix code

This commit is contained in:
Matt Kincaid 2021-04-19 14:16:37 -05:00
Родитель f500b6b3a3
Коммит 615bdd879a
3 изменённых файлов: 17 добавлений и 5 удалений

7
.gitattributes.txt Normal file
Просмотреть файл

@ -0,0 +1,7 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto
# Also can define which files are text and binary, to help Git make the right decision
*.md text
*.png binary

Просмотреть файл

@ -5,7 +5,7 @@
"description": "Standards Mapping is an open source tool used to map and visualize standards and regulations.",
"scripts": {
"lint": "tslint ./src/**/*.ts -t verbose",
"start": "ng serve",
"start": "npm run import && ng serve",
"test": "ng test",
"build": "npm run import && ng build --prod=true --outputPath=docs",
"e2e": "ng e2e",

Просмотреть файл

@ -48,11 +48,16 @@ function exportXlsx(allDocs) {
});
}
function writeResultDir(dir, result) {
function writeResultDir(dir, result, optional) {
const fs = require('fs');
if (!fs.existsSync(dir)){
fs.mkdirSync(dir);
try {
if (!fs.existsSync(dir)){
fs.mkdirSync(dir);
}
} catch (e) {
if (!optional)
throw e;
}
let data = JSON.stringify(result, null, 4);
@ -360,7 +365,7 @@ function importXlsx() {
"docs": allDocs
};
writeResultDir(outputDir1, db);
writeResultDir(outputDir2, db);
writeResultDir(outputDir2, db, true); // this is only here to hot fix an existing build. if there's no build, no need.
});
};