Skip to content

Commit 11c5089

Browse files
committed
_
Signed-off-by: Sora Morimoto <[email protected]>
1 parent bb5d054 commit 11c5089

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

src/commands/generate-templates/templates-gen-process.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import path from "node:path";
2+
import url from "node:url";
23
import { FileSystem } from "../../util/file-system.js";
34
import { Logger } from "../../util/logger.js";
45
import { TemplatesGenConfig } from "./configuration.js";
56

7+
const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
8+
69
class TemplatesGenProcess {
710
/**
811
* @type {TemplatesGenConfig}

src/templates-worker.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { resolve } from "node:path";
22
import path from "node:path";
3+
import url from "node:url";
34
import * as Eta from "eta";
45
import _ from "lodash";
56

@@ -34,6 +35,7 @@ class TemplatesWorker {
3435
* @returns {CodeGenConfig.templatePaths}
3536
*/
3637
getTemplatePaths = (config) => {
38+
const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
3739
const baseTemplatesPath = resolve(__dirname, "../templates/base");
3840
const defaultTemplatesPath = resolve(__dirname, "../templates/default");
3941
const modularTemplatesPath = resolve(__dirname, "../templates/modular");

src/util/file-system.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import fs from "node:fs";
2-
import { resolve } from "node:path";
2+
import { dirname, resolve } from "node:path";
3+
import url from "node:url";
34
import _ from "lodash";
45
import { Logger } from "./logger.js";
56

@@ -83,6 +84,7 @@ class FileSystem {
8384
};
8485

8586
createFile = ({ path, fileName, content, withPrefix }) => {
87+
const __dirname = dirname(url.fileURLToPath(import.meta.url));
8688
const absolutePath = resolve(__dirname, path, `./${fileName}`);
8789
const fileContent = `${withPrefix ? FILE_PREFIX : ""}${content}`;
8890

0 commit comments

Comments
 (0)