diff --git a/TypeScript/10ScopesAndTypes/build.mjs b/TypeScript/10ScopesAndTypes/build.mjs index 13f7b54..b05c89e 100644 --- a/TypeScript/10ScopesAndTypes/build.mjs +++ b/TypeScript/10ScopesAndTypes/build.mjs @@ -32,6 +32,8 @@ import fs from "fs"; import os from "os"; import path from "path"; +import { fileURLToPath } from "url"; +import { dirname } from "path"; import ignore from "ignore"; import archiver from "archiver"; import winston from "winston"; @@ -100,11 +102,11 @@ async function main() { // Remove the old distribution directory and create a fresh one. const distDir = await cleanAndCreateDistDirectory(currentDir); - logger.log("info", `Distribution directory successfully cleaned.`); + logger.log("info", "Distribution directory successfully cleaned."); // Create a temporary working directory to perform the build operations. projectDir = await createTemporaryDirectoryWithProjectName(projectName); - logger.log("success", `Temporary working directory successfully created.`); + logger.log("success", "Temporary working directory successfully created."); logger.log("info", projectDir); // Copy files to the temporary directory while respecting the .buildignore rules. @@ -163,7 +165,7 @@ async function main() { * @returns {string} The absolute path of the current working directory. */ function getCurrentDirectory() { - return path.dirname(new URL(import.meta.url).pathname); + return dirname(fileURLToPath(import.meta.url)); } /** diff --git a/TypeScript/11BundleLoadingSample/build.mjs b/TypeScript/11BundleLoadingSample/build.mjs index 13f7b54..b05c89e 100644 --- a/TypeScript/11BundleLoadingSample/build.mjs +++ b/TypeScript/11BundleLoadingSample/build.mjs @@ -32,6 +32,8 @@ import fs from "fs"; import os from "os"; import path from "path"; +import { fileURLToPath } from "url"; +import { dirname } from "path"; import ignore from "ignore"; import archiver from "archiver"; import winston from "winston"; @@ -100,11 +102,11 @@ async function main() { // Remove the old distribution directory and create a fresh one. const distDir = await cleanAndCreateDistDirectory(currentDir); - logger.log("info", `Distribution directory successfully cleaned.`); + logger.log("info", "Distribution directory successfully cleaned."); // Create a temporary working directory to perform the build operations. projectDir = await createTemporaryDirectoryWithProjectName(projectName); - logger.log("success", `Temporary working directory successfully created.`); + logger.log("success", "Temporary working directory successfully created."); logger.log("info", projectDir); // Copy files to the temporary directory while respecting the .buildignore rules. @@ -163,7 +165,7 @@ async function main() { * @returns {string} The absolute path of the current working directory. */ function getCurrentDirectory() { - return path.dirname(new URL(import.meta.url).pathname); + return dirname(fileURLToPath(import.meta.url)); } /** diff --git a/TypeScript/12ClassExtensionOverride/build.mjs b/TypeScript/12ClassExtensionOverride/build.mjs index 13f7b54..b05c89e 100644 --- a/TypeScript/12ClassExtensionOverride/build.mjs +++ b/TypeScript/12ClassExtensionOverride/build.mjs @@ -32,6 +32,8 @@ import fs from "fs"; import os from "os"; import path from "path"; +import { fileURLToPath } from "url"; +import { dirname } from "path"; import ignore from "ignore"; import archiver from "archiver"; import winston from "winston"; @@ -100,11 +102,11 @@ async function main() { // Remove the old distribution directory and create a fresh one. const distDir = await cleanAndCreateDistDirectory(currentDir); - logger.log("info", `Distribution directory successfully cleaned.`); + logger.log("info", "Distribution directory successfully cleaned."); // Create a temporary working directory to perform the build operations. projectDir = await createTemporaryDirectoryWithProjectName(projectName); - logger.log("success", `Temporary working directory successfully created.`); + logger.log("success", "Temporary working directory successfully created."); logger.log("info", projectDir); // Copy files to the temporary directory while respecting the .buildignore rules. @@ -163,7 +165,7 @@ async function main() { * @returns {string} The absolute path of the current working directory. */ function getCurrentDirectory() { - return path.dirname(new URL(import.meta.url).pathname); + return dirname(fileURLToPath(import.meta.url)); } /** diff --git a/TypeScript/13AddTrader/build.mjs b/TypeScript/13AddTrader/build.mjs index 13f7b54..b05c89e 100644 --- a/TypeScript/13AddTrader/build.mjs +++ b/TypeScript/13AddTrader/build.mjs @@ -32,6 +32,8 @@ import fs from "fs"; import os from "os"; import path from "path"; +import { fileURLToPath } from "url"; +import { dirname } from "path"; import ignore from "ignore"; import archiver from "archiver"; import winston from "winston"; @@ -100,11 +102,11 @@ async function main() { // Remove the old distribution directory and create a fresh one. const distDir = await cleanAndCreateDistDirectory(currentDir); - logger.log("info", `Distribution directory successfully cleaned.`); + logger.log("info", "Distribution directory successfully cleaned."); // Create a temporary working directory to perform the build operations. projectDir = await createTemporaryDirectoryWithProjectName(projectName); - logger.log("success", `Temporary working directory successfully created.`); + logger.log("success", "Temporary working directory successfully created."); logger.log("info", projectDir); // Copy files to the temporary directory while respecting the .buildignore rules. @@ -163,7 +165,7 @@ async function main() { * @returns {string} The absolute path of the current working directory. */ function getCurrentDirectory() { - return path.dirname(new URL(import.meta.url).pathname); + return dirname(fileURLToPath(import.meta.url)); } /** diff --git a/TypeScript/14AfterDBLoadHook/build.mjs b/TypeScript/14AfterDBLoadHook/build.mjs index 13f7b54..b05c89e 100644 --- a/TypeScript/14AfterDBLoadHook/build.mjs +++ b/TypeScript/14AfterDBLoadHook/build.mjs @@ -32,6 +32,8 @@ import fs from "fs"; import os from "os"; import path from "path"; +import { fileURLToPath } from "url"; +import { dirname } from "path"; import ignore from "ignore"; import archiver from "archiver"; import winston from "winston"; @@ -100,11 +102,11 @@ async function main() { // Remove the old distribution directory and create a fresh one. const distDir = await cleanAndCreateDistDirectory(currentDir); - logger.log("info", `Distribution directory successfully cleaned.`); + logger.log("info", "Distribution directory successfully cleaned."); // Create a temporary working directory to perform the build operations. projectDir = await createTemporaryDirectoryWithProjectName(projectName); - logger.log("success", `Temporary working directory successfully created.`); + logger.log("success", "Temporary working directory successfully created."); logger.log("info", projectDir); // Copy files to the temporary directory while respecting the .buildignore rules. @@ -163,7 +165,7 @@ async function main() { * @returns {string} The absolute path of the current working directory. */ function getCurrentDirectory() { - return path.dirname(new URL(import.meta.url).pathname); + return dirname(fileURLToPath(import.meta.url)); } /** diff --git a/TypeScript/15HttpListenerExample/build.mjs b/TypeScript/15HttpListenerExample/build.mjs index 13f7b54..b05c89e 100644 --- a/TypeScript/15HttpListenerExample/build.mjs +++ b/TypeScript/15HttpListenerExample/build.mjs @@ -32,6 +32,8 @@ import fs from "fs"; import os from "os"; import path from "path"; +import { fileURLToPath } from "url"; +import { dirname } from "path"; import ignore from "ignore"; import archiver from "archiver"; import winston from "winston"; @@ -100,11 +102,11 @@ async function main() { // Remove the old distribution directory and create a fresh one. const distDir = await cleanAndCreateDistDirectory(currentDir); - logger.log("info", `Distribution directory successfully cleaned.`); + logger.log("info", "Distribution directory successfully cleaned."); // Create a temporary working directory to perform the build operations. projectDir = await createTemporaryDirectoryWithProjectName(projectName); - logger.log("success", `Temporary working directory successfully created.`); + logger.log("success", "Temporary working directory successfully created."); logger.log("info", projectDir); // Copy files to the temporary directory while respecting the .buildignore rules. @@ -163,7 +165,7 @@ async function main() { * @returns {string} The absolute path of the current working directory. */ function getCurrentDirectory() { - return path.dirname(new URL(import.meta.url).pathname); + return dirname(fileURLToPath(import.meta.url)); } /** diff --git a/TypeScript/16ImporterUtil/build.mjs b/TypeScript/16ImporterUtil/build.mjs index 13f7b54..b05c89e 100644 --- a/TypeScript/16ImporterUtil/build.mjs +++ b/TypeScript/16ImporterUtil/build.mjs @@ -32,6 +32,8 @@ import fs from "fs"; import os from "os"; import path from "path"; +import { fileURLToPath } from "url"; +import { dirname } from "path"; import ignore from "ignore"; import archiver from "archiver"; import winston from "winston"; @@ -100,11 +102,11 @@ async function main() { // Remove the old distribution directory and create a fresh one. const distDir = await cleanAndCreateDistDirectory(currentDir); - logger.log("info", `Distribution directory successfully cleaned.`); + logger.log("info", "Distribution directory successfully cleaned."); // Create a temporary working directory to perform the build operations. projectDir = await createTemporaryDirectoryWithProjectName(projectName); - logger.log("success", `Temporary working directory successfully created.`); + logger.log("success", "Temporary working directory successfully created."); logger.log("info", projectDir); // Copy files to the temporary directory while respecting the .buildignore rules. @@ -163,7 +165,7 @@ async function main() { * @returns {string} The absolute path of the current working directory. */ function getCurrentDirectory() { - return path.dirname(new URL(import.meta.url).pathname); + return dirname(fileURLToPath(import.meta.url)); } /** diff --git a/TypeScript/17AsyncImporterWithDependency1/build.mjs b/TypeScript/17AsyncImporterWithDependency1/build.mjs index 13f7b54..b05c89e 100644 --- a/TypeScript/17AsyncImporterWithDependency1/build.mjs +++ b/TypeScript/17AsyncImporterWithDependency1/build.mjs @@ -32,6 +32,8 @@ import fs from "fs"; import os from "os"; import path from "path"; +import { fileURLToPath } from "url"; +import { dirname } from "path"; import ignore from "ignore"; import archiver from "archiver"; import winston from "winston"; @@ -100,11 +102,11 @@ async function main() { // Remove the old distribution directory and create a fresh one. const distDir = await cleanAndCreateDistDirectory(currentDir); - logger.log("info", `Distribution directory successfully cleaned.`); + logger.log("info", "Distribution directory successfully cleaned."); // Create a temporary working directory to perform the build operations. projectDir = await createTemporaryDirectoryWithProjectName(projectName); - logger.log("success", `Temporary working directory successfully created.`); + logger.log("success", "Temporary working directory successfully created."); logger.log("info", projectDir); // Copy files to the temporary directory while respecting the .buildignore rules. @@ -163,7 +165,7 @@ async function main() { * @returns {string} The absolute path of the current working directory. */ function getCurrentDirectory() { - return path.dirname(new URL(import.meta.url).pathname); + return dirname(fileURLToPath(import.meta.url)); } /** diff --git a/TypeScript/17AsyncImporterWithDependency2/build.mjs b/TypeScript/17AsyncImporterWithDependency2/build.mjs index 13f7b54..b05c89e 100644 --- a/TypeScript/17AsyncImporterWithDependency2/build.mjs +++ b/TypeScript/17AsyncImporterWithDependency2/build.mjs @@ -32,6 +32,8 @@ import fs from "fs"; import os from "os"; import path from "path"; +import { fileURLToPath } from "url"; +import { dirname } from "path"; import ignore from "ignore"; import archiver from "archiver"; import winston from "winston"; @@ -100,11 +102,11 @@ async function main() { // Remove the old distribution directory and create a fresh one. const distDir = await cleanAndCreateDistDirectory(currentDir); - logger.log("info", `Distribution directory successfully cleaned.`); + logger.log("info", "Distribution directory successfully cleaned."); // Create a temporary working directory to perform the build operations. projectDir = await createTemporaryDirectoryWithProjectName(projectName); - logger.log("success", `Temporary working directory successfully created.`); + logger.log("success", "Temporary working directory successfully created."); logger.log("info", projectDir); // Copy files to the temporary directory while respecting the .buildignore rules. @@ -163,7 +165,7 @@ async function main() { * @returns {string} The absolute path of the current working directory. */ function getCurrentDirectory() { - return path.dirname(new URL(import.meta.url).pathname); + return dirname(fileURLToPath(import.meta.url)); } /** diff --git a/TypeScript/18CustomItemService/build.mjs b/TypeScript/18CustomItemService/build.mjs index 13f7b54..b05c89e 100644 --- a/TypeScript/18CustomItemService/build.mjs +++ b/TypeScript/18CustomItemService/build.mjs @@ -32,6 +32,8 @@ import fs from "fs"; import os from "os"; import path from "path"; +import { fileURLToPath } from "url"; +import { dirname } from "path"; import ignore from "ignore"; import archiver from "archiver"; import winston from "winston"; @@ -100,11 +102,11 @@ async function main() { // Remove the old distribution directory and create a fresh one. const distDir = await cleanAndCreateDistDirectory(currentDir); - logger.log("info", `Distribution directory successfully cleaned.`); + logger.log("info", "Distribution directory successfully cleaned."); // Create a temporary working directory to perform the build operations. projectDir = await createTemporaryDirectoryWithProjectName(projectName); - logger.log("success", `Temporary working directory successfully created.`); + logger.log("success", "Temporary working directory successfully created."); logger.log("info", projectDir); // Copy files to the temporary directory while respecting the .buildignore rules. @@ -163,7 +165,7 @@ async function main() { * @returns {string} The absolute path of the current working directory. */ function getCurrentDirectory() { - return path.dirname(new URL(import.meta.url).pathname); + return dirname(fileURLToPath(import.meta.url)); } /** diff --git a/TypeScript/1LogToConsole/build.mjs b/TypeScript/1LogToConsole/build.mjs index 13f7b54..b05c89e 100644 --- a/TypeScript/1LogToConsole/build.mjs +++ b/TypeScript/1LogToConsole/build.mjs @@ -32,6 +32,8 @@ import fs from "fs"; import os from "os"; import path from "path"; +import { fileURLToPath } from "url"; +import { dirname } from "path"; import ignore from "ignore"; import archiver from "archiver"; import winston from "winston"; @@ -100,11 +102,11 @@ async function main() { // Remove the old distribution directory and create a fresh one. const distDir = await cleanAndCreateDistDirectory(currentDir); - logger.log("info", `Distribution directory successfully cleaned.`); + logger.log("info", "Distribution directory successfully cleaned."); // Create a temporary working directory to perform the build operations. projectDir = await createTemporaryDirectoryWithProjectName(projectName); - logger.log("success", `Temporary working directory successfully created.`); + logger.log("success", "Temporary working directory successfully created."); logger.log("info", projectDir); // Copy files to the temporary directory while respecting the .buildignore rules. @@ -163,7 +165,7 @@ async function main() { * @returns {string} The absolute path of the current working directory. */ function getCurrentDirectory() { - return path.dirname(new URL(import.meta.url).pathname); + return dirname(fileURLToPath(import.meta.url)); } /** diff --git a/TypeScript/2EditDatabase/build.mjs b/TypeScript/2EditDatabase/build.mjs index 13f7b54..b05c89e 100644 --- a/TypeScript/2EditDatabase/build.mjs +++ b/TypeScript/2EditDatabase/build.mjs @@ -32,6 +32,8 @@ import fs from "fs"; import os from "os"; import path from "path"; +import { fileURLToPath } from "url"; +import { dirname } from "path"; import ignore from "ignore"; import archiver from "archiver"; import winston from "winston"; @@ -100,11 +102,11 @@ async function main() { // Remove the old distribution directory and create a fresh one. const distDir = await cleanAndCreateDistDirectory(currentDir); - logger.log("info", `Distribution directory successfully cleaned.`); + logger.log("info", "Distribution directory successfully cleaned."); // Create a temporary working directory to perform the build operations. projectDir = await createTemporaryDirectoryWithProjectName(projectName); - logger.log("success", `Temporary working directory successfully created.`); + logger.log("success", "Temporary working directory successfully created."); logger.log("info", projectDir); // Copy files to the temporary directory while respecting the .buildignore rules. @@ -163,7 +165,7 @@ async function main() { * @returns {string} The absolute path of the current working directory. */ function getCurrentDirectory() { - return path.dirname(new URL(import.meta.url).pathname); + return dirname(fileURLToPath(import.meta.url)); } /** diff --git a/TypeScript/3GetSptConfigFile/build.mjs b/TypeScript/3GetSptConfigFile/build.mjs index 13f7b54..b05c89e 100644 --- a/TypeScript/3GetSptConfigFile/build.mjs +++ b/TypeScript/3GetSptConfigFile/build.mjs @@ -32,6 +32,8 @@ import fs from "fs"; import os from "os"; import path from "path"; +import { fileURLToPath } from "url"; +import { dirname } from "path"; import ignore from "ignore"; import archiver from "archiver"; import winston from "winston"; @@ -100,11 +102,11 @@ async function main() { // Remove the old distribution directory and create a fresh one. const distDir = await cleanAndCreateDistDirectory(currentDir); - logger.log("info", `Distribution directory successfully cleaned.`); + logger.log("info", "Distribution directory successfully cleaned."); // Create a temporary working directory to perform the build operations. projectDir = await createTemporaryDirectoryWithProjectName(projectName); - logger.log("success", `Temporary working directory successfully created.`); + logger.log("success", "Temporary working directory successfully created."); logger.log("info", projectDir); // Copy files to the temporary directory while respecting the .buildignore rules. @@ -163,7 +165,7 @@ async function main() { * @returns {string} The absolute path of the current working directory. */ function getCurrentDirectory() { - return path.dirname(new URL(import.meta.url).pathname); + return dirname(fileURLToPath(import.meta.url)); } /** diff --git a/TypeScript/4UseACustomConfigFile/build.mjs b/TypeScript/4UseACustomConfigFile/build.mjs index 13f7b54..b05c89e 100644 --- a/TypeScript/4UseACustomConfigFile/build.mjs +++ b/TypeScript/4UseACustomConfigFile/build.mjs @@ -32,6 +32,8 @@ import fs from "fs"; import os from "os"; import path from "path"; +import { fileURLToPath } from "url"; +import { dirname } from "path"; import ignore from "ignore"; import archiver from "archiver"; import winston from "winston"; @@ -100,11 +102,11 @@ async function main() { // Remove the old distribution directory and create a fresh one. const distDir = await cleanAndCreateDistDirectory(currentDir); - logger.log("info", `Distribution directory successfully cleaned.`); + logger.log("info", "Distribution directory successfully cleaned."); // Create a temporary working directory to perform the build operations. projectDir = await createTemporaryDirectoryWithProjectName(projectName); - logger.log("success", `Temporary working directory successfully created.`); + logger.log("success", "Temporary working directory successfully created."); logger.log("info", projectDir); // Copy files to the temporary directory while respecting the .buildignore rules. @@ -163,7 +165,7 @@ async function main() { * @returns {string} The absolute path of the current working directory. */ function getCurrentDirectory() { - return path.dirname(new URL(import.meta.url).pathname); + return dirname(fileURLToPath(import.meta.url)); } /** diff --git a/TypeScript/5ReplaceMethod/build.mjs b/TypeScript/5ReplaceMethod/build.mjs index 13f7b54..b05c89e 100644 --- a/TypeScript/5ReplaceMethod/build.mjs +++ b/TypeScript/5ReplaceMethod/build.mjs @@ -32,6 +32,8 @@ import fs from "fs"; import os from "os"; import path from "path"; +import { fileURLToPath } from "url"; +import { dirname } from "path"; import ignore from "ignore"; import archiver from "archiver"; import winston from "winston"; @@ -100,11 +102,11 @@ async function main() { // Remove the old distribution directory and create a fresh one. const distDir = await cleanAndCreateDistDirectory(currentDir); - logger.log("info", `Distribution directory successfully cleaned.`); + logger.log("info", "Distribution directory successfully cleaned."); // Create a temporary working directory to perform the build operations. projectDir = await createTemporaryDirectoryWithProjectName(projectName); - logger.log("success", `Temporary working directory successfully created.`); + logger.log("success", "Temporary working directory successfully created."); logger.log("info", projectDir); // Copy files to the temporary directory while respecting the .buildignore rules. @@ -163,7 +165,7 @@ async function main() { * @returns {string} The absolute path of the current working directory. */ function getCurrentDirectory() { - return path.dirname(new URL(import.meta.url).pathname); + return dirname(fileURLToPath(import.meta.url)); } /** diff --git a/TypeScript/6ReferenceAnotherClass/build.mjs b/TypeScript/6ReferenceAnotherClass/build.mjs index 13f7b54..b05c89e 100644 --- a/TypeScript/6ReferenceAnotherClass/build.mjs +++ b/TypeScript/6ReferenceAnotherClass/build.mjs @@ -32,6 +32,8 @@ import fs from "fs"; import os from "os"; import path from "path"; +import { fileURLToPath } from "url"; +import { dirname } from "path"; import ignore from "ignore"; import archiver from "archiver"; import winston from "winston"; @@ -100,11 +102,11 @@ async function main() { // Remove the old distribution directory and create a fresh one. const distDir = await cleanAndCreateDistDirectory(currentDir); - logger.log("info", `Distribution directory successfully cleaned.`); + logger.log("info", "Distribution directory successfully cleaned."); // Create a temporary working directory to perform the build operations. projectDir = await createTemporaryDirectoryWithProjectName(projectName); - logger.log("success", `Temporary working directory successfully created.`); + logger.log("success", "Temporary working directory successfully created."); logger.log("info", projectDir); // Copy files to the temporary directory while respecting the .buildignore rules. @@ -163,7 +165,7 @@ async function main() { * @returns {string} The absolute path of the current working directory. */ function getCurrentDirectory() { - return path.dirname(new URL(import.meta.url).pathname); + return dirname(fileURLToPath(import.meta.url)); } /** diff --git a/TypeScript/7OnLoadHook/build.mjs b/TypeScript/7OnLoadHook/build.mjs index 13f7b54..b05c89e 100644 --- a/TypeScript/7OnLoadHook/build.mjs +++ b/TypeScript/7OnLoadHook/build.mjs @@ -32,6 +32,8 @@ import fs from "fs"; import os from "os"; import path from "path"; +import { fileURLToPath } from "url"; +import { dirname } from "path"; import ignore from "ignore"; import archiver from "archiver"; import winston from "winston"; @@ -100,11 +102,11 @@ async function main() { // Remove the old distribution directory and create a fresh one. const distDir = await cleanAndCreateDistDirectory(currentDir); - logger.log("info", `Distribution directory successfully cleaned.`); + logger.log("info", "Distribution directory successfully cleaned."); // Create a temporary working directory to perform the build operations. projectDir = await createTemporaryDirectoryWithProjectName(projectName); - logger.log("success", `Temporary working directory successfully created.`); + logger.log("success", "Temporary working directory successfully created."); logger.log("info", projectDir); // Copy files to the temporary directory while respecting the .buildignore rules. @@ -163,7 +165,7 @@ async function main() { * @returns {string} The absolute path of the current working directory. */ function getCurrentDirectory() { - return path.dirname(new URL(import.meta.url).pathname); + return dirname(fileURLToPath(import.meta.url)); } /** diff --git a/TypeScript/8OnUpdateHook/build.mjs b/TypeScript/8OnUpdateHook/build.mjs index 13f7b54..b05c89e 100644 --- a/TypeScript/8OnUpdateHook/build.mjs +++ b/TypeScript/8OnUpdateHook/build.mjs @@ -32,6 +32,8 @@ import fs from "fs"; import os from "os"; import path from "path"; +import { fileURLToPath } from "url"; +import { dirname } from "path"; import ignore from "ignore"; import archiver from "archiver"; import winston from "winston"; @@ -100,11 +102,11 @@ async function main() { // Remove the old distribution directory and create a fresh one. const distDir = await cleanAndCreateDistDirectory(currentDir); - logger.log("info", `Distribution directory successfully cleaned.`); + logger.log("info", "Distribution directory successfully cleaned."); // Create a temporary working directory to perform the build operations. projectDir = await createTemporaryDirectoryWithProjectName(projectName); - logger.log("success", `Temporary working directory successfully created.`); + logger.log("success", "Temporary working directory successfully created."); logger.log("info", projectDir); // Copy files to the temporary directory while respecting the .buildignore rules. @@ -163,7 +165,7 @@ async function main() { * @returns {string} The absolute path of the current working directory. */ function getCurrentDirectory() { - return path.dirname(new URL(import.meta.url).pathname); + return dirname(fileURLToPath(import.meta.url)); } /** diff --git a/TypeScript/9RouterHooks/build.mjs b/TypeScript/9RouterHooks/build.mjs index 13f7b54..b05c89e 100644 --- a/TypeScript/9RouterHooks/build.mjs +++ b/TypeScript/9RouterHooks/build.mjs @@ -32,6 +32,8 @@ import fs from "fs"; import os from "os"; import path from "path"; +import { fileURLToPath } from "url"; +import { dirname } from "path"; import ignore from "ignore"; import archiver from "archiver"; import winston from "winston"; @@ -100,11 +102,11 @@ async function main() { // Remove the old distribution directory and create a fresh one. const distDir = await cleanAndCreateDistDirectory(currentDir); - logger.log("info", `Distribution directory successfully cleaned.`); + logger.log("info", "Distribution directory successfully cleaned."); // Create a temporary working directory to perform the build operations. projectDir = await createTemporaryDirectoryWithProjectName(projectName); - logger.log("success", `Temporary working directory successfully created.`); + logger.log("success", "Temporary working directory successfully created."); logger.log("info", projectDir); // Copy files to the temporary directory while respecting the .buildignore rules. @@ -163,7 +165,7 @@ async function main() { * @returns {string} The absolute path of the current working directory. */ function getCurrentDirectory() { - return path.dirname(new URL(import.meta.url).pathname); + return dirname(fileURLToPath(import.meta.url)); } /**