create-arkos 2.0.0-next.2 → 2.0.0-next.21
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/README.md +178 -150
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/utils/project-config-inquirer.js +93 -74
- package/dist/utils/project-config-inquirer.js.map +1 -1
- package/dist/utils/template-compiler.js +16 -11
- package/dist/utils/template-compiler.js.map +1 -1
- package/package.json +15 -14
- package/templates/basic/.env.hbs +5 -1
- package/templates/basic/.gitignore.hbs +2 -0
- package/templates/basic/README.md.hbs +2 -4
- package/templates/basic/arkos.config.ts.hbs +16 -3
- package/templates/basic/jsconfig.json.hbs +3 -13
- package/templates/basic/package.json.hbs +33 -18
- package/templates/basic/prisma/schema/__tests__/user-role.prisma.hbs.test.ts +2 -2
- package/templates/basic/prisma/schema/__tests__/user.prisma.hbs.test.ts +2 -2
- package/templates/basic/prisma/schema/auth-permission.prisma.hbs +3 -9
- package/templates/basic/prisma/schema/auth-role.prisma.hbs +2 -2
- package/templates/basic/prisma/schema/schema.prisma.hbs +2 -3
- package/templates/basic/prisma/schema/user-permission.prisma.hbs +18 -0
- package/templates/basic/prisma/schema/user.prisma.hbs +4 -2
- package/templates/basic/prisma.config.ts.hbs +11 -0
- package/templates/basic/public/favicon.ico +0 -0
- package/templates/basic/src/app.ts.hbs +9 -7
- package/templates/basic/src/modules/auth/auth.policy.ts.hbs +1 -1
- package/templates/basic/src/modules/auth/auth.router.ts.hbs +72 -7
- package/templates/basic/src/modules/auth/dtos/login.dto.ts.hbs +1 -1
- package/templates/basic/src/modules/auth/dtos/signup.dto.ts.hbs +1 -1
- package/templates/basic/src/modules/auth/dtos/update-me.dto.ts.hbs +1 -1
- package/templates/basic/src/modules/auth/dtos/update-password.dto.ts.hbs +1 -1
- package/templates/basic/src/modules/auth-permission/auth-permission.router.ts.hbs +39 -7
- package/templates/basic/src/modules/auth-permission/auth-permission.service.ts.hbs +4 -6
- package/templates/basic/src/modules/auth-permission/dtos/create-auth-permission.dto.ts.hbs +7 -10
- package/templates/basic/src/modules/auth-permission/dtos/{query-auth-role.dto.ts.hbs → query-auth-permission.dto.ts.hbs} +1 -1
- package/templates/basic/src/modules/auth-permission/dtos/update-auth-permission.dto.ts.hbs +19 -4
- package/templates/basic/src/modules/auth-role/auth-role.router.ts.hbs +38 -6
- package/templates/basic/src/modules/auth-role/auth-role.service.ts.hbs +4 -6
- package/templates/basic/src/modules/auth-role/dtos/create-auth-role.dto.ts.hbs +3 -8
- package/templates/basic/src/modules/auth-role/dtos/query-auth-role.dto.ts.hbs +1 -1
- package/templates/basic/src/modules/auth-role/dtos/update-auth-role.dto.ts.hbs +3 -6
- package/templates/basic/src/modules/file-upload/file-upload.router.ts.hbs +28 -8
- package/templates/basic/src/modules/user/dtos/create-user.dto.ts.hbs +5 -5
- package/templates/basic/src/modules/user/dtos/update-user.dto.ts.hbs +5 -5
- package/templates/basic/src/modules/user/user.router.ts.hbs +91 -7
- package/templates/basic/src/modules/user/user.service.ts.hbs +4 -6
- package/templates/basic/src/router.ts.hbs +2 -2
- package/templates/basic/src/server.ts.hbs +8 -0
- package/templates/basic/src/utils/prisma/index.ts.hbs +48 -2
- package/templates/basic/src/utils/validation/api-actions.ts.hbs +2 -2
- package/templates/basic/tsconfig.json.hbs +6 -13
- package/templates/basic/src/loadables.ts.hbs +0 -29
- package/templates/basic/src/modules/auth/auth.route-hook.ts.hbs +0 -66
- package/templates/basic/src/modules/auth-permission/auth-permission.route-hook.ts.hbs +0 -35
- package/templates/basic/src/modules/auth-role/auth-role.route-hook.ts.hbs +0 -35
- package/templates/basic/src/modules/file-upload/file-upload.route-hook.ts.hbs +0 -23
- package/templates/basic/src/modules/user/user.route-hook.ts.hbs +0 -88
package/README.md
CHANGED
|
@@ -1,237 +1,265 @@
|
|
|
1
|
-
|
|
1
|
+

|
|
2
2
|
|
|
3
3
|
<div align="center">
|
|
4
4
|
|
|
5
|
-
](https://badge.socket.dev/npm/package/arkos)
|
|
6
|
+

|
|
7
|
+

|
|
7
8
|

|
|
9
|
+

|
|
8
10
|
|
|
9
11
|
</div>
|
|
10
12
|
|
|
11
13
|
<div align="center">
|
|
12
|
-
<h2>
|
|
13
|
-
<p>
|
|
14
|
+
<h2>The Express & Prisma RESTful Framework</h2>
|
|
15
|
+
<p>A tool for backend developers and teams who ship software with complex business logic under tight deadlines</p>
|
|
14
16
|
</div>
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
## Why create-arkos?
|
|
19
|
-
|
|
20
|
-
Skip the hours of boilerplate setup. Get a production-ready API with authentication, validation, and auto-generated docs in **under 5 minutes**.
|
|
18
|
+
<div align="center">
|
|
21
19
|
|
|
22
|
-
**
|
|
20
|
+
**[Installation](https://www.arkosjs.com/docs/getting-started/installation)** •
|
|
21
|
+
**[Documentation](https://arkosjs.com/docs)** •
|
|
22
|
+
**[Website](https://arkosjs.com)** •
|
|
23
|
+
**[Tutorial](https://arkosjs.com/learn)** •
|
|
24
|
+
**[GitHub](https://github.com/uanela/arkos)** •
|
|
25
|
+
**[Blog](https://www.arkosjs.com/blog)** •
|
|
26
|
+
**[Npm](https://www.npmjs.com/package/arkos)**
|
|
23
27
|
|
|
24
|
-
|
|
25
|
-
- Prototyping APIs that need to scale later
|
|
26
|
-
- Teams who want consistent project structure from day one
|
|
28
|
+
</div>
|
|
27
29
|
|
|
28
30
|
## Quick Start
|
|
29
31
|
|
|
30
32
|
```bash
|
|
31
|
-
# Using pnpm (recommended)
|
|
32
|
-
pnpm create arkos@latest my-project
|
|
33
|
-
|
|
34
|
-
# Using npm
|
|
35
33
|
npm create arkos@latest my-project
|
|
36
|
-
|
|
37
|
-
# Using yarn
|
|
38
|
-
yarn create arkos@latest my-project
|
|
39
34
|
```
|
|
40
35
|
|
|
41
|
-
|
|
36
|
+
Your new project already has JWT auth, customizable CRUD routes, Swagger docs at `/api/docs`, file uploads, validation, and a full security middleware stack. Understand the generated [Project Structure](https://www.arkosjs.com/docs/getting-started/project-structure).
|
|
42
37
|
|
|
43
|
-
##
|
|
38
|
+
## Your Entry Point
|
|
44
39
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
✅ **Input validation** (Zod or class-validator)
|
|
50
|
-
✅ **TypeScript support** (optional)
|
|
51
|
-
✅ **Best practices** and security middleware
|
|
40
|
+
```typescript
|
|
41
|
+
// src/app.ts
|
|
42
|
+
import arkos from "arkos";
|
|
43
|
+
import postRouter from "@/src/modules/post/post.router"; // custom router
|
|
52
44
|
|
|
53
|
-
|
|
45
|
+
const app = arkos();
|
|
54
46
|
|
|
55
|
-
|
|
47
|
+
app.use(postRouter);
|
|
56
48
|
|
|
57
|
-
|
|
58
|
-
? What is the name of your project? my-arkos-project
|
|
59
|
-
? Would you like to use TypeScript? Yes
|
|
60
|
-
? What db provider will be used for Prisma? mongodb
|
|
61
|
-
? Would you like to set up Validation? Yes
|
|
62
|
-
? Choose validation library: zod
|
|
63
|
-
? Would you like to set up Authentication? Yes
|
|
64
|
-
? Choose authentication type: dynamic
|
|
65
|
-
? Would you like to use authentication with Multiple Roles? Yes
|
|
66
|
-
? Choose default username field for login: email
|
|
49
|
+
app.listen();
|
|
67
50
|
```
|
|
68
51
|
|
|
69
|
-
|
|
52
|
+
Arkos replaces the Express `app` — but it _is_ Express under the hood. You can still use `app.use()`, custom middleware, and raw Express code wherever you need it.
|
|
70
53
|
|
|
71
|
-
|
|
54
|
+
## Automatic CRUD: One Model, Full REST Endpoints
|
|
72
55
|
|
|
73
|
-
|
|
74
|
-
- MongoDB
|
|
75
|
-
- MySQL
|
|
76
|
-
- SQLite (great for prototyping)
|
|
77
|
-
- SQL Server
|
|
78
|
-
- CockroachDB
|
|
56
|
+
**Define The Prisma model:**
|
|
79
57
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
58
|
+
```prisma
|
|
59
|
+
model Post {
|
|
60
|
+
id String @id @default(uuid())
|
|
61
|
+
title String
|
|
62
|
+
content String
|
|
63
|
+
authorId String
|
|
64
|
+
author User @relation(fields: [authorId], references: [id])
|
|
65
|
+
createdAt DateTime @default(now())
|
|
66
|
+
updatedAt DateTime @updatedAt
|
|
67
|
+
}
|
|
68
|
+
```
|
|
84
69
|
|
|
85
|
-
**
|
|
70
|
+
**Get a full REST API — instantly:**
|
|
86
71
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
72
|
+
```
|
|
73
|
+
POST /api/posts Create a post
|
|
74
|
+
GET /api/posts List all posts
|
|
75
|
+
GET /api/posts/:id Get a post
|
|
76
|
+
PATCH /api/posts/:id Update a post
|
|
77
|
+
DELETE /api/posts/:id Delete a post
|
|
78
|
+
```
|
|
90
79
|
|
|
91
|
-
|
|
80
|
+
Authenticated, validated, and documented. Zero boilerplate.
|
|
92
81
|
|
|
93
|
-
|
|
94
|
-
# 1. Create your project
|
|
95
|
-
pnpm create arkos@latest my-project
|
|
82
|
+
## Creating a Router Beyond Express
|
|
96
83
|
|
|
97
|
-
|
|
98
|
-
|
|
84
|
+
```typescript
|
|
85
|
+
// src/modules/post/post.router.ts
|
|
86
|
+
import { ArkosRouter } from "arkos";
|
|
87
|
+
import CreatePostSchema from "@/src/modules/post/schemas/create-post.schema";
|
|
88
|
+
import postService from "@/src/modules/post/post.service";
|
|
89
|
+
import postPolicy from "@/src/modules/post/post.policy"; // Authorization component
|
|
99
90
|
|
|
100
|
-
|
|
101
|
-
# Edit .env with your DATABASE_URL
|
|
91
|
+
const postRouter = ArkosRouter({ prefix: "/api/posts" });
|
|
102
92
|
|
|
103
|
-
|
|
104
|
-
|
|
93
|
+
postRouter.post(
|
|
94
|
+
{
|
|
95
|
+
path: "/", // auto registered into openapi
|
|
96
|
+
authentication: postPolicy.Create, // Authentication and authorization with RBAC
|
|
97
|
+
validation: { body: CreatePostSchema }, // auto documented into openapi requestBody
|
|
98
|
+
},
|
|
99
|
+
async (req, res) => {
|
|
100
|
+
const post = await postService.createOne(req.body); // no error handling need, arkos already handles it
|
|
101
|
+
res.json({ data: post });
|
|
102
|
+
}
|
|
103
|
+
);
|
|
105
104
|
|
|
106
|
-
|
|
107
|
-
npm run dev
|
|
105
|
+
export default postRouter;
|
|
108
106
|
```
|
|
109
107
|
|
|
110
|
-
|
|
108
|
+
See more about the enhanced express-based router (ArkosRouter) at [ArkosRouter Guide](https://www.arkosjs.com/docs/core-concepts/components/routers).
|
|
111
109
|
|
|
112
|
-
|
|
113
|
-
- Health check at `/api/health`
|
|
114
|
-
- Authentication endpoints ready to use
|
|
110
|
+
## Define Permissions Once, Guard Everywhere
|
|
115
111
|
|
|
116
|
-
|
|
112
|
+
```typescript
|
|
113
|
+
// src/modules/post/post.policy.ts
|
|
114
|
+
import { ArkosPolicy } from "arkos";
|
|
117
115
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
│ │ └── prisma/
|
|
125
|
-
│ │ └── index.ts # Prisma client
|
|
126
|
-
│ ├── app.ts # Main application
|
|
127
|
-
│ ├── arkos.config.ts # Framework configuration
|
|
128
|
-
│ └── server.ts # Server entry point
|
|
129
|
-
├── .env # Environment variables
|
|
130
|
-
├── .gitignore
|
|
131
|
-
├── package.json
|
|
132
|
-
└── tsconfig.json # TypeScript config (if selected)
|
|
116
|
+
const postPolicy: ArkosPolicy<"post"> = ArkosPolicy("post");
|
|
117
|
+
|
|
118
|
+
postPolicy.rule("Create", ["Writer", "Admin"]);
|
|
119
|
+
postPolicy.rule("View", ["Writer", "Admin", "User"]);
|
|
120
|
+
|
|
121
|
+
export default postPolicy;
|
|
133
122
|
```
|
|
134
123
|
|
|
135
|
-
|
|
124
|
+
Define who can do what, once, per resource. Arkos enforces it across every route that references the policy — no scattered middleware, no repeated role checks.
|
|
136
125
|
|
|
137
|
-
|
|
126
|
+
**Customize CRUD Routes just like normal router:**
|
|
138
127
|
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
|
|
128
|
+
```typescript
|
|
129
|
+
// src/modules/post/post.router.ts
|
|
130
|
+
import { ArkosRouter, RouteHook } from "arkos";
|
|
131
|
+
import postPolicy from "@/src/modules/post/post.policy";
|
|
132
|
+
import UpdatePostSchema from "@/src/modules/post/post.schema";
|
|
142
133
|
|
|
143
|
-
|
|
144
|
-
|
|
134
|
+
export const hook: RouteHook<"prisma"> = {
|
|
135
|
+
findMany: { authentication: false }, // Making GET /api/posts public
|
|
136
|
+
createOne: { authentication: postPolicy.Create },
|
|
137
|
+
updateOne: {
|
|
138
|
+
authentication: postPolicy.Update,
|
|
139
|
+
validation: { body: UpdatePostSchema },
|
|
140
|
+
},
|
|
141
|
+
deleteOne: { authentication: postPolicy.Delete },
|
|
142
|
+
};
|
|
145
143
|
|
|
146
|
-
|
|
147
|
-
DATABASE_URL="mysql://username:password@localhost:3306/mydb"
|
|
144
|
+
const postRouter = ArkosRouter({ prefix: "/api/posts" });
|
|
148
145
|
|
|
149
|
-
|
|
150
|
-
DATABASE_URL="file:./dev.db"
|
|
146
|
+
export default postRouter;
|
|
151
147
|
```
|
|
152
148
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
### Dynamic Authentication (Recommended)
|
|
149
|
+
Your auto-generated CRUD routes accept the same config as any ArkosRouter route — authentication, validation, rate limiting, all in one place.
|
|
156
150
|
|
|
157
|
-
|
|
151
|
+
**Add business logic exactly where you need it:**
|
|
158
152
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
153
|
+
```typescript
|
|
154
|
+
// src/modules/post/post.interceptor.ts
|
|
155
|
+
import { ArkosRequest, ArkosResponse, ArkosNextFunction } from "arkos";
|
|
156
|
+
import { BadRequestError } from "arkos/error-handler";
|
|
163
157
|
|
|
164
|
-
|
|
158
|
+
export const beforeCreateOne = [
|
|
159
|
+
async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
|
|
160
|
+
if (req.body.title.length < 5)
|
|
161
|
+
throw new BadRequestError("Title is too short", "TitleTooShort");
|
|
165
162
|
|
|
166
|
-
|
|
163
|
+
req.body.slug = req.body.title.toLowerCase().replace(/\s/g, "-");
|
|
164
|
+
req.body.authorId = req.user.id;
|
|
165
|
+
next();
|
|
166
|
+
},
|
|
167
|
+
];
|
|
168
|
+
```
|
|
167
169
|
|
|
168
|
-
|
|
169
|
-
- Faster setup
|
|
170
|
-
- Easy to understand and modify
|
|
170
|
+
Name the file, export the hook, and Arkos picks it up automatically. No registration needed.
|
|
171
171
|
|
|
172
|
-
##
|
|
172
|
+
## What You Stop Building From Scratch
|
|
173
173
|
|
|
174
|
-
|
|
174
|
+
| What you'd normally write | What Arkos gives you |
|
|
175
|
+
| ---------------------------------------- | --------------------------------- |
|
|
176
|
+
| JWT setup, refresh tokens, bcrypt | ✅ Built-in auth system |
|
|
177
|
+
| 5 route handlers per Prisma model | ✅ Auto-generated CRUD |
|
|
178
|
+
| Zod/CV schemas per endpoint | ✅ Auto generate from your models |
|
|
179
|
+
| Swagger config + schema upkeep | ✅ Auto-generated OpenAPI docs |
|
|
180
|
+
| Multer setup + file type validation | ✅ File upload system |
|
|
181
|
+
| Rate limiting, CORS, Helmet, compression | ✅ Pre-configured security stack |
|
|
182
|
+
| **Total setup time** | **~5 minutes vs ~8–12 hours** |
|
|
175
183
|
|
|
176
|
-
|
|
177
|
-
2. **Run migrations** with `npx prisma db push`
|
|
178
|
-
3. **Start coding** - Arkos handles the CRUD operations automatically
|
|
179
|
-
4. **Add custom logic** with interceptors when needed
|
|
184
|
+
## Documentation
|
|
180
185
|
|
|
181
|
-
|
|
182
|
-
# Generate CRUD for a new model
|
|
183
|
-
arkos generate posts -m Post
|
|
186
|
+
For comprehensive guides, API reference, and examples, visit our [official documentation](https://arkosjs.com/docs).
|
|
184
187
|
|
|
185
|
-
|
|
186
|
-
npm run dev
|
|
188
|
+
**Quick Links:**
|
|
187
189
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
190
|
+
- [Getting Started Guide](https://arkosjs.com/docs)
|
|
191
|
+
- [Authentication Setup](https://arkosjs.com/docs/core-concepts/authentication/setup)
|
|
192
|
+
- [Using Interceptors](https://arkosjs.com/docs/core-concepts/components/interceptors)
|
|
193
|
+
- [File Uploads](https://arkosjs.com/docs/guides/file-handling/file-uploads/setup)
|
|
194
|
+
- [Validation](https://arkosjs.com/docs/guides/validation/setup)
|
|
195
|
+
- [Email Service](https://arkosjs.com/docs/guides/email-service)
|
|
191
196
|
|
|
192
|
-
##
|
|
197
|
+
## Getting Nightly Updates
|
|
193
198
|
|
|
194
|
-
|
|
199
|
+
You can get the latest features we're testing before releasing them:
|
|
195
200
|
|
|
196
201
|
```bash
|
|
197
|
-
pnpm create arkos@
|
|
202
|
+
pnpm create arkos@next my-project
|
|
198
203
|
```
|
|
199
204
|
|
|
200
|
-
##
|
|
205
|
+
## Built With
|
|
201
206
|
|
|
202
|
-
|
|
203
|
-
- npm, yarn, or pnpm
|
|
207
|
+
Arkos.js is built on top of industry-leading tools:
|
|
204
208
|
|
|
205
|
-
|
|
209
|
+
- **[Express](https://expressjs.com/)** - Fast, unopinionated, minimalist web framework for Node.js
|
|
210
|
+
- **[Prisma](https://www.prisma.io/)** - Next-generation ORM for Node.js and TypeScript
|
|
211
|
+
- **[Node.js](https://nodejs.org/)** - JavaScript runtime built on Chrome's V8 engine
|
|
206
212
|
|
|
207
|
-
|
|
208
|
-
- **Main Framework:** [github.com/uanela/arkos](https://github.com/uanela/arkos)
|
|
209
|
-
- **Community:** [Join our WhatsApp group](https://chat.whatsapp.com/EJ8cjb9hxau0EcOnI4fdpD)
|
|
210
|
-
- **Examples:** [arkosjs.com/docs/examples](https://arkosjs.com/docs/examples)
|
|
211
|
-
|
|
212
|
-
## Support
|
|
213
|
+
## Support & Contributing
|
|
213
214
|
|
|
215
|
+
- **Documentation:** [arkosjs.com/docs](https://arkosjs.com/docs)
|
|
214
216
|
- **Bug Reports:** [GitHub Issues](https://github.com/uanela/arkos/issues)
|
|
215
217
|
- **Feature Requests:** Open a GitHub issue
|
|
216
|
-
- **
|
|
218
|
+
- **Contact:** [uanelaluiswayne@gmail.com](mailto:uanelaluiswayne@gmail.com)
|
|
217
219
|
|
|
218
|
-
|
|
220
|
+
Contributions are welcome! We appreciate all contributions, from bug fixes to new features.
|
|
221
|
+
|
|
222
|
+
## What Developers Say
|
|
223
|
+
|
|
224
|
+
> "Arkos.js changed how I work on the backend: with a Prisma model I already get CRUD routes, auth, and validation out-of-the-box — I saved a lot of time and could focus on business logic."
|
|
225
|
+
>
|
|
226
|
+
> **— Gelson Matavela, Founder / Grupo Vergui**
|
|
227
|
+
|
|
228
|
+
> "It removes boilerplate and provides a clean structure to build products. Built-in auth is powerful and ready. Automatic CRUD and docs save time, while interceptors allow flexible business logic."
|
|
229
|
+
>
|
|
230
|
+
> **— Augusto Domingos, Tech Lead / DSAI For Moz**
|
|
231
|
+
|
|
232
|
+
> "With Arkos.js, I can build backends in just a few minutes. It removes the boilerplate and lets me focus entirely on the core logic. Fast, simple, and incredibly productive."
|
|
233
|
+
>
|
|
234
|
+
> **— Niuro Langa, Software Developer / SparkTech**
|
|
219
235
|
|
|
220
|
-
|
|
236
|
+
[See more testimonials →](https://arkosjs.com)
|
|
221
237
|
|
|
222
|
-
|
|
238
|
+
## Philosophy
|
|
239
|
+
|
|
240
|
+
Arkos sits between minimal frameworks like Express/Fastify and opinionated ones like NestJS/AdonisJS. It doesn't ask you to learn a new paradigm — it enhances the one most Node.js developers already use, by automating everything that's standardized and staying out of the way everywhere else.
|
|
241
|
+
|
|
242
|
+
Inspired by how Django and Laravel work in their ecosystems: batteries included, nothing forced on you.
|
|
243
|
+
|
|
244
|
+
> The name "Arkos" comes from the Greek word **ἀρχή** _(Arkhē)_, meaning "beginning" or "foundation".
|
|
245
|
+
|
|
246
|
+
## License
|
|
247
|
+
|
|
248
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
223
249
|
|
|
224
250
|
<div align="center">
|
|
225
251
|
|
|
226
|
-
**[
|
|
252
|
+
**[Installation](https://www.arkosjs.com/docs/getting-started/installation)** •
|
|
253
|
+
**[Documentation](https://arkosjs.com/docs)** •
|
|
227
254
|
**[Website](https://arkosjs.com)** •
|
|
255
|
+
**[Tutorial](https://arkosjs.com/learn)** •
|
|
228
256
|
**[GitHub](https://github.com/uanela/arkos)** •
|
|
229
|
-
**[
|
|
257
|
+
**[Blog](https://www.arkosjs.com/blog)** •
|
|
258
|
+
**[Npm](https://www.npmjs.com/package/arkos)**
|
|
230
259
|
|
|
231
260
|
Built with ❤️ by [Uanela Como](https://github.com/uanela) and contributors
|
|
232
261
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
_From the Greek "ἀρχή" (Arkhē) - meaning "beginning" - your foundation for Express and Prisma backend development_
|
|
262
|
+
_The name "Arkos" comes from the Greek word "ἀρχή" (Arkhē), meaning "beginning" or "foundation", reflecting our goal of providing a solid foundation for backend development._
|
|
236
263
|
|
|
237
264
|
</div>
|
|
265
|
+
|
package/dist/index.js
CHANGED
|
@@ -11,6 +11,10 @@ import { detectPackageManagerFromUserAgent } from "./utils/helpers/npm.helpers.j
|
|
|
11
11
|
import { fileURLToPath } from "url";
|
|
12
12
|
handlebars.registerHelper("eq", (a, b) => a === b);
|
|
13
13
|
handlebars.registerHelper("neq", (a, b) => a !== b);
|
|
14
|
+
handlebars.registerHelper("or", (...args) => {
|
|
15
|
+
const conditions = args.slice(0, -1);
|
|
16
|
+
return conditions.some((a) => !!a);
|
|
17
|
+
});
|
|
14
18
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
15
19
|
export async function main() {
|
|
16
20
|
const config = await projectConfigInquirer.run();
|
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,EA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C;;;OAGrC,cAAc;CACpB;QACK,CAAC,CAAC,iBAAiB,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC;;;OAG5C,cAAc;CAEnB;KACG,CAAC,CAAC;AACP,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAE5B,OAAO,EAAE,UAAU,EAAE,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/package-json.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);\nhandlebars.registerHelper(\"or\", (...args: any[]) => {\n const conditions = args.slice(0, -1);\n return conditions.some((a) => !!a);\n});\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nexport async 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 const installCmd = `${packageManager} install`;\n execSync(installCmd, { stdio: \"inherit\", cwd: projectPath });\n execSync(installCmd, { stdio: \"pipe\", cwd: projectPath });\n\n process.chdir(projectPath);\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 arkos prisma generate\n 4. npx prisma db push\n 5. ${packageManager} run dev\n`\n : `1. setup your ${chalk.cyan(\"DATABASE_URL\")} under .env\n 2. npx arkos prisma generate\n 3. npx prisma db push\n 4. ${packageManager} run dev\n`\n }\n `);\n}\n\nmain().catch(console.error);\n\nexport { handlebars };\n"]}
|