From 48cf4b53832db54998b96700287d21b790b82f6b Mon Sep 17 00:00:00 2001 From: Bastian Ike Date: Tue, 13 Sep 2022 14:41:03 +0200 Subject: [PATCH] fix(build): check if radar folder exists fixes #163 --- dist_scripts/scripts/generateJson.js | 8 ++++++++ scripts/generateJson.ts | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/dist_scripts/scripts/generateJson.js b/dist_scripts/scripts/generateJson.js index f07b4fd..1a56f2c 100755 --- a/dist_scripts/scripts/generateJson.js +++ b/dist_scripts/scripts/generateJson.js @@ -61,6 +61,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) { }; Object.defineProperty(exports, "__esModule", { value: true }); var fs = __importStar(require("fs-extra")); +var file_1 = require("./generateJson/file"); var paths = __importStar(require("./paths")); // Do this as the first thing so that any code reading it knows the right env. process.env.BABEL_ENV = "production"; @@ -73,6 +74,13 @@ process.on("unhandledRejection", function (err) { }); fs.removeSync(paths.templateNodeModules); fs.ensureSymlinkSync(paths.appNodeModules, paths.templateNodeModules); +try { + fs.statSync((0, file_1.radarPath)()); +} +catch (e) { + console.error("".concat((0, file_1.radarPath)(), " not found. Please create ").concat((0, file_1.radarPath)(), " and add your markdown files to build the techradar.")); + process.exit(1); +} var generateJson = function () { return __awaiter(void 0, void 0, void 0, function () { var createRadar, save, radar; return __generator(this, function (_a) { diff --git a/scripts/generateJson.ts b/scripts/generateJson.ts index 5c7abdb..ab59fed 100644 --- a/scripts/generateJson.ts +++ b/scripts/generateJson.ts @@ -1,6 +1,7 @@ #!/usr/bin/env node import * as fs from "fs-extra"; +import { radarPath } from "./generateJson/file"; import * as paths from "./paths"; // Do this as the first thing so that any code reading it knows the right env. @@ -17,6 +18,15 @@ process.on("unhandledRejection", (err) => { fs.removeSync(paths.templateNodeModules); fs.ensureSymlinkSync(paths.appNodeModules, paths.templateNodeModules); +try { + fs.statSync(radarPath()); +} catch (e) { + console.error( + `${radarPath()} not found. Please create ${radarPath()} and add your markdown files to build the techradar.` + ); + process.exit(1); +} + const generateJson = async () => { const { createRadar } = require("./generateJson/radar"); const { save } = require("./generateJson/file");