@devbro/pashmak 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/app/console/project/CreateProjectCommand.ts"],"sourcesContent":["import { cli } from \"../../../facades\";\nimport { Command, Option } from \"clipanion\";\nimport { Case } from \"change-case-all\";\nimport path from \"path\";\nimport * as fs from \"fs/promises\";\nimport { fileURLToPath } from \"url\";\nimport handlebars from \"handlebars\";\nimport { execSync } from \"child_process\";\n\nexport class CreateProjectCommand extends Command {\n static paths = [[`create`, `project`]];\n\n static usage = Command.Usage({\n category: `Project`,\n description: `Create a new project`,\n details: `\n This command creates a new project with the specified name at the given path.\n If no path is provided, the project will be created in the current directory.\n `,\n examples: [\n [\n `Create a new project in specified directory`,\n `create project --path /path/to/my-project --git`,\n ],\n [\n `Create a new project at a specific path with git initialized`,\n `create project --path /path/to/my-project --git`,\n ],\n ],\n });\n\n projectPath = Option.String(\"--path\", { required: true });\n\n git = Option.Boolean(`--git`, false, {\n description: `Initialize a git repository in the new project`,\n });\n\n async folderExists(folderPath: string): Promise<boolean> {\n try {\n const stats = await fs.stat(folderPath);\n return stats.isDirectory();\n } catch (error: any) {\n if (error.code === \"ENOENT\") {\n return false; // Folder does not exist\n }\n throw error; // Other errors (e.g., permission issues)\n }\n }\n\n async execute() {\n // Create the project directory path by joining the specified path and project name\n const projectPath = path.join(this.projectPath);\n // Check if directory already exists\n try {\n await fs.access(projectPath);\n console.error(`Error: Directory ${projectPath} already exists.`);\n return 1;\n } catch {\n // Directory doesn't exist, we can proceed\n }\n\n await fs.mkdir(projectPath, { recursive: true });\n console.log(`Created project directory at: ${projectPath}`);\n\n let dirname = __dirname;\n if (!dirname) {\n dirname = path.dirname(fileURLToPath(import.meta.url));\n }\n\n let basePath = path.join(dirname, `./base_project`);\n if ((await this.folderExists(basePath)) === false) {\n // we are running a compiled code that was bundled and the code is running from ./dist/bin/ folder.\n basePath = path.join(dirname, `../app/console/project/base_project`);\n }\n\n console.log(`Using base project path: ${basePath}`);\n //copy content of ./base_project to the new project directory\n const baseProjectPath = basePath;\n\n await this.processTplFolder(baseProjectPath, projectPath, {});\n console.log(`Copied base project files to: ${projectPath}`);\n\n //modify package.json with foldername\n const packageJsonPath = path.join(projectPath, `package.json`);\n const packageJson = JSON.parse(await fs.readFile(packageJsonPath, `utf-8`));\n packageJson.name = Case.snake(path.basename(projectPath));\n await fs.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2));\n console.log(`Updated package.json with project name: ${packageJson.name}`);\n\n if (this.git) {\n try {\n execSync(\n 'git init; git add --all; git commit --allow-empty -m \"chore: first commit for pashmak\"',\n {\n cwd: projectPath,\n },\n );\n } catch (error) {\n console.error(`Failed to create project.`, error);\n return 1;\n }\n }\n }\n\n async processTplFolder(src: string, dest: string, data: any = {}) {\n const files = await fs.readdir(src, { withFileTypes: true });\n for (const file of files) {\n const srcPath = path.join(src, file.name);\n const destPath =\n file.isFile() && file.name.endsWith(\".tpl\")\n ? path.join(dest, file.name.substring(0, file.name.length - 4))\n : path.join(dest, file.name);\n\n if (file.isDirectory()) {\n await fs.mkdir(destPath, { recursive: true });\n await this.processTplFolder(srcPath, destPath, data);\n } else if (file.name.endsWith(\".tpl\")) {\n await this.processTplFile(srcPath, destPath, {});\n } else {\n throw new Error(\n \"unexpected non tpl file: \" + srcPath + \" \" + file.name,\n );\n }\n }\n }\n\n async processTplFile(src: string, dest: string, data: any = {}) {\n const compiledTemplate = handlebars.compile(\n (await fs.readFile(src)).toString(),\n );\n const template = await compiledTemplate(data);\n await fs.writeFile(dest, template);\n }\n}\n"],"mappings":";;AACA,SAASA,SAASC,cAAc;AAChC,SAASC,YAAY;AACrB,OAAOC,UAAU;AACjB,YAAYC,QAAQ;AACpB,SAASC,qBAAqB;AAC9B,OAAOC,gBAAgB;AACvB,SAASC,gBAAgB;AAElB,MAAMC,6BAA6BR,QAAAA;EAR1C,OA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ACL,cAAM,IAAIM,MACR,8BAA8BP,UAAU,MAAMD,KAAKZ,IAAI;MAE3D;IACF;EACF;EAEA,MAAMmB,eAAeb,KAAaC,MAAcC,OAAY,CAAC,GAAG;AAC9D,UAAMa,mBAAmB7D,WAAW8D,SACjC,MAAMhE,GAAGyC,SAASO,GAAAA,GAAMiB,SAAQ,CAAA;AAEnC,UAAMC,WAAW,MAAMH,iBAAiBb,IAAAA;AACxC,UAAMlD,GAAG6C,UAAUI,MAAMiB,QAAAA;EAC3B;AACF;","names":["Command","Option","Case","path","fs","fileURLToPath","handlebars","execSync","CreateProjectCommand","paths","usage","Usage","category","description","details","examples","projectPath","String","required","git","Boolean","folderExists","folderPath","stats","stat","isDirectory","error","code","execute","join","access","console","mkdir","recursive","log","dirname","__dirname","url","basePath","baseProjectPath","processTplFolder","packageJsonPath","packageJson","JSON","parse","readFile","name","snake","basename","writeFile","stringify","cwd","src","dest","data","files","readdir","withFileTypes","file","srcPath","destPath","isFile","endsWith","substring","length","processTplFile","Error","compiledTemplate","compile","toString","template"]}
1
+ {"version":3,"sources":["../../../../src/app/console/project/CreateProjectCommand.ts"],"sourcesContent":["import { Command, Option } from \"clipanion\";\nimport { Case } from \"change-case-all\";\nimport path from \"path\";\nimport * as fs from \"fs/promises\";\nimport { fileURLToPath } from \"url\";\nimport handlebars from \"handlebars\";\nimport { execSync } from \"child_process\";\n\nexport class CreateProjectCommand extends Command {\n static paths = [[`create`, `project`]];\n\n static usage = Command.Usage({\n category: `Project`,\n description: `Create a new project`,\n details: `\n This command creates a new project with the specified name at the given path.\n If no path is provided, the project will be created in the current directory.\n `,\n examples: [\n [\n `Create a new project in specified directory`,\n `create project --path /path/to/my-project --git`,\n ],\n [\n `Create a new project at a specific path with git initialized`,\n `create project --path /path/to/my-project --git`,\n ],\n ],\n });\n\n projectPath = Option.String(\"--path\", { required: true });\n\n git = Option.Boolean(`--git`, false, {\n description: `Initialize a git repository in the new project`,\n });\n\n async folderExists(folderPath: string): Promise<boolean> {\n try {\n const stats = await fs.stat(folderPath);\n return stats.isDirectory();\n } catch (error: any) {\n if (error.code === \"ENOENT\") {\n return false; // Folder does not exist\n }\n throw error; // Other errors (e.g., permission issues)\n }\n }\n\n async execute() {\n // Create the project directory path by joining the specified path and project name\n const projectPath = path.join(this.projectPath);\n // Check if directory already exists\n try {\n await fs.access(projectPath);\n console.error(`Error: Directory ${projectPath} already exists.`);\n return 1;\n } catch {\n // Directory doesn't exist, we can proceed\n }\n\n await fs.mkdir(projectPath, { recursive: true });\n console.log(`Created project directory at: ${projectPath}`);\n\n let dirname = __dirname;\n if (!dirname) {\n dirname = path.dirname(fileURLToPath(import.meta.url));\n }\n\n let basePath = path.join(dirname, `./base_project`);\n if ((await this.folderExists(basePath)) === false) {\n // we are running a compiled code that was bundled and the code is running from ./dist/bin/ folder.\n basePath = path.join(dirname, `../app/console/project/base_project`);\n }\n\n console.log(`Using base project path: ${basePath}`);\n //copy content of ./base_project to the new project directory\n const baseProjectPath = basePath;\n\n await this.processTplFolder(baseProjectPath, projectPath, {});\n console.log(`Copied base project files to: ${projectPath}`);\n\n //modify package.json with foldername\n const packageJsonPath = path.join(projectPath, `package.json`);\n const packageJson = JSON.parse(await fs.readFile(packageJsonPath, `utf-8`));\n packageJson.name = Case.snake(path.basename(projectPath));\n await fs.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2));\n console.log(`Updated package.json with project name: ${packageJson.name}`);\n\n if (this.git) {\n try {\n execSync(\n 'git init; git add --all; git commit --allow-empty -m \"chore: first commit for pashmak\"',\n {\n cwd: projectPath,\n },\n );\n } catch (error) {\n console.error(`Failed to create project.`, error);\n return 1;\n }\n }\n }\n\n async processTplFolder(src: string, dest: string, data: any = {}) {\n const files = await fs.readdir(src, { withFileTypes: true });\n for (const file of files) {\n const srcPath = path.join(src, file.name);\n const destPath =\n file.isFile() && file.name.endsWith(\".tpl\")\n ? path.join(dest, file.name.substring(0, file.name.length - 4))\n : path.join(dest, file.name);\n\n if (file.isDirectory()) {\n await fs.mkdir(destPath, { recursive: true });\n await this.processTplFolder(srcPath, destPath, data);\n } else if (file.name.endsWith(\".tpl\")) {\n await this.processTplFile(srcPath, destPath, {});\n } else {\n throw new Error(\n \"unexpected non tpl file: \" + srcPath + \" \" + file.name,\n );\n }\n }\n }\n\n async processTplFile(src: string, dest: string, data: any = {}) {\n const compiledTemplate = handlebars.compile(\n (await fs.readFile(src)).toString(),\n );\n const template = await compiledTemplate(data);\n await fs.writeFile(dest, template);\n }\n}\n"],"mappings":";;AAAA,SAASA,SAASC,cAAc;AAChC,SAASC,YAAY;AACrB,OAAOC,UAAU;AACjB,YAAYC,QAAQ;AACpB,SAASC,qBAAqB;AAC9B,OAAOC,gBAAgB;AACvB,SAASC,gBAAgB;AAElB,MAAMC,6BAA6BR,QAAAA;EAR1C,OAQ0CA;;;EACxC,OAAOS,QAAQ;IAAC;MAAC;MAAU;;;EAE3B,OAAOC,QAAQV,QAAQW,MAAM;IAC3BC,UAAU;IACVC,aAAa;IACbC,SAAS;;;;IAITC,UAAU;MACR;QACE;QACA;;MAEF;QACE;QACA;;;EAGN,CAAA;EAEAC,cAAcf,OAAOgB,OAAO,UAAU;IAAEC,UAAU;EAAK,CAAA;EAEvDC,MAAMlB,OAAOmB,QAAQ,SAAS,OAAO;IACnCP,aAAa;EACf,CAAA;EAEA,MAAMQ,aAAaC,YAAsC;AACvD,QAAI;AACF,YAAMC,QAAQ,MAAMnB,GAAGoB,KAAKF,UAAAA;AAC5B,aAAOC,MAAME,YAAW;IAC1B,SAASC,OAAY;AACnB,UAAIA,MAAMC,SAAS,UAAU;AAC3B,eAAO;MACT;AACA,YAAMD;IACR;EACF;EAEA,MAAME,UAAU;AAEd,UAAMZ,cAAcb,KAAK0B,KAAK,KAAKb,WAAW;AAE9C,QAAI;AACF,YAAMZ,GAAG0B,OAAOd,WAAAA;AAChBe,cAAQL,MAAM,oBAAoBV,WAAAA,kBAA6B;AAC/D,aAAO;IACT,QAAQ;IAER;AAEA,UA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,KAAKuB,KAAKM,KAAKZ,IAAI;AACxC,YAAMc,WACJF,KAAKG,OAAM,KAAMH,KAAKZ,KAAKgB,SAAS,MAAA,IAChC3D,KAAK0B,KAAKwB,MAAMK,KAAKZ,KAAKiB,UAAU,GAAGL,KAAKZ,KAAKkB,SAAS,CAAA,CAAA,IAC1D7D,KAAK0B,KAAKwB,MAAMK,KAAKZ,IAAI;AAE/B,UAAIY,KAAKjC,YAAW,GAAI;AACtB,cAAMrB,GAAG4B,MAAM4B,UAAU;UAAE3B,WAAW;QAAK,CAAA;AAC3C,cAAM,KAAKO,iBAAiBmB,SAASC,UAAUN,IAAAA;MACjD,WAAWI,KAAKZ,KAAKgB,SAAS,MAAA,GAAS;AACrC,cAAM,KAAKG,eAAeN,SAASC,UAAU,CAAC,CAAA;MAChD,OAAO;AACL,cAAM,IAAIM,MACR,8BAA8BP,UAAU,MAAMD,KAAKZ,IAAI;MAE3D;IACF;EACF;EAEA,MAAMmB,eAAeb,KAAaC,MAAcC,OAAY,CAAC,GAAG;AAC9D,UAAMa,mBAAmB7D,WAAW8D,SACjC,MAAMhE,GAAGyC,SAASO,GAAAA,GAAMiB,SAAQ,CAAA;AAEnC,UAAMC,WAAW,MAAMH,iBAAiBb,IAAAA;AACxC,UAAMlD,GAAG6C,UAAUI,MAAMiB,QAAAA;EAC3B;AACF;","names":["Command","Option","Case","path","fs","fileURLToPath","handlebars","execSync","CreateProjectCommand","paths","usage","Usage","category","description","details","examples","projectPath","String","required","git","Boolean","folderExists","folderPath","stats","stat","isDirectory","error","code","execute","join","access","console","mkdir","recursive","log","dirname","__dirname","url","basePath","baseProjectPath","processTplFolder","packageJsonPath","packageJson","JSON","parse","readFile","name","snake","basename","writeFile","stringify","cwd","src","dest","data","files","readdir","withFileTypes","file","srcPath","destPath","isFile","endsWith","substring","length","processTplFile","Error","compiledTemplate","compile","toString","template"]}
@@ -34,14 +34,16 @@
34
34
  "supertest": "^6.3.3",
35
35
  "tsx": "^4.20.3",
36
36
  "typescript": "^5.8.3",
37
+ "pino-pretty": "^13.0.0",
38
+ "husky": "^9.1.7",
37
39
  "vitest": "^3.2.4"
38
40
  },
39
41
  "dependencies": {
40
- "@devbro/pashmak": "0.1.0",
42
+ "@devbro/pashmak": "^0.1.0",
41
43
  "bcryptjs": "^3.0.2",
42
44
  "clipanion": "^4.0.0-rc.4",
43
45
  "dotenv": "^16.5.0",
44
- "jsonwebtoken": "^9.0.2",
46
+ "jsonwebtoken": "^9.0.0",
45
47
  "tsconfig-paths": "^4.2.0",
46
48
  "yup": "^1.6.1"
47
49
  },
@@ -5,3 +5,8 @@ import { fileURLToPath } from "url";
5
5
  await bootstrap({
6
6
  root_dir: dirname(fileURLToPath(import.meta.url)),
7
7
  });
8
+
9
+ console.log("Registering service providers...");
10
+ await import(`./app/console`);
11
+ await import(`./routes`);
12
+ await import(`./schedules`);
@@ -1,3 +1,4 @@
1
+ #!/usr/bin/env node
1
2
  "use strict";
2
3
  var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
@@ -1,2 +1 @@
1
-
2
- export { }
1
+ #!/usr/bin/env node
@@ -1,3 +1,4 @@
1
+ #!/usr/bin/env node
1
2
  import { Cli } from "clipanion";
2
3
  const [node, app, ...args] = process.argv;
3
4
  let cli = new Cli({
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/bin/pashmak_cli.ts"],"sourcesContent":["import { Cli } from \"clipanion\";\n\nconst [node, app, ...args] = process.argv;\nlet cli = new Cli({\n binaryLabel: `Pashmak CLI`,\n binaryName: `${node} ${app}`,\n binaryVersion: `1.0.0`,\n});\n\nimport { CreateProjectCommand } from \"../app/console/project/CreateProjectCommand\";\n\ncli.register(CreateProjectCommand);\n\ncli\n .runExit(args)\n .then(() => {})\n .catch((err: any) => {\n console.error(err);\n });\n"],"mappings":"AAAA,SAASA,WAAW;AAEpB,MAAM,CAACC,MAAMC,KAAK,GAAGC,IAAAA,IAAQC,QAAQC;AACrC,IAAIC,MAAM,IAAIN,IAAI;EAChBO,aAAa;EACbC,YAAY,GAAGP,IAAAA,IAAQC,GAAAA;EACvBO,eAAe;AACjB,CAAA;AAEA,SAASC,4BAA4B;AAErCJ,IAAIK,SAASD,oBAAAA;AAEbJ,IACGM,QAAQT,IAAAA,EACRU,KAAK,MAAA;AAAO,CAAA,EACZC,MAAM,CAACC,QAAAA;AACNC,UAAQC,MAAMF,GAAAA;AAChB,CAAA;","names":["Cli","node","app","args","process","argv","cli","binaryLabel","binaryName","binaryVersion","CreateProjectCommand","register","runExit","then","catch","err","console","error"]}
1
+ {"version":3,"sources":["../../src/bin/pashmak_cli.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { Cli } from \"clipanion\";\n\nconst [node, app, ...args] = process.argv;\nlet cli = new Cli({\n binaryLabel: `Pashmak CLI`,\n binaryName: `${node} ${app}`,\n binaryVersion: `1.0.0`,\n});\n\nimport { CreateProjectCommand } from \"../app/console/project/CreateProjectCommand\";\n\ncli.register(CreateProjectCommand);\n\ncli\n .runExit(args)\n .then(() => {})\n .catch((err: any) => {\n console.error(err);\n });\n"],"mappings":";AAEA,SAASA,WAAW;AAEpB,MAAM,CAACC,MAAMC,KAAK,GAAGC,IAAAA,IAAQC,QAAQC;AACrC,IAAIC,MAAM,IAAIN,IAAI;EAChBO,aAAa;EACbC,YAAY,GAAGP,IAAAA,IAAQC,GAAAA;EACvBO,eAAe;AACjB,CAAA;AAEA,SAASC,4BAA4B;AAErCJ,IAAIK,SAASD,oBAAAA;AAEbJ,IACGM,QAAQT,IAAAA,EACRU,KAAK,MAAA;AAAO,CAAA,EACZC,MAAM,CAACC,QAAAA;AACNC,UAAQC,MAAMF,GAAAA;AAChB,CAAA;","names":["Cli","node","app","args","process","argv","cli","binaryLabel","binaryName","binaryVersion","CreateProjectCommand","register","runExit","then","catch","err","console","error"]}
package/dist/index.js CHANGED
@@ -14,10 +14,6 @@ async function bootstrap(options) {
14
14
  await import("./app/console");
15
15
  console.log("Loading Database Provider ...");
16
16
  const { DatabaseServiceProvider } = await import("./DatabaseServiceProvider");
17
- console.log("Registering service providers...");
18
- await import(`${options.root_dir}/app/console`);
19
- await import(`${options.root_dir}/routes`);
20
- await import(`${options.root_dir}/schedules`);
21
17
  console.log("Setting up pre-loader for context provider...");
22
18
  context_provider.setPreLoader(async (f) => {
23
19
  const middlewares = [];
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import dotenv from \"dotenv\";\nimport { context_provider } from \"@devbro/neko-context\";\nimport { Middleware } from \"@devbro/neko-router\";\nimport { runNext } from \"@devbro/neko-router\";\nimport { Request, Response } from \"@devbro/neko-router\";\nimport { config } from \"@devbro/neko-config\";\n\nexport { config };\nexport async function bootstrap(options: { root_dir: string }): Promise<void> {\n // This function is used to bootstrap the application.\n // It can be used to initialize the application, load configuration, etc.\n // Currently, it does nothing but can be extended in the future.\n dotenv.config();\n\n console.log(\"Bootstrapping application...\");\n console.log(`Root directory: ${options.root_dir}`);\n let a = (await import(`${options.root_dir}/config/default`)).default;\n config.load(a);\n\n console.log(\"Loading application modules...\");\n await import(`./app/console`);\n console.log(\"Loading Database Provider ...\");\n const { DatabaseServiceProvider } = await import(\"./DatabaseServiceProvider\");\n\n console.log(\"Registering service providers...\");\n await import(`${options.root_dir}/app/console`);\n await import(`${options.root_dir}/routes`);\n await import(`${options.root_dir}/schedules`);\n\n console.log(\"Setting up pre-loader for context provider...\");\n context_provider.setPreLoader(async (f: Function) => {\n const middlewares: Middleware[] = [];\n // do I need to use ServiceProvider like a middleware or can I get rid of this logic?\n middlewares.push(DatabaseServiceProvider.getInstance());\n\n return await runNext(\n middlewares,\n {} as Request,\n {} as Response,\n // @ts-ignore\n f,\n );\n });\n console.log(\"Application bootstrapped successfully.\");\n}\n"],"mappings":";;AAAA,OAAOA,YAAY;AACnB,SAASC,wBAAwB;AAEjC,SAASC,eAAe;AAExB,SAASC,cAAc;AAGvB,eAAsBC,UAAUC,SAA6B;AAI3DL,SAAOG,OAAM;AAEbG,UAAQC,IAAI,8BAAA;AACZD,UAAQC,IAAI,mBAAmBF,QAAQG,QAAQ,EAAE;AACjD,MAAIC,KAAK,MAAM,OAAO,GAAGJ,QAAQG,QAAQ,oBAAoBE;AAC7DP,SAAOQ,KAAKF,CAAAA;AAEZH,UAAQC,IAAI,gCAAA;AACZ,QAAM,OAAO,eAAe;AAC5BD,UAAQC,IAAI,+BAAA;AACZ,QAAM,EAAEK,wBAAuB,IAAK,MAAM,OAAO,2BAAA;AAEjDN,UAAQC,IAAI,kCAAA;AACZ,QAAM,OAAO,GAAGF,QAAQG,QAAQ;AAChC,QAAM,OAAO,GAAGH,QAAQG,QAAQ;AAChC,QAAM,OAAO,GAAGH,QAAQG,QAAQ;AAEhCF,UAAQC,IAAI,+CAAA;AACZN,mBAAiBY,aAAa,OAAOC,MAAAA;AACnC,UAAMC,cAA4B,CAAA;AAElCA,gBAAYC,KAAKJ,wBAAwBK,YAAW,CAAA;AAEpD,WAAO,MAAMf;MACXa;MACA,CAAC;MACD,CAAC;;MAEDD;IAAAA;EAEJ,CAAA;AACAR,UAAQC,IAAI,wCAAA;AACd;AApCsBH;","names":["dotenv","context_provider","runNext","config","bootstrap","options","console","log","root_dir","a","default","load","DatabaseServiceProvider","setPreLoader","f","middlewares","push","getInstance"]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import dotenv from \"dotenv\";\nimport { context_provider } from \"@devbro/neko-context\";\nimport { Middleware } from \"@devbro/neko-router\";\nimport { runNext } from \"@devbro/neko-router\";\nimport { Request, Response } from \"@devbro/neko-router\";\nimport { config } from \"@devbro/neko-config\";\n\nexport { config };\nexport async function bootstrap(options: { root_dir: string }): Promise<void> {\n // This function is used to bootstrap the application.\n // It can be used to initialize the application, load configuration, etc.\n // Currently, it does nothing but can be extended in the future.\n dotenv.config();\n\n console.log(\"Bootstrapping application...\");\n console.log(`Root directory: ${options.root_dir}`);\n let a = (await import(`${options.root_dir}/config/default`)).default;\n config.load(a);\n\n console.log(\"Loading application modules...\");\n await import(`./app/console`);\n console.log(\"Loading Database Provider ...\");\n const { DatabaseServiceProvider } = await import(\"./DatabaseServiceProvider\");\n\n console.log(\"Setting up pre-loader for context provider...\");\n context_provider.setPreLoader(async (f: Function) => {\n const middlewares: Middleware[] = [];\n // do I need to use ServiceProvider like a middleware or can I get rid of this logic?\n middlewares.push(DatabaseServiceProvider.getInstance());\n\n return await runNext(\n middlewares,\n {} as Request,\n {} as Response,\n // @ts-ignore\n f,\n );\n });\n console.log(\"Application bootstrapped successfully.\");\n}\n"],"mappings":";;AAAA,OAAOA,YAAY;AACnB,SAASC,wBAAwB;AAEjC,SAASC,eAAe;AAExB,SAASC,cAAc;AAGvB,eAAsBC,UAAUC,SAA6B;AAI3DL,SAAOG,OAAM;AAEbG,UAAQC,IAAI,8BAAA;AACZD,UAAQC,IAAI,mBAAmBF,QAAQG,QAAQ,EAAE;AACjD,MAAIC,KAAK,MAAM,OAAO,GAAGJ,QAAQG,QAAQ,oBAAoBE;AAC7DP,SAAOQ,KAAKF,CAAAA;AAEZH,UAAQC,IAAI,gCAAA;AACZ,QAAM,OAAO,eAAe;AAC5BD,UAAQC,IAAI,+BAAA;AACZ,QAAM,EAAEK,wBAAuB,IAAK,MAAM,OAAO,2BAAA;AAEjDN,UAAQC,IAAI,+CAAA;AACZN,mBAAiBY,aAAa,OAAOC,MAAAA;AACnC,UAAMC,cAA4B,CAAA;AAElCA,gBAAYC,KAAKJ,wBAAwBK,YAAW,CAAA;AAEpD,WAAO,MAAMf;MACXa;MACA,CAAC;MACD,CAAC;;MAEDD;IAAAA;EAEJ,CAAA;AACAR,UAAQC,IAAI,wCAAA;AACd;AA/BsBH;","names":["dotenv","context_provider","runNext","config","bootstrap","options","console","log","root_dir","a","default","load","DatabaseServiceProvider","setPreLoader","f","middlewares","push","getInstance"]}
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@devbro/pashmak",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "testing application for the entire repo",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
7
7
  "types": "./dist/index.d.ts",
8
8
  "type": "module",
9
9
  "bin": {
10
- "pashmak": "./dist/bin/pashmak_cli.js"
10
+ "pashmak": "./dist/bin/pashmak_cli.cjs"
11
11
  },
12
12
  "files": [
13
13
  "dist"
@@ -105,6 +105,7 @@
105
105
  "@devbro/neko-orm": "^0.1.0",
106
106
  "@devbro/neko-scheduler": "^0.1.0",
107
107
  "@devbro/neko-sql": "^0.1.0",
108
+ "@devbro/neko-storage": "^0.1.0",
108
109
  "pg-pool": "3.10.0",
109
110
  "ts-jest": "^29.3.4",
110
111
  "tsconfig-paths": "^4.2.0",