Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

core: don't include tests & unnecessary files during build

Abdullah Atta8442b4371562
diff --git a/packages/core/scripts/prebuild.mjs b/packages/core/scripts/prebuild.mjs
index 28c4dd588..53e5f4b5e 100644
--- a/packages/core/scripts/prebuild.mjs
+++ b/packages/core/scripts/prebuild.mjs
@@ -27,7 +27,10 @@ const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const ROOT_DIR = path.resolve(path.join(__dirname, ".."));
-const languagesList = await langen(ROOT_DIR, path.join(ROOT_DIR, "languages"));
+const languagesList = await langen(
+ ROOT_DIR,
+ path.join(ROOT_DIR, "src", "utils", "templates", "html", "languages")
+);
const languageIndex = `function hasRequire() {
return typeof require === "function" && !("IS_DESKTOP_APP" in globalThis);
}
@@ -46,4 +49,15 @@ export async function loadLanguage(language) {
}
}`;
-await fs.writeFile(path.join(ROOT_DIR, "languages", "index.js"), languageIndex);
+await fs.writeFile(
+ path.join(
+ ROOT_DIR,
+ "src",
+ "utils",
+ "templates",
+ "html",
+ "languages",
+ "index.js"
+ ),
+ languageIndex
+);
diff --git a/packages/core/src/utils/templates/html/builder.js b/packages/core/src/utils/templates/html/builder.js
index b60b9cb92..f30094b5a 100644
--- a/packages/core/src/utils/templates/html/builder.js
+++ b/packages/core/src/utils/templates/html/builder.js
@@ -67,8 +67,8 @@ async function preprocessHTML(templateData) {
? require("prismjs")
: (await import("prismjs")).default;
const { loadLanguage } = hasRequire()
- ? require("../../../../languages/index.js")
- : await import("../../../../languages/index.js");
+ ? require("./languages/index.js")
+ : await import("./languages/index.js");
prismjs.register = (syntax) => {
if (typeof arg === "function") syntax(prismjs);
};
diff --git a/packages/core/tsconfig.json b/packages/core/tsconfig.json
index 80ac9524f..a6c28f3f4 100644
--- a/packages/core/tsconfig.json
+++ b/packages/core/tsconfig.json
@@ -7,5 +7,6 @@
"allowJs": true,
"jsx": "react-jsx"
},
+ "exclude": ["src/**/*.test.js", "src/**/*.test.skip.js"],
"include": ["src/"]
}