Skip to content

Commit 803b2fa

Browse files
committed
chore: wip
chore: wip chore: wip
1 parent dec308b commit 803b2fa

File tree

20 files changed

+219
-101
lines changed

20 files changed

+219
-101
lines changed

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ APP_DEBUG=true
55
APP_URL=stacks.localhost
66
APP_PORT=3333
77

8-
DB_CONNECTION=mysql
8+
DB_CONNECTION=sqlite
99
DB_HOST=127.0.0.1
1010
DB_PORT=3306
1111
DB_DATABASE=stacks
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,71 @@
11
// generates the pkgx file based on the user configuration
2+
// @ts-ignore
3+
import data from '../../../../../pkgx.yaml'
4+
import { config } from '@stacksjs/config'
5+
import { runCommand } from '@stacksjs/cli'
6+
7+
if (!data)
8+
throw new Error('pkgx.yaml file not found')
9+
10+
if (data.dependencies['aws.amazon.com/cdk'] === undefined) {
11+
log.info('aws.amazon.com/cdk dependency not found in pkgx.yaml.')
12+
// throw an error unless its installed locally
13+
const result = await runCommand('which cdk')
14+
if (result.isErr())
15+
throw new Error('aws.amazon.com/cdk dependency not found in pkgx.yaml. To confirm, run `which cdk`')
16+
}
17+
18+
if (data.dependencies['aws.amazon.com/cli'] === undefined) {
19+
log.info('aws.amazon.com/cli dependency not found in pkgx.yaml.')
20+
const result = await runCommand('which aws')
21+
if (result.isErr())
22+
throw new Error('aws.amazon.com/cli dependency not found in pkgx.yaml. To confirm, run `which aws`')
23+
}
24+
25+
if (data.dependencies['bun.sh'] === undefined) {
26+
log.info('bun.sh dependency not found in pkgx.yaml.')
27+
// throw an error unless its installed locally
28+
const result = await runCommand('which aws')
29+
if (result.isErr())
30+
throw new Error('bun.sh dependency not found in pkgx.yaml. To confirm, run `which bun`')
31+
}
32+
33+
if (data.dependencies['info-zip.org/zip'] === undefined) {
34+
log.info('info-zip.org/zip dependency not found in pkgx.yaml.')
35+
// throw an error unless its installed locally
36+
const result = await runCommand('which zip')
37+
if (result.isErr())
38+
throw new Error('info-zip.org/zip dependency not found in pkgx.yaml. To confirm, run `which zip`')
39+
}
40+
41+
if (data.dependencies['info-zip.org/unzip'] === undefined) {
42+
log.info('info-zip.org/unzip dependency not found in pkgx.yaml.')
43+
// throw an error unless its installed locally
44+
const result = await runCommand('which unzip')
45+
if (result.isErr())
46+
throw new Error('info-zip.org/unzip dependency not found in pkgx.yaml. To confirm, run `which unzip`')
47+
}
48+
49+
if (data.dependencies['mailpit.axllent.org'] === undefined) {
50+
log.info('mailpit.axllent.org dependency not found in pkgx.yaml.')
51+
// throw an error unless its installed locally
52+
const result = await runCommand('which mailpit')
53+
if (result.isErr())
54+
throw new Error('mailpit.axllent.org dependency not found in pkgx.yaml. To confirm, run `which mailpit`')
55+
}
56+
57+
if (data.dependencies['redis.io'] === undefined) {
58+
log.info('redis.io dependency not found in pkgx.yaml.')
59+
// throw an error unless its installed locally
60+
const result = await runCommand('which redis')
61+
if (result.isErr())
62+
throw new Error('redis.io dependency not found in pkgx.yaml. To confirm, run `which redis`')
63+
}
64+
65+
if (config.database.default === 'sqlite' && data.dependencies['sqlite.org'] === undefined) {
66+
log.info('sqlite.org dependency not found in pkgx.yaml.')
67+
// throw an error unless its installed locally
68+
const result = await runCommand('which sqlite')
69+
if (result.isErr())
70+
throw new Error('sqlite.org dependency not found in pkgx.yaml. To confirm, run `which sqlite`')
71+
}

.stacks/core/cache/package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,7 @@
5757
},
5858
"optionalDependencies": {
5959
"@aws-sdk/client-dynamodb": "^3.449.0",
60-
"@types/memjs": "^1.3.3",
61-
"memcached": "^2.2.2",
62-
"memjs": "^1.3.1",
63-
"redis": "^4.6.10"
60+
"ioredis": "^5.3.2"
6461
},
6562
"devDependencies": {
6663
"@stacksjs/development": "workspace:*"
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
export * as redis from './redis'
22
export * as dynamodb from './dynamodb'
3-
export * as memcached from './memcached'
4-
export * as upstash from './upstash'

.stacks/core/cache/src/drivers/memcached.ts

Lines changed: 0 additions & 21 deletions
This file was deleted.
Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
11
import { cache } from '@stacksjs/config'
2-
import { type RedisClientType, createClient } from 'redis'
3-
4-
export const client: RedisClientType = createClient({
5-
socket: {
6-
host: cache.drivers?.redis?.host,
7-
port: cache.drivers?.redis?.port,
8-
},
9-
password: '',
10-
})
2+
import Redis, { Command } from 'ioredis'
113

12-
// await client.connect()
13-
// client.on('error', (error) => {
14-
// console.error(error)
15-
// })
4+
export const client = new Redis({
5+
host: cache.drivers?.redis?.host,
6+
port: cache.drivers?.redis?.port,
7+
username: cache.drivers?.redis?.username,
8+
password: cache.drivers?.redis?.password,
9+
})
1610

1711
export async function set(key: string, value: any): Promise<void> {
1812
await client.set(key, value)
@@ -33,9 +27,11 @@ export async function del(key: string): Promise<void> {
3327
}
3428

3529
export async function flushAll(): Promise<void> {
36-
await client.sendCommand(['FLUSHALL', 'ASYNC'])
30+
const command = new Command('FLUSHALL', ['ASYNC'], { replyEncoding: 'utf-8' }, () => {})
31+
await client.sendCommand(command);
3732
}
3833

3934
export async function flushDB(): Promise<void> {
40-
await client.sendCommand(['FLUSHDB', 'ASYNC'])
35+
const command = new Command('FLUSHDB', ['ASYNC'], { replyEncoding: 'utf-8' }, () => {})
36+
await client.sendCommand(command)
4137
}

.stacks/core/cache/src/drivers/upstash.ts

Lines changed: 0 additions & 2 deletions
This file was deleted.

.stacks/core/cli/build.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { log, runCommand } from './src'
22

3-
const result = await runCommand('bun --bun build ./src/index.ts --outdir dist --external vite --external @antfu/install-pkg --external @stacksjs/types --external @stacksjs/logging --external prompts --external @stacksjs/utils --external @stacksjs/validation --external @stacksjs/error-handling --external ora --external kolorist --external cac --target bun', {
3+
const result = await runCommand('bun --bun build ./src/index.ts --outdir dist --external vite --external @antfu/install-pkg --external @stacksjs/types --external @stacksjs/tunnel --external @stacksjs/logging --external prompts --external @stacksjs/utils --external @stacksjs/validation --external @stacksjs/error-handling --external ora --external kolorist --external cac --target bun', {
44
cwd: import.meta.dir,
55
})
66

.stacks/core/cloud/deploy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ import process from 'node:process'
33
import { config } from '@stacksjs/config'
44
import { ExitCode } from '@stacksjs/types'
55
import { env } from '@stacksjs/env'
6-
import * as cdk from 'aws-cdk-lib'
6+
import { App } from 'aws-cdk-lib'
77
import { Cloud } from './src/cloud'
88
import { getOrCreateTimestamp } from './src/helpers'
99
import type { CloudOptions } from './src/types'
1010

11-
const app = new cdk.App()
11+
const app = new App()
1212
const appEnv = config.app.env === 'local' ? 'dev' : config.app.env
1313
const appKey = config.app.key
1414
const domain = config.app.url

.stacks/core/config/build.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { log, runCommand } from '@stacksjs/cli'
22

3-
const result = await runCommand('bun build ./src/index.ts --outdir dist --format esm --external @stacksjs/types --external @stacksjs/env --external @stacksjs/path --external @stacksjs/validation --external @stacksjs/path --external @vinejs/compiler --external pluralize --external @stacksjs/strings --external dinero.js --external @dinero.js/currencies --external validator --external @vinejs/vine --external @stacksjs/validation --target node', {
3+
const result = await runCommand('bun build ./src/index.ts --outdir dist --format esm --external @stacksjs/types --external @stacksjs/tunnel --external @stacksjs/env --external @stacksjs/path --external @stacksjs/validation --external @stacksjs/path --external @vinejs/compiler --external pluralize --external @stacksjs/strings --external dinero.js --external @dinero.js/currencies --external validator --external @vinejs/vine --external @stacksjs/validation --target node', {
44
cwd: import.meta.dir,
55
})
66

0 commit comments

Comments
 (0)