Skip to content

Commit

Permalink
add error message for when the index.jsx or index.tsx is not found
Browse files Browse the repository at this point in the history
  • Loading branch information
wpdas committed Mar 11, 2024
1 parent 6d64405 commit 751d524
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions lib/compiler.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const { create_dist } = require("./utils");
const { create_dist, log } = require("./utils");
const path = require("path");
const fs = require("fs");
const loadFilesInfo = require("./actions/loadFilesInfo");
const toolsFiles = require("./actions/toolsFiles");
const loadFilesContent = require("./actions/loadFilesContent");
Expand All @@ -18,7 +19,14 @@ const distFolder = process.env.DIST_FOLDER || "build";
function compile_files() {
create_dist(distFolder);

const entryFile = path.join(".", "src", "index.tsx");
let entryFile = path.join(".", "src", "index.tsx");
entryFile = fs.existsSync(entryFile)
? entryFile
: path.join(".", "src", "index.jsx");
if (!fs.existsSync(entryFile)) {
log.error("src/index.tsx or src/index.jsx not found.");
process.exit(1);
}

// TEST
// #1 - Load imported files content
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "alem",
"description": "Create web3 applications for NEAR BOS with a focus on performance while using concepts that are based on ReactJS.",
"version": "0.0.1-alpha.17",
"version": "0.0.1-alpha.18",
"main": "main.js",
"types": "index.d.ts",
"author": "Wenderson Pires - wendersonpires.near",
Expand Down

0 comments on commit 751d524

Please sign in to comment.