@darkstar-cli/cli 0.0.2 → 0.0.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.
- package/package.json +18 -5
- package/templates/project/.env.example +90 -0
- package/templates/project/darkstar.config.ts +0 -0
- package/templates/project/database/seeders/DatabaseSeeder.ts +13 -0
- package/templates/project/database/seeders/Seeder.ts +3 -0
- package/templates/project/src/controllers/controller.stub +32 -0
- package/templates/project/src/core/app.ts +5 -0
- package/templates/project/src/models/model.stub +5 -0
- package/templates/project/src/repositories/repository.stub +9 -0
- package/templates/project/src/services/service.stub +11 -0
- package/templates/project/src/utils/omitSecret.stub +0 -0
- package/templates/project/src/utils/omitpassword.stub +0 -0
- package/templates/project/tsconfig.json +15 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@darkstar-cli/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "CLI do framework DarkStar — backend Node.js inspirado no Laravel",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Albertaodasmassa",
|
|
@@ -9,15 +9,28 @@
|
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "https://github.com/SidneiAJr/Darkstar"
|
|
11
11
|
},
|
|
12
|
-
"engines": {
|
|
13
|
-
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": ">=18.0.0"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"darkstar",
|
|
17
|
+
"cli",
|
|
18
|
+
"framework",
|
|
19
|
+
"nodejs",
|
|
20
|
+
"mvc"
|
|
21
|
+
],
|
|
14
22
|
"main": "dist/index.js",
|
|
15
23
|
"types": "dist/index.d.ts",
|
|
16
24
|
"bin": {
|
|
17
25
|
"darkstar": "dist/index.js"
|
|
18
26
|
},
|
|
19
|
-
"files": [
|
|
20
|
-
|
|
27
|
+
"files": [
|
|
28
|
+
"dist",
|
|
29
|
+
"templates"
|
|
30
|
+
],
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "tsc --build"
|
|
33
|
+
},
|
|
21
34
|
"dependencies": {
|
|
22
35
|
"@darkstar-cli/orm": "*",
|
|
23
36
|
"@darkstar-cli/core": "*",
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# -----------------------------------------------
|
|
2
|
+
# TANIS — Environment Configuration
|
|
3
|
+
# -----------------------------------------------
|
|
4
|
+
# Copie este arquivo para .env e preencha os valores
|
|
5
|
+
# cp .env.example .env
|
|
6
|
+
# -----------------------------------------------
|
|
7
|
+
|
|
8
|
+
# App
|
|
9
|
+
APP_NAME=DarkStar
|
|
10
|
+
APP_ENV=local # local | development | staging | production
|
|
11
|
+
APP_DEBUG=true
|
|
12
|
+
APP_URL=http://localhost
|
|
13
|
+
APP_PORT=3000
|
|
14
|
+
APP_KEY= # gerado pelo: tanis artisan key:generate
|
|
15
|
+
|
|
16
|
+
# Locale
|
|
17
|
+
APP_LOCALE=pt_BR
|
|
18
|
+
APP_TIMEZONE=America/Sao_Paulo
|
|
19
|
+
|
|
20
|
+
# -----------------------------------------------
|
|
21
|
+
# Database
|
|
22
|
+
# -----------------------------------------------
|
|
23
|
+
DB_CONNECTION=mysql # sqlite | mysql | postgres
|
|
24
|
+
DB_HOST=127.0.0.1
|
|
25
|
+
DB_PORT=3306 # mysql: 3306 | postgres: 5432
|
|
26
|
+
DB_DATABASE=darkstar
|
|
27
|
+
DB_USERNAME=root # Seu usuario do banco Local
|
|
28
|
+
DB_PASSWORD=root # Sua senha do banco local
|
|
29
|
+
|
|
30
|
+
# -----------------------------------------------
|
|
31
|
+
# Cache
|
|
32
|
+
# -----------------------------------------------
|
|
33
|
+
CACHE_DRIVER=memory # memory | redis
|
|
34
|
+
|
|
35
|
+
# -----------------------------------------------
|
|
36
|
+
# Session
|
|
37
|
+
# -----------------------------------------------
|
|
38
|
+
SESSION_DRIVER=memory # memory | redis | database
|
|
39
|
+
SESSION_LIFETIME=120 # em minutos
|
|
40
|
+
SESSION_SECRET= # gerado pelo: tanis artisan key:generate
|
|
41
|
+
|
|
42
|
+
# -----------------------------------------------
|
|
43
|
+
# Queue
|
|
44
|
+
# -----------------------------------------------
|
|
45
|
+
QUEUE_CONNECTION=sync # sync | redis | database
|
|
46
|
+
|
|
47
|
+
# -----------------------------------------------
|
|
48
|
+
# Redis
|
|
49
|
+
# -----------------------------------------------
|
|
50
|
+
REDIS_HOST=127.0.0.1
|
|
51
|
+
REDIS_PORT=6379
|
|
52
|
+
REDIS_PASSWORD=null
|
|
53
|
+
REDIS_DB=0
|
|
54
|
+
|
|
55
|
+
# -----------------------------------------------
|
|
56
|
+
# Auth / JWT
|
|
57
|
+
# -----------------------------------------------
|
|
58
|
+
JWT_SECRET= # gerado pelo: tanis artisan key:generate
|
|
59
|
+
JWT_EXPIRES_IN= # ex: 60s | 10m | 2h | 7d
|
|
60
|
+
JWT_REFRESH_EXPIRES_IN= # ex: 60s | 10m | 2h | 7d
|
|
61
|
+
|
|
62
|
+
# -----------------------------------------------
|
|
63
|
+
# Mail
|
|
64
|
+
# -----------------------------------------------
|
|
65
|
+
MAIL_DRIVER=log # log | smtp | ses | sendgrid
|
|
66
|
+
MAIL_HOST=127.0.0.1
|
|
67
|
+
MAIL_PORT=2525
|
|
68
|
+
MAIL_USERNAME=null
|
|
69
|
+
MAIL_PASSWORD=null
|
|
70
|
+
MAIL_FROM_ADDRESS="hello@example.com"
|
|
71
|
+
MAIL_FROM_NAME="${APP_NAME}"
|
|
72
|
+
MAIL_ENCRYPTION=null # null | tls | ssl
|
|
73
|
+
|
|
74
|
+
# -----------------------------------------------
|
|
75
|
+
# Storage / AWS S3
|
|
76
|
+
# -----------------------------------------------
|
|
77
|
+
FILESYSTEM_DISK=local # local | s3
|
|
78
|
+
|
|
79
|
+
AWS_ACCESS_KEY_ID=
|
|
80
|
+
AWS_SECRET_ACCESS_KEY=
|
|
81
|
+
AWS_DEFAULT_REGION=us-east-1
|
|
82
|
+
AWS_BUCKET=
|
|
83
|
+
AWS_ENDPOINT= # para MinIO ou S3-compatíveis
|
|
84
|
+
|
|
85
|
+
# -----------------------------------------------
|
|
86
|
+
# Logging
|
|
87
|
+
# -----------------------------------------------
|
|
88
|
+
LOG_CHANNEL=console # console | file | combined
|
|
89
|
+
LOG_LEVEL=debug # debug | info | warn | error
|
|
90
|
+
LOG_FILE=storage/logs/tanis.log
|
|
File without changes
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { TanisRequest, TanisResponse } from 'darkstar-core'
|
|
2
|
+
import { {{name}}Service } from '../services/{{name}}Service'
|
|
3
|
+
|
|
4
|
+
export class {{name}}Controller {
|
|
5
|
+
constructor(private {{nameLower}}Service: {{name}}Service) {}
|
|
6
|
+
|
|
7
|
+
async index(req: TanisRequest, res: TanisResponse) {
|
|
8
|
+
const data = await this.{{nameLower}}Service.findAll()
|
|
9
|
+
return res.ok(data)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
async show(req: TanisRequest, res: TanisResponse) {
|
|
13
|
+
const data = await this.{{nameLower}}Service.findById(req.param('id')!)
|
|
14
|
+
if (!data) return res.notFound('{{name}} não encontrado')
|
|
15
|
+
return res.ok(data)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
async store(req: TanisRequest, res: TanisResponse) {
|
|
19
|
+
const data = await this.{{nameLower}}Service.create(req.all())
|
|
20
|
+
return res.created(data)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async update(req: TanisRequest, res: TanisResponse) {
|
|
24
|
+
const data = await this.{{nameLower}}Service.update(req.param('id')!, req.all())
|
|
25
|
+
return res.ok(data)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async destroy(req: TanisRequest, res: TanisResponse) {
|
|
29
|
+
await this.{{nameLower}}Service.delete(req.param('id')!)
|
|
30
|
+
return res.noContent()
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { {{name}} } from '../models/{{name}}'
|
|
2
|
+
|
|
3
|
+
export class {{name}}Repository {
|
|
4
|
+
findAll() { return {{name}}.findAll() }
|
|
5
|
+
findById(id: string) { return {{name}}.findById(id) }
|
|
6
|
+
create(data: Record<string, any>) { return {{name}}.create(data as any) }
|
|
7
|
+
update(id: string, data: Record<string, any>) { return {{name}}.update(id, data as any) }
|
|
8
|
+
delete(id: string) { return {{name}}.delete(id) }
|
|
9
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { {{name}}Repository } from '../repositories/{{name}}Repository'
|
|
2
|
+
|
|
3
|
+
export class {{name}}Service {
|
|
4
|
+
constructor(private {{nameLower}}Repository: {{name}}Repository) {}
|
|
5
|
+
|
|
6
|
+
findAll() { return this.{{nameLower}}Repository.findAll() }
|
|
7
|
+
findById(id: string) { return this.{{nameLower}}Repository.findById(id) }
|
|
8
|
+
create(data: Record<string, any>) { return this.{{nameLower}}Repository.create(data) }
|
|
9
|
+
update(id: string, data: Record<string, any>) { return this.{{nameLower}}Repository.update(id, data) }
|
|
10
|
+
delete(id: string) { return this.{{nameLower}}Repository.delete(id) }
|
|
11
|
+
}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"module": "Node16",
|
|
5
|
+
"moduleResolution": "node16",
|
|
6
|
+
"outDir": "./dist",
|
|
7
|
+
"rootDir": "./src",
|
|
8
|
+
"strict": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"resolveJsonModule": true
|
|
12
|
+
},
|
|
13
|
+
"include": ["src/**/*"],
|
|
14
|
+
"exclude": ["node_modules", "dist"]
|
|
15
|
+
}
|