Skip to content

Commit e6461e9

Browse files
committed
chore: wip
1 parent a50d092 commit e6461e9

File tree

16 files changed

+263
-14
lines changed

16 files changed

+263
-14
lines changed

.github/workflows/deploy-dev.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Deployment (Dev)
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
deployment:
10+
runs-on: ubuntu-latest
11+
environment: development
12+
steps:
13+
- name: Checkout Code
14+
uses: actions/checkout@v4
15+
16+
- name: Setup Bun
17+
uses: oven-sh/setup-bun@v1
18+
19+
- name: Use cached node_modules
20+
uses: actions/cache@v4
21+
with:
22+
path: node_modules
23+
key: node-modules-${{ hashFiles('**/bun.lockb') }}
24+
restore-keys: |
25+
node-modules-
26+
27+
- name: Install Dependencies
28+
run: bun install
29+

.github/workflows/deploy-prod.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Deployment (Prod)
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
deployment:
10+
runs-on: ubuntu-latest
11+
environment: production
12+
steps:
13+
- name: Checkout Code
14+
uses: actions/checkout@v4
15+
16+
- name: Setup Bun
17+
uses: oven-sh/setup-bun@v1
18+
19+
- name: Use cached node_modules
20+
uses: actions/cache@v4
21+
with:
22+
path: node_modules
23+
key: node-modules-${{ hashFiles('**/bun.lockb') }}
24+
restore-keys: |
25+
node-modules-
26+
27+
- name: Install Dependencies
28+
run: bun install
29+

.github/workflows/deploy-stage.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Deployment (Stage)
2+
3+
on:
4+
push:
5+
tags:
6+
- '*-beta.*'
7+
8+
jobs:
9+
deployment:
10+
runs-on: ubuntu-latest
11+
environment: staging
12+
steps:
13+
- name: Checkout Code
14+
uses: actions/checkout@v4
15+
16+
- name: Setup Bun
17+
uses: oven-sh/setup-bun@v1
18+
19+
- name: Use cached node_modules
20+
uses: actions/cache@v4
21+
with:
22+
path: node_modules
23+
key: node-modules-${{ hashFiles('**/bun.lockb') }}
24+
restore-keys: |
25+
node-modules-
26+
27+
- name: Install Dependencies
28+
run: bun install
29+

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# Stacks Changelog
22

3+
## v0.58.65...v0.58.65-3-gd47ed35f9
4+
5+
[compare changes](https://github.com/stacksjs/stacks/compare/v0.58.65...v0.58.65-3-gd47ed35f9)
6+
7+
### 🏡 Chore
8+
9+
- Wip ([80078006f](https://github.com/stacksjs/stacks/commit/80078006f))
10+
- Wip ([d47ed35f9](https://github.com/stacksjs/stacks/commit/d47ed35f9))
11+
12+
### ❤️ Contributors
13+
14+
- Chris <chrisbreuer93@gmail.com>
15+
316
## v0.58.64...v0.58.64-3-g940445637
417

518
[compare changes](https://github.com/stacksjs/stacks/compare/v0.58.64...v0.58.64-3-g940445637)

app/Actions/BuddyAction.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Action } from '@stacksjs/actions'
33
export default new Action({
44
name: 'Buddy Info',
55
description: 'This command displays the buddy info.',
6+
path: 'buddy', // turns into `APP_URL/api/buddy`
67

78
handle() {
89
return {

app/Actions/LogAction.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { Action } from '@stacksjs/actions'
2+
import { validator } from '@stacksjs/validation'
3+
import { log } from '@stacksjs/logging'
4+
5+
export default new Action({
6+
name: 'Dummy Logger',
7+
description: 'This action is used to demo how to POST to a server and upon success, log a message.',
8+
9+
fields: {
10+
message: {
11+
rule: validator.string().minLength(3).maxLength(255),
12+
message: 'The message must be between 3 and 255 characters long.',
13+
},
14+
15+
level: {
16+
rule: validator.enum(['info', 'warn', 'error']),
17+
message: 'The log level must be one of "info", "warn", or "error".',
18+
},
19+
},
20+
21+
// handle(request: { message: string, level: 'info' | 'warn' | 'error' }) {
22+
handle(request: Request) {
23+
log[request.level](request.message)
24+
25+
return `Logged "${request.message}" at "${request.level}" level`
26+
},
27+
})

app/Middleware/Api.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { log } from '@stacksjs/cli'
2+
import { Middleware } from '@stacksjs/router'
3+
4+
export default new Middleware({
5+
name: 'API Authentication',
6+
priority: 1,
7+
handle() {
8+
log.info('API Authentication middleware')
9+
},
10+
})

app/Middleware/Logger.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import { log } from '@stacksjs/cli'
22
import { Middleware } from '@stacksjs/router'
33

44
export default new Middleware({
5-
name: 'logger',
6-
priority: 1,
5+
name: 'Logger',
6+
priority: 2,
77
handle() {
8-
log.info('logger middleware')
8+
log.info('Logger middleware')
99
},
1010
})

bun.lockb

17.4 KB
Binary file not shown.

routes/api.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,13 @@ route.get('/api/welcome', () => 'hello world 3') // stacksjs.org/api/welcome
77
route.get('/api/welcome/', () => 'hello world 4') // stacksjs.org/api/welcome/
88

99
route.health() // /api/health
10+
// route.action('BuddyAction') // /api/buddy
11+
// route.get('/api/buddy', 'BuddyAction') // /api/buddy
1012
// route.job('/api/example') // the equivalent of route.get('/api/example', 'ExampleJob')
11-
// route.action('/api/buddy') // the equivalent of route.get('/api/buddy', 'BuddyAction')
1213
// route.get('/api/buddy-2', '../app/Actions/BuddyAction') // todo: support this
1314
// route.get('/api/buddy-3', import('../app/Actions/BuddyAction')) // todo: support this
1415

1516
// route.group({ prefix: '/users' }, () => {
16-
// route.before(async (params) => {
17-
// console.log(`[${now()}] ${params.method} ${params.url}`)
18-
// })
19-
2017
// route.get('/:id', ({ id }) => {
2118
// // Retrieve user from database
2219
// return `User with ID ${id}`

0 commit comments

Comments
 (0)