arkos 1.1.0-beta → 1.1.1-test

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.
package/cli.js CHANGED
@@ -1,50 +1,4 @@
1
1
  #!/usr/bin/env node
2
- // // cli.js (in the root of your package)
3
-
4
- // // This is a bridge file that works with both CJS and ESM
5
- // // It will dynamically load the appropriate version of the CLI
6
-
7
- // // Use strict to catch common coding issues
8
- // "use strict";
9
-
10
- // // Set up exports variable to silence node warnings about exports
11
- // const exports = {};
12
-
13
- // // Determine if we should use ESM or CJS
14
- // let useEsm = false;
15
-
16
- // try {
17
- // // Check if current environment is set to use ESM
18
- // const pkgPath = require("path").join(process.cwd(), "package.json");
19
- // if (require("fs").existsSync(pkgPath)) {
20
- // const pkg = JSON.parse(require("fs").readFileSync(pkgPath, "utf8"));
21
- // useEsm = pkg.type === "module";
22
- // }
23
- // } catch (err) {
24
- // // Ignore errors and default to CJS
25
- // }
26
-
27
- // // Import the appropriate version
28
- // if (useEsm) {
29
- // // Use dynamic import for ESM
30
- // import("./dist/es2020/utils/cli/index.js").catch((err) => {
31
- // console.error("Failed to load ESM CLI:", err);
32
- // process.exit(1);
33
- // });
34
- // } else {
35
- // // Regular require for CommonJS
36
- // try {
37
- // require("./dist/cjs/utils/cli/index.js");
38
- // } catch (err) {
39
- // console.error("Failed to load CJS CLI:", err);
40
- // process.exit(1);
41
- // }
42
- // }
43
-
44
- // cli.js (in the root of your package)
45
-
46
- // This is a bridge file that works with both CJS and ESM
47
- // It needs to be able to run in both module systems
48
2
 
49
3
  // First, we need to detect which module system we're running in
50
4
  // We'll use dynamic import which works in both systems
@@ -72,11 +26,10 @@
72
26
  // Import the appropriate version
73
27
  if (useEsm) {
74
28
  // Use dynamic import for ESM
75
- const index = await import("./dist/es2020/utils/cli/index.js");
76
- console.log("esm", index);
29
+ await import("./dist/es2020/utils/cli/index.js");
77
30
  } else {
78
31
  // For CommonJS, we still need to use dynamic import in an ESM context
79
- const index = await import("./dist/cjs/utils/cli/index.js");
32
+ await import("./dist/cjs/utils/cli/index.js");
80
33
  // console.log("cjs", index);
81
34
  }
82
35
  } catch (err) {
@@ -1 +1 @@
1
- "use strict";var __awaiter=this&&this.__awaiter||function(e,t,n,s){function l(r){return r instanceof n?r:new n(function(i){i(r)})}return new(n||(n=Promise))(function(r,i){function u(o){try{p(s.next(o))}catch(c){i(c)}}function a(o){try{p(s.throw(o))}catch(c){i(c)}}function p(o){o.done?r(o.value):l(o.value).then(u,a)}p((s=s.apply(e,t||[])).next())})},__importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.server=void 0,exports.getArkosConfig=getArkosConfig,exports.getExpressApp=getExpressApp,exports.initApp=initApp;const app_1=require("./app"),deepmerge_helper_1=__importDefault(require("./utils/helpers/deepmerge.helper"));process.on("uncaughtException",e=>{console.error("UNCAUGHT EXCEPTION! SHUTTING DOWN..."),console.error(e.name,e.message),console.error(e),process.exit(1)});let server,_app,_arkosConfig={welcomeMessage:"Welcome to our RESTful API generated by Arkos, find out more about Arkos at www.arkosjs.com",port:8e3,fileUpload:{baseUploadDir:"uploads",baseRoute:"/api/uploads"}};function initApp(){return __awaiter(this,arguments,void 0,function*(e={}){_arkosConfig=(0,deepmerge_helper_1.default)(_arkosConfig,e);const t=_arkosConfig.port;return _app=yield(0,app_1.bootstrap)(_arkosConfig),t&&(exports.server=server=_app.listen(e?.host?[t,e?.host]:t,()=>{const n=new Date().toTimeString().split(" ")[0];console.info(`[\x1B[32mREADY\x1B[0m] \x1B[90m${n}\x1B[0m App running on port \x1B[33m${t}\x1B[0m, server waiting on http://localhost:${t}`),process.env.NODE_ENV&&console.info(`${`Environment: ${process.env.NODE_ENV}`}`)})),_app})}process.on("unhandledRejection",e=>{console.error("UNHANDLED REJECTION! SHUTTING DOWN..."),console.error(e.name,e.message),console.error(e),server?.close(()=>{process.exit(1)})});function getArkosConfig(){return _arkosConfig}function getExpressApp(){return _app}
1
+ "use strict";var __awaiter=this&&this.__awaiter||function(e,o,n,s){function c(r){return r instanceof n?r:new n(function(i){i(r)})}return new(n||(n=Promise))(function(r,i){function l(t){try{p(s.next(t))}catch(u){i(u)}}function a(t){try{p(s.throw(t))}catch(u){i(u)}}function p(t){t.done?r(t.value):c(t.value).then(l,a)}p((s=s.apply(e,o||[])).next())})},__importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.server=void 0,exports.getArkosConfig=getArkosConfig,exports.getExpressApp=getExpressApp,exports.initApp=initApp;const app_1=require("./app"),deepmerge_helper_1=__importDefault(require("./utils/helpers/deepmerge.helper"));process.on("uncaughtException",e=>{console.error("UNCAUGHT EXCEPTION! SHUTTING DOWN..."),console.error(e.name,e.message),console.error(e),process.exit(1)});let server,_app,_arkosConfig={welcomeMessage:"Welcome to our RESTful API generated by Arkos, find out more about Arkos at www.arkosjs.com",port:8e3,fileUpload:{baseUploadDir:"uploads",baseRoute:"/api/uploads"}};function initApp(){return __awaiter(this,arguments,void 0,function*(e={}){_arkosConfig=(0,deepmerge_helper_1.default)(_arkosConfig,e);const o=_arkosConfig.port;return _app=yield(0,app_1.bootstrap)(_arkosConfig),o&&(exports.server=server=_app.listen(e?.host?[o,e?.host]:o,()=>{const n=new Date().toTimeString().split(" ")[0];process.env.NODE_ENV&&console.info(`${`Environment: ${process.env.NODE_ENV}`}`)})),_app})}process.on("unhandledRejection",e=>{console.error("UNHANDLED REJECTION! SHUTTING DOWN..."),console.error(e.name,e.message),console.error(e),server?.close(()=>{process.exit(1)})});function getArkosConfig(){return _arkosConfig}function getExpressApp(){return _app}
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAwEA,wCAEC;AAED,sCAEC;AAEgB,0BAAO;AA7ExB,+BAAkC;AAElC,wFAAyD;AAEzD,OAAO,CA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,QAAQ;oBACxB,OAAO,CAAC,IAAI,CAAC,GAAG,gBAAgB,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;YAC9D,CAAC,CACF,CAAC;QAEJ,OAAO,IAAI,CAAC;IACd,CAAC;CAAA;AAED,OAAO,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC,GAAa,EAAE,EAAE;IACjD,OAAO,CAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC;IACvD,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IACrC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnB,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,CAAC,GAAG,EAAE;QACjB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,SAAgB,cAAc;IAC5B,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,SAAgB,aAAa;IAC3B,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { IncomingMessage, Server, ServerResponse } from \"http\";\nimport AppError from \"./modules/error-handler/utils/app-error\";\nimport { Express } from \"express\";\nimport { bootstrap } from \"./app\";\nimport { ArkosConfig } from \"./types/arkos-config\";\nimport deepmerge from \"./utils/helpers/deepmerge.helper\";\n\nprocess.on(\"uncaughtException\", (err) => {\n console.error(\"UNCAUGHT EXCEPTION! SHUTTING DOWN...\");\n console.error(err.name, err.message);\n console.error(err);\n process.exit(1);\n});\n\nlet server: Server<typeof IncomingMessage, typeof ServerResponse>;\nlet _app: Express;\n\nlet _arkosConfig: ArkosConfig = {\n welcomeMessage:\n \"Welcome to our RESTful API generated by Arkos, find out more about Arkos at www.arkosjs.com\",\n port: 8000,\n fileUpload: {\n baseUploadDir: \"uploads\",\n baseRoute: \"/api/uploads\",\n },\n};\n\n/**\n * Initializes the application server.\n *\n * This function starts the server by listening on a specified port.\n * The port is determined by the following order of precedence:\n * 1. The `port` argument passed to the function.\n * 2. Defaults to `8000` if neither is provided.\n *\n * @param {ArkosConfig} arkosConfig - initial configs for the api ( authentication, port).\n * @returns {Promise<Express>} This function returns the Express App after all middlewares configurations.\n * You can prevent it from listen py passing port as undefined\n *\n */\nasync function initApp(arkosConfig: ArkosConfig = {}): Promise<Express> {\n _arkosConfig = deepmerge(_arkosConfig, arkosConfig);\n\n const port = _arkosConfig.port;\n _app = await bootstrap(_arkosConfig);\n\n if (port)\n server = _app.listen(\n arkosConfig?.host ? [port, arkosConfig?.host!] : port,\n () => {\n const time = new Date().toTimeString().split(\" \")[0];\n console.info(\n `[\\x1b[32mREADY\\x1b[0m] \\x1b[90m${time}\\x1b[0m App running on port \\x1b[33m${port}\\x1b[0m, server waiting on http://localhost:${port}`\n );\n\n if (!!process.env.NODE_ENV)\n console.info(`${`Environment: ${process.env.NODE_ENV}`}`);\n }\n );\n\n return _app;\n}\n\nprocess.on(\"unhandledRejection\", (err: AppError) => {\n console.error(\"UNHANDLED REJECTION! SHUTTING DOWN...\");\n console.error(err.name, err.message);\n console.error(err);\n server?.close(() => {\n process.exit(1);\n });\n});\n\nexport function getArkosConfig() {\n return _arkosConfig;\n}\n\nexport function getExpressApp() {\n return _app;\n}\n\nexport { server, initApp };\n"]}
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAwEA,wCAEC;AAED,sCAEC;AAEgB,0BAAO;AA7ExB,+BAAkC;AAElC,wFAAyD;AAEzD,OAAO,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC,GAAG,EAAE,EAAE;IACtC,OAAO,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAC;IACtD,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IACrC,OAAO,CAAC,KAAK,CAAC,GAAG,CAA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AAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IACrC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnB,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,CAAC,GAAG,EAAE;QACjB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,SAAgB,cAAc;IAC5B,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,SAAgB,aAAa;IAC3B,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { IncomingMessage, Server, ServerResponse } from \"http\";\nimport AppError from \"./modules/error-handler/utils/app-error\";\nimport { Express } from \"express\";\nimport { bootstrap } from \"./app\";\nimport { ArkosConfig } from \"./types/arkos-config\";\nimport deepmerge from \"./utils/helpers/deepmerge.helper\";\n\nprocess.on(\"uncaughtException\", (err) => {\n console.error(\"UNCAUGHT EXCEPTION! SHUTTING DOWN...\");\n console.error(err.name, err.message);\n console.error(err);\n process.exit(1);\n});\n\nlet server: Server<typeof IncomingMessage, typeof ServerResponse>;\nlet _app: Express;\n\nlet _arkosConfig: ArkosConfig = {\n welcomeMessage:\n \"Welcome to our RESTful API generated by Arkos, find out more about Arkos at www.arkosjs.com\",\n port: 8000,\n fileUpload: {\n baseUploadDir: \"uploads\",\n baseRoute: \"/api/uploads\",\n },\n};\n\n/**\n * Initializes the application server.\n *\n * This function starts the server by listening on a specified port.\n * The port is determined by the following order of precedence:\n * 1. The `port` argument passed to the function.\n * 2. Defaults to `8000` if neither is provided.\n *\n * @param {ArkosConfig} arkosConfig - initial configs for the api ( authentication, port).\n * @returns {Promise<Express>} This function returns the Express App after all middlewares configurations.\n * You can prevent it from listen py passing port as undefined\n *\n */\nasync function initApp(arkosConfig: ArkosConfig = {}): Promise<Express> {\n _arkosConfig = deepmerge(_arkosConfig, arkosConfig);\n\n const port = _arkosConfig.port;\n _app = await bootstrap(_arkosConfig);\n\n if (port)\n server = _app.listen(\n arkosConfig?.host ? [port, arkosConfig?.host!] : port,\n () => {\n const time = new Date().toTimeString().split(\" \")[0];\n // console.info(\n // `[\\x1b[32mREADY\\x1b[0m] \\x1b[90m${time}\\x1b[0m App running on port \\x1b[33m${port}\\x1b[0m, server waiting on http://localhost:${port}`\n // );\n\n if (!!process.env.NODE_ENV)\n console.info(`${`Environment: ${process.env.NODE_ENV}`}`);\n }\n );\n\n return _app;\n}\n\nprocess.on(\"unhandledRejection\", (err: AppError) => {\n console.error(\"UNHANDLED REJECTION! SHUTTING DOWN...\");\n console.error(err.name, err.message);\n console.error(err);\n server?.close(() => {\n process.exit(1);\n });\n});\n\nexport function getArkosConfig() {\n return _arkosConfig;\n}\n\nexport function getExpressApp() {\n return _app;\n}\n\nexport { server, initApp };\n"]}
@@ -11,19 +11,17 @@ const fs_helpers_1 = require("../helpers/fs.helpers");
11
11
  const BUILD_DIR = ".build";
12
12
  const MODULE_TYPES = ["cjs", "esm"];
13
13
  function buildCommand(options = {}) {
14
- console.info("buildCommand executed");
15
14
  try {
16
- const moduleType = validateModuleType(options.module);
17
- console.info(`🚀 Building project (${moduleType})...`);
15
+ console.info(`Building project...`);
18
16
  ensureBuildDir();
19
17
  const fileExt = (0, fs_helpers_1.getUserFileExtension)();
20
- if (fileExt) {
21
- buildTypeScriptProject(options, moduleType);
18
+ if (fileExt === "ts") {
19
+ buildTypeScriptProject(options);
22
20
  }
23
21
  else {
24
- buildJavaScriptProject(options, moduleType);
22
+ buildJavaScriptProject(options);
25
23
  }
26
- console.info(`✅ Build complete! Output: ${BUILD_DIR}/${moduleType}/`);
24
+ console.info(`Build complete! Output: ${BUILD_DIR}/`);
27
25
  }
28
26
  catch (error) {
29
27
  console.error("❌ Build failed:", error);
@@ -54,8 +52,7 @@ function ensureBuildDir() {
54
52
  }
55
53
  }
56
54
  }
57
- function buildTypeScriptProject(options, moduleType) {
58
- console.info("📝 TypeScript project detected");
55
+ function buildTypeScriptProject(options) {
59
56
  const tsconfigPath = path_1.default.join(process.cwd(), options.config || "tsconfig.json");
60
57
  let tsconfig = {};
61
58
  try {
@@ -68,10 +65,9 @@ function buildTypeScriptProject(options, moduleType) {
68
65
  console.error("❌ Error reading tsconfig.json:", error);
69
66
  }
70
67
  const tempTsconfig = Object.assign(Object.assign({}, tsconfig), { compilerOptions: Object.assign(Object.assign({}, (tsconfig.compilerOptions || {})), { outDir: path_1.default.join(`./${BUILD_DIR}`) }) });
71
- const tempTsconfigPath = path_1.default.join(process.cwd(), `tsconfig.arkos-build-${moduleType}.json`);
68
+ const tempTsconfigPath = path_1.default.join(process.cwd(), `tsconfig.arkos-build.json`);
72
69
  fs_1.default.writeFileSync(tempTsconfigPath, JSON.stringify(tempTsconfig, null, 2));
73
70
  try {
74
- console.info(`Running TypeScript compiler (${moduleType})...`);
75
71
  if (options.watch) {
76
72
  const tsc = (0, child_process_1.spawn)("npx", ["tsc", "-p", tempTsconfigPath, "--watch"], {
77
73
  stdio: "inherit",
@@ -88,7 +84,6 @@ function buildTypeScriptProject(options, moduleType) {
88
84
  stdio: "inherit",
89
85
  cwd: process.cwd(),
90
86
  });
91
- copyAssetFiles(moduleType);
92
87
  cleanupTempConfig(tempTsconfigPath);
93
88
  }
94
89
  }
@@ -97,29 +92,24 @@ function buildTypeScriptProject(options, moduleType) {
97
92
  throw error;
98
93
  }
99
94
  }
100
- function buildJavaScriptProject(options, moduleType) {
101
- console.info("JavaScript project detected");
102
- const targetDir = path_1.default.join(BUILD_DIR, moduleType);
95
+ function buildJavaScriptProject(options) {
96
+ const targetDir = path_1.default.join(BUILD_DIR);
103
97
  try {
104
- console.info(`📂 Copying JavaScript files to ${targetDir}...`);
105
- if (moduleType === "esm") {
106
- (0, child_process_1.execSync)(`npx copyfiles -u 0 "src/**/*.js" "src/**/*.jsx" "src/**/*.mjs" ${targetDir}`, {
98
+ if (true) {
99
+ (0, child_process_1.execSync)(`npx copyfiles -u 0 "src/**/*.js" "src/**/*.jsx" "src/**/*.mjs" "src/**/*.cjs" ${targetDir}`, {
107
100
  stdio: "inherit",
108
101
  cwd: process.cwd(),
109
102
  });
110
103
  }
111
104
  else {
112
- (0, child_process_1.execSync)(`npx copyfiles -u 0 "src/**/*.js" "src/**/*.jsx" "src/**/*.cjs" ${targetDir}`, {
105
+ (0, child_process_1.execSync)(`npx copyfiles -u 0 "src/**/*.js" "src/**/*.jsx" "src/**/*.cjs" "src/**/*.mjs" ${targetDir}`, {
113
106
  stdio: "inherit",
114
107
  cwd: process.cwd(),
115
108
  });
116
109
  }
117
- copyAssetFiles(moduleType);
110
+ copyAssetFiles();
118
111
  if (options.watch) {
119
- console.info("Watch mode enabled. Press Ctrl+C to stop.");
120
- const patterns = moduleType === "esm"
121
- ? `"src/**/*.js" "src/**/*.jsx" "src/**/*.mjs"`
122
- : `"src/**/*.js" "src/**/*.jsx" "src/**/*.cjs"`;
112
+ const patterns = `"src/**/*.js" "src/**/*.jsx" "src/**/*.mjs" "src/**/*.cjs"`;
123
113
  const watcher = (0, child_process_1.spawn)("npx", ["chokidar", patterns, "-c", `npx copyfiles -u 0 {path} ${targetDir}`], {
124
114
  stdio: "inherit",
125
115
  shell: true,
@@ -135,10 +125,9 @@ function buildJavaScriptProject(options, moduleType) {
135
125
  throw error;
136
126
  }
137
127
  }
138
- function copyAssetFiles(moduleType) {
139
- const targetDir = path_1.default.join(BUILD_DIR, moduleType);
128
+ function copyAssetFiles() {
129
+ const targetDir = path_1.default.join(BUILD_DIR);
140
130
  try {
141
- console.info("Copying asset files...");
142
131
  (0, child_process_1.execSync)(`npx copyfiles -u 0 "src/**/*.json" "src/**/*.html" "src/**/*.css" "src/**/*.svg" "src/**/*.png" ${targetDir}`, {
143
132
  stdio: "inherit",
144
133
  cwd: process.cwd(),
@@ -1 +1 @@
1
- {"version":3,"file":"build.js","sourceRoot":"","sources":["../../../../src/utils/cli/build.ts"],"names":[],"mappings":";;;;;AAoBA,oCAyBC;AA5CD,gDAAwB;AACx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IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,sCAAsC,EAAE,KAAK,CAAC,CAAC;QAC7D,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAKD,SAAS,cAAc,CAAC,UAAsB;IAC5C,MAAM,SAAS,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IAEnD,IAAI,CAAC;QACH,OAAO,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;QACvC,IAAA,wBAAQ,EACN,mGAAmG,SAAS,EAAE,EAC9G;YACE,KAAK,EAAE,SAAS;YAChB,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;SACnB,CACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,qCAAqC,EAAE,KAAK,CAAC,CAAC;IAC7D,CAAC;AACH,CAAC;AAKD,SAAS,iBAAiB,CAAC,UAAkB;IAC3C,IAAI,CAAC;QACH,IAAI,YAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;YAC9B,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;YACnC,YAAE,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,8CAA8C,EAAE,KAAK,CAAC,CAAC;IACtE,CAAC;AACH,CAAC","sourcesContent":["// src/utils/cli/build.ts\nimport path from \"path\";\nimport fs from \"fs\";\nimport { execSync, spawn } from \"child_process\";\nimport { getUserFileExtension } from \"../helpers/fs.helpers\";\n\n// Constants\nconst BUILD_DIR = \".build\";\nconst MODULE_TYPES = [\"cjs\", \"esm\"] as const;\ntype ModuleType = (typeof MODULE_TYPES)[number];\n\ninterface BuildOptions {\n watch?: boolean;\n config?: string;\n module?: string;\n}\n\n/**\n * Main build function for the arkos CLI\n */\nexport function buildCommand(options: BuildOptions = {}) {\n console.info(\"buildCommand executed\");\n try {\n // Validate module type\n const moduleType = validateModuleType(options.module);\n\n console.info(`🚀 Building project (${moduleType})...`);\n\n // Ensure build directory exists\n ensureBuildDir();\n\n // Detect project type\n const fileExt = getUserFileExtension();\n\n if (fileExt) {\n buildTypeScriptProject(options, moduleType);\n } else {\n buildJavaScriptProject(options, moduleType);\n }\n\n console.info(`✅ Build complete! Output: ${BUILD_DIR}/${moduleType}/`);\n } catch (error) {\n console.error(\"❌ Build failed:\", error);\n process.exit(1);\n }\n}\n\n/**\n * Validates and normalizes module type option\n */\nfunction validateModuleType(moduleType?: string): ModuleType {\n if (!moduleType) return \"cjs\";\n\n const normalizedType = moduleType.toLowerCase();\n\n // Map common terms to our module types\n if (normalizedType === \"cjs\" || normalizedType === \"commonjs\") {\n return \"cjs\";\n } else if (\n [\"esm\", \"es\", \"es2020\", \"esnext\", \"module\"].includes(normalizedType)\n ) {\n return \"esm\";\n }\n\n // Default to CJS if unrecognized\n console.warn(\n `⚠️ Unrecognized module type \"${moduleType}\", defaulting to \"cjs\"`\n );\n return \"cjs\";\n}\n\n/**\n * Ensure the build directory exists\n */\nfunction ensureBuildDir() {\n if (!fs.existsSync(BUILD_DIR)) {\n fs.mkdirSync(BUILD_DIR, { recursive: true });\n }\n\n // Create module-specific subdirectories\n for (const moduleType of MODULE_TYPES) {\n const moduleDir = path.join(BUILD_DIR, moduleType);\n if (!fs.existsSync(moduleDir)) {\n fs.mkdirSync(moduleDir, { recursive: true });\n }\n }\n}\n\n/**\n * Build a TypeScript project\n */\nfunction buildTypeScriptProject(options: BuildOptions, moduleType: ModuleType) {\n console.info(\"📝 TypeScript project detected\");\n\n // Read the user's tsconfig.json\n const tsconfigPath = path.join(\n process.cwd(),\n options.config || \"tsconfig.json\"\n );\n let tsconfig: any = {};\n\n try {\n if (fs.existsSync(tsconfigPath)) {\n const tsconfigContent = fs.readFileSync(tsconfigPath, \"utf8\");\n tsconfig = JSON.parse(tsconfigContent);\n }\n } catch (error) {\n console.error(\"❌ Error reading tsconfig.json:\", error);\n // Continue with default config\n }\n\n // Create a custom tsconfig that outputs to our .build directory\n const tempTsconfig = {\n ...tsconfig,\n compilerOptions: {\n ...(tsconfig.compilerOptions || {}),\n outDir: path.join(`./${BUILD_DIR}`),\n },\n };\n\n const tempTsconfigPath = path.join(\n process.cwd(),\n `tsconfig.arkos-build-${moduleType}.json`\n );\n fs.writeFileSync(tempTsconfigPath, JSON.stringify(tempTsconfig, null, 2));\n\n try {\n // Run TypeScript compiler\n console.info(`Running TypeScript compiler (${moduleType})...`);\n\n if (options.watch) {\n // For watch mode, spawn a process\n const tsc = spawn(\"npx\", [\"tsc\", \"-p\", tempTsconfigPath, \"--watch\"], {\n stdio: \"inherit\",\n shell: true,\n });\n\n // Handle process exit\n process.on(\"SIGINT\", () => {\n tsc.kill();\n cleanupTempConfig(tempTsconfigPath);\n process.exit(0);\n });\n } else {\n // For one-time build, use execSync\n execSync(`npx tsc -p ${tempTsconfigPath}`, {\n stdio: \"inherit\",\n cwd: process.cwd(),\n });\n\n // Copy non-TypeScript files\n copyAssetFiles(moduleType);\n\n // Clean up temp config\n cleanupTempConfig(tempTsconfigPath);\n }\n } catch (error) {\n cleanupTempConfig(tempTsconfigPath);\n throw error;\n }\n}\n\n/**\n * Build a JavaScript project\n */\nfunction buildJavaScriptProject(options: BuildOptions, moduleType: ModuleType) {\n console.info(\"JavaScript project detected\");\n\n // Target directory\n const targetDir = path.join(BUILD_DIR, moduleType);\n\n try {\n // Copy JavaScript files\n console.info(`📂 Copying JavaScript files to ${targetDir}...`);\n\n // For JS projects, we need to handle module transformations if needed\n if (moduleType === \"esm\") {\n // For ESM output, we might want to transform CJS to ESM if needed\n // This is a simplified approach - for production, consider using tools like Babel\n execSync(\n `npx copyfiles -u 0 \"src/**/*.js\" \"src/**/*.jsx\" \"src/**/*.mjs\" ${targetDir}`,\n {\n stdio: \"inherit\",\n cwd: process.cwd(),\n }\n );\n } else {\n // For CJS output, direct copy is usually fine\n execSync(\n `npx copyfiles -u 0 \"src/**/*.js\" \"src/**/*.jsx\" \"src/**/*.cjs\" ${targetDir}`,\n {\n stdio: \"inherit\",\n cwd: process.cwd(),\n }\n );\n }\n\n // Copy asset files\n copyAssetFiles(moduleType);\n\n // Handle watch mode\n if (options.watch) {\n console.info(\"Watch mode enabled. Press Ctrl+C to stop.\");\n const patterns =\n moduleType === \"esm\"\n ? `\"src/**/*.js\" \"src/**/*.jsx\" \"src/**/*.mjs\"`\n : `\"src/**/*.js\" \"src/**/*.jsx\" \"src/**/*.cjs\"`;\n\n const watcher = spawn(\n \"npx\",\n [\"chokidar\", patterns, \"-c\", `npx copyfiles -u 0 {path} ${targetDir}`],\n {\n stdio: \"inherit\",\n shell: true,\n }\n );\n\n // Handle process exit\n process.on(\"SIGINT\", () => {\n watcher.kill();\n process.exit(0);\n });\n }\n } catch (error) {\n console.error(\"❌ Error building JavaScript project:\", error);\n throw error;\n }\n}\n\n/**\n * Copy asset files to the build directory\n */\nfunction copyAssetFiles(moduleType: ModuleType) {\n const targetDir = path.join(BUILD_DIR, moduleType);\n\n try {\n console.info(\"Copying asset files...\");\n execSync(\n `npx copyfiles -u 0 \"src/**/*.json\" \"src/**/*.html\" \"src/**/*.css\" \"src/**/*.svg\" \"src/**/*.png\" ${targetDir}`,\n {\n stdio: \"inherit\",\n cwd: process.cwd(),\n }\n );\n } catch (error) {\n console.warn(\"Warning: Error copying asset files:\", error);\n }\n}\n\n/**\n * Clean up temporary tsconfig\n */\nfunction cleanupTempConfig(configPath: string) {\n try {\n if (fs.existsSync(configPath)) {\n console.log(\"exitsts\", configPath);\n fs.unlinkSync(configPath);\n }\n } catch (error) {\n console.warn(\"Warning: Error cleaning up temporary config:\", error);\n }\n}\n"]}
1
+ {"version":3,"file":"build.js","sourceRoot":"","sources":["../../../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AC;IAC7D,CAAC;AACH,CAAC;AAKD,SAAS,iBAAiB,CAAC,UAAkB;IAC3C,IAAI,CAAC;QACH,IAAI,YAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;YAC9B,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;YACnC,YAAE,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,8CAA8C,EAAE,KAAK,CAAC,CAAC;IACtE,CAAC;AACH,CAAC","sourcesContent":["// src/utils/cli/build.ts\nimport path from \"path\";\nimport fs from \"fs\";\nimport { execSync, spawn } from \"child_process\";\nimport { getUserFileExtension } from \"../helpers/fs.helpers\";\n\n// Constants\nconst BUILD_DIR = \".build\";\nconst MODULE_TYPES = [\"cjs\", \"esm\"] as const;\ntype ModuleType = (typeof MODULE_TYPES)[number];\n\ninterface BuildOptions {\n watch?: boolean;\n config?: string;\n module?: string;\n}\n\n/**\n * Main build function for the arkos CLI\n */\nexport function buildCommand(options: BuildOptions = {}) {\n try {\n console.info(`Building project...`);\n\n ensureBuildDir();\n\n // Detect project type\n const fileExt = getUserFileExtension();\n\n if (fileExt === \"ts\") {\n buildTypeScriptProject(options);\n } else {\n buildJavaScriptProject(options);\n }\n\n console.info(`Build complete! Output: ${BUILD_DIR}/`);\n } catch (error) {\n console.error(\"❌ Build failed:\", error);\n process.exit(1);\n }\n}\n\n/**\n * Validates and normalizes module type option\n */\nfunction validateModuleType(moduleType?: string): ModuleType {\n if (!moduleType) return \"cjs\";\n\n const normalizedType = moduleType.toLowerCase();\n\n // Map common terms to our module types\n if (normalizedType === \"cjs\" || normalizedType === \"commonjs\") {\n return \"cjs\";\n } else if (\n [\"esm\", \"es\", \"es2020\", \"esnext\", \"module\"].includes(normalizedType)\n ) {\n return \"esm\";\n }\n\n // Default to CJS if unrecognized\n console.warn(\n `⚠️ Unrecognized module type \"${moduleType}\", defaulting to \"cjs\"`\n );\n return \"cjs\";\n}\n\n/**\n * Ensure the build directory exists\n */\nfunction ensureBuildDir() {\n if (!fs.existsSync(BUILD_DIR)) {\n fs.mkdirSync(BUILD_DIR, { recursive: true });\n }\n\n // Create module-specific subdirectories\n for (const moduleType of MODULE_TYPES) {\n const moduleDir = path.join(BUILD_DIR, moduleType);\n if (!fs.existsSync(moduleDir)) {\n fs.mkdirSync(moduleDir, { recursive: true });\n }\n }\n}\n\n/**\n * Build a TypeScript project\n */\nfunction buildTypeScriptProject(options: BuildOptions) {\n // Read the user's tsconfig.json\n const tsconfigPath = path.join(\n process.cwd(),\n options.config || \"tsconfig.json\"\n );\n let tsconfig: any = {};\n\n try {\n if (fs.existsSync(tsconfigPath)) {\n const tsconfigContent = fs.readFileSync(tsconfigPath, \"utf8\");\n tsconfig = JSON.parse(tsconfigContent);\n }\n } catch (error) {\n console.error(\"❌ Error reading tsconfig.json:\", error);\n // Continue with default config\n }\n\n // Create a custom tsconfig that outputs to our .build directory\n const tempTsconfig = {\n ...tsconfig,\n compilerOptions: {\n ...(tsconfig.compilerOptions || {}),\n outDir: path.join(`./${BUILD_DIR}`),\n },\n };\n\n const tempTsconfigPath = path.join(\n process.cwd(),\n `tsconfig.arkos-build.json`\n );\n fs.writeFileSync(tempTsconfigPath, JSON.stringify(tempTsconfig, null, 2));\n\n try {\n // Run TypeScript compiler\n\n if (options.watch) {\n // For watch mode, spawn a process\n const tsc = spawn(\"npx\", [\"tsc\", \"-p\", tempTsconfigPath, \"--watch\"], {\n stdio: \"inherit\",\n shell: true,\n });\n\n // Handle process exit\n process.on(\"SIGINT\", () => {\n tsc.kill();\n cleanupTempConfig(tempTsconfigPath);\n process.exit(0);\n });\n } else {\n // For one-time build, use execSync\n execSync(`npx tsc -p ${tempTsconfigPath}`, {\n stdio: \"inherit\",\n cwd: process.cwd(),\n });\n\n // Copy non-TypeScript files\n // copyAssetFiles(moduleType);\n\n // Clean up temp config\n cleanupTempConfig(tempTsconfigPath);\n }\n } catch (error) {\n cleanupTempConfig(tempTsconfigPath);\n throw error;\n }\n}\n\n/**\n * Build a JavaScript project\n */\nfunction buildJavaScriptProject(options: BuildOptions) {\n // Target directory\n const targetDir = path.join(BUILD_DIR);\n\n try {\n // For JS projects, we need to handle module transformations if needed\n if (true) {\n // For ESM output, we might want to transform CJS to ESM if needed\n // This is a simplified approach - for production, consider using tools like Babel\n execSync(\n `npx copyfiles -u 0 \"src/**/*.js\" \"src/**/*.jsx\" \"src/**/*.mjs\" \"src/**/*.cjs\" ${targetDir}`,\n {\n stdio: \"inherit\",\n cwd: process.cwd(),\n }\n );\n } else {\n // For CJS output, direct copy is usually fine\n execSync(\n `npx copyfiles -u 0 \"src/**/*.js\" \"src/**/*.jsx\" \"src/**/*.cjs\" \"src/**/*.mjs\" ${targetDir}`,\n {\n stdio: \"inherit\",\n cwd: process.cwd(),\n }\n );\n }\n\n // Copy asset files\n copyAssetFiles();\n\n // Handle watch mode\n if (options.watch) {\n const patterns = `\"src/**/*.js\" \"src/**/*.jsx\" \"src/**/*.mjs\" \"src/**/*.cjs\"`;\n\n const watcher = spawn(\n \"npx\",\n [\"chokidar\", patterns, \"-c\", `npx copyfiles -u 0 {path} ${targetDir}`],\n {\n stdio: \"inherit\",\n shell: true,\n }\n );\n\n // Handle process exit\n process.on(\"SIGINT\", () => {\n watcher.kill();\n process.exit(0);\n });\n }\n } catch (error) {\n console.error(\"❌ Error building JavaScript project:\", error);\n throw error;\n }\n}\n\n/**\n * Copy asset files to the build directory\n */\nfunction copyAssetFiles() {\n const targetDir = path.join(BUILD_DIR);\n\n try {\n execSync(\n `npx copyfiles -u 0 \"src/**/*.json\" \"src/**/*.html\" \"src/**/*.css\" \"src/**/*.svg\" \"src/**/*.png\" ${targetDir}`,\n {\n stdio: \"inherit\",\n cwd: process.cwd(),\n }\n );\n } catch (error) {\n console.warn(\"Warning: Error copying asset files:\", error);\n }\n}\n\n/**\n * Clean up temporary tsconfig\n */\nfunction cleanupTempConfig(configPath: string) {\n try {\n if (fs.existsSync(configPath)) {\n console.log(\"exitsts\", configPath);\n fs.unlinkSync(configPath);\n }\n } catch (error) {\n console.warn(\"Warning: Error cleaning up temporary config:\", error);\n }\n}\n"]}
@@ -3,21 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.devCommand = devCommand;
4
4
  const child_process_1 = require("child_process");
5
5
  const fs_helpers_1 = require("../helpers/fs.helpers");
6
+ const _1 = require(".");
7
+ const server_1 = require("../../server");
6
8
  function devCommand(options = {}) {
9
+ const configs = (0, server_1.getArkosConfig)();
10
+ console.log(configs);
7
11
  try {
8
12
  const { port, host } = options;
9
- console.info(`🚀 Starting development server on ${host}:${port}...`);
10
13
  const fileExt = (0, fs_helpers_1.getUserFileExtension)();
11
14
  const entryPoint = `src/app.${fileExt}`;
12
15
  if (!entryPoint) {
13
16
  console.error("❌ Could not find application entry point.");
14
17
  process.exit(1);
15
18
  }
16
- console.info(`📂 Using entry point: ${entryPoint}`);
17
19
  const env = Object.assign(Object.assign(Object.assign({ NODE_ENV: "development" }, process.env), (port && { PORT: port })), (host && { HOST: host }));
18
20
  let child;
19
21
  if (fileExt === "ts") {
20
- console.info("👀 Watch mode enabled. Changes will trigger restart.");
21
22
  child = (0, child_process_1.spawn)("npx", ["ts-node-dev", "--respawn", entryPoint], {
22
23
  stdio: "inherit",
23
24
  env,
@@ -31,6 +32,9 @@ function devCommand(options = {}) {
31
32
  shell: true,
32
33
  });
33
34
  }
35
+ console.info(`\x1b[1m\x1b[36m⇪ Arkos.js ${(0, _1.getVersion)()}\x1b[0m`);
36
+ console.info(`- Local: http://${host}:${port}`);
37
+ console.info(`- Environments: development\n`);
34
38
  process.on("SIGINT", () => {
35
39
  if (child) {
36
40
  child.kill();
@@ -1 +1 @@
1
- {"version":3,"file":"dev.js","sourceRoot":"","sources":["../../../../src/utils/cli/dev.ts"],"names":[],"mappings":";;AAYA,gCAyDC;AApED,iDAAs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C,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;YACxB,IAAI,KAAK,EAAE,CAAC;gBACV,KAAK,CAAC,IAAI,EAAE,CAAC;YACf,CAAC;YACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,uCAAuC,EAAE,KAAK,CAAC,CAAC;QAC9D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC","sourcesContent":["// src/utils/cli/dev.ts\nimport { spawn } from \"child_process\";\nimport { getUserFileExtension } from \"../helpers/fs.helpers\";\n\ninterface DevOptions {\n port?: string;\n host?: string;\n}\n\n/**\n * Dev server command for the arkos CLI\n */\nexport function devCommand(options: DevOptions = {}) {\n try {\n const { port, host } = options;\n console.info(`🚀 Starting development server on ${host}:${port}...`);\n\n // Detect if project uses TypeScript or JavaScript\n const fileExt = getUserFileExtension();\n\n // Find the application entry point\n const entryPoint = `src/app.${fileExt}`;\n\n if (!entryPoint) {\n console.error(\"❌ Could not find application entry point.\");\n process.exit(1);\n }\n\n console.info(`📂 Using entry point: ${entryPoint}`);\n\n // Set environment variables\n const env = {\n NODE_ENV: \"development\",\n ...process.env,\n ...(port && { PORT: port }),\n ...(host && { HOST: host }),\n };\n\n // Start the application with the appropriate runner\n let child;\n\n // Setup file watching if enabled\n if (fileExt === \"ts\") {\n console.info(\"👀 Watch mode enabled. Changes will trigger restart.\");\n\n child = spawn(\"npx\", [\"ts-node-dev\", \"--respawn\", entryPoint], {\n stdio: \"inherit\",\n env,\n shell: true,\n });\n } else {\n child = spawn(\"npx\", [\"nodemon\", entryPoint], {\n stdio: \"inherit\",\n env,\n shell: true,\n });\n }\n\n // Handle process exit\n process.on(\"SIGINT\", () => {\n if (child) {\n child.kill();\n }\n process.exit(0);\n });\n } catch (error) {\n console.error(\"❌ Development server failed to start:\", error);\n process.exit(1);\n }\n}\n\n// /**\n// * Find the application entry point\n// */\n// function findEntryPoint(fileExt: \"ts\" | \"js\"): string | null {\n// const possibleEntryPoints = [\n// ,// `src/index.${fileExt}`,\n// // `src/main.${fileExt}`,\n// // `src/server.${fileExt}`,\n// // `app.${fileExt}`,\n// // `index.${fileExt}`,\n// // `main.${fileExt}`,\n// // `server.${fileExt}`,\n// ];\n\n// for (const entryPoint of possibleEntryPoints) {\n// if (fs.existsSync(path.join(process.cwd(), entryPoint))) {\n// return entryPoint;\n// }\n// }\n\n// // If no entry point is found, check if we're in a built directory\n// // and look for .build entry points\n// const isBuild =\n// process.cwd().includes(\".build\") ||\n// fs.existsSync(path.join(process.cwd(), \".build\"));\n\n// if (isBuild) {\n// // Check both module formats\n// const moduleTypes = [\"cjs\", \"esm\"];\n\n// for (const moduleType of moduleTypes) {\n// for (const baseName of [\"app\", \"index\", \"main\", \"server\"]) {\n// const builtEntryPoint = path.join(\n// \".build\",\n// moduleType,\n// `src/${baseName}.js`\n// );\n\n// if (fs.existsSync(path.join(process.cwd(), builtEntryPoint))) {\n// return builtEntryPoint;\n// }\n// }\n// }\n// }\n\n// return null;\n// }\n"]}
1
+ {"version":3,"file":"dev.js","sourceRoot":"","sources":["../../../../src/utils/cli/dev.ts"],"names":[],"mappings":";;AAcA,gCA2DC;AAxED,iDAAsC;AACtC,sDAA6D;AAC7D,wBAA+B;AAC/B,yCAA8C;AAU9C,SAAgB,UAAU,CAAC,UAAsB,EAAE;IACjD,MAAM,OAAO,GAAG,IAAA,uBAAc,GAAE,CAAC;IACjC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAErB,IAAI,CAAC;QACH,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;QAG/B,MAAM,OAAO,GAAG,IAAA,iCAAoB,GAAE,CAAC;QAGvC,MAAM,UAAU,GAAG,WAAW,OAAO,EAAE,CAAC;QAExC,IAAI,CAAC,UAAU,EAAE,CAAC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CAAuC,EAAE,KAAK,CAAC,CAAC;QAC9D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC","sourcesContent":["// src/utils/cli/dev.ts\nimport { spawn } from \"child_process\";\nimport { getUserFileExtension } from \"../helpers/fs.helpers\";\nimport { getVersion } from \".\";\nimport { getArkosConfig } from \"../../server\";\n\ninterface DevOptions {\n port?: string;\n host?: string;\n}\n\n/**\n * Dev server command for the arkos CLI\n */\nexport function devCommand(options: DevOptions = {}) {\n const configs = getArkosConfig();\n console.log(configs);\n\n try {\n const { port, host } = options;\n\n // Detect if project uses TypeScript or JavaScript\n const fileExt = getUserFileExtension();\n\n // Find the application entry point\n const entryPoint = `src/app.${fileExt}`;\n\n if (!entryPoint) {\n console.error(\"❌ Could not find application entry point.\");\n process.exit(1);\n }\n\n // Set environment variables\n const env = {\n NODE_ENV: \"development\",\n ...process.env,\n ...(port && { PORT: port }),\n ...(host && { HOST: host }),\n };\n\n // Start the application with the appropriate runner\n let child;\n\n // Setup file watching if enabled\n if (fileExt === \"ts\") {\n child = spawn(\"npx\", [\"ts-node-dev\", \"--respawn\", entryPoint], {\n stdio: \"inherit\",\n env,\n shell: true,\n });\n } else {\n child = spawn(\"npx\", [\"nodemon\", entryPoint], {\n stdio: \"inherit\",\n env,\n shell: true,\n });\n }\n\n console.info(`\\x1b[1m\\x1b[36m⇪ Arkos.js ${getVersion()}\\x1b[0m`);\n console.info(`- Local: http://${host}:${port}`);\n console.info(`- Environments: development\\n`);\n\n // Handle process exit\n process.on(\"SIGINT\", () => {\n if (child) {\n child.kill();\n }\n process.exit(0);\n });\n } catch (error) {\n console.error(\"❌ Development server failed to start:\", error);\n process.exit(1);\n }\n}\n"]}
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.startCommand = exports.devCommand = exports.buildCommand = exports.program = void 0;
7
+ exports.getVersion = getVersion;
7
8
  const commander_1 = require("commander");
8
9
  const build_1 = require("./build");
9
10
  Object.defineProperty(exports, "buildCommand", { enumerable: true, get: function () { return build_1.buildCommand; } });
@@ -13,11 +14,13 @@ const dev_1 = require("./dev");
13
14
  Object.defineProperty(exports, "devCommand", { enumerable: true, get: function () { return dev_1.devCommand; } });
14
15
  const start_1 = require("./start");
15
16
  Object.defineProperty(exports, "startCommand", { enumerable: true, get: function () { return start_1.startCommand; } });
16
- const packageJson = JSON.parse(fs_1.default.readFileSync(path_1.default.join(__dirname, "../../../../package.json"), "utf8"));
17
- const version = packageJson.version || "1.0.0";
17
+ function getVersion() {
18
+ const packageJson = JSON.parse(fs_1.default.readFileSync(path_1.default.join(__dirname, "../../../../package.json"), "utf8"));
19
+ return packageJson.version || "1.0.0";
20
+ }
18
21
  const program = new commander_1.Command();
19
22
  exports.program = program;
20
- program.name("arkos").description("Arkos framework CLI").version(version);
23
+ program.name("arkos").description("Arkos framework CLI").version(getVersion());
21
24
  console.log("program setup", program);
22
25
  program
23
26
  .command("build")
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/utils/cli/index.ts"],"names":[],"mappings":";;;;;;AACA,yCAAoC;AACpC,mCAAuC;AA2CrB,6FA3CT,oBAAY,OA2CS;AA1C9B,gDAAwB;AACxB,4CAAoB;AACpB,+BAAmC;AAwCH,2FAxCvB,gBAAU,OAwCuB;AAvC1C,mCAAuC;AAuCK,6FAvCnC,oBAAY,OAuCmC;AApCxD,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAC5B,YAAE,CAAC,YAAY,CAAC,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,0BAA0B,CAAC,EAAE,MAAM,CAAC,CAC1E,CAAC;AAEF,MAAM,OAAO,GAAG,WAAW,CAAC,OAAO,IAAI,OAAO,CAAC;AAE/C,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AA8BrB,0BAAO;AA5BhB,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AAE1E,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;AAEtC,OAAO;KACJ,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,0BAA0B,CAAC;KACvC,MAAM,CAAC,aAAa,EAAE,mBAAmB,CAAC;KAC1C,MAAM,CAAC,qBAAqB,EAAE,qBAAqB,CAAC;KACpD,MAAM,CAAC,qBAAqB,EAAE,0BAA0B,EAAE,KAAK,CAAC;KAChE,MAAM,CAAC,oBAAY,CAAC,CAAC;AAExB,OAAO;KACJ,OAAO,CAAC,KAAK,CAAC;KACd,WAAW,CAAC,wBAAwB,CAAC;KACrC,MAAM,CAAC,qBAAqB,EAAE,aAAa,CAAC;KAC5C,MAAM,CAAC,mBAAmB,EAAE,iBAAiB,CAAC;KAC9C,MAAM,CAAC,gBAAU,CAAC,CAAC;AAEtB,OAAO;KACJ,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,uBAAuB,CAAC;KACpC,MAAM,CAAC,qBAAqB,EAAE,aAAa,CAAC;KAC5C,MAAM,CAAC,mBAAmB,EAAE,iBAAiB,CAAC;KAC9C,MAAM,CAAC,oBAAY,CAAC,CAAC;AAExB,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC","sourcesContent":["// src/utils/cli/index.ts\nimport { Command } from \"commander\";\nimport { buildCommand } from \"./build\";\nimport path from \"path\";\nimport fs from \"fs\";\nimport { devCommand } from \"./dev\";\nimport { startCommand } from \"./start\";\n\n// Get package version from package.json\nconst packageJson = JSON.parse(\n fs.readFileSync(path.join(__dirname, \"../../../../package.json\"), \"utf8\")\n);\n\nconst version = packageJson.version || \"1.0.0\";\n\nconst program = new Command();\n\nprogram.name(\"arkos\").description(\"Arkos framework CLI\").version(version);\n\nconsole.log(\"program setup\", program);\n\nprogram\n .command(\"build\")\n .description(\"Build your Arkos project\")\n .option(\"-w, --watch\", \"Watch for changes\")\n .option(\"-c, --config <path>\", \"Path to config file\")\n .option(\"-m, --module <type>\", \"Module type (cjs or esm)\", \"cjs\")\n .action(buildCommand);\n\nprogram\n .command(\"dev\")\n .description(\"Run development server\")\n .option(\"-p, --port <number>\", \"Port number\")\n .option(\"-h, --host <host>\", \"Host to bind to\")\n .action(devCommand);\n\nprogram\n .command(\"start\")\n .description(\"Run production server\")\n .option(\"-p, --port <number>\", \"Port number\")\n .option(\"-h, --host <host>\", \"Host to bind to\")\n .action(startCommand);\n\nprogram.parse(process.argv);\n\nexport { program, buildCommand, devCommand, startCommand };\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/utils/cli/index.ts"],"names":[],"mappings":";;;;;;AAQA,gCAMC;AAbD,yCAAoC;AACpC,mCAAuC;AA4CrB,6FA5CT,oBAAY,OA4CS;AA3C9B,gDAAwB;AACxB,4CAAoB;AACpB,+BAAmC;AAyCH,2FAzCvB,gBAAU,OAyCuB;AAxC1C,mCAAuC;AAwCK,6FAxCnC,oBAAY,OAwCmC;AAtCxD,SAAgB,UAAU;IACxB,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAC5B,YAAE,CAAC,YAAY,CAAC,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,0BAA0B,CAAC,EAAE,MAAM,CAAC,CAC1E,CAAC;IAEF,OAAO,WAAW,CAAC,OAAO,IAAI,OAAO,CAAC;AACxC,CAAC;AAED,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AA8BrB,0BAAO;AA5BhB,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;AAE/E,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;AAEtC,OAAO;KACJ,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,0BAA0B,CAAC;KACvC,MAAM,CAAC,aAAa,EAAE,mBAAmB,CAAC;KAC1C,MAAM,CAAC,qBAAqB,EAAE,qBAAqB,CAAC;KACpD,MAAM,CAAC,qBAAqB,EAAE,0BAA0B,EAAE,KAAK,CAAC;KAChE,MAAM,CAAC,oBAAY,CAAC,CAAC;AAExB,OAAO;KACJ,OAAO,CAAC,KAAK,CAAC;KACd,WAAW,CAAC,wBAAwB,CAAC;KACrC,MAAM,CAAC,qBAAqB,EAAE,aAAa,CAAC;KAC5C,MAAM,CAAC,mBAAmB,EAAE,iBAAiB,CAAC;KAC9C,MAAM,CAAC,gBAAU,CAAC,CAAC;AAEtB,OAAO;KACJ,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,uBAAuB,CAAC;KACpC,MAAM,CAAC,qBAAqB,EAAE,aAAa,CAAC;KAC5C,MAAM,CAAC,mBAAmB,EAAE,iBAAiB,CAAC;KAC9C,MAAM,CAAC,oBAAY,CAAC,CAAC;AAExB,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC","sourcesContent":["// src/utils/cli/index.ts\nimport { Command } from \"commander\";\nimport { buildCommand } from \"./build\";\nimport path from \"path\";\nimport fs from \"fs\";\nimport { devCommand } from \"./dev\";\nimport { startCommand } from \"./start\";\n\nexport function getVersion() {\n const packageJson = JSON.parse(\n fs.readFileSync(path.join(__dirname, \"../../../../package.json\"), \"utf8\")\n );\n\n return packageJson.version || \"1.0.0\";\n}\n\nconst program = new Command();\n\nprogram.name(\"arkos\").description(\"Arkos framework CLI\").version(getVersion());\n\nconsole.log(\"program setup\", program);\n\nprogram\n .command(\"build\")\n .description(\"Build your Arkos project\")\n .option(\"-w, --watch\", \"Watch for changes\")\n .option(\"-c, --config <path>\", \"Path to config file\")\n .option(\"-m, --module <type>\", \"Module type (cjs or esm)\", \"cjs\")\n .action(buildCommand);\n\nprogram\n .command(\"dev\")\n .description(\"Run development server\")\n .option(\"-p, --port <number>\", \"Port number\")\n .option(\"-h, --host <host>\", \"Host to bind to\")\n .action(devCommand);\n\nprogram\n .command(\"start\")\n .description(\"Run production server\")\n .option(\"-p, --port <number>\", \"Port number\")\n .option(\"-h, --host <host>\", \"Host to bind to\")\n .action(startCommand);\n\nprogram.parse(process.argv);\n\nexport { program, buildCommand, devCommand, startCommand };\n"]}
@@ -7,16 +7,18 @@ exports.startCommand = startCommand;
7
7
  const path_1 = __importDefault(require("path"));
8
8
  const fs_1 = __importDefault(require("fs"));
9
9
  const child_process_1 = require("child_process");
10
+ const server_1 = require("../../server");
11
+ const _1 = require(".");
10
12
  function startCommand(options = {}) {
13
+ const configs = (0, server_1.getArkosConfig)();
14
+ console.log(configs);
11
15
  try {
12
16
  const { port, host } = options;
13
- console.info(`🚀 Starting production server on ${host}:${port}...`);
14
17
  const entryPoint = path_1.default.join(".build", "src", "app.js");
15
18
  if (!fs_1.default.existsSync(path_1.default.join(process.cwd(), entryPoint))) {
16
19
  console.error(`❌ Could not find built application entry point at ${entryPoint}`);
17
20
  process.exit(1);
18
21
  }
19
- console.info(`📂 Using entry point: ${entryPoint}`);
20
22
  const env = Object.assign(Object.assign(Object.assign(Object.assign({}, process.env), (port && { PORT: port })), (host && { HOST: host })), { NODE_ENV: "production", ARKOS_BUILD: "true" });
21
23
  const child = (0, child_process_1.spawn)("node", [entryPoint], {
22
24
  stdio: "inherit",
@@ -29,6 +31,9 @@ function startCommand(options = {}) {
29
31
  }
30
32
  process.exit(0);
31
33
  });
34
+ console.info(`\x1b[1m\x1b[36m⇪ Arkos.js ${(0, _1.getVersion)()}\x1b[0m`);
35
+ console.info(`- Local: http://${host}:${port}`);
36
+ console.info(`- Environments: production\n`);
32
37
  }
33
38
  catch (error) {
34
39
  console.error("❌ Production server failed to start:", error);
@@ -1 +1 @@
1
- {"version":3,"file":"start.js","sourceRoot":"","sources":["../../../../src/utils/cli/start.ts"],"names":[],"mappings":";;;;;AAaA,oCA4CC;AAxDD,gDAAw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O,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,sCAAsC,EAAE,KAAK,CAAC,CAAC;QAC7D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC","sourcesContent":["// src/utils/cli/start.ts\nimport path from \"path\";\nimport fs from \"fs\";\nimport { spawn } from \"child_process\";\n\ninterface StartOptions {\n port?: string;\n host?: string;\n}\n\n/**\n * Production start command for the arkos CLI\n */\nexport function startCommand(options: StartOptions = {}) {\n try {\n const { port, host } = options;\n console.info(`🚀 Starting production server on ${host}:${port}...`);\n\n // Check for built app file\n const entryPoint = path.join(\".build\", \"src\", \"app.js\");\n\n if (!fs.existsSync(path.join(process.cwd(), entryPoint))) {\n console.error(\n `❌ Could not find built application entry point at ${entryPoint}`\n );\n process.exit(1);\n }\n\n console.info(`📂 Using entry point: ${entryPoint}`);\n\n // Set environment variables\n const env = {\n ...process.env,\n ...(port && { PORT: port }),\n ...(host && { HOST: host }),\n NODE_ENV: \"production\",\n ARKOS_BUILD: \"true\",\n };\n\n // Start the application\n const child = spawn(\"node\", [entryPoint], {\n stdio: \"inherit\",\n env,\n shell: true,\n });\n\n // Handle process exit\n process.on(\"SIGINT\", () => {\n if (child) {\n child.kill();\n }\n process.exit(0);\n });\n } catch (error) {\n console.error(\"❌ Production server failed to start:\", error);\n process.exit(1);\n }\n}\n"]}
1
+ {"version":3,"file":"start.js","sourceRoot":"","sources":["../../../../src/utils/cli/start.ts"],"names":[],"mappings":";;;;;AAeA,oCA+CC;AA7DD,gDAAwB;AACxB,4CAAoB;AACpB,iDAAsC;AACtC,yCAA8C;AAC9C,wBAA+B;AAU/B,SAAgB,YAAY,CAAC,UAAwB,EAAE;IACrD,MAAM,OAAO,GAAG,IAAA,uBAAc,GAAE,CAAC;IACjC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACrB,IAAI,CAAC;QACH,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,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AC,CAAC;QAC7D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC","sourcesContent":["// src/utils/cli/start.ts\nimport path from \"path\";\nimport fs from \"fs\";\nimport { spawn } from \"child_process\";\nimport { getArkosConfig } from \"../../server\";\nimport { getVersion } from \".\";\n\ninterface StartOptions {\n port?: string;\n host?: string;\n}\n\n/**\n * Production start command for the arkos CLI\n */\nexport function startCommand(options: StartOptions = {}) {\n const configs = getArkosConfig();\n console.log(configs);\n try {\n const { port, host } = options;\n\n // Check for built app file\n const entryPoint = path.join(\".build\", \"src\", \"app.js\");\n\n if (!fs.existsSync(path.join(process.cwd(), entryPoint))) {\n console.error(\n `❌ Could not find built application entry point at ${entryPoint}`\n );\n process.exit(1);\n }\n\n // Set environment variables\n const env = {\n ...process.env,\n ...(port && { PORT: port }),\n ...(host && { HOST: host }),\n NODE_ENV: \"production\",\n ARKOS_BUILD: \"true\",\n };\n\n // Start the application\n const child = spawn(\"node\", [entryPoint], {\n stdio: \"inherit\",\n env,\n shell: true,\n });\n\n // Handle process exit\n process.on(\"SIGINT\", () => {\n if (child) {\n child.kill();\n }\n process.exit(0);\n });\n\n console.info(`\\x1b[1m\\x1b[36m⇪ Arkos.js ${getVersion()}\\x1b[0m`);\n console.info(`- Local: http://${host}:${port}`);\n console.info(`- Environments: production\\n`);\n } catch (error) {\n console.error(\"❌ Production server failed to start:\", error);\n process.exit(1);\n }\n}\n"]}
@@ -1 +1 @@
1
- "use strict";var x=function(o,e,n,c){function m(r){return r instanceof n?r:new n(function(p){p(r)})}return new(n||(n=Promise))(function(r,p){function d(t){try{u(c.next(t))}catch(a){p(a)}}function f(t){try{u(c.throw(t))}catch(a){p(a)}}function u(t){t.done?r(t.value):m(t.value).then(d,f)}u((c=c.apply(o,e||[])).next())})};import{bootstrap as E}from"./app";import h from"./utils/helpers/deepmerge.helper";process.on("uncaughtException",o=>{console.error("UNCAUGHT EXCEPTION! SHUTTING DOWN..."),console.error(o.name,o.message),console.error(o),process.exit(1)});let i,l,s={welcomeMessage:"Welcome to our RESTful API generated by Arkos, find out more about Arkos at www.arkosjs.com",port:8e3,fileUpload:{baseUploadDir:"uploads",baseRoute:"/api/uploads"}};function v(){return x(this,arguments,void 0,function*(o={}){s=h(s,o);const e=s.port;return l=yield E(s),e&&(i=l.listen(o?.host?[e,o?.host]:e,()=>{const n=new Date().toTimeString().split(" ")[0];console.info(`[\x1B[32mREADY\x1B[0m] \x1B[90m${n}\x1B[0m App running on port \x1B[33m${e}\x1B[0m, server waiting on http://localhost:${e}`),process.env.NODE_ENV&&console.info(`${`Environment: ${process.env.NODE_ENV}`}`)})),l})}process.on("unhandledRejection",o=>{console.error("UNHANDLED REJECTION! SHUTTING DOWN..."),console.error(o.name,o.message),console.error(o),i?.close(()=>{process.exit(1)})});export function getArkosConfig(){return s}export function getExpressApp(){return l}export{i as server,v as initApp};
1
+ "use strict";var E=function(e,t,n,c){function d(r){return r instanceof n?r:new n(function(p){p(r)})}return new(n||(n=Promise))(function(r,p){function f(o){try{u(c.next(o))}catch(a){p(a)}}function m(o){try{u(c.throw(o))}catch(a){p(a)}}function u(o){o.done?r(o.value):d(o.value).then(f,m)}u((c=c.apply(e,t||[])).next())})};import{bootstrap as N}from"./app";import v from"./utils/helpers/deepmerge.helper";process.on("uncaughtException",e=>{console.error("UNCAUGHT EXCEPTION! SHUTTING DOWN..."),console.error(e.name,e.message),console.error(e),process.exit(1)});let s,l,i={welcomeMessage:"Welcome to our RESTful API generated by Arkos, find out more about Arkos at www.arkosjs.com",port:8e3,fileUpload:{baseUploadDir:"uploads",baseRoute:"/api/uploads"}};function h(){return E(this,arguments,void 0,function*(e={}){i=v(i,e);const t=i.port;return l=yield N(i),t&&(s=l.listen(e?.host?[t,e?.host]:t,()=>{const n=new Date().toTimeString().split(" ")[0];process.env.NODE_ENV&&console.info(`${`Environment: ${process.env.NODE_ENV}`}`)})),l})}process.on("unhandledRejection",e=>{console.error("UNHANDLED REJECTION! SHUTTING DOWN..."),console.error(e.name,e.message),console.error(e),s?.close(()=>{process.exit(1)})});export function getArkosConfig(){return i}export function getExpressApp(){return l}export{s as server,h as initApp};
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":";;;;;;;;;AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,SAAS,MAAM,kCAAkC,CAAC;AAEzD,OAAO,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC,GAAG,EAAE,EAAE;IACtC,OAAO,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAC;IACtD,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IACrC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,IAAI,MAA6D,CAAC;AAClE,IAAI,IAAa,CAAC;AAElB,IAAI,YAAY,GAAgB;IAC9B,cAAc,EACZ,6FAA6F;IAC/F,IAAI,EAAE,IAAI;IACV,UAAU,EAAE;QACV,aAAa,EAAE,SAAS;QACxB,SAAS,EAAE,cAAc;KAC1B;CACF,CAAC;AAeF,SAAe,OAAO;yDAAC,cAA2B,EAAE;QAClD,YAAY,GAAG,SAAS,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC;QAEpD,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC;QAC/B,IAAI,GAAG,MAAM,SAAS,CAAC,YAAY,CAAC,CAAC;QAErC,IAAI,IAAI;YACN,MAAM,GAAG,IAAI,CAAC,MAAM,CAClB,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,IAAI,EAAC,CAAC,CAAC,CAAC,IAAI,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,IAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EACrD,GAAG,EAAE;gBACH,MAAM,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC,YAAY,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;gBACrD,OAAO,CAAC,IAAI,CACV,kCAAkC,IAAI,uCAAuC,IAAI,+CAA+C,IAAI,EAAE,CACvI,CAAC;gBAEF,IAAI,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ;oBACxB,OAAO,CAAC,IAAI,CAAC,GAAG,gBAAgB,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;YAC9D,CAAC,CACF,CAAC;QAEJ,OAAO,IAAI,CAAC;IACd,CAAC;CAAA;AAED,OAAO,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC,GAAa,EAAE,EAAE;IACjD,OAAO,CAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC;IACvD,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IACrC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnB,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,CAAC,GAAG,EAAE;QACjB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,MAAM,UAAU,cAAc;IAC5B,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,OAAO,IAAI,CAAC;AACd,CAAC;AAED,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC","sourcesContent":["import { IncomingMessage, Server, ServerResponse } from \"http\";\nimport AppError from \"./modules/error-handler/utils/app-error\";\nimport { Express } from \"express\";\nimport { bootstrap } from \"./app\";\nimport { ArkosConfig } from \"./types/arkos-config\";\nimport deepmerge from \"./utils/helpers/deepmerge.helper\";\n\nprocess.on(\"uncaughtException\", (err) => {\n console.error(\"UNCAUGHT EXCEPTION! SHUTTING DOWN...\");\n console.error(err.name, err.message);\n console.error(err);\n process.exit(1);\n});\n\nlet server: Server<typeof IncomingMessage, typeof ServerResponse>;\nlet _app: Express;\n\nlet _arkosConfig: ArkosConfig = {\n welcomeMessage:\n \"Welcome to our RESTful API generated by Arkos, find out more about Arkos at www.arkosjs.com\",\n port: 8000,\n fileUpload: {\n baseUploadDir: \"uploads\",\n baseRoute: \"/api/uploads\",\n },\n};\n\n/**\n * Initializes the application server.\n *\n * This function starts the server by listening on a specified port.\n * The port is determined by the following order of precedence:\n * 1. The `port` argument passed to the function.\n * 2. Defaults to `8000` if neither is provided.\n *\n * @param {ArkosConfig} arkosConfig - initial configs for the api ( authentication, port).\n * @returns {Promise<Express>} This function returns the Express App after all middlewares configurations.\n * You can prevent it from listen py passing port as undefined\n *\n */\nasync function initApp(arkosConfig: ArkosConfig = {}): Promise<Express> {\n _arkosConfig = deepmerge(_arkosConfig, arkosConfig);\n\n const port = _arkosConfig.port;\n _app = await bootstrap(_arkosConfig);\n\n if (port)\n server = _app.listen(\n arkosConfig?.host ? [port, arkosConfig?.host!] : port,\n () => {\n const time = new Date().toTimeString().split(\" \")[0];\n console.info(\n `[\\x1b[32mREADY\\x1b[0m] \\x1b[90m${time}\\x1b[0m App running on port \\x1b[33m${port}\\x1b[0m, server waiting on http://localhost:${port}`\n );\n\n if (!!process.env.NODE_ENV)\n console.info(`${`Environment: ${process.env.NODE_ENV}`}`);\n }\n );\n\n return _app;\n}\n\nprocess.on(\"unhandledRejection\", (err: AppError) => {\n console.error(\"UNHANDLED REJECTION! SHUTTING DOWN...\");\n console.error(err.name, err.message);\n console.error(err);\n server?.close(() => {\n process.exit(1);\n });\n});\n\nexport function getArkosConfig() {\n return _arkosConfig;\n}\n\nexport function getExpressApp() {\n return _app;\n}\n\nexport { server, initApp };\n"]}
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":";;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,QAAQ;oBACxB,OAAO,CAAC,IAAI,CAAC,GAAG,gBAAgB,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;YAC9D,CAAC,CACF,CAAC;QAEJ,OAAO,IAAI,CAAC;IACd,CAAC;CAAA;AAED,OAAO,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC,GAAa,EAAE,EAAE;IACjD,OAAO,CAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC;IACvD,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IACrC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnB,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,CAAC,GAAG,EAAE;QACjB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,MAAM,UAAU,cAAc;IAC5B,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,OAAO,IAAI,CAAC;AACd,CAAC;AAED,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC","sourcesContent":["import { IncomingMessage, Server, ServerResponse } from \"http\";\nimport AppError from \"./modules/error-handler/utils/app-error\";\nimport { Express } from \"express\";\nimport { bootstrap } from \"./app\";\nimport { ArkosConfig } from \"./types/arkos-config\";\nimport deepmerge from \"./utils/helpers/deepmerge.helper\";\n\nprocess.on(\"uncaughtException\", (err) => {\n console.error(\"UNCAUGHT EXCEPTION! SHUTTING DOWN...\");\n console.error(err.name, err.message);\n console.error(err);\n process.exit(1);\n});\n\nlet server: Server<typeof IncomingMessage, typeof ServerResponse>;\nlet _app: Express;\n\nlet _arkosConfig: ArkosConfig = {\n welcomeMessage:\n \"Welcome to our RESTful API generated by Arkos, find out more about Arkos at www.arkosjs.com\",\n port: 8000,\n fileUpload: {\n baseUploadDir: \"uploads\",\n baseRoute: \"/api/uploads\",\n },\n};\n\n/**\n * Initializes the application server.\n *\n * This function starts the server by listening on a specified port.\n * The port is determined by the following order of precedence:\n * 1. The `port` argument passed to the function.\n * 2. Defaults to `8000` if neither is provided.\n *\n * @param {ArkosConfig} arkosConfig - initial configs for the api ( authentication, port).\n * @returns {Promise<Express>} This function returns the Express App after all middlewares configurations.\n * You can prevent it from listen py passing port as undefined\n *\n */\nasync function initApp(arkosConfig: ArkosConfig = {}): Promise<Express> {\n _arkosConfig = deepmerge(_arkosConfig, arkosConfig);\n\n const port = _arkosConfig.port;\n _app = await bootstrap(_arkosConfig);\n\n if (port)\n server = _app.listen(\n arkosConfig?.host ? [port, arkosConfig?.host!] : port,\n () => {\n const time = new Date().toTimeString().split(\" \")[0];\n // console.info(\n // `[\\x1b[32mREADY\\x1b[0m] \\x1b[90m${time}\\x1b[0m App running on port \\x1b[33m${port}\\x1b[0m, server waiting on http://localhost:${port}`\n // );\n\n if (!!process.env.NODE_ENV)\n console.info(`${`Environment: ${process.env.NODE_ENV}`}`);\n }\n );\n\n return _app;\n}\n\nprocess.on(\"unhandledRejection\", (err: AppError) => {\n console.error(\"UNHANDLED REJECTION! SHUTTING DOWN...\");\n console.error(err.name, err.message);\n console.error(err);\n server?.close(() => {\n process.exit(1);\n });\n});\n\nexport function getArkosConfig() {\n return _arkosConfig;\n}\n\nexport function getExpressApp() {\n return _app;\n}\n\nexport { server, initApp };\n"]}
@@ -5,19 +5,17 @@ import { getUserFileExtension } from "../helpers/fs.helpers";
5
5
  const BUILD_DIR = ".build";
6
6
  const MODULE_TYPES = ["cjs", "esm"];
7
7
  export function buildCommand(options = {}) {
8
- console.info("buildCommand executed");
9
8
  try {
10
- const moduleType = validateModuleType(options.module);
11
- console.info(`🚀 Building project (${moduleType})...`);
9
+ console.info(`Building project...`);
12
10
  ensureBuildDir();
13
11
  const fileExt = getUserFileExtension();
14
- if (fileExt) {
15
- buildTypeScriptProject(options, moduleType);
12
+ if (fileExt === "ts") {
13
+ buildTypeScriptProject(options);
16
14
  }
17
15
  else {
18
- buildJavaScriptProject(options, moduleType);
16
+ buildJavaScriptProject(options);
19
17
  }
20
- console.info(`✅ Build complete! Output: ${BUILD_DIR}/${moduleType}/`);
18
+ console.info(`Build complete! Output: ${BUILD_DIR}/`);
21
19
  }
22
20
  catch (error) {
23
21
  console.error("❌ Build failed:", error);
@@ -48,8 +46,7 @@ function ensureBuildDir() {
48
46
  }
49
47
  }
50
48
  }
51
- function buildTypeScriptProject(options, moduleType) {
52
- console.info("📝 TypeScript project detected");
49
+ function buildTypeScriptProject(options) {
53
50
  const tsconfigPath = path.join(process.cwd(), options.config || "tsconfig.json");
54
51
  let tsconfig = {};
55
52
  try {
@@ -62,10 +59,9 @@ function buildTypeScriptProject(options, moduleType) {
62
59
  console.error("❌ Error reading tsconfig.json:", error);
63
60
  }
64
61
  const tempTsconfig = Object.assign(Object.assign({}, tsconfig), { compilerOptions: Object.assign(Object.assign({}, (tsconfig.compilerOptions || {})), { outDir: path.join(`./${BUILD_DIR}`) }) });
65
- const tempTsconfigPath = path.join(process.cwd(), `tsconfig.arkos-build-${moduleType}.json`);
62
+ const tempTsconfigPath = path.join(process.cwd(), `tsconfig.arkos-build.json`);
66
63
  fs.writeFileSync(tempTsconfigPath, JSON.stringify(tempTsconfig, null, 2));
67
64
  try {
68
- console.info(`Running TypeScript compiler (${moduleType})...`);
69
65
  if (options.watch) {
70
66
  const tsc = spawn("npx", ["tsc", "-p", tempTsconfigPath, "--watch"], {
71
67
  stdio: "inherit",
@@ -82,7 +78,6 @@ function buildTypeScriptProject(options, moduleType) {
82
78
  stdio: "inherit",
83
79
  cwd: process.cwd(),
84
80
  });
85
- copyAssetFiles(moduleType);
86
81
  cleanupTempConfig(tempTsconfigPath);
87
82
  }
88
83
  }
@@ -91,29 +86,24 @@ function buildTypeScriptProject(options, moduleType) {
91
86
  throw error;
92
87
  }
93
88
  }
94
- function buildJavaScriptProject(options, moduleType) {
95
- console.info("JavaScript project detected");
96
- const targetDir = path.join(BUILD_DIR, moduleType);
89
+ function buildJavaScriptProject(options) {
90
+ const targetDir = path.join(BUILD_DIR);
97
91
  try {
98
- console.info(`📂 Copying JavaScript files to ${targetDir}...`);
99
- if (moduleType === "esm") {
100
- execSync(`npx copyfiles -u 0 "src/**/*.js" "src/**/*.jsx" "src/**/*.mjs" ${targetDir}`, {
92
+ if (true) {
93
+ execSync(`npx copyfiles -u 0 "src/**/*.js" "src/**/*.jsx" "src/**/*.mjs" "src/**/*.cjs" ${targetDir}`, {
101
94
  stdio: "inherit",
102
95
  cwd: process.cwd(),
103
96
  });
104
97
  }
105
98
  else {
106
- execSync(`npx copyfiles -u 0 "src/**/*.js" "src/**/*.jsx" "src/**/*.cjs" ${targetDir}`, {
99
+ execSync(`npx copyfiles -u 0 "src/**/*.js" "src/**/*.jsx" "src/**/*.cjs" "src/**/*.mjs" ${targetDir}`, {
107
100
  stdio: "inherit",
108
101
  cwd: process.cwd(),
109
102
  });
110
103
  }
111
- copyAssetFiles(moduleType);
104
+ copyAssetFiles();
112
105
  if (options.watch) {
113
- console.info("Watch mode enabled. Press Ctrl+C to stop.");
114
- const patterns = moduleType === "esm"
115
- ? `"src/**/*.js" "src/**/*.jsx" "src/**/*.mjs"`
116
- : `"src/**/*.js" "src/**/*.jsx" "src/**/*.cjs"`;
106
+ const patterns = `"src/**/*.js" "src/**/*.jsx" "src/**/*.mjs" "src/**/*.cjs"`;
117
107
  const watcher = spawn("npx", ["chokidar", patterns, "-c", `npx copyfiles -u 0 {path} ${targetDir}`], {
118
108
  stdio: "inherit",
119
109
  shell: true,
@@ -129,10 +119,9 @@ function buildJavaScriptProject(options, moduleType) {
129
119
  throw error;
130
120
  }
131
121
  }
132
- function copyAssetFiles(moduleType) {
133
- const targetDir = path.join(BUILD_DIR, moduleType);
122
+ function copyAssetFiles() {
123
+ const targetDir = path.join(BUILD_DIR);
134
124
  try {
135
- console.info("Copying asset files...");
136
125
  execSync(`npx copyfiles -u 0 "src/**/*.json" "src/**/*.html" "src/**/*.css" "src/**/*.svg" "src/**/*.png" ${targetDir}`, {
137
126
  stdio: "inherit",
138
127
  cwd: process.cwd(),
@@ -1 +1 @@
1
- {"version":3,"file":"build.js","sourceRoot":"","sources":["../../../../src/utils/cli/build.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAG7D,MAAM,SAAS,GAAG,QAAQ,CAAC;AAC3B,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE,KAAK,CAAU,CAAC;AAY7C,MAAM,UAAU,YAAY,CAAC,UAAwB,EAAE;IACrD,OAAO,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;IACtC,IAAI,CAAC;QAEH,MAAM,UAAU,GAAG,kBAAkB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAEtD,OAAO,CAAC,IAAI,CAAC,wBAAwB,UAAU,MAAM,CAAC,CAAC;QAGvD,cAAc,EAAE,CAAC;QAGjB,MAAM,OAAO,GAAG,oBAAoB,EAAE,CAAC;QAEvC,IAAI,OAAO,EAAE,CAAC;YACZ,sBAAsB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;QAC9C,CAAC;aAAM,CAAC;YACN,sBAAsB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;QAC9C,CAAC;QAED,OAAO,CAAC,IAAI,CAAC,6BAA6B,SAAS,IAAI,UAAU,GAAG,CAAC,CAAC;IACxE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAC;QACxC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAKD,SAAS,kBAAkB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AAO,CAAC,IAAI,CAAC,8CAA8C,EAAE,KAAK,CAAC,CAAC;IACtE,CAAC;AACH,CAAC","sourcesContent":["// src/utils/cli/build.ts\nimport path from \"path\";\nimport fs from \"fs\";\nimport { execSync, spawn } from \"child_process\";\nimport { getUserFileExtension } from \"../helpers/fs.helpers\";\n\n// Constants\nconst BUILD_DIR = \".build\";\nconst MODULE_TYPES = [\"cjs\", \"esm\"] as const;\ntype ModuleType = (typeof MODULE_TYPES)[number];\n\ninterface BuildOptions {\n watch?: boolean;\n config?: string;\n module?: string;\n}\n\n/**\n * Main build function for the arkos CLI\n */\nexport function buildCommand(options: BuildOptions = {}) {\n console.info(\"buildCommand executed\");\n try {\n // Validate module type\n const moduleType = validateModuleType(options.module);\n\n console.info(`🚀 Building project (${moduleType})...`);\n\n // Ensure build directory exists\n ensureBuildDir();\n\n // Detect project type\n const fileExt = getUserFileExtension();\n\n if (fileExt) {\n buildTypeScriptProject(options, moduleType);\n } else {\n buildJavaScriptProject(options, moduleType);\n }\n\n console.info(`✅ Build complete! Output: ${BUILD_DIR}/${moduleType}/`);\n } catch (error) {\n console.error(\"❌ Build failed:\", error);\n process.exit(1);\n }\n}\n\n/**\n * Validates and normalizes module type option\n */\nfunction validateModuleType(moduleType?: string): ModuleType {\n if (!moduleType) return \"cjs\";\n\n const normalizedType = moduleType.toLowerCase();\n\n // Map common terms to our module types\n if (normalizedType === \"cjs\" || normalizedType === \"commonjs\") {\n return \"cjs\";\n } else if (\n [\"esm\", \"es\", \"es2020\", \"esnext\", \"module\"].includes(normalizedType)\n ) {\n return \"esm\";\n }\n\n // Default to CJS if unrecognized\n console.warn(\n `⚠️ Unrecognized module type \"${moduleType}\", defaulting to \"cjs\"`\n );\n return \"cjs\";\n}\n\n/**\n * Ensure the build directory exists\n */\nfunction ensureBuildDir() {\n if (!fs.existsSync(BUILD_DIR)) {\n fs.mkdirSync(BUILD_DIR, { recursive: true });\n }\n\n // Create module-specific subdirectories\n for (const moduleType of MODULE_TYPES) {\n const moduleDir = path.join(BUILD_DIR, moduleType);\n if (!fs.existsSync(moduleDir)) {\n fs.mkdirSync(moduleDir, { recursive: true });\n }\n }\n}\n\n/**\n * Build a TypeScript project\n */\nfunction buildTypeScriptProject(options: BuildOptions, moduleType: ModuleType) {\n console.info(\"📝 TypeScript project detected\");\n\n // Read the user's tsconfig.json\n const tsconfigPath = path.join(\n process.cwd(),\n options.config || \"tsconfig.json\"\n );\n let tsconfig: any = {};\n\n try {\n if (fs.existsSync(tsconfigPath)) {\n const tsconfigContent = fs.readFileSync(tsconfigPath, \"utf8\");\n tsconfig = JSON.parse(tsconfigContent);\n }\n } catch (error) {\n console.error(\"❌ Error reading tsconfig.json:\", error);\n // Continue with default config\n }\n\n // Create a custom tsconfig that outputs to our .build directory\n const tempTsconfig = {\n ...tsconfig,\n compilerOptions: {\n ...(tsconfig.compilerOptions || {}),\n outDir: path.join(`./${BUILD_DIR}`),\n },\n };\n\n const tempTsconfigPath = path.join(\n process.cwd(),\n `tsconfig.arkos-build-${moduleType}.json`\n );\n fs.writeFileSync(tempTsconfigPath, JSON.stringify(tempTsconfig, null, 2));\n\n try {\n // Run TypeScript compiler\n console.info(`Running TypeScript compiler (${moduleType})...`);\n\n if (options.watch) {\n // For watch mode, spawn a process\n const tsc = spawn(\"npx\", [\"tsc\", \"-p\", tempTsconfigPath, \"--watch\"], {\n stdio: \"inherit\",\n shell: true,\n });\n\n // Handle process exit\n process.on(\"SIGINT\", () => {\n tsc.kill();\n cleanupTempConfig(tempTsconfigPath);\n process.exit(0);\n });\n } else {\n // For one-time build, use execSync\n execSync(`npx tsc -p ${tempTsconfigPath}`, {\n stdio: \"inherit\",\n cwd: process.cwd(),\n });\n\n // Copy non-TypeScript files\n copyAssetFiles(moduleType);\n\n // Clean up temp config\n cleanupTempConfig(tempTsconfigPath);\n }\n } catch (error) {\n cleanupTempConfig(tempTsconfigPath);\n throw error;\n }\n}\n\n/**\n * Build a JavaScript project\n */\nfunction buildJavaScriptProject(options: BuildOptions, moduleType: ModuleType) {\n console.info(\"JavaScript project detected\");\n\n // Target directory\n const targetDir = path.join(BUILD_DIR, moduleType);\n\n try {\n // Copy JavaScript files\n console.info(`📂 Copying JavaScript files to ${targetDir}...`);\n\n // For JS projects, we need to handle module transformations if needed\n if (moduleType === \"esm\") {\n // For ESM output, we might want to transform CJS to ESM if needed\n // This is a simplified approach - for production, consider using tools like Babel\n execSync(\n `npx copyfiles -u 0 \"src/**/*.js\" \"src/**/*.jsx\" \"src/**/*.mjs\" ${targetDir}`,\n {\n stdio: \"inherit\",\n cwd: process.cwd(),\n }\n );\n } else {\n // For CJS output, direct copy is usually fine\n execSync(\n `npx copyfiles -u 0 \"src/**/*.js\" \"src/**/*.jsx\" \"src/**/*.cjs\" ${targetDir}`,\n {\n stdio: \"inherit\",\n cwd: process.cwd(),\n }\n );\n }\n\n // Copy asset files\n copyAssetFiles(moduleType);\n\n // Handle watch mode\n if (options.watch) {\n console.info(\"Watch mode enabled. Press Ctrl+C to stop.\");\n const patterns =\n moduleType === \"esm\"\n ? `\"src/**/*.js\" \"src/**/*.jsx\" \"src/**/*.mjs\"`\n : `\"src/**/*.js\" \"src/**/*.jsx\" \"src/**/*.cjs\"`;\n\n const watcher = spawn(\n \"npx\",\n [\"chokidar\", patterns, \"-c\", `npx copyfiles -u 0 {path} ${targetDir}`],\n {\n stdio: \"inherit\",\n shell: true,\n }\n );\n\n // Handle process exit\n process.on(\"SIGINT\", () => {\n watcher.kill();\n process.exit(0);\n });\n }\n } catch (error) {\n console.error(\"❌ Error building JavaScript project:\", error);\n throw error;\n }\n}\n\n/**\n * Copy asset files to the build directory\n */\nfunction copyAssetFiles(moduleType: ModuleType) {\n const targetDir = path.join(BUILD_DIR, moduleType);\n\n try {\n console.info(\"Copying asset files...\");\n execSync(\n `npx copyfiles -u 0 \"src/**/*.json\" \"src/**/*.html\" \"src/**/*.css\" \"src/**/*.svg\" \"src/**/*.png\" ${targetDir}`,\n {\n stdio: \"inherit\",\n cwd: process.cwd(),\n }\n );\n } catch (error) {\n console.warn(\"Warning: Error copying asset files:\", error);\n }\n}\n\n/**\n * Clean up temporary tsconfig\n */\nfunction cleanupTempConfig(configPath: string) {\n try {\n if (fs.existsSync(configPath)) {\n console.log(\"exitsts\", configPath);\n fs.unlinkSync(configPath);\n }\n } catch (error) {\n console.warn(\"Warning: Error cleaning up temporary config:\", error);\n }\n}\n"]}
1
+ {"version":3,"file":"build.js","sourceRoot":"","sources":["../../../../src/utils/cli/build.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAG7D,MAAM,SAAS,GAAG,QAAQ,CAAC;AAC3B,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE,KAAK,CAAU,CAAC;AAY7C,MAAM,UAAU,YAAY,CAAC,UAAwB,EAAE;IACrD,IAAI,CAAC;QACH,OAAO,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;QAEpC,cAAc,EAAE,CAAC;QAGjB,MAAM,OAAO,GAAG,oBAAoB,EAAE,CAAC;QAEvC,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;YACrB,sBAAsB,CAAC,OAAO,CAAC,CAAC;QAClC,CAAC;aAAM,CAAC;YACN,sBAAsB,CAAC,OAAO,CAAC,CAAC;QAClC,CAAC;QAED,OAAO,CAAC,IAAI,CAAC,2BAA2B,SAAS,GAAG,CAAC,CAAC;IACxD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAC;QACxC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAKD,SAAS,kBAAkB,CAAC,UAAmB;IAC7C,IAAI,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AAC;IACd,CAAC;AACH,CAAC;AAKD,SAAS,cAAc;IACrB,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAEvC,IAAI,CAAC;QACH,QAAQ,CACN,mGAAmG,SAAS,EAAE,EAC9G;YACE,KAAK,EAAE,SAAS;YAChB,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;SACnB,CACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,qCAAqC,EAAE,KAAK,CAAC,CAAC;IAC7D,CAAC;AACH,CAAC;AAKD,SAAS,iBAAiB,CAAC,UAAkB;IAC3C,IAAI,CAAC;QACH,IAAI,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;YAC9B,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;YACnC,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,8CAA8C,EAAE,KAAK,CAAC,CAAC;IACtE,CAAC;AACH,CAAC","sourcesContent":["// src/utils/cli/build.ts\nimport path from \"path\";\nimport fs from \"fs\";\nimport { execSync, spawn } from \"child_process\";\nimport { getUserFileExtension } from \"../helpers/fs.helpers\";\n\n// Constants\nconst BUILD_DIR = \".build\";\nconst MODULE_TYPES = [\"cjs\", \"esm\"] as const;\ntype ModuleType = (typeof MODULE_TYPES)[number];\n\ninterface BuildOptions {\n watch?: boolean;\n config?: string;\n module?: string;\n}\n\n/**\n * Main build function for the arkos CLI\n */\nexport function buildCommand(options: BuildOptions = {}) {\n try {\n console.info(`Building project...`);\n\n ensureBuildDir();\n\n // Detect project type\n const fileExt = getUserFileExtension();\n\n if (fileExt === \"ts\") {\n buildTypeScriptProject(options);\n } else {\n buildJavaScriptProject(options);\n }\n\n console.info(`Build complete! Output: ${BUILD_DIR}/`);\n } catch (error) {\n console.error(\"❌ Build failed:\", error);\n process.exit(1);\n }\n}\n\n/**\n * Validates and normalizes module type option\n */\nfunction validateModuleType(moduleType?: string): ModuleType {\n if (!moduleType) return \"cjs\";\n\n const normalizedType = moduleType.toLowerCase();\n\n // Map common terms to our module types\n if (normalizedType === \"cjs\" || normalizedType === \"commonjs\") {\n return \"cjs\";\n } else if (\n [\"esm\", \"es\", \"es2020\", \"esnext\", \"module\"].includes(normalizedType)\n ) {\n return \"esm\";\n }\n\n // Default to CJS if unrecognized\n console.warn(\n `⚠️ Unrecognized module type \"${moduleType}\", defaulting to \"cjs\"`\n );\n return \"cjs\";\n}\n\n/**\n * Ensure the build directory exists\n */\nfunction ensureBuildDir() {\n if (!fs.existsSync(BUILD_DIR)) {\n fs.mkdirSync(BUILD_DIR, { recursive: true });\n }\n\n // Create module-specific subdirectories\n for (const moduleType of MODULE_TYPES) {\n const moduleDir = path.join(BUILD_DIR, moduleType);\n if (!fs.existsSync(moduleDir)) {\n fs.mkdirSync(moduleDir, { recursive: true });\n }\n }\n}\n\n/**\n * Build a TypeScript project\n */\nfunction buildTypeScriptProject(options: BuildOptions) {\n // Read the user's tsconfig.json\n const tsconfigPath = path.join(\n process.cwd(),\n options.config || \"tsconfig.json\"\n );\n let tsconfig: any = {};\n\n try {\n if (fs.existsSync(tsconfigPath)) {\n const tsconfigContent = fs.readFileSync(tsconfigPath, \"utf8\");\n tsconfig = JSON.parse(tsconfigContent);\n }\n } catch (error) {\n console.error(\"❌ Error reading tsconfig.json:\", error);\n // Continue with default config\n }\n\n // Create a custom tsconfig that outputs to our .build directory\n const tempTsconfig = {\n ...tsconfig,\n compilerOptions: {\n ...(tsconfig.compilerOptions || {}),\n outDir: path.join(`./${BUILD_DIR}`),\n },\n };\n\n const tempTsconfigPath = path.join(\n process.cwd(),\n `tsconfig.arkos-build.json`\n );\n fs.writeFileSync(tempTsconfigPath, JSON.stringify(tempTsconfig, null, 2));\n\n try {\n // Run TypeScript compiler\n\n if (options.watch) {\n // For watch mode, spawn a process\n const tsc = spawn(\"npx\", [\"tsc\", \"-p\", tempTsconfigPath, \"--watch\"], {\n stdio: \"inherit\",\n shell: true,\n });\n\n // Handle process exit\n process.on(\"SIGINT\", () => {\n tsc.kill();\n cleanupTempConfig(tempTsconfigPath);\n process.exit(0);\n });\n } else {\n // For one-time build, use execSync\n execSync(`npx tsc -p ${tempTsconfigPath}`, {\n stdio: \"inherit\",\n cwd: process.cwd(),\n });\n\n // Copy non-TypeScript files\n // copyAssetFiles(moduleType);\n\n // Clean up temp config\n cleanupTempConfig(tempTsconfigPath);\n }\n } catch (error) {\n cleanupTempConfig(tempTsconfigPath);\n throw error;\n }\n}\n\n/**\n * Build a JavaScript project\n */\nfunction buildJavaScriptProject(options: BuildOptions) {\n // Target directory\n const targetDir = path.join(BUILD_DIR);\n\n try {\n // For JS projects, we need to handle module transformations if needed\n if (true) {\n // For ESM output, we might want to transform CJS to ESM if needed\n // This is a simplified approach - for production, consider using tools like Babel\n execSync(\n `npx copyfiles -u 0 \"src/**/*.js\" \"src/**/*.jsx\" \"src/**/*.mjs\" \"src/**/*.cjs\" ${targetDir}`,\n {\n stdio: \"inherit\",\n cwd: process.cwd(),\n }\n );\n } else {\n // For CJS output, direct copy is usually fine\n execSync(\n `npx copyfiles -u 0 \"src/**/*.js\" \"src/**/*.jsx\" \"src/**/*.cjs\" \"src/**/*.mjs\" ${targetDir}`,\n {\n stdio: \"inherit\",\n cwd: process.cwd(),\n }\n );\n }\n\n // Copy asset files\n copyAssetFiles();\n\n // Handle watch mode\n if (options.watch) {\n const patterns = `\"src/**/*.js\" \"src/**/*.jsx\" \"src/**/*.mjs\" \"src/**/*.cjs\"`;\n\n const watcher = spawn(\n \"npx\",\n [\"chokidar\", patterns, \"-c\", `npx copyfiles -u 0 {path} ${targetDir}`],\n {\n stdio: \"inherit\",\n shell: true,\n }\n );\n\n // Handle process exit\n process.on(\"SIGINT\", () => {\n watcher.kill();\n process.exit(0);\n });\n }\n } catch (error) {\n console.error(\"❌ Error building JavaScript project:\", error);\n throw error;\n }\n}\n\n/**\n * Copy asset files to the build directory\n */\nfunction copyAssetFiles() {\n const targetDir = path.join(BUILD_DIR);\n\n try {\n execSync(\n `npx copyfiles -u 0 \"src/**/*.json\" \"src/**/*.html\" \"src/**/*.css\" \"src/**/*.svg\" \"src/**/*.png\" ${targetDir}`,\n {\n stdio: \"inherit\",\n cwd: process.cwd(),\n }\n );\n } catch (error) {\n console.warn(\"Warning: Error copying asset files:\", error);\n }\n}\n\n/**\n * Clean up temporary tsconfig\n */\nfunction cleanupTempConfig(configPath: string) {\n try {\n if (fs.existsSync(configPath)) {\n console.log(\"exitsts\", configPath);\n fs.unlinkSync(configPath);\n }\n } catch (error) {\n console.warn(\"Warning: Error cleaning up temporary config:\", error);\n }\n}\n"]}
@@ -1,20 +1,21 @@
1
1
  import { spawn } from "child_process";
2
2
  import { getUserFileExtension } from "../helpers/fs.helpers";
3
+ import { getVersion } from ".";
4
+ import { getArkosConfig } from "../../server";
3
5
  export function devCommand(options = {}) {
6
+ const configs = getArkosConfig();
7
+ console.log(configs);
4
8
  try {
5
9
  const { port, host } = options;
6
- console.info(`🚀 Starting development server on ${host}:${port}...`);
7
10
  const fileExt = getUserFileExtension();
8
11
  const entryPoint = `src/app.${fileExt}`;
9
12
  if (!entryPoint) {
10
13
  console.error("❌ Could not find application entry point.");
11
14
  process.exit(1);
12
15
  }
13
- console.info(`📂 Using entry point: ${entryPoint}`);
14
16
  const env = Object.assign(Object.assign(Object.assign({ NODE_ENV: "development" }, process.env), (port && { PORT: port })), (host && { HOST: host }));
15
17
  let child;
16
18
  if (fileExt === "ts") {
17
- console.info("👀 Watch mode enabled. Changes will trigger restart.");
18
19
  child = spawn("npx", ["ts-node-dev", "--respawn", entryPoint], {
19
20
  stdio: "inherit",
20
21
  env,
@@ -28,6 +29,9 @@ export function devCommand(options = {}) {
28
29
  shell: true,
29
30
  });
30
31
  }
32
+ console.info(`\x1b[1m\x1b[36m⇪ Arkos.js ${getVersion()}\x1b[0m`);
33
+ console.info(`- Local: http://${host}:${port}`);
34
+ console.info(`- Environments: development\n`);
31
35
  process.on("SIGINT", () => {
32
36
  if (child) {
33
37
  child.kill();
@@ -1 +1 @@
1
- {"version":3,"file":"dev.js","sourceRoot":"","sources":["../../../../src/utils/cli/dev.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAU7D,MAAM,UAAU,UAAU,CAAC,UAAsB,EAAE;IACjD,IAAI,CAAC;QACH,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;QAC/B,OAAO,CAAC,IAAI,CAAC,qCAAqC,IAAI,IAAI,IAAI,KAAK,CAAC,CAAC;QAGrE,MAAM,OAAO,GAAG,oBAAoB,EAAE,CAAC;QAGvC,MAAM,UAAU,GAAG,WAAW,OAAO,EAAE,CAAC;QAExC,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,OAAO,CAAC,KAAK,CAAC,2CAA2C,CAAC,CAAC;YAC3D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,OAAO,CAAC,IAAI,CAAC,yBAAyB,UAAU,EAAE,CAAC,CAAC;QAGpD,MAAM,GAAG,+CACP,QAAQ,EAAE,aAAa,IACpB,OAAO,CAAC,GAAG,GACX,CAAC,IAAI,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,GACxB,CAAC,IAAI,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAC5B,CAAC;QAGF,IAAI,KAAK,CAAC;QAGV,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;YACrB,OAAO,CAAC,IAAI,CAAC,sDAAsD,CAAC,CAAC;YAErE,KAAK,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC,aAAa,EAAE,WAAW,EAAE,UAAU,CAAC,EAAE;gBAC7D,KAAK,EAAE,SAAS;gBAChB,GAAG;gBACH,KAAK,EAAE,IAAI;aACZ,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,KAAK,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC,SAAS,EAAE,UAAU,CAAC,EAAE;gBAC5C,KAAK,EAAE,SAAS;gBAChB,GAAG;gBACH,KAAK,EAAE,IAAI;aACZ,CAAC,CAAC;QACL,CAAC;QAGD,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;YACxB,IAAI,KAAK,EAAE,CAAC;gBACV,KAAK,CAAC,IAAI,EAAE,CAAC;YACf,CAAC;YACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,uCAAuC,EAAE,KAAK,CAAC,CAAC;QAC9D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC","sourcesContent":["// src/utils/cli/dev.ts\nimport { spawn } from \"child_process\";\nimport { getUserFileExtension } from \"../helpers/fs.helpers\";\n\ninterface DevOptions {\n port?: string;\n host?: string;\n}\n\n/**\n * Dev server command for the arkos CLI\n */\nexport function devCommand(options: DevOptions = {}) {\n try {\n const { port, host } = options;\n console.info(`🚀 Starting development server on ${host}:${port}...`);\n\n // Detect if project uses TypeScript or JavaScript\n const fileExt = getUserFileExtension();\n\n // Find the application entry point\n const entryPoint = `src/app.${fileExt}`;\n\n if (!entryPoint) {\n console.error(\"❌ Could not find application entry point.\");\n process.exit(1);\n }\n\n console.info(`📂 Using entry point: ${entryPoint}`);\n\n // Set environment variables\n const env = {\n NODE_ENV: \"development\",\n ...process.env,\n ...(port && { PORT: port }),\n ...(host && { HOST: host }),\n };\n\n // Start the application with the appropriate runner\n let child;\n\n // Setup file watching if enabled\n if (fileExt === \"ts\") {\n console.info(\"👀 Watch mode enabled. Changes will trigger restart.\");\n\n child = spawn(\"npx\", [\"ts-node-dev\", \"--respawn\", entryPoint], {\n stdio: \"inherit\",\n env,\n shell: true,\n });\n } else {\n child = spawn(\"npx\", [\"nodemon\", entryPoint], {\n stdio: \"inherit\",\n env,\n shell: true,\n });\n }\n\n // Handle process exit\n process.on(\"SIGINT\", () => {\n if (child) {\n child.kill();\n }\n process.exit(0);\n });\n } catch (error) {\n console.error(\"❌ Development server failed to start:\", error);\n process.exit(1);\n }\n}\n\n// /**\n// * Find the application entry point\n// */\n// function findEntryPoint(fileExt: \"ts\" | \"js\"): string | null {\n// const possibleEntryPoints = [\n// ,// `src/index.${fileExt}`,\n// // `src/main.${fileExt}`,\n// // `src/server.${fileExt}`,\n// // `app.${fileExt}`,\n// // `index.${fileExt}`,\n// // `main.${fileExt}`,\n// // `server.${fileExt}`,\n// ];\n\n// for (const entryPoint of possibleEntryPoints) {\n// if (fs.existsSync(path.join(process.cwd(), entryPoint))) {\n// return entryPoint;\n// }\n// }\n\n// // If no entry point is found, check if we're in a built directory\n// // and look for .build entry points\n// const isBuild =\n// process.cwd().includes(\".build\") ||\n// fs.existsSync(path.join(process.cwd(), \".build\"));\n\n// if (isBuild) {\n// // Check both module formats\n// const moduleTypes = [\"cjs\", \"esm\"];\n\n// for (const moduleType of moduleTypes) {\n// for (const baseName of [\"app\", \"index\", \"main\", \"server\"]) {\n// const builtEntryPoint = path.join(\n// \".build\",\n// moduleType,\n// `src/${baseName}.js`\n// );\n\n// if (fs.existsSync(path.join(process.cwd(), builtEntryPoint))) {\n// return builtEntryPoint;\n// }\n// }\n// }\n// }\n\n// return null;\n// }\n"]}
1
+ {"version":3,"file":"dev.js","sourceRoot":"","sources":["../../../../src/utils/cli/dev.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,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QACjE,OAAO,CAAC,IAAI,CAAC,0BAA0B,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC;QACvD,OAAO,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;QAG9C,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;YACxB,IAAI,KAAK,EAAE,CAAC;gBACV,KAAK,CAAC,IAAI,EAAE,CAAC;YACf,CAAC;YACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,uCAAuC,EAAE,KAAK,CAAC,CAAC;QAC9D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC","sourcesContent":["// src/utils/cli/dev.ts\nimport { spawn } from \"child_process\";\nimport { getUserFileExtension } from \"../helpers/fs.helpers\";\nimport { getVersion } from \".\";\nimport { getArkosConfig } from \"../../server\";\n\ninterface DevOptions {\n port?: string;\n host?: string;\n}\n\n/**\n * Dev server command for the arkos CLI\n */\nexport function devCommand(options: DevOptions = {}) {\n const configs = getArkosConfig();\n console.log(configs);\n\n try {\n const { port, host } = options;\n\n // Detect if project uses TypeScript or JavaScript\n const fileExt = getUserFileExtension();\n\n // Find the application entry point\n const entryPoint = `src/app.${fileExt}`;\n\n if (!entryPoint) {\n console.error(\"❌ Could not find application entry point.\");\n process.exit(1);\n }\n\n // Set environment variables\n const env = {\n NODE_ENV: \"development\",\n ...process.env,\n ...(port && { PORT: port }),\n ...(host && { HOST: host }),\n };\n\n // Start the application with the appropriate runner\n let child;\n\n // Setup file watching if enabled\n if (fileExt === \"ts\") {\n child = spawn(\"npx\", [\"ts-node-dev\", \"--respawn\", entryPoint], {\n stdio: \"inherit\",\n env,\n shell: true,\n });\n } else {\n child = spawn(\"npx\", [\"nodemon\", entryPoint], {\n stdio: \"inherit\",\n env,\n shell: true,\n });\n }\n\n console.info(`\\x1b[1m\\x1b[36m⇪ Arkos.js ${getVersion()}\\x1b[0m`);\n console.info(`- Local: http://${host}:${port}`);\n console.info(`- Environments: development\\n`);\n\n // Handle process exit\n process.on(\"SIGINT\", () => {\n if (child) {\n child.kill();\n }\n process.exit(0);\n });\n } catch (error) {\n console.error(\"❌ Development server failed to start:\", error);\n process.exit(1);\n }\n}\n"]}
@@ -4,10 +4,12 @@ import path from "path";
4
4
  import fs from "fs";
5
5
  import { devCommand } from "./dev";
6
6
  import { startCommand } from "./start";
7
- const packageJson = JSON.parse(fs.readFileSync(path.join(__dirname, "../../../../package.json"), "utf8"));
8
- const version = packageJson.version || "1.0.0";
7
+ export function getVersion() {
8
+ const packageJson = JSON.parse(fs.readFileSync(path.join(__dirname, "../../../../package.json"), "utf8"));
9
+ return packageJson.version || "1.0.0";
10
+ }
9
11
  const program = new Command();
10
- program.name("arkos").description("Arkos framework CLI").version(version);
12
+ program.name("arkos").description("Arkos framework CLI").version(getVersion());
11
13
  console.log("program setup", program);
12
14
  program
13
15
  .command("build")
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/utils/cli/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAGvC,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAC5B,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,0BAA0B,CAAC,EAAE,MAAM,CAAC,CAC1E,CAAC;AAEF,MAAM,OAAO,GAAG,WAAW,CAAC,OAAO,IAAI,OAAO,CAAC;AAE/C,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AAE1E,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;AAEtC,OAAO;KACJ,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,0BAA0B,CAAC;KACvC,MAAM,CAAC,aAAa,EAAE,mBAAmB,CAAC;KAC1C,MAAM,CAAC,qBAAqB,EAAE,qBAAqB,CAAC;KACpD,MAAM,CAAC,qBAAqB,EAAE,0BAA0B,EAAE,KAAK,CAAC;KAChE,MAAM,CAAC,YAAY,CAAC,CAAC;AAExB,OAAO;KACJ,OAAO,CAAC,KAAK,CAAC;KACd,WAAW,CAAC,wBAAwB,CAAC;KACrC,MAAM,CAAC,qBAAqB,EAAE,aAAa,CAAC;KAC5C,MAAM,CAAC,mBAAmB,EAAE,iBAAiB,CAAC;KAC9C,MAAM,CAAC,UAAU,CAAC,CAAC;AAEtB,OAAO;KACJ,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,uBAAuB,CAAC;KACpC,MAAM,CAAC,qBAAqB,EAAE,aAAa,CAAC;KAC5C,MAAM,CAAC,mBAAmB,EAAE,iBAAiB,CAAC;KAC9C,MAAM,CAAC,YAAY,CAAC,CAAC;AAExB,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAE5B,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC","sourcesContent":["// src/utils/cli/index.ts\nimport { Command } from \"commander\";\nimport { buildCommand } from \"./build\";\nimport path from \"path\";\nimport fs from \"fs\";\nimport { devCommand } from \"./dev\";\nimport { startCommand } from \"./start\";\n\n// Get package version from package.json\nconst packageJson = JSON.parse(\n fs.readFileSync(path.join(__dirname, \"../../../../package.json\"), \"utf8\")\n);\n\nconst version = packageJson.version || \"1.0.0\";\n\nconst program = new Command();\n\nprogram.name(\"arkos\").description(\"Arkos framework CLI\").version(version);\n\nconsole.log(\"program setup\", program);\n\nprogram\n .command(\"build\")\n .description(\"Build your Arkos project\")\n .option(\"-w, --watch\", \"Watch for changes\")\n .option(\"-c, --config <path>\", \"Path to config file\")\n .option(\"-m, --module <type>\", \"Module type (cjs or esm)\", \"cjs\")\n .action(buildCommand);\n\nprogram\n .command(\"dev\")\n .description(\"Run development server\")\n .option(\"-p, --port <number>\", \"Port number\")\n .option(\"-h, --host <host>\", \"Host to bind to\")\n .action(devCommand);\n\nprogram\n .command(\"start\")\n .description(\"Run production server\")\n .option(\"-p, --port <number>\", \"Port number\")\n .option(\"-h, --host <host>\", \"Host to bind to\")\n .action(startCommand);\n\nprogram.parse(process.argv);\n\nexport { program, buildCommand, devCommand, startCommand };\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/utils/cli/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,MAAM,UAAU,UAAU;IACxB,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAC5B,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,0BAA0B,CAAC,EAAE,MAAM,CAAC,CAC1E,CAAC;IAEF,OAAO,WAAW,CAAC,OAAO,IAAI,OAAO,CAAC;AACxC,CAAC;AAED,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;AAE/E,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;AAEtC,OAAO;KACJ,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,0BAA0B,CAAC;KACvC,MAAM,CAAC,aAAa,EAAE,mBAAmB,CAAC;KAC1C,MAAM,CAAC,qBAAqB,EAAE,qBAAqB,CAAC;KACpD,MAAM,CAAC,qBAAqB,EAAE,0BAA0B,EAAE,KAAK,CAAC;KAChE,MAAM,CAAC,YAAY,CAAC,CAAC;AAExB,OAAO;KACJ,OAAO,CAAC,KAAK,CAAC;KACd,WAAW,CAAC,wBAAwB,CAAC;KACrC,MAAM,CAAC,qBAAqB,EAAE,aAAa,CAAC;KAC5C,MAAM,CAAC,mBAAmB,EAAE,iBAAiB,CAAC;KAC9C,MAAM,CAAC,UAAU,CAAC,CAAC;AAEtB,OAAO;KACJ,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,uBAAuB,CAAC;KACpC,MAAM,CAAC,qBAAqB,EAAE,aAAa,CAAC;KAC5C,MAAM,CAAC,mBAAmB,EAAE,iBAAiB,CAAC;KAC9C,MAAM,CAAC,YAAY,CAAC,CAAC;AAExB,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAE5B,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC","sourcesContent":["// src/utils/cli/index.ts\nimport { Command } from \"commander\";\nimport { buildCommand } from \"./build\";\nimport path from \"path\";\nimport fs from \"fs\";\nimport { devCommand } from \"./dev\";\nimport { startCommand } from \"./start\";\n\nexport function getVersion() {\n const packageJson = JSON.parse(\n fs.readFileSync(path.join(__dirname, \"../../../../package.json\"), \"utf8\")\n );\n\n return packageJson.version || \"1.0.0\";\n}\n\nconst program = new Command();\n\nprogram.name(\"arkos\").description(\"Arkos framework CLI\").version(getVersion());\n\nconsole.log(\"program setup\", program);\n\nprogram\n .command(\"build\")\n .description(\"Build your Arkos project\")\n .option(\"-w, --watch\", \"Watch for changes\")\n .option(\"-c, --config <path>\", \"Path to config file\")\n .option(\"-m, --module <type>\", \"Module type (cjs or esm)\", \"cjs\")\n .action(buildCommand);\n\nprogram\n .command(\"dev\")\n .description(\"Run development server\")\n .option(\"-p, --port <number>\", \"Port number\")\n .option(\"-h, --host <host>\", \"Host to bind to\")\n .action(devCommand);\n\nprogram\n .command(\"start\")\n .description(\"Run production server\")\n .option(\"-p, --port <number>\", \"Port number\")\n .option(\"-h, --host <host>\", \"Host to bind to\")\n .action(startCommand);\n\nprogram.parse(process.argv);\n\nexport { program, buildCommand, devCommand, startCommand };\n"]}
@@ -1,16 +1,18 @@
1
1
  import path from "path";
2
2
  import fs from "fs";
3
3
  import { spawn } from "child_process";
4
+ import { getArkosConfig } from "../../server";
5
+ import { getVersion } from ".";
4
6
  export function startCommand(options = {}) {
7
+ const configs = getArkosConfig();
8
+ console.log(configs);
5
9
  try {
6
10
  const { port, host } = options;
7
- console.info(`🚀 Starting production server on ${host}:${port}...`);
8
11
  const entryPoint = path.join(".build", "src", "app.js");
9
12
  if (!fs.existsSync(path.join(process.cwd(), entryPoint))) {
10
13
  console.error(`❌ Could not find built application entry point at ${entryPoint}`);
11
14
  process.exit(1);
12
15
  }
13
- console.info(`📂 Using entry point: ${entryPoint}`);
14
16
  const env = Object.assign(Object.assign(Object.assign(Object.assign({}, process.env), (port && { PORT: port })), (host && { HOST: host })), { NODE_ENV: "production", ARKOS_BUILD: "true" });
15
17
  const child = spawn("node", [entryPoint], {
16
18
  stdio: "inherit",
@@ -23,6 +25,9 @@ export function startCommand(options = {}) {
23
25
  }
24
26
  process.exit(0);
25
27
  });
28
+ console.info(`\x1b[1m\x1b[36m⇪ Arkos.js ${getVersion()}\x1b[0m`);
29
+ console.info(`- Local: http://${host}:${port}`);
30
+ console.info(`- Environments: production\n`);
26
31
  }
27
32
  catch (error) {
28
33
  console.error("❌ Production server failed to start:", error);
@@ -1 +1 @@
1
- {"version":3,"file":"start.js","sourceRoot":"","sources":["../../../../src/utils/cli/start.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAUtC,MAAM,UAAU,YAAY,CAAC,UAAwB,EAAE;IACrD,IAAI,CAAC;QACH,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;QAC/B,OAAO,CAAC,IAAI,CAAC,oCAAoC,IAAI,IAAI,IAAI,KAAK,CAAC,CAAC;QAGpE,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;QAExD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC;YACzD,OAAO,CAAC,KAAK,CACX,qDAAqD,UAAU,EAAE,CAClE,CAAC;YACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,OAAO,CAAC,IAAI,CAAC,yBAAyB,UAAU,EAAE,CAAC,CAAC;QAGpD,MAAM,GAAG,+DACJ,OAAO,CAAC,GAAG,GACX,CAAC,IAAI,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,GACxB,CAAC,IAAI,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,KAC3B,QAAQ,EAAE,YAAY,EACtB,WAAW,EAAE,MAAM,GACpB,CAAC;QAGF,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,UAAU,CAAC,EAAE;YACxC,KAAK,EAAE,SAAS;YAChB,GAAG;YACH,KAAK,EAAE,IAAI;SACZ,CAAC,CAAC;QAGH,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;YACxB,IAAI,KAAK,EAAE,CAAC;gBACV,KAAK,CAAC,IAAI,EAAE,CAAC;YACf,CAAC;YACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,sCAAsC,EAAE,KAAK,CAAC,CAAC;QAC7D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC","sourcesContent":["// src/utils/cli/start.ts\nimport path from \"path\";\nimport fs from \"fs\";\nimport { spawn } from \"child_process\";\n\ninterface StartOptions {\n port?: string;\n host?: string;\n}\n\n/**\n * Production start command for the arkos CLI\n */\nexport function startCommand(options: StartOptions = {}) {\n try {\n const { port, host } = options;\n console.info(`🚀 Starting production server on ${host}:${port}...`);\n\n // Check for built app file\n const entryPoint = path.join(\".build\", \"src\", \"app.js\");\n\n if (!fs.existsSync(path.join(process.cwd(), entryPoint))) {\n console.error(\n `❌ Could not find built application entry point at ${entryPoint}`\n );\n process.exit(1);\n }\n\n console.info(`📂 Using entry point: ${entryPoint}`);\n\n // Set environment variables\n const env = {\n ...process.env,\n ...(port && { PORT: port }),\n ...(host && { HOST: host }),\n NODE_ENV: \"production\",\n ARKOS_BUILD: \"true\",\n };\n\n // Start the application\n const child = spawn(\"node\", [entryPoint], {\n stdio: \"inherit\",\n env,\n shell: true,\n });\n\n // Handle process exit\n process.on(\"SIGINT\", () => {\n if (child) {\n child.kill();\n }\n process.exit(0);\n });\n } catch (error) {\n console.error(\"❌ Production server failed to start:\", error);\n process.exit(1);\n }\n}\n"]}
1
+ {"version":3,"file":"start.js","sourceRoot":"","sources":["../../../../src/utils/cli/start.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO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C,CAAC;QAClB,CAAC,CAAC,CAAC;QAEH,OAAO,CAAC,IAAI,CAAC,6BAA6B,UAAU,EAAE,SAAS,CAAC,CAAC;QACjE,OAAO,CAAC,IAAI,CAAC,0BAA0B,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC;QACvD,OAAO,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;IAC/C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,sCAAsC,EAAE,KAAK,CAAC,CAAC;QAC7D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC","sourcesContent":["// src/utils/cli/start.ts\nimport path from \"path\";\nimport fs from \"fs\";\nimport { spawn } from \"child_process\";\nimport { getArkosConfig } from \"../../server\";\nimport { getVersion } from \".\";\n\ninterface StartOptions {\n port?: string;\n host?: string;\n}\n\n/**\n * Production start command for the arkos CLI\n */\nexport function startCommand(options: StartOptions = {}) {\n const configs = getArkosConfig();\n console.log(configs);\n try {\n const { port, host } = options;\n\n // Check for built app file\n const entryPoint = path.join(\".build\", \"src\", \"app.js\");\n\n if (!fs.existsSync(path.join(process.cwd(), entryPoint))) {\n console.error(\n `❌ Could not find built application entry point at ${entryPoint}`\n );\n process.exit(1);\n }\n\n // Set environment variables\n const env = {\n ...process.env,\n ...(port && { PORT: port }),\n ...(host && { HOST: host }),\n NODE_ENV: \"production\",\n ARKOS_BUILD: \"true\",\n };\n\n // Start the application\n const child = spawn(\"node\", [entryPoint], {\n stdio: \"inherit\",\n env,\n shell: true,\n });\n\n // Handle process exit\n process.on(\"SIGINT\", () => {\n if (child) {\n child.kill();\n }\n process.exit(0);\n });\n\n console.info(`\\x1b[1m\\x1b[36m⇪ Arkos.js ${getVersion()}\\x1b[0m`);\n console.info(`- Local: http://${host}:${port}`);\n console.info(`- Environments: production\\n`);\n } catch (error) {\n console.error(\"❌ Production server failed to start:\", error);\n process.exit(1);\n }\n}\n"]}
@@ -2,5 +2,6 @@ import { Command } from "commander";
2
2
  import { buildCommand } from "./build";
3
3
  import { devCommand } from "./dev";
4
4
  import { startCommand } from "./start";
5
+ export declare function getVersion(): any;
5
6
  declare const program: Command;
6
7
  export { program, buildCommand, devCommand, startCommand };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arkos",
3
- "version": "1.1.0-beta",
3
+ "version": "1.1.1-test",
4
4
  "description": "The Express & Prisma Framework For RESTful API",
5
5
  "main": "dist/cjs/exports/index.js",
6
6
  "module": "dist/es2020/exports/index.js",