mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-16 19:57:52 +01:00
core: create languages directory if it doesn't exist
This commit is contained in:
@@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
import "isomorphic-fetch";
|
import "isomorphic-fetch";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import fs from "fs/promises";
|
import fs, { mkdir } from "fs/promises";
|
||||||
import { langen } from "../../editor/scripts/langen.mjs";
|
import { langen } from "../../editor/scripts/langen.mjs";
|
||||||
import { fileURLToPath } from "url";
|
import { fileURLToPath } from "url";
|
||||||
|
|
||||||
@@ -30,15 +30,14 @@ const ROOT_DIR = path.resolve(path.join(__dirname, ".."));
|
|||||||
const { languageIndex } = await langen(ROOT_DIR);
|
const { languageIndex } = await langen(ROOT_DIR);
|
||||||
if (!languageIndex) throw new Error("No language index found.");
|
if (!languageIndex) throw new Error("No language index found.");
|
||||||
|
|
||||||
await fs.writeFile(
|
const languagesDir = path.join(
|
||||||
path.join(
|
ROOT_DIR,
|
||||||
ROOT_DIR,
|
"src",
|
||||||
"src",
|
"utils",
|
||||||
"utils",
|
"templates",
|
||||||
"templates",
|
"html",
|
||||||
"html",
|
"languages"
|
||||||
"languages",
|
|
||||||
"index.ts"
|
|
||||||
),
|
|
||||||
languageIndex
|
|
||||||
);
|
);
|
||||||
|
await mkdir(languagesDir, { recursive: true });
|
||||||
|
|
||||||
|
await fs.writeFile(path.join(languagesDir, "index.ts"), languageIndex);
|
||||||
|
|||||||
Reference in New Issue
Block a user