create-arkos 1.2.15-beta.8 → 1.2.16-beta

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 Uanela Como
3
+ Copyright (c) 2025-present Uanela Como
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/dist/index.js CHANGED
@@ -34,10 +34,10 @@ async function main() {
34
34
  console.info("\nRunning npx prisma generate...");
35
35
  execSync(`npx prisma generate`, { stdio: "inherit" });
36
36
  console.info(`
37
- ${chalk.bold(chalk.cyan("Arkos.js"))} project created successfully!
37
+ \n${chalk.bold(chalk.cyan("Arkos.js"))} project created successfully!
38
38
 
39
39
  ${chalk.bold("Next Steps:")}
40
- ${argProjectName === "."
40
+ ${argProjectName !== "."
41
41
  ? `1. cd ${config.projectName}
42
42
  2. setup your ${chalk.cyan("DATABASE_URL")} under .env
43
43
  3. npx prisma db push
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,EAAE,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,qBAAqB,MAAM,iCAAiC,CAAC;AACpE,OAAO,gBAAgB,MAAM,2BAA2B,CAAC;AACzD,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,gCAAgC,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,iCAAiC,EAAE,MAAM,6BAA6B,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,UAAU,CAAC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{ dirname } from \"path\";\nimport chalk from \"chalk\";\nimport { execSync } from \"child_process\";\nimport projectConfigInquirer from \"./utils/project-config-inquirer\";\nimport templateCompiler from \"./utils/template-compiler\";\nimport Handlebars from \"handlebars\";\nimport { getProcjetPackageJsonDependecies } from \"./utils/helpers\";\nimport { detectPackageManagerFromUserAgent } from \"./utils/helpers/npm.helpers\";\nimport { fileURLToPath } from \"url\";\n\nHandlebars.registerHelper(\"eq\", (a: any, b: any) => a === b);\nHandlebars.registerHelper(\"neq\", (a: any, b: any) => a !== b);\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nasync function main() {\n const config = await projectConfigInquirer.run();\n const argProjectName = config.argProjectName;\n\n const projectPath = config.projectPath;\n\n fs.mkdirSync(projectPath, { recursive: true });\n\n console.info(\n `\\nCreating a new ${chalk.bold(chalk.cyan(\"Arkos.js\"))} project under ${chalk.green(`./${config.projectName}`)}`\n );\n\n const templatesDir = path.join(__dirname, `../templates/basic`);\n await templateCompiler.compile(templatesDir, config);\n\n process.chdir(projectPath);\n\n const packageManager = detectPackageManagerFromUserAgent();\n const { dependencies, devDependencies } =\n getProcjetPackageJsonDependecies(projectPath);\n\n console.info(chalk.cyan(chalk.bold(\"\\ndependencies:\")));\n dependencies.forEach((dependency) => console.info(`- ${dependency}`));\n\n console.info(chalk.cyan(chalk.bold(\"\\ndevDependencies:\")));\n devDependencies.forEach((devDependency) =>\n console.info(`- ${devDependency}`)\n );\n\n console.info(chalk.bold(\"\\nInstalling dependencies...\"));\n console.info(`Using ${packageManager}.\\n`);\n\n execSync(`${packageManager} install`, { stdio: \"inherit\" });\n\n process.chdir(projectPath);\n console.info(\"\\nRunning npx prisma generate...\");\n execSync(`npx prisma generate`, { stdio: \"inherit\" });\n\n console.info(`\n ${chalk.bold(chalk.cyan(\"Arkos.js\"))} project created successfully!\n\n ${chalk.bold(\"Next Steps:\")}\n ${\n argProjectName === \".\"\n ? `1. cd ${config.projectName}\n 2. setup your ${chalk.cyan(\"DATABASE_URL\")} under .env\n 3. npx prisma db push\n 4. ${packageManager} run dev\n`\n : `1. setup your ${chalk.cyan(\"DATABASE_URL\")} under .env\n 2. npx prisma db push\n 3. ${packageManager} run dev\n`\n }\n `);\n}\n\nmain().catch(console.error);\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,EAAE,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,qBAAqB,MAAM,iCAAiC,CAAC;AACpE,OAAO,gBAAgB,MAAM,2BAA2B,CAAC;AACzD,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,gCAAgC,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,iCAAiC,EAAE,MAAM,6BAA6B,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,UAAU,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,CAAM,EAAE,CAAM,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;AAC7D,UAAU,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC,CAAM,EAAE,CAAM,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;AAE9D,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE1D,KAAK,UAAU,IAAI;IACjB,MAAM,MAAM,GAAG,MAAM,qBAAqB,CAAC,GAAG,EAAE,CAAC;IACjD,MAAM,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;IAE7C,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;IAEvC,EAAE,CAAC,SAAS,CAAC,WAAW,EAAE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S,EAAE,CAAC,CAAC;IAE5D,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAC3B,OAAO,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAC;IACjD,QAAQ,CAAC,qBAAqB,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;IAEtD,OAAO,CAAC,IAAI,CAAC;MACT,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;;IAEpC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC;IAEzB,cAAc,KAAK,GAAG;QACpB,CAAC,CAAC,SAAS,MAAM,CAAC,WAAW;kBACjB,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC;;OAErC,cAAc;CACpB;QACK,CAAC,CAAC,iBAAiB,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC;;OAE5C,cAAc;CAEnB;KACG,CAAC,CAAC;AACP,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\nimport fs from \"fs\";\nimport path, { dirname } from \"path\";\nimport chalk from \"chalk\";\nimport { execSync } from \"child_process\";\nimport projectConfigInquirer from \"./utils/project-config-inquirer\";\nimport templateCompiler from \"./utils/template-compiler\";\nimport Handlebars from \"handlebars\";\nimport { getProcjetPackageJsonDependecies } from \"./utils/helpers\";\nimport { detectPackageManagerFromUserAgent } from \"./utils/helpers/npm.helpers\";\nimport { fileURLToPath } from \"url\";\n\nHandlebars.registerHelper(\"eq\", (a: any, b: any) => a === b);\nHandlebars.registerHelper(\"neq\", (a: any, b: any) => a !== b);\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nasync function main() {\n const config = await projectConfigInquirer.run();\n const argProjectName = config.argProjectName;\n\n const projectPath = config.projectPath;\n\n fs.mkdirSync(projectPath, { recursive: true });\n\n console.info(\n `\\nCreating a new ${chalk.bold(chalk.cyan(\"Arkos.js\"))} project under ${chalk.green(`./${config.projectName}`)}`\n );\n\n const templatesDir = path.join(__dirname, `../templates/basic`);\n await templateCompiler.compile(templatesDir, config);\n\n process.chdir(projectPath);\n\n const packageManager = detectPackageManagerFromUserAgent();\n const { dependencies, devDependencies } =\n getProcjetPackageJsonDependecies(projectPath);\n\n console.info(chalk.cyan(chalk.bold(\"\\ndependencies:\")));\n dependencies.forEach((dependency) => console.info(`- ${dependency}`));\n\n console.info(chalk.cyan(chalk.bold(\"\\ndevDependencies:\")));\n devDependencies.forEach((devDependency) =>\n console.info(`- ${devDependency}`)\n );\n\n console.info(chalk.bold(\"\\nInstalling dependencies...\"));\n console.info(`Using ${packageManager}.\\n`);\n\n execSync(`${packageManager} install`, { stdio: \"inherit\" });\n\n process.chdir(projectPath);\n console.info(\"\\nRunning npx prisma generate...\");\n execSync(`npx prisma generate`, { stdio: \"inherit\" });\n\n console.info(`\n \\n${chalk.bold(chalk.cyan(\"Arkos.js\"))} project created successfully!\n\n ${chalk.bold(\"Next Steps:\")}\n ${\n argProjectName !== \".\"\n ? `1. cd ${config.projectName}\n 2. setup your ${chalk.cyan(\"DATABASE_URL\")} under .env\n 3. npx prisma db push\n 4. ${packageManager} run dev\n`\n : `1. setup your ${chalk.cyan(\"DATABASE_URL\")} under .env\n 2. npx prisma db push\n 3. ${packageManager} run dev\n`\n }\n `);\n}\n\nmain().catch(console.error);\n"]}
@@ -153,7 +153,7 @@ class ProjectConfigInquirer {
153
153
  },
154
154
  ]);
155
155
  else {
156
- console.info(chalk.bold(`${chalk.greenBright("?")} Validation library set to zod (class-validator is not supported on JavaScript)? ${chalk.cyan("zod")}`));
156
+ console.info(chalk.bold(`${chalk.greenBright("?")} Validation library set to zod (class-validator is not supported on JavaScript):`), chalk.cyan("zod"));
157
157
  }
158
158
  this.config.validation = {
159
159
  type: validationTypeResponse.validationType,
@@ -1 +1 @@
1
- {"version":3,"file":"project-config-inquirer.js","sourceRoot":"","sources":["../../src/utils/project-config-inquirer.ts"],"names":[],"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C,aAAa;gBAC7D,aAAa,EAAE,KAAK;aACrB,CAAC;YAEF,IACE,kBAAkB,KAAK,cAAc;gBACrC,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,KAAK,QAAQ;oBACvC,kBAAkB,KAAK,QAAQ,CAAC,EAClC;gBACA,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;oBAC9C;wBACE,IAAI,EAAE,SAAS;wBACf,IAAI,EAAE,eAAe;wBACrB,OAAO,EAAE,IAAI;wBACb,OAAO,EAAE,6CAA6C,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,GAAG;qBACtF;iBACF,CAAC,CAAC;gBAEH,IAAI,CAAC,MAAM,CAAC,cAAc,GAAG;oBAC3B,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc;oBAC7B,aAAa;iBACd,CAAC;aACH;iBAAM,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,KAAK,QAAQ,EAAE;gBACnD,OAAO,CAAC,IAAI,CACV,0HAA0H,CAC3H,CAAC;aACH;SACF;IACH,CAAC;CACF;AAED,MAAM,qBAAqB,GAAG,IAAI,qBAAqB,EAAE,CAAC;AAE1D,eAAe,qBAAqB,CAAC","sourcesContent":["import path from \"path\";\nimport inquirer from \"inquirer\";\nimport chalk from \"chalk\";\n\nexport interface ProjectConfig {\n projectName: string;\n argProjectName?: string;\n typescript: boolean;\n validation: {\n type?: \"zod\" | \"class-validator\";\n };\n authentication: {\n type?: \"static\" | \"dynamic\" | \"define later\";\n usernameField?: \"username\" | \"email\" | \"custom\";\n multipleRoles: boolean;\n };\n prisma: {\n provider:\n | \"postgresql\"\n | \"mysql\"\n | \"sqlite\"\n | \"sqlserver\"\n | \"cockroachdb\"\n | \"mongodb\";\n idDatabaseType: string;\n defaultDBurl: string;\n };\n projectPath: string;\n}\n\nclass ProjectConfigInquirer {\n private config: ProjectConfig;\n\n constructor() {\n this.config = {} as ProjectConfig;\n }\n\n async run() {\n await this.promptProjectName();\n await this.promptTypescript();\n await this.promptPrismaProvider();\n await this.promptValidation();\n await this.promptAuthentication();\n\n // If user passed \".\", use current directory name\n if (this.config.projectName === \".\") {\n this.config.projectName = path.basename(process.cwd());\n this.config.projectPath = path.resolve(process.cwd());\n } else\n this.config.projectPath = path.resolve(\n process.cwd(),\n this.config.projectName\n );\n\n return this.config;\n }\n\n private async promptProjectName() {\n let projectName = process?.argv?.[2];\n this.config.argProjectName = process?.argv?.[2];\n\n if (!projectName) {\n const result = await inquirer.prompt([\n {\n type: \"input\",\n name: \"projectName\",\n message: \"What is the name of your project?\",\n default: \"my-arkos-project\",\n validate: this.validateProjectName,\n },\n ]);\n projectName = result.projectName;\n } else {\n // Validate the project name from command line args\n const validation = this.validateProjectName(projectName);\n if (validation !== true) {\n console.error(chalk.red(`\\nError: ${validation}`));\n process.exit(1);\n }\n }\n\n this.config.projectName = projectName;\n }\n\n private validateProjectName(input: string): boolean | string {\n if (input === \".\") return true;\n\n if (!input || input.length === 0) {\n return \"Project name cannot be empty\";\n }\n\n // Check for valid characters (letters, numbers, hyphens, underscores)\n if (!/^[a-zA-Z0-9_-]+$/.test(input)) {\n return \"Project name can only contain letters, numbers, hyphens, and underscores\";\n }\n\n // Check if it starts with a letter or number (not hyphen or underscore)\n if (!/^[a-zA-Z0-9]/.test(input)) {\n return \"Project name must start with a letter or number\";\n }\n\n // Check if it ends with a letter or number (not hyphen or underscore)\n if (!/[a-zA-Z0-9]$/.test(input)) {\n return \"Project name must end with a letter or number\";\n }\n\n // Check length (reasonable limits)\n if (input.length > 50) {\n return \"Project name must be 50 characters or less\";\n }\n\n // Check for reserved names\n const reservedNames = [\"node_modules\"];\n if (reservedNames.includes(input.toLowerCase())) {\n return \"Project name cannot be a reserved name\";\n }\n\n return true;\n }\n\n private async promptTypescript() {\n const { typescript } = await inquirer.prompt([\n {\n type: \"confirm\",\n name: \"typescript\",\n message: `Would you like to use ${chalk.cyan(\"TypeScript\")}?`,\n default: false,\n },\n ]);\n this.config.typescript = typescript;\n }\n\n private async promptPrismaProvider() {\n const { prismaProvider } = await inquirer.prompt([\n {\n type: \"list\",\n name: \"prismaProvider\",\n message: `What db provider will be used for ${chalk.cyan(\"Prisma\")}?`,\n choices: [\n \"postgresql\",\n \"mongodb\",\n \"mysql\",\n \"sqlite\",\n \"sqlserver\",\n \"cockroachdb\",\n ],\n },\n ]);\n\n // Set the correct idDatabaseType based on provider\n let idDatabaseType: string;\n let defaultDBurl: string;\n\n switch (prismaProvider) {\n case \"mongodb\":\n idDatabaseType = '@id @default(auto()) @map(\"_id\") @db.ObjectId';\n defaultDBurl = `mongodb://localhost:27017/${this.config.projectName}`;\n break;\n case \"sqlite\":\n idDatabaseType = \"@id @default(cuid())\";\n defaultDBurl = \"file:../../file.db\";\n break;\n case \"mysql\":\n idDatabaseType = \"@id @default(uuid())\";\n defaultDBurl = `mysql://username:password@localhost:3306/${this.config.projectName}`;\n break;\n case \"postgresql\":\n idDatabaseType = \"@id @default(uuid())\";\n defaultDBurl = `postgresql://username:password@localhost:5432/${this.config.projectName}`;\n break;\n case \"sqlserver\":\n idDatabaseType = \"@id @default(uuid())\";\n defaultDBurl = `sqlserver://localhost:1433;database=${this.config.projectName};username=sa;password=password;encrypt=DANGER_PLAINTEXT`;\n break;\n case \"cockroachdb\":\n idDatabaseType = \"@id @default(uuid())\";\n defaultDBurl = `postgresql://username:password@localhost:26257/${this.config.projectName}?sslmode=require`;\n break;\n default:\n idDatabaseType = \"@id @default(uuid())\";\n defaultDBurl = `postgresql://username:password@localhost:5432/${this.config.projectName}`;\n }\n\n this.config.prisma = {\n provider: prismaProvider,\n idDatabaseType: idDatabaseType,\n defaultDBurl: defaultDBurl,\n };\n }\n\n private async promptValidation() {\n const { useValidation } = await inquirer.prompt([\n {\n type: \"confirm\",\n name: \"useValidation\",\n message: `Would you like to set up ${chalk.cyan(\"Validation\")}?`,\n default: true,\n },\n ]);\n\n if (useValidation) {\n let validationTypeResponse: {\n validationType: \"zod\" | \"class-validator\";\n } = { validationType: \"zod\" };\n\n if (this.config.typescript)\n validationTypeResponse = await inquirer.prompt([\n {\n type: \"list\",\n name: \"validationType\",\n message: \"Choose validation library:\",\n choices: [\"zod\", \"class-validator\"],\n },\n ]);\n else {\n console.info(\n chalk.bold(\n `${chalk.greenBright(\"?\")} Validation library set to zod (class-validator is not supported on JavaScript)? ${chalk.cyan(\"zod\")}`\n )\n );\n }\n this.config.validation = {\n type: validationTypeResponse.validationType,\n };\n } else if (!this.config.typescript) {\n }\n }\n\n private async promptAuthentication() {\n const { useAuthentication } = await inquirer.prompt([\n {\n type: \"confirm\",\n name: \"useAuthentication\",\n message: `Would you like to set up ${chalk.cyan(\"Authentication\")}?`,\n default: true,\n },\n ]);\n\n if (useAuthentication) {\n const { authenticationType } = await inquirer.prompt([\n {\n type: \"list\",\n name: \"authenticationType\",\n message: \"Choose authentication type:\",\n choices: [\"static\", \"dynamic\", \"define later\"],\n },\n ]);\n\n const { usernameField } = await inquirer.prompt([\n {\n type: \"list\",\n name: \"usernameField\",\n message: \"Choose default username field for login:\",\n choices: [\"email\", \"username\", \"define later\"],\n },\n ]);\n\n this.config.authentication = {\n type: authenticationType,\n usernameField:\n usernameField === \"define later\" ? \"custom\" : usernameField,\n multipleRoles: false,\n };\n\n if (\n authenticationType !== \"define later\" ||\n (this.config.prisma.provider !== \"sqlite\" &&\n authenticationType !== \"static\")\n ) {\n const { multipleRoles } = await inquirer.prompt([\n {\n type: \"confirm\",\n name: \"multipleRoles\",\n default: true,\n message: `Would you like to use authentication with ${chalk.cyan(\"Multiple Roles\")}?`,\n },\n ]);\n\n this.config.authentication = {\n ...this.config.authentication,\n multipleRoles,\n };\n } else if (this.config.prisma.provider === \"sqlite\") {\n console.info(\n `\\nSkipping multiple roles option because it is not supported with sqlite prisma provider and static authentication mode.`\n );\n }\n }\n }\n}\n\nconst projectConfigInquirer = new ProjectConfigInquirer();\n\nexport default projectConfigInquirer;\n"]}
1
+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ACxB,aAAa,EACX,aAAa,KAAK,cAAc,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAa;gBAC7D,aAAa,EAAE,KAAK;aACrB,CAAC;YAEF,IACE,kBAAkB,KAAK,cAAc;gBACrC,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,KAAK,QAAQ;oBACvC,kBAAkB,KAAK,QAAQ,CAAC,EAClC;gBACA,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;oBAC9C;wBACE,IAAI,EAAE,SAAS;wBACf,IAAI,EAAE,eAAe;wBACrB,OAAO,EAAE,IAAI;wBACb,OAAO,EAAE,6CAA6C,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,GAAG;qBACtF;iBACF,CAAC,CAAC;gBAEH,IAAI,CAAC,MAAM,CAAC,cAAc,GAAG;oBAC3B,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc;oBAC7B,aAAa;iBACd,CAAC;aACH;iBAAM,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,KAAK,QAAQ,EAAE;gBACnD,OAAO,CAAC,IAAI,CACV,0HAA0H,CAC3H,CAAC;aACH;SACF;IACH,CAAC;CACF;AAED,MAAM,qBAAqB,GAAG,IAAI,qBAAqB,EAAE,CAAC;AAE1D,eAAe,qBAAqB,CAAC","sourcesContent":["import path from \"path\";\nimport inquirer from \"inquirer\";\nimport chalk from \"chalk\";\n\nexport interface ProjectConfig {\n projectName: string;\n argProjectName?: string;\n typescript: boolean;\n validation: {\n type?: \"zod\" | \"class-validator\";\n };\n authentication: {\n type?: \"static\" | \"dynamic\" | \"define later\";\n usernameField?: \"username\" | \"email\" | \"custom\";\n multipleRoles: boolean;\n };\n prisma: {\n provider:\n | \"postgresql\"\n | \"mysql\"\n | \"sqlite\"\n | \"sqlserver\"\n | \"cockroachdb\"\n | \"mongodb\";\n idDatabaseType: string;\n defaultDBurl: string;\n };\n projectPath: string;\n}\n\nclass ProjectConfigInquirer {\n private config: ProjectConfig;\n\n constructor() {\n this.config = {} as ProjectConfig;\n }\n\n async run() {\n await this.promptProjectName();\n await this.promptTypescript();\n await this.promptPrismaProvider();\n await this.promptValidation();\n await this.promptAuthentication();\n\n // If user passed \".\", use current directory name\n if (this.config.projectName === \".\") {\n this.config.projectName = path.basename(process.cwd());\n this.config.projectPath = path.resolve(process.cwd());\n } else\n this.config.projectPath = path.resolve(\n process.cwd(),\n this.config.projectName\n );\n\n return this.config;\n }\n\n private async promptProjectName() {\n let projectName = process?.argv?.[2];\n this.config.argProjectName = process?.argv?.[2];\n\n if (!projectName) {\n const result = await inquirer.prompt([\n {\n type: \"input\",\n name: \"projectName\",\n message: \"What is the name of your project?\",\n default: \"my-arkos-project\",\n validate: this.validateProjectName,\n },\n ]);\n projectName = result.projectName;\n } else {\n // Validate the project name from command line args\n const validation = this.validateProjectName(projectName);\n if (validation !== true) {\n console.error(chalk.red(`\\nError: ${validation}`));\n process.exit(1);\n }\n }\n\n this.config.projectName = projectName;\n }\n\n private validateProjectName(input: string): boolean | string {\n if (input === \".\") return true;\n\n if (!input || input.length === 0) {\n return \"Project name cannot be empty\";\n }\n\n // Check for valid characters (letters, numbers, hyphens, underscores)\n if (!/^[a-zA-Z0-9_-]+$/.test(input)) {\n return \"Project name can only contain letters, numbers, hyphens, and underscores\";\n }\n\n // Check if it starts with a letter or number (not hyphen or underscore)\n if (!/^[a-zA-Z0-9]/.test(input)) {\n return \"Project name must start with a letter or number\";\n }\n\n // Check if it ends with a letter or number (not hyphen or underscore)\n if (!/[a-zA-Z0-9]$/.test(input)) {\n return \"Project name must end with a letter or number\";\n }\n\n // Check length (reasonable limits)\n if (input.length > 50) {\n return \"Project name must be 50 characters or less\";\n }\n\n // Check for reserved names\n const reservedNames = [\"node_modules\"];\n if (reservedNames.includes(input.toLowerCase())) {\n return \"Project name cannot be a reserved name\";\n }\n\n return true;\n }\n\n private async promptTypescript() {\n const { typescript } = await inquirer.prompt([\n {\n type: \"confirm\",\n name: \"typescript\",\n message: `Would you like to use ${chalk.cyan(\"TypeScript\")}?`,\n default: false,\n },\n ]);\n this.config.typescript = typescript;\n }\n\n private async promptPrismaProvider() {\n const { prismaProvider } = await inquirer.prompt([\n {\n type: \"list\",\n name: \"prismaProvider\",\n message: `What db provider will be used for ${chalk.cyan(\"Prisma\")}?`,\n choices: [\n \"postgresql\",\n \"mongodb\",\n \"mysql\",\n \"sqlite\",\n \"sqlserver\",\n \"cockroachdb\",\n ],\n },\n ]);\n\n // Set the correct idDatabaseType based on provider\n let idDatabaseType: string;\n let defaultDBurl: string;\n\n switch (prismaProvider) {\n case \"mongodb\":\n idDatabaseType = '@id @default(auto()) @map(\"_id\") @db.ObjectId';\n defaultDBurl = `mongodb://localhost:27017/${this.config.projectName}`;\n break;\n case \"sqlite\":\n idDatabaseType = \"@id @default(cuid())\";\n defaultDBurl = \"file:../../file.db\";\n break;\n case \"mysql\":\n idDatabaseType = \"@id @default(uuid())\";\n defaultDBurl = `mysql://username:password@localhost:3306/${this.config.projectName}`;\n break;\n case \"postgresql\":\n idDatabaseType = \"@id @default(uuid())\";\n defaultDBurl = `postgresql://username:password@localhost:5432/${this.config.projectName}`;\n break;\n case \"sqlserver\":\n idDatabaseType = \"@id @default(uuid())\";\n defaultDBurl = `sqlserver://localhost:1433;database=${this.config.projectName};username=sa;password=password;encrypt=DANGER_PLAINTEXT`;\n break;\n case \"cockroachdb\":\n idDatabaseType = \"@id @default(uuid())\";\n defaultDBurl = `postgresql://username:password@localhost:26257/${this.config.projectName}?sslmode=require`;\n break;\n default:\n idDatabaseType = \"@id @default(uuid())\";\n defaultDBurl = `postgresql://username:password@localhost:5432/${this.config.projectName}`;\n }\n\n this.config.prisma = {\n provider: prismaProvider,\n idDatabaseType: idDatabaseType,\n defaultDBurl: defaultDBurl,\n };\n }\n\n private async promptValidation() {\n const { useValidation } = await inquirer.prompt([\n {\n type: \"confirm\",\n name: \"useValidation\",\n message: `Would you like to set up ${chalk.cyan(\"Validation\")}?`,\n default: true,\n },\n ]);\n\n if (useValidation) {\n let validationTypeResponse: {\n validationType: \"zod\" | \"class-validator\";\n } = { validationType: \"zod\" };\n\n if (this.config.typescript)\n validationTypeResponse = await inquirer.prompt([\n {\n type: \"list\",\n name: \"validationType\",\n message: \"Choose validation library:\",\n choices: [\"zod\", \"class-validator\"],\n },\n ]);\n else {\n console.info(\n chalk.bold(\n `${chalk.greenBright(\"?\")} Validation library set to zod (class-validator is not supported on JavaScript):`\n ),\n chalk.cyan(\"zod\")\n );\n }\n this.config.validation = {\n type: validationTypeResponse.validationType,\n };\n } else if (!this.config.typescript) {\n }\n }\n\n private async promptAuthentication() {\n const { useAuthentication } = await inquirer.prompt([\n {\n type: \"confirm\",\n name: \"useAuthentication\",\n message: `Would you like to set up ${chalk.cyan(\"Authentication\")}?`,\n default: true,\n },\n ]);\n\n if (useAuthentication) {\n const { authenticationType } = await inquirer.prompt([\n {\n type: \"list\",\n name: \"authenticationType\",\n message: \"Choose authentication type:\",\n choices: [\"static\", \"dynamic\", \"define later\"],\n },\n ]);\n\n const { usernameField } = await inquirer.prompt([\n {\n type: \"list\",\n name: \"usernameField\",\n message: \"Choose default username field for login:\",\n choices: [\"email\", \"username\", \"define later\"],\n },\n ]);\n\n this.config.authentication = {\n type: authenticationType,\n usernameField:\n usernameField === \"define later\" ? \"custom\" : usernameField,\n multipleRoles: false,\n };\n\n if (\n authenticationType !== \"define later\" ||\n (this.config.prisma.provider !== \"sqlite\" &&\n authenticationType !== \"static\")\n ) {\n const { multipleRoles } = await inquirer.prompt([\n {\n type: \"confirm\",\n name: \"multipleRoles\",\n default: true,\n message: `Would you like to use authentication with ${chalk.cyan(\"Multiple Roles\")}?`,\n },\n ]);\n\n this.config.authentication = {\n ...this.config.authentication,\n multipleRoles,\n };\n } else if (this.config.prisma.provider === \"sqlite\") {\n console.info(\n `\\nSkipping multiple roles option because it is not supported with sqlite prisma provider and static authentication mode.`\n );\n }\n }\n }\n}\n\nconst projectConfigInquirer = new ProjectConfigInquirer();\n\nexport default projectConfigInquirer;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-arkos",
3
- "version": "1.2.15-beta.8",
3
+ "version": "1.2.16-beta",
4
4
  "type": "module",
5
5
  "description": "CLI for creating Arkos.js projects, see docs at www.arkosjs.com",
6
6
  "bin": {
@@ -10,6 +10,7 @@
10
10
  "build": "rimraf dist && tsc",
11
11
  "dev": "ts-node src/index.ts",
12
12
  "postbuia": "ts-node scripts/postbuild/index.ts",
13
+ "postbuild": "npx tsx scripts/postbuild/fix-esm-imports.ts",
13
14
  "postpublisa": "ts-node scripts/postpublish/index.ts",
14
15
  "test:hbs": "ts-node src/utils/helpers/hbs-tester.helpers.ts",
15
16
  "prepublishOnlyBak": "pnpm build",
@@ -29,7 +29,7 @@
29
29
  "prisma": "^6.11.1"
30
30
  },
31
31
  "dependencies": {
32
- "arkos": "{{arkosCurrentVersion}}",
32
+ "arkos": "^1.2.15-beta",
33
33
  "express": "^4.21.2",
34
34
  "@prisma/client": "^6.4.1",
35
35
  "swagger-jsdoc": "^6.2.8",
@@ -16,10 +16,13 @@ arkos.init({
16
16
  validation: {
17
17
  resolver: '{{validation.type}}'
18
18
  },
19
- {{#if (neq validation.type "")}}
20
19
  swagger: {
21
- mode: '{{validation.type}}'
20
+ {{#if (neq validation.type "")}}
21
+ mode: '{{validation.type}}',
22
+ {{else}}
23
+ mode: 'prisma',
24
+ {{/if}}
25
+ strict: false,
22
26
  }
23
27
  {{/if}}
24
- {{/if}}
25
28
  });
@@ -1,18 +1,7 @@
1
1
  import 'reflect-metadata'
2
- import {
3
- IsString,
4
- MinLength,
5
- Matches,
6
- IsNotEmpty,
7
- IsBoolean,
8
- IsOptional,
9
- IsArray,
10
- ValidateNested,
11
- Type,
12
- IsEnum
13
- } from 'class-validator'
2
+ import { IsString, IsNotEmpty, IsOptional } from "class-validator";
14
3
 
15
- export default class UpdateUserDto {
4
+ export default class UpdateMeDto {
16
5
  @IsString()
17
6
  @IsNotEmpty({ message: '{{authentication.usernameField}} is required' })
18
7
  @IsOptional()
@@ -17,7 +17,7 @@ const authPermissionQueryOptions = {
17
17
  },
18
18
  findOne: {},
19
19
  findMany: {},
20
- udpate: {},
20
+ update: {},
21
21
  updateMany: {},
22
22
  updateOne: {},
23
23
  create: {},
@@ -26,7 +26,7 @@ export default class CreateAuthPermissionDto {
26
26
 
27
27
  @IsEnum(AuthPermissionAction)
28
28
  @Transform(({ value }) => value || AuthPermissionAction.View)
29
- action!: AuthPermissionAction = AuthPermissionAction.View;
29
+ action?: AuthPermissionAction = AuthPermissionAction.View;
30
30
 
31
31
  @ValidateNested()
32
32
  @Type(() => RoleConnectDto)
@@ -34,6 +34,6 @@ export default class CreateAuthPermissionDto {
34
34
 
35
35
  @IsOptional()
36
36
  @IsString()
37
- @Transform(({ value }) => value || "Allows to create a permission for a given role.")
38
- description?: string = "Allows to create a permission for a given role.";
37
+ @Transform(({ value }) => value)
38
+ description?: string;
39
39
  }
@@ -20,8 +20,8 @@ export default class UpdateAuthPermissionDto {
20
20
 
21
21
  @IsOptional()
22
22
  @IsEnum(AuthPermissionAction)
23
- @Transform(({ value }) => value || AuthPermissionAction.View)
24
- action?: AuthPermissionAction = AuthPermissionAction.View;
23
+ @Transform(({ value }) => value)
24
+ action?: AuthPermissionAction
25
25
 
26
26
  @IsOptional()
27
27
  @IsString()
@@ -17,7 +17,7 @@ const authRoleQueryOptions = {
17
17
  },
18
18
  },
19
19
  findMany: {},
20
- udpate: {},
20
+ update: {},
21
21
  updateMany: {},
22
22
  updateOne: {},
23
23
  create: {},
@@ -16,7 +16,7 @@ import { AuthPermissionAction } from "@prisma/client"
16
16
  class CreatePermissionForRoleDto {
17
17
  @IsString()
18
18
  @IsNotEmpty({ message: 'Resource is required' })
19
- resource: string;
19
+ resource!: string;
20
20
 
21
21
  @IsEnum(AuthPermissionAction)
22
22
  @Transform(({ value }) => value || AuthPermissionAction.View)
@@ -24,14 +24,14 @@ class CreatePermissionForRoleDto {
24
24
 
25
25
  @IsOptional()
26
26
  @IsString()
27
- @Transform(({ value }) => value || "Allows to create a permission for a given role.")
28
- description?: string = "Allows to create a permission for a given role.";
27
+ @Transform(({ value }) => value)
28
+ description?: string;
29
29
  }
30
30
 
31
31
  export default class CreateAuthRoleDto {
32
32
  @IsString()
33
33
  @IsNotEmpty({ message: 'Role name is required' })
34
- name: string;
34
+ name!: string;
35
35
 
36
36
  @IsOptional()
37
37
  @IsString()
@@ -42,5 +42,5 @@ export default class CreateAuthRoleDto {
42
42
  @ValidateNested({ each: true })
43
43
  @Type(() => CreatePermissionForRoleDto)
44
44
  @Transform(({ value }) => value || [])
45
- permissions?: CreatePermissionForRoleDto[] = [];
45
+ permissions: CreatePermissionForRoleDto[] = [];
46
46
  }
@@ -19,22 +19,26 @@ export enum ApiAction {
19
19
  }
20
20
 
21
21
  class UpdatePermissionForRoleDto {
22
+ @IsString()
23
+ @IsOptional()
24
+ id?: string;
25
+
22
26
  @IsString()
23
27
  @IsNotEmpty({ message: 'Resource is required' })
24
28
  resource!: string;
25
29
 
26
30
  @IsEnum(AuthPermissionAction)
27
- @Transform(({ value }) => value || AuthPermissionAction.View)
28
- action!: AuthPermissionAction = AuthPermissionAction.View;
31
+ @Transform(({ value }) => value)
32
+ action!: AuthPermissionAction
29
33
 
30
34
  @IsOptional()
31
35
  @IsString()
32
- @Transform(({ value }) => value || "Allows to create a permission for a given role.")
33
- description?: string = "Allows to create a permission for a given role.";
36
+ @Transform(({ value }) => value)
37
+ description?: string;
34
38
 
35
39
  @IsEnum(ApiAction)
36
40
  @IsOptional()
37
- apiAction!: ApiAction;
41
+ apiAction?: ApiAction;
38
42
  }
39
43
 
40
44
  export default class UpdateAuthRoleDto {
@@ -8,9 +8,8 @@ import {
8
8
  IsOptional,
9
9
  IsArray,
10
10
  ValidateNested,
11
- Type,
12
- IsEnum
13
11
  } from 'class-validator'
12
+ import { Type } from "class-transformer";
14
13
  {{#if (eq authentication.type "static")}}
15
14
  {{#if (neq prisma.provider "sqlite")}}
16
15
  import { UserRole } from "@prisma/client"
@@ -27,20 +26,20 @@ class RoleConnectDto {
27
26
  class RoleConnectionDto {
28
27
  @ValidateNested()
29
28
  @Type(() => RoleConnectDto)
30
- role: RoleConnectDto
29
+ role!: RoleConnectDto
31
30
  }
32
31
  {{/if}}
33
32
 
34
33
  export default class CreateUserDto {
35
34
  @IsString()
36
35
  @IsNotEmpty({ message: '{{authentication.usernameField}} is required' })
37
- {{authentication.usernameField}}: string
36
+ {{authentication.usernameField}}!: string
38
37
 
39
38
  @IsString()
40
39
  @MinLength(8, { message: 'Password must be at least 8 characters long' })
41
40
  @Matches(/[a-z]/, { message: 'Password must contain at least one lowercase letter' })
42
41
  @Matches(/[A-Z]/, { message: 'Password must contain at least one uppercase letter' })
43
- password: string
42
+ password!: string
44
43
 
45
44
  @IsBoolean()
46
45
  @IsOptional()
@@ -58,15 +57,15 @@ export default class CreateUserDto {
58
57
  {{#if (eq prisma.provider "sqlite")}}
59
58
  @IsString()
60
59
  @IsNotEmpty()
61
- role: string
60
+ role!: string
62
61
  {{else}}
63
62
  {{#if authentication.multipleRoles}}
64
63
  @IsArray()
65
64
  @IsEnum(UserRole, { each: true })
66
- roles: UserRole[]
65
+ roles?: UserRole[]
67
66
  {{else}}
68
67
  @IsEnum(UserRole)
69
- role: UserRole
68
+ role!: UserRole
70
69
  {{/if}}
71
70
  {{/if}}
72
71
  {{else}}
@@ -8,9 +8,9 @@ import {
8
8
  IsOptional,
9
9
  IsArray,
10
10
  ValidateNested,
11
- Type,
12
11
  IsEnum
13
12
  } from 'class-validator'
13
+ import { Type } from 'class-transformer'
14
14
  {{#if typescript}}
15
15
  import apiActions from "../../../utils/validation/api-actions"
16
16
  {{else}}
@@ -27,22 +27,22 @@ class RoleConnectDto {
27
27
  @IsString()
28
28
  @IsNotEmpty()
29
29
  @IsOptional()
30
- id: string
30
+ id?: string
31
31
  }
32
32
 
33
33
  class RoleConnectionDto {
34
34
  @IsString()
35
35
  @IsOptional()
36
- id: string
36
+ id?: string
37
37
 
38
38
  @IsEnum(apiActions)
39
39
  @IsOptional()
40
- apiAction: string
40
+ apiAction?: string
41
41
 
42
42
  @ValidateNested()
43
43
  @Type(() => RoleConnectDto)
44
44
  @IsOptional()
45
- role: RoleConnectDto
45
+ role?: RoleConnectDto
46
46
  }
47
47
  {{/if}}
48
48
 
@@ -50,36 +50,43 @@ export default class UpdateUserDto {
50
50
  @IsString()
51
51
  @IsNotEmpty({ message: '{{authentication.usernameField}} is required' })
52
52
  @IsOptional()
53
- {{authentication.usernameField}}: string
53
+ {{authentication.usernameField}}?: string
54
+
55
+ @IsString()
56
+ @MinLength(8, { message: 'Password must be at least 8 characters long' })
57
+ @Matches(/[a-z]/, { message: 'Password must contain at least one lowercase letter' })
58
+ @Matches(/[A-Z]/, { message: 'Password must contain at least one uppercase letter' })
59
+ @IsOptional()
60
+ password?: string
54
61
 
55
62
  @IsBoolean()
56
63
  @IsOptional()
57
- isSuperUser?: boolean = false
64
+ isSuperUser?: boolean
58
65
 
59
66
  @IsBoolean()
60
67
  @IsOptional()
61
- isStaff?: boolean = false
68
+ isStaff?: boolean
62
69
 
63
70
  @IsBoolean()
64
71
  @IsOptional()
65
- isActive?: boolean = true
72
+ isActive?: boolean
66
73
 
67
74
  {{#if (eq authentication.type "static")}}
68
75
  {{#if (eq prisma.provider "sqlite")}}
69
76
  @IsString()
70
77
  @IsNotEmpty()
71
78
  @IsOptional()
72
- role: string
79
+ role?: string
73
80
  {{else}}
74
81
  {{#if authentication.multipleRoles}}
75
82
  @IsArray()
76
83
  @IsEnum(UserRole, { each: true })
77
84
  @IsOptional()
78
- roles: UserRole[]
85
+ roles?: UserRole[]
79
86
  {{else}}
80
87
  @IsEnum(UserRole)
81
88
  @IsOptional()
82
- role: UserRole
89
+ role?: UserRole
83
90
  {{/if}}
84
91
  {{/if}}
85
92
  {{else}}
@@ -60,7 +60,7 @@ const userQueryOptions = {
60
60
  },
61
61
  },
62
62
  findMany: {},
63
- udpate: {},
63
+ update: {},
64
64
  updateMany: {},
65
65
  updateOne: {},
66
66
  create: {},