arkos 1.3.8-canary.2 → 1.3.8-canary.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,6 +19,6 @@ function killServerChildProcess() {
19
19
  (0, start_1.killProductionServerChildProcess)();
20
20
  }
21
21
  function getVersion() {
22
- return "1.3.8-canary.2";
22
+ return "1.3.8-canary.3";
23
23
  }
24
24
  //# sourceMappingURL=cli.helpers.js.map
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const fs_helpers_1 = require("../../helpers/fs.helpers");
3
4
  const cli_helpers_1 = require("./cli.helpers");
4
5
  class WatermarkStamper {
5
6
  stamp({ envFiles, host, port, }) {
@@ -7,9 +8,10 @@ class WatermarkStamper {
7
8
  if (host && port)
8
9
  console.info(` - Local: http://${host}:${port}`);
9
10
  if (envFiles?.length || 0 > 1)
10
- console.info(` - Environments: ${envFiles
11
- ?.join(", ")
12
- .replaceAll(`${process.cwd()}/`, "")}\n`);
11
+ if (envFiles?.length || 0 > 1)
12
+ console.info(` - Environments: ${(0, fs_helpers_1.fullCleanCwd)(envFiles?.join(", ") || "")
13
+ .replaceAll(`\\`, "")
14
+ .replaceAll("/", "")}\n`);
13
15
  }
14
16
  }
15
17
  const watermarkStamper = new WatermarkStamper();
@@ -1 +1 @@
1
- {"version":3,"file":"watermark-stamper.js","sourceRoot":"","sources":["../../../../../src/utils/cli/utils/watermark-stamper.ts"],"names":[],"mappings":";;AAAA,+CAA2C;AAK3C,MAAM,gBAAgB;IAIpB,KAAK,CAAC,EACJ,QAAQ,EACR,IAAI,EACJ,IAAI,GAKL;QACC,OAAO,CAAC,IAAI,CAAC,iCAAiC,IAAA,wBAAU,GAAE,SAAS,CAAC,CAAC;QACrE,IAAI,IAAI,IAAI,IAAI;YAAE,OAAO,CAAC,IAAI,CAAC,4BAA4B,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC;QAC3E,IAAI,QAAQ,EAAE,MAAM,IAAI,CAAC,GAAG,CAAC;YAC3B,OAAO,CAAC,IAAI,CACV,qBAAqB,QAAQ;gBAC3B,EAAE,IAAI,CAAC,IAAI,CAAC;iBACX,UAAU,CAAC,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,IAAI,CAC3C,CAAC;IACN,CAAC;CACF;AAED,MAAM,gBAAgB,GAAG,IAAI,gBAAgB,EAAE,CAAC;AAEhD,kBAAe,gBAAgB,CAAC","sourcesContent":["import { getVersion } from \"./cli.helpers\";\n\n/**\n * Helps in putting Arkosjs watermark\n */\nclass WatermarkStamper {\n /**\n * Stamps Arkosjs watermark with Local and Environments\n */\n stamp({\n envFiles,\n host,\n port,\n }: {\n envFiles: string[] | undefined;\n host: string | undefined;\n port: string | undefined;\n }) {\n console.info(`\\n \\x1b[1m\\x1b[36m Arkos.js ${getVersion()}\\x1b[0m`);\n if (host && port) console.info(` - Local: http://${host}:${port}`);\n if (envFiles?.length || 0 > 1)\n console.info(\n ` - Environments: ${envFiles\n ?.join(\", \")\n .replaceAll(`${process.cwd()}/`, \"\")}\\n`\n );\n }\n}\n\nconst watermarkStamper = new WatermarkStamper();\n\nexport default watermarkStamper;\n"]}
1
+ {"version":3,"file":"watermark-stamper.js","sourceRoot":"","sources":["../../../../../src/utils/cli/utils/watermark-stamper.ts"],"names":[],"mappings":";;AAAA,yDAAwD;AACxD,+CAA2C;AAK3C,MAAM,gBAAgB;IAIpB,KAAK,CAAC,EACJ,QAAQ,EACR,IAAI,EACJ,IAAI,GAKL;QACC,OAAO,CAAC,IAAI,CAAC,iCAAiC,IAAA,wBAAU,GAAE,SAAS,CAAC,CAAC;QACrE,IAAI,IAAI,IAAI,IAAI;YAAE,OAAO,CAAC,IAAI,CAAC,4BAA4B,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC;QAC3E,IAAI,QAAQ,EAAE,MAAM,IAAI,CAAC,GAAG,CAAC;YAC3B,IAAI,QAAQ,EAAE,MAAM,IAAI,CAAC,GAAG,CAAC;gBAC3B,OAAO,CAAC,IAAI,CACV,qBAAqB,IAAA,yBAAY,EAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;qBAC1D,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC;qBACpB,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAC3B,CAAC;IACR,CAAC;CACF;AAED,MAAM,gBAAgB,GAAG,IAAI,gBAAgB,EAAE,CAAC;AAEhD,kBAAe,gBAAgB,CAAC","sourcesContent":["import { fullCleanCwd } from \"../../helpers/fs.helpers\";\nimport { getVersion } from \"./cli.helpers\";\n\n/**\n * Helps in putting Arkosjs watermark\n */\nclass WatermarkStamper {\n /**\n * Stamps Arkosjs watermark with Local and Environments\n */\n stamp({\n envFiles,\n host,\n port,\n }: {\n envFiles: string[] | undefined;\n host: string | undefined;\n port: string | undefined;\n }) {\n console.info(`\\n \\x1b[1m\\x1b[36m Arkos.js ${getVersion()}\\x1b[0m`);\n if (host && port) console.info(` - Local: http://${host}:${port}`);\n if (envFiles?.length || 0 > 1)\n if (envFiles?.length || 0 > 1)\n console.info(\n ` - Environments: ${fullCleanCwd(envFiles?.join(\", \") || \"\")\n .replaceAll(`\\\\`, \"\")\n .replaceAll(\"/\", \"\")}\\n`\n );\n }\n}\n\nconst watermarkStamper = new WatermarkStamper();\n\nexport default watermarkStamper;\n"]}
@@ -18,10 +18,7 @@ function fullCleanCwd(path) {
18
18
  if (path.startsWith(`/${process.cwd()}`) ||
19
19
  path.startsWith(`${process.cwd()}`) ||
20
20
  path.startsWith(`${process.cwd()}/`))
21
- return path
22
- .replace(process.cwd(), "")
23
- .replace(/^\/+/g, "")
24
- .replace("\\", "");
21
+ return path.replaceAll(process.cwd(), "").replaceAll(/^\/+/g, "");
25
22
  else
26
23
  return path;
27
24
  }
@@ -1 +1 @@
1
- {"version":3,"file":"fs.helpers.js","sourceRoot":"","sources":["../../../../src/utils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CAAC,CAAC,CAAC;QACvE,MAAM,QAAQ,GAAG,YAAE,CAAC,UAAU,CAAC,cAAI,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;QAEvE,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,KAAK,MAAM,CAAC;QAEvD,IAAI,WAAW;YAAE,yBAAiB,GAAG,IAAI,CAAC;aACrC,IAAI,WAAW,IAAI,QAAQ;YAAE,yBAAiB,GAAG,IAAI,CAAC;aACtD,IAAI,QAAQ,IAAI,CAAC,QAAQ;YAAE,yBAAiB,GAAG,IAAI,CAAC;aACpD,IAAI,QAAQ;YAAE,yBAAiB,GAAG,IAAI,CAAC;;YACvC,yBAAiB,GAAG,IAAI,CAAC;QAE9B,OAAO,yBAAiB,CAAC;IAC3B,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,yBAAiB,GAAG,IAAI,CAAC;QACzB,OAAO,yBAAiB,CAAC;IAC3B,CAAC;AACH,CAAC,CAAC;AAxBW,QAAA,oBAAoB,wBAwB/B;AAgBF,SAAgB,eAAe,CAAC,QAAgB;IAC9C,IAAI,CAAC;QACH,OAAO,YAAE,CAAC,UAAU,CAAC,cAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC/C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC","sourcesContent":["import fs from \"fs\";\nimport path from \"path\";\n\nexport const crd = () =>\n process.env.ARKOS_BUILD === \"true\"\n ? process.cwd() + \"/.build/\"\n : process.cwd();\n\n/**\n * Removes the current working directory prefix from the given path.\n * Handles cases with or without a trailing slash in cwd.\n * @param path - The path to clean\n * @returns The path without the cwd prefix\n */\nexport function fullCleanCwd(path: string): string {\n if (typeof path !== \"string\") throw new Error(\"Path must be a string\");\n\n if (\n path.startsWith(`/${process.cwd()}`) ||\n path.startsWith(`${process.cwd()}`) ||\n path.startsWith(`${process.cwd()}/`)\n )\n return path\n .replace(process.cwd(), \"\")\n .replace(/^\\/+/g, \"\")\n .replace(\"\\\\\", \"\");\n else return path;\n}\n\nexport let userFileExtension: \"ts\" | \"js\" | undefined;\n\n/**\n * Detects the file extension that should be used in the current execution context\n * Returns 'ts' when TypeScript config exists and not in build mode, otherwise 'js'\n * @returns 'ts' | 'js'\n */\nexport const getUserFileExtension = (): \"ts\" | \"js\" => {\n if (userFileExtension) return userFileExtension;\n\n try {\n const currentDir = process.cwd();\n\n const hasTsConfig = fs.existsSync(path.join(currentDir, \"tsconfig.json\"));\n\n const hasAppTs = fs.existsSync(path.join(currentDir, \"src\", \"app.ts\"));\n const hasAppJs = fs.existsSync(path.join(currentDir, \"src\", \"app.js\"));\n\n const isBuildMode = process.env.ARKOS_BUILD === \"true\";\n\n if (isBuildMode) userFileExtension = \"js\";\n else if (hasTsConfig && hasAppTs) userFileExtension = \"ts\";\n else if (hasAppTs && !hasAppJs) userFileExtension = \"ts\";\n else if (hasAppJs) userFileExtension = \"js\";\n else userFileExtension = \"js\";\n\n return userFileExtension;\n } catch (e) {\n userFileExtension = \"js\";\n return userFileExtension;\n }\n};\n\n/**\n * Checks if a file exists at the specified file path.\n *\n * @param filePath - The path to the file to check\n * @returns {boolean} True if the file exists, false otherwise or if there's an error\n *\n * @example\n * ```ts\n * const exists = checkFileExists('./path/to/file.txt');\n * if (exists) {\n * console.info('File exists!');\n * }\n * ```\n */\nexport function checkFileExists(filePath: string): boolean {\n try {\n return fs.existsSync(path.resolve(filePath));\n } catch (error) {\n return false;\n }\n}\n"]}
1
+ {"version":3,"file":"fs.helpers.js","sourceRoot":"","sources":["../../../../src/utils/helpers/fs.helpers.ts"],"names":[],"mappings":";;;;;;AAcA,oCAUC;AAiDD,0CAMC;AA/ED,4CAAoB;AACpB,gDAAwB;AAEjB,MAAM,GAAG,GAAG,GAAG,EAAE,CACtB,OAAO,CAAC,GAAG,CAAC,WAAW,KAAK,MAAM;IAChC,C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AW;YAAE,yBAAiB,GAAG,IAAI,CAAC;aACrC,IAAI,WAAW,IAAI,QAAQ;YAAE,yBAAiB,GAAG,IAAI,CAAC;aACtD,IAAI,QAAQ,IAAI,CAAC,QAAQ;YAAE,yBAAiB,GAAG,IAAI,CAAC;aACpD,IAAI,QAAQ;YAAE,yBAAiB,GAAG,IAAI,CAAC;;YACvC,yBAAiB,GAAG,IAAI,CAAC;QAE9B,OAAO,yBAAiB,CAAC;IAC3B,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,yBAAiB,GAAG,IAAI,CAAC;QACzB,OAAO,yBAAiB,CAAC;IAC3B,CAAC;AACH,CAAC,CAAC;AAxBW,QAAA,oBAAoB,wBAwB/B;AAgBF,SAAgB,eAAe,CAAC,QAAgB;IAC9C,IAAI,CAAC;QACH,OAAO,YAAE,CAAC,UAAU,CAAC,cAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC/C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC","sourcesContent":["import fs from \"fs\";\nimport path from \"path\";\n\nexport const crd = () =>\n process.env.ARKOS_BUILD === \"true\"\n ? process.cwd() + \"/.build/\"\n : process.cwd();\n\n/**\n * Removes the current working directory prefix from the given path.\n * Handles cases with or without a trailing slash in cwd.\n * @param path - The path to clean\n * @returns The path without the cwd prefix\n */\nexport function fullCleanCwd(path: string): string {\n if (typeof path !== \"string\") throw new Error(\"Path must be a string\");\n\n if (\n path.startsWith(`/${process.cwd()}`) ||\n path.startsWith(`${process.cwd()}`) ||\n path.startsWith(`${process.cwd()}/`)\n )\n return path.replaceAll(process.cwd(), \"\").replaceAll(/^\\/+/g, \"\");\n else return path;\n}\n\nexport let userFileExtension: \"ts\" | \"js\" | undefined;\n\n/**\n * Detects the file extension that should be used in the current execution context\n * Returns 'ts' when TypeScript config exists and not in build mode, otherwise 'js'\n * @returns 'ts' | 'js'\n */\nexport const getUserFileExtension = (): \"ts\" | \"js\" => {\n if (userFileExtension) return userFileExtension;\n\n try {\n const currentDir = process.cwd();\n\n const hasTsConfig = fs.existsSync(path.join(currentDir, \"tsconfig.json\"));\n\n const hasAppTs = fs.existsSync(path.join(currentDir, \"src\", \"app.ts\"));\n const hasAppJs = fs.existsSync(path.join(currentDir, \"src\", \"app.js\"));\n\n const isBuildMode = process.env.ARKOS_BUILD === \"true\";\n\n if (isBuildMode) userFileExtension = \"js\";\n else if (hasTsConfig && hasAppTs) userFileExtension = \"ts\";\n else if (hasAppTs && !hasAppJs) userFileExtension = \"ts\";\n else if (hasAppJs) userFileExtension = \"js\";\n else userFileExtension = \"js\";\n\n return userFileExtension;\n } catch (e) {\n userFileExtension = \"js\";\n return userFileExtension;\n }\n};\n\n/**\n * Checks if a file exists at the specified file path.\n *\n * @param filePath - The path to the file to check\n * @returns {boolean} True if the file exists, false otherwise or if there's an error\n *\n * @example\n * ```ts\n * const exists = checkFileExists('./path/to/file.txt');\n * if (exists) {\n * console.info('File exists!');\n * }\n * ```\n */\nexport function checkFileExists(filePath: string): boolean {\n try {\n return fs.existsSync(path.resolve(filePath));\n } catch (error) {\n return false;\n }\n}\n"]}
@@ -11,6 +11,6 @@ export function killServerChildProcess() {
11
11
  killProductionServerChildProcess();
12
12
  }
13
13
  export function getVersion() {
14
- return "1.3.8-canary.2";
14
+ return "1.3.8-canary.3";
15
15
  }
16
16
  //# sourceMappingURL=cli.helpers.js.map
@@ -1,3 +1,4 @@
1
+ import { fullCleanCwd } from "../../helpers/fs.helpers.js";
1
2
  import { getVersion } from "./cli.helpers.js";
2
3
  class WatermarkStamper {
3
4
  stamp({ envFiles, host, port, }) {
@@ -5,9 +6,10 @@ class WatermarkStamper {
5
6
  if (host && port)
6
7
  console.info(` - Local: http://${host}:${port}`);
7
8
  if (envFiles?.length || 0 > 1)
8
- console.info(` - Environments: ${envFiles
9
- ?.join(", ")
10
- .replaceAll(`${process.cwd()}/`, "")}\n`);
9
+ if (envFiles?.length || 0 > 1)
10
+ console.info(` - Environments: ${fullCleanCwd(envFiles?.join(", ") || "")
11
+ .replaceAll(`\\`, "")
12
+ .replaceAll("/", "")}\n`);
11
13
  }
12
14
  }
13
15
  const watermarkStamper = new WatermarkStamper();
@@ -1 +1 @@
1
- {"version":3,"file":"watermark-stamper.js","sourceRoot":"","sources":["../../../../../src/utils/cli/utils/watermark-stamper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAK3C,MAAM,gBAAgB;IAIpB,KAAK,CAAC,EACJ,QAAQ,EACR,IAAI,EACJ,IAAI,GAKL;QACC,OAAO,CAAC,IAAI,CAAC,iCAAiC,UAAU,EAAE,SAAS,CAAC,CAAC;QACrE,IAAI,IAAI,IAAI,IAAI;YAAE,OAAO,CAAC,IAAI,CAAC,4BAA4B,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC;QAC3E,IAAI,QAAQ,EAAE,MAAM,IAAI,CAAC,GAAG,CAAC;YAC3B,OAAO,CAAC,IAAI,CACV,qBAAqB,QAAQ;gBAC3B,EAAE,IAAI,CAAC,IAAI,CAAC;iBACX,UAAU,CAAC,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,IAAI,CAC3C,CAAC;IACN,CAAC;CACF;AAED,MAAM,gBAAgB,GAAG,IAAI,gBAAgB,EAAE,CAAC;AAEhD,eAAe,gBAAgB,CAAC","sourcesContent":["import { getVersion } from \"./cli.helpers\";\n\n/**\n * Helps in putting Arkosjs watermark\n */\nclass WatermarkStamper {\n /**\n * Stamps Arkosjs watermark with Local and Environments\n */\n stamp({\n envFiles,\n host,\n port,\n }: {\n envFiles: string[] | undefined;\n host: string | undefined;\n port: string | undefined;\n }) {\n console.info(`\\n \\x1b[1m\\x1b[36m Arkos.js ${getVersion()}\\x1b[0m`);\n if (host && port) console.info(` - Local: http://${host}:${port}`);\n if (envFiles?.length || 0 > 1)\n console.info(\n ` - Environments: ${envFiles\n ?.join(\", \")\n .replaceAll(`${process.cwd()}/`, \"\")}\\n`\n );\n }\n}\n\nconst watermarkStamper = new WatermarkStamper();\n\nexport default watermarkStamper;\n"]}
1
+ {"version":3,"file":"watermark-stamper.js","sourceRoot":"","sources":["../../../../../src/utils/cli/utils/watermark-stamper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAK3C,MAAM,gBAAgB;IAIpB,KAAK,CAAC,EACJ,QAAQ,EACR,IAAI,EACJ,IAAI,GAKL;QACC,OAAO,CAAC,IAAI,CAAC,iCAAiC,UAAU,EAAE,SAAS,CAAC,CAAC;QACrE,IAAI,IAAI,IAAI,IAAI;YAAE,OAAO,CAAC,IAAI,CAAC,4BAA4B,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC;QAC3E,IAAI,QAAQ,EAAE,MAAM,IAAI,CAAC,GAAG,CAAC;YAC3B,IAAI,QAAQ,EAAE,MAAM,IAAI,CAAC,GAAG,CAAC;gBAC3B,OAAO,CAAC,IAAI,CACV,qBAAqB,YAAY,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;qBAC1D,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC;qBACpB,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAC3B,CAAC;IACR,CAAC;CACF;AAED,MAAM,gBAAgB,GAAG,IAAI,gBAAgB,EAAE,CAAC;AAEhD,eAAe,gBAAgB,CAAC","sourcesContent":["import { fullCleanCwd } from \"../../helpers/fs.helpers\";\nimport { getVersion } from \"./cli.helpers\";\n\n/**\n * Helps in putting Arkosjs watermark\n */\nclass WatermarkStamper {\n /**\n * Stamps Arkosjs watermark with Local and Environments\n */\n stamp({\n envFiles,\n host,\n port,\n }: {\n envFiles: string[] | undefined;\n host: string | undefined;\n port: string | undefined;\n }) {\n console.info(`\\n \\x1b[1m\\x1b[36m Arkos.js ${getVersion()}\\x1b[0m`);\n if (host && port) console.info(` - Local: http://${host}:${port}`);\n if (envFiles?.length || 0 > 1)\n if (envFiles?.length || 0 > 1)\n console.info(\n ` - Environments: ${fullCleanCwd(envFiles?.join(\", \") || \"\")\n .replaceAll(`\\\\`, \"\")\n .replaceAll(\"/\", \"\")}\\n`\n );\n }\n}\n\nconst watermarkStamper = new WatermarkStamper();\n\nexport default watermarkStamper;\n"]}
@@ -9,10 +9,7 @@ export function fullCleanCwd(path) {
9
9
  if (path.startsWith(`/${process.cwd()}`) ||
10
10
  path.startsWith(`${process.cwd()}`) ||
11
11
  path.startsWith(`${process.cwd()}/`))
12
- return path
13
- .replace(process.cwd(), "")
14
- .replace(/^\/+/g, "")
15
- .replace("\\", "");
12
+ return path.replaceAll(process.cwd(), "").replaceAll(/^\/+/g, "");
16
13
  else
17
14
  return path;
18
15
  }
@@ -1 +1 @@
1
- {"version":3,"file":"fs.helpers.js","sourceRoot":"","sources":["../../../../src/utils/helpers/fs.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,MAAM,CAAC,MAAM,GAAG,GAAG,GAAG,EAAE,CACtB,OAAO,CAAC,GAAG,CAAC,WAAW,KAAK,MAAM;IAChC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,UAAU;IAC5B,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;AAQpB,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAEvE,IACE,IAAI,CAAC,UAAU,CAAC,IAAI,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC;QACpC,IAAI,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC;QACnC,IAAI,CAAC,UAA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,CAAC;QACX,iBAAiB,GAAG,IAAI,CAAC;QACzB,OAAO,iBAAiB,CAAC;IAC3B,CAAC;AACH,CAAC,CAAC;AAgBF,MAAM,UAAU,eAAe,CAAC,QAAgB;IAC9C,IAAI,CAAC;QACH,OAAO,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC/C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC","sourcesContent":["import fs from \"fs\";\nimport path from \"path\";\n\nexport const crd = () =>\n process.env.ARKOS_BUILD === \"true\"\n ? process.cwd() + \"/.build/\"\n : process.cwd();\n\n/**\n * Removes the current working directory prefix from the given path.\n * Handles cases with or without a trailing slash in cwd.\n * @param path - The path to clean\n * @returns The path without the cwd prefix\n */\nexport function fullCleanCwd(path: string): string {\n if (typeof path !== \"string\") throw new Error(\"Path must be a string\");\n\n if (\n path.startsWith(`/${process.cwd()}`) ||\n path.startsWith(`${process.cwd()}`) ||\n path.startsWith(`${process.cwd()}/`)\n )\n return path\n .replace(process.cwd(), \"\")\n .replace(/^\\/+/g, \"\")\n .replace(\"\\\\\", \"\");\n else return path;\n}\n\nexport let userFileExtension: \"ts\" | \"js\" | undefined;\n\n/**\n * Detects the file extension that should be used in the current execution context\n * Returns 'ts' when TypeScript config exists and not in build mode, otherwise 'js'\n * @returns 'ts' | 'js'\n */\nexport const getUserFileExtension = (): \"ts\" | \"js\" => {\n if (userFileExtension) return userFileExtension;\n\n try {\n const currentDir = process.cwd();\n\n const hasTsConfig = fs.existsSync(path.join(currentDir, \"tsconfig.json\"));\n\n const hasAppTs = fs.existsSync(path.join(currentDir, \"src\", \"app.ts\"));\n const hasAppJs = fs.existsSync(path.join(currentDir, \"src\", \"app.js\"));\n\n const isBuildMode = process.env.ARKOS_BUILD === \"true\";\n\n if (isBuildMode) userFileExtension = \"js\";\n else if (hasTsConfig && hasAppTs) userFileExtension = \"ts\";\n else if (hasAppTs && !hasAppJs) userFileExtension = \"ts\";\n else if (hasAppJs) userFileExtension = \"js\";\n else userFileExtension = \"js\";\n\n return userFileExtension;\n } catch (e) {\n userFileExtension = \"js\";\n return userFileExtension;\n }\n};\n\n/**\n * Checks if a file exists at the specified file path.\n *\n * @param filePath - The path to the file to check\n * @returns {boolean} True if the file exists, false otherwise or if there's an error\n *\n * @example\n * ```ts\n * const exists = checkFileExists('./path/to/file.txt');\n * if (exists) {\n * console.info('File exists!');\n * }\n * ```\n */\nexport function checkFileExists(filePath: string): boolean {\n try {\n return fs.existsSync(path.resolve(filePath));\n } catch (error) {\n return false;\n }\n}\n"]}
1
+ {"version":3,"file":"fs.helpers.js","sourceRoot":"","sources":["../../../../src/utils/helpers/fs.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,MAAM,CAAC,MAAM,GAAG,GAAG,GAAG,EAAE,CACtB,OAAO,CAAC,GAAG,CAAC,WAAW,KAAK,MAAM;IAChC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,UAAU;IAC5B,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;AAQpB,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAEvE,IACE,IAAI,CAAC,UAAU,CAAC,IAAI,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC;QACpC,IAAI,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC;QACnC,IAAI,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC;QAEpC,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,OAAO,EAAE,EAA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,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC/C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC","sourcesContent":["import fs from \"fs\";\nimport path from \"path\";\n\nexport const crd = () =>\n process.env.ARKOS_BUILD === \"true\"\n ? process.cwd() + \"/.build/\"\n : process.cwd();\n\n/**\n * Removes the current working directory prefix from the given path.\n * Handles cases with or without a trailing slash in cwd.\n * @param path - The path to clean\n * @returns The path without the cwd prefix\n */\nexport function fullCleanCwd(path: string): string {\n if (typeof path !== \"string\") throw new Error(\"Path must be a string\");\n\n if (\n path.startsWith(`/${process.cwd()}`) ||\n path.startsWith(`${process.cwd()}`) ||\n path.startsWith(`${process.cwd()}/`)\n )\n return path.replaceAll(process.cwd(), \"\").replaceAll(/^\\/+/g, \"\");\n else return path;\n}\n\nexport let userFileExtension: \"ts\" | \"js\" | undefined;\n\n/**\n * Detects the file extension that should be used in the current execution context\n * Returns 'ts' when TypeScript config exists and not in build mode, otherwise 'js'\n * @returns 'ts' | 'js'\n */\nexport const getUserFileExtension = (): \"ts\" | \"js\" => {\n if (userFileExtension) return userFileExtension;\n\n try {\n const currentDir = process.cwd();\n\n const hasTsConfig = fs.existsSync(path.join(currentDir, \"tsconfig.json\"));\n\n const hasAppTs = fs.existsSync(path.join(currentDir, \"src\", \"app.ts\"));\n const hasAppJs = fs.existsSync(path.join(currentDir, \"src\", \"app.js\"));\n\n const isBuildMode = process.env.ARKOS_BUILD === \"true\";\n\n if (isBuildMode) userFileExtension = \"js\";\n else if (hasTsConfig && hasAppTs) userFileExtension = \"ts\";\n else if (hasAppTs && !hasAppJs) userFileExtension = \"ts\";\n else if (hasAppJs) userFileExtension = \"js\";\n else userFileExtension = \"js\";\n\n return userFileExtension;\n } catch (e) {\n userFileExtension = \"js\";\n return userFileExtension;\n }\n};\n\n/**\n * Checks if a file exists at the specified file path.\n *\n * @param filePath - The path to the file to check\n * @returns {boolean} True if the file exists, false otherwise or if there's an error\n *\n * @example\n * ```ts\n * const exists = checkFileExists('./path/to/file.txt');\n * if (exists) {\n * console.info('File exists!');\n * }\n * ```\n */\nexport function checkFileExists(filePath: string): boolean {\n try {\n return fs.existsSync(path.resolve(filePath));\n } catch (error) {\n return false;\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arkos",
3
- "version": "1.3.8-canary.2",
3
+ "version": "1.3.8-canary.3",
4
4
  "description": "The Express & Prisma RESTful Framework",
5
5
  "main": "dist/cjs/exports/index.js",
6
6
  "module": "dist/esm/exports/index.js",