create-arkos 0.0.2 → 0.0.4

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/dist/index.js CHANGED
@@ -28,7 +28,7 @@ function main() {
28
28
  const projectPath = config.projectPath;
29
29
  fs_1.default.mkdirSync(projectPath, { recursive: true });
30
30
  console.info(`\nCreating a new ${chalk_1.default.bold(chalk_1.default.cyan("Arkos.js"))} project in ${chalk_1.default.green(`./${config.projectName}`)}`);
31
- const templatesDir = path_1.default.resolve(`./src/utils/templates/basic`);
31
+ const templatesDir = path_1.default.resolve(`./templates/basic`);
32
32
  yield template_compiler_1.default.compile(templatesDir, config);
33
33
  process.chdir(projectPath);
34
34
  console.info("\nInstalling dependencies...");
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,4CAAoB;AACpB,gDAAwB;AACxB,kDAA0B;AAC1B,iDAAyC;AACzC,8FAAoE;AACpE,kFAAyD;AACzD,4DAAoC;AAEpC,oBAAU,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;AACnD,oBAAU,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;AAEpD,SAAe,IAAI;;QACjB,MAAM,MAAM,GAAG,MAAM,iCAAqB,CAAC,GAAG,EAAE,CAAC;QAEjD,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;QAEvC,YAAE,CAAC,SAAS,CAAC,WAAW,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAE/C,OAAO,CAAC,IAAI,CACV,oBAAoB,eAAK,CAAC,IAAI,CAAC,eAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,eAAe,eAAK,CAAC,KAAK,CAAC,KAAK,MAAM,CAAC,WAAW,EAAE,CAAC,EAAE,CAC9G,CAAC;QAEF,MAAM,YAAY,GAAG,cAAI,CAAC,OAAO,CAAC,6BAA6B,CAAC,CAAC;QACjE,MAAM,2BAAgB,CAAC,OAAO,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;QAErD,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAE3B,OAAO,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;QAC7C,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAE/B,IAAA,wBAAQ,EAAC,aAAa,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;QAE9C,OAAO,CAAC,IAAI,CAAC;IACX,eAAK,CAAC,IAAI,CAAC,eAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;;;UAG5B,MAAM,CAAC,WAAW;kBACV,eAAK,CAAC,IAAI,CAAC,cAAc,CAAC;;;;KAIvC,CAAC,CAAC;IACP,CAAC;CAAA;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\nimport fs from \"fs\";\nimport path 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\";\n\nHandlebars.registerHelper(\"eq\", (a, b) => a === b);\nHandlebars.registerHelper(\"neq\", (a, b) => a !== b);\n\nasync function main() {\n const config = await projectConfigInquirer.run();\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 in ${chalk.green(`./${config.projectName}`)}`\n );\n\n const templatesDir = path.resolve(`./src/utils/templates/basic`);\n await templateCompiler.compile(templatesDir, config);\n\n process.chdir(projectPath);\n\n console.info(\"\\nInstalling dependencies...\");\n console.info(\"\\nUsing npm.\\n\");\n\n execSync(\"npm install\", { stdio: \"inherit\" });\n\n console.info(`\n ${chalk.bold(chalk.cyan(\"Arkos.js\"))} project created successfully!\n\n Next steps:\n 1. cd ${config.projectName}\n 2. setup your ${chalk.cyan(\"DATABASE_URL\")} under .env\n 3. npx prisma db push\n 4. npx prisma generate\n 5. npm run dev\n `);\n}\n\nmain().catch(console.error);\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,4CAAoB;AACpB,gDAAwB;AACxB,kDAA0B;AAC1B,iDAAyC;AACzC,8FAAoE;AACpE,kFAAyD;AACzD,4DAAoC;AAEpC,oBAAU,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;AACnD,oBAAU,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;AAEpD,SAAe,IAAI;;QACjB,MAAM,MAAM,GAAG,MAAM,iCAAqB,CAAC,GAAG,EAAE,CAAC;QAEjD,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;QAEvC,YAAE,CAAC,SAAS,CAAC,WAAW,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAE/C,OAAO,CAAC,IAAI,CACV,oBAAoB,eAAK,CAAC,IAAI,CAAC,eAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,eAAe,eAAK,CAAC,KAAK,CAAC,KAAK,MAAM,CAAC,WAAW,EAAE,CAAC,EAAE,CAC9G,CAAC;QAEF,MAAM,YAAY,GAAG,cAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;QACvD,MAAM,2BAAgB,CAAC,OAAO,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;QAErD,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAE3B,OAAO,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;QAC7C,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAE/B,IAAA,wBAAQ,EAAC,aAAa,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;QAE9C,OAAO,CAAC,IAAI,CAAC;IACX,eAAK,CAAC,IAAI,CAAC,eAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;;;UAG5B,MAAM,CAAC,WAAW;kBACV,eAAK,CAAC,IAAI,CAAC,cAAc,CAAC;;;;KAIvC,CAAC,CAAC;IACP,CAAC;CAAA;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\nimport fs from \"fs\";\nimport path 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\";\n\nHandlebars.registerHelper(\"eq\", (a, b) => a === b);\nHandlebars.registerHelper(\"neq\", (a, b) => a !== b);\n\nasync function main() {\n const config = await projectConfigInquirer.run();\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 in ${chalk.green(`./${config.projectName}`)}`\n );\n\n const templatesDir = path.resolve(`./templates/basic`);\n await templateCompiler.compile(templatesDir, config);\n\n process.chdir(projectPath);\n\n console.info(\"\\nInstalling dependencies...\");\n console.info(\"\\nUsing npm.\\n\");\n\n execSync(\"npm install\", { stdio: \"inherit\" });\n\n console.info(`\n ${chalk.bold(chalk.cyan(\"Arkos.js\"))} project created successfully!\n\n Next steps:\n 1. cd ${config.projectName}\n 2. setup your ${chalk.cyan(\"DATABASE_URL\")} under .env\n 3. npx prisma db push\n 4. npx prisma generate\n 5. npm run dev\n `);\n}\n\nmain().catch(console.error);\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-arkos",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "CLI for creating Arkos.js projects, see docs at www.arkosjs.com/docs",
5
5
  "bin": {
6
6
  "create-arkos": "./dist/index.js"
@@ -21,17 +21,17 @@
21
21
  "url": "https://github.com/uanela/arkos/issues"
22
22
  },
23
23
  "homepage": "https://www.arkosjs.com",
24
- "files": ["dist", "cli.js", "README.md"],
24
+ "files": ["dist", "templates", "cli.js", "README.md"],
25
25
  "devDependencies": {
26
26
  "@types/inquirer": "^8.1.0",
27
27
  "@types/node": "^16.18.126",
28
- "inquirer": "^8.2.6",
29
28
  "ts-node": "^10.9.2",
30
29
  "typescript": "^4.9.5"
31
30
  },
32
31
  "dependencies": {
33
32
  "@clack/prompts": "^0.11.0",
34
33
  "@inquirer/prompts": "^7.6.0",
34
+ "inquirer": "^8.2.6",
35
35
  "chalk": "^5.4.1",
36
36
  "handlebars": "^4.7.8"
37
37
  }
@@ -0,0 +1 @@
1
+ DATABASE_URL=your-db-url-here
@@ -0,0 +1,85 @@
1
+ # Dependencies
2
+ /node_modules
3
+ /.pnp
4
+ .pnp.js
5
+ package-lock.json
6
+ yarn.lock
7
+ pnpm-lock.yaml
8
+ .npm
9
+
10
+ # Environment files
11
+ .env
12
+ .env.local
13
+ .env.*.local
14
+ .env.development
15
+ .env.test
16
+ .env.production
17
+ *.env
18
+
19
+ # Build and output directories
20
+ /build
21
+ /dist
22
+ /.dist
23
+ /out
24
+ /.build
25
+ /coverage
26
+ /.nyc_output
27
+
28
+ # Arkos.js' base uploads directory
29
+ /uploads
30
+
31
+ # TypeScript cache and declaration files
32
+ *.tsbuildinfo
33
+ /src/**/*.js.map
34
+ /src/**/*.d.ts
35
+ /types/generated/*
36
+
37
+ # Logs
38
+ logs
39
+ *.log
40
+ npm-debug.log*
41
+ yarn-debug.log*
42
+ yarn-error.log*
43
+ lerna-debug.log*
44
+
45
+ # IDE and editor directories
46
+ /.idea
47
+ /.vscode
48
+ *.swp
49
+ *.swo
50
+ .DS_Store
51
+ .project
52
+ .classpath
53
+ .settings/
54
+
55
+ # OS files
56
+ .DS_Store
57
+ Thumbs.db
58
+ ehthumbs.db
59
+ Desktop.ini
60
+ $RECYCLE.BIN/
61
+
62
+ # Testing
63
+ /coverage
64
+ /.nyc_output
65
+ /cypress/screenshots
66
+ /cypress/videos
67
+ /.jest-cache
68
+
69
+ # Temporary files
70
+ *.tmp
71
+ *.temp
72
+ .cache/
73
+ .eslintcache
74
+ .stylelintcache
75
+
76
+ # Misc
77
+ .serverless/
78
+ .fusebox/
79
+ .dynamodb/
80
+ .webpack/
81
+ .next/
82
+ .nuxt/
83
+ .cache/
84
+ .docz/
85
+ .vercel
@@ -0,0 +1,10 @@
1
+ {{#if TYPECSRIPT_ENABLED}}
2
+ import { ArkosConfig } from 'arkos'
3
+
4
+ const config: ArkosConfig = {}
5
+ {{else}}
6
+ /** @type {import('arkos').ArkosConfig} */
7
+ const config = {}
8
+ {{/if}}
9
+
10
+ export default config
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "{{projectName}}",
3
+ "version": "1.0.0",
4
+ "description": "This RESTful API was generated by Arkos.js, read more about Arkos.js at www.arkosjs.com",
5
+ "scripts": {
6
+ "dev": "arkos dev",
7
+ "build": "arkos build",
8
+ "start": "arkos start",
9
+ "arkos": "arkos"
10
+ },
11
+ "prisma": {
12
+ "schema": "prisma/schema/"
13
+ },
14
+ "devDependencies": {
15
+ {{#if typescript}}
16
+ "typescript": "^5.7.3",
17
+ "ts-node": "^10.9.2",
18
+ "ts-node-dev": "^2.0.0",
19
+ "@types/node": "^24.0.12",
20
+ {{/if}}
21
+ "prisma": "^6.11.1"
22
+ },
23
+ "dependencies": {
24
+ "arkos": "^1.2.0-beta",
25
+ "@prisma/client": "^6.11.1"
26
+ }
27
+ }
@@ -0,0 +1,28 @@
1
+ {{#if (neq prisma.provider "sqlite")}}
2
+ enum AuthPermissionAction {
3
+ View
4
+ Create
5
+ Update
6
+ Delete
7
+ // Add more custom actions
8
+ }
9
+ {{/if}}
10
+
11
+ model AuthPermission {
12
+ id String {{prisma.idDatabaseType}}
13
+ resource String
14
+ {{#if (eq prisma.provider "sqlite")}}
15
+ action String @default("View")
16
+ {{else}}
17
+ action AuthPermissionAction @default(View)
18
+ {{/if}}
19
+ roleId String
20
+ role AuthRole @relation(fields: [roleId], references: [id])
21
+ description String?
22
+ createdAt DateTime @default(now())
23
+ updatedAt DateTime @default(now())
24
+
25
+ @@unique([resource, action, roleId])
26
+ }
27
+
28
+
@@ -0,0 +1,10 @@
1
+ model AuthRole {
2
+ id String {{prisma.idDatabaseType}}
3
+ name String @unique
4
+ description String?
5
+ permissions AuthPermission[]
6
+ users UserRole[]
7
+ createdAt DateTime @default(now())
8
+ updatedAt DateTime @default(now())
9
+ }
10
+
@@ -0,0 +1,9 @@
1
+ generator client {
2
+ provider = "prisma-client-js"
3
+ }
4
+
5
+ datasource db {
6
+ provider = "{{prisma.provider}}"
7
+ url = env("DATABASE_URL")
8
+ }
9
+
@@ -0,0 +1,63 @@
1
+ model User {
2
+ id String {{prisma.idDatabaseType}}
3
+ {{authentication.usernameField}} String @unique
4
+ password String
5
+ passwordChangedAt DateTime?
6
+ lastLoginAt DateTime?
7
+ isSuperUser Boolean @default(false)
8
+ isStaff Boolean @default(false)
9
+ deletedSelfAccountAt DateTime?
10
+ isActive Boolean @default(true)
11
+ {{#if authentication.multipleRoles}}
12
+ {{#if (eq prisma.provider "sqlite")}}
13
+ roles String[] // Roles examples: Admin, User
14
+ {{else}}
15
+ roles UserRole[]
16
+ {{/if}}
17
+ {{else}}
18
+ {{#if (eq authentication.type "dynamic")}}
19
+ role UserRole?
20
+ {{else}}
21
+ {{#if (eq prisma.provider "sqlite")}}
22
+ role String // Roles examples: Admin, User
23
+ {{else}}
24
+ role UserRole
25
+ {{/if}}
26
+ {{/if}}
27
+ {{/if}}
28
+ createdAt DateTime @default(now())
29
+ updatedAt DateTime @default(now())
30
+ // other fields for your application
31
+ }
32
+
33
+ {{#if (eq authentication.type "dynamic")}}
34
+ model UserRole {
35
+ id String {{prisma.idDatabaseType}}
36
+ {{#if authentication.multipleRoles}}
37
+ userId String
38
+ {{else}}
39
+ userId String @unique
40
+ {{/if}}
41
+ user User @relation(fields: [userId], references: [id])
42
+ roleId String
43
+ role AuthRole @relation(fields: [roleId], references: [id])
44
+ createdAt DateTime @default(now())
45
+ updatedAt DateTime @default(now())
46
+ {{#if authentication.multipleRoles}}
47
+
48
+ @@unique([userId, roleId])
49
+ {{/if}}
50
+ }
51
+ {{/if}}
52
+
53
+ {{#if (eq authentication.type "static")}}
54
+ {{#if (eq prisma.provider "sqlite")}}
55
+ {{else}}
56
+ enum UserRole {
57
+ Admin
58
+ User
59
+ // change or add new roles
60
+ }
61
+ {{/if}}
62
+ {{/if}}
63
+
@@ -0,0 +1,17 @@
1
+ import arkos from 'arkos';
2
+
3
+ arkos.init({
4
+ {{#if authentication.type}}
5
+ authentication: {
6
+ mode: '{{authentication.type}}',
7
+ login: {
8
+ allowedUsernames: ['{{authentication.usernameField}}'],
9
+ }
10
+ },
11
+ {{/if}}
12
+ {{#if validation.type}}
13
+ validation: {
14
+ resolver: '{{validation.type}}'
15
+ },
16
+ {{/if}}
17
+ });
@@ -0,0 +1,5 @@
1
+ import { PrismaClient } from "@prisma/client";
2
+
3
+ const prisma = new PrismaClient();
4
+
5
+ export default prisma;