Skip to content

Commit de27fbb

Browse files
committed
chore: wip
1 parent 6cf3c01 commit de27fbb

File tree

9 files changed

+30
-54
lines changed

9 files changed

+30
-54
lines changed

.stacks/core/logging/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable @typescript-eslint/no-unsafe-argument */
2-
2+
import process from 'node:process'
33
import { handleError } from '@stacksjs/error-handling'
44
import { bold, green, prompts } from '@stacksjs/cli'
55
import { ray as debug } from 'node-ray'

.stacks/core/modules/src/pinia.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const install: UserModule = ({ isClient, initialState, app }) => {
99
// Refer to
1010
// https://github.com/antfu/vite-ssg/blob/main/README.md#state-serialization
1111
// for other serialization strategies.
12-
if (isClient)
12+
if (isClient) // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
1313
pinia.state.value = (initialState.pinia) || {}
1414

1515
else

.stacks/core/queue/src/index.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
1-
import { type JobOptions } from '@stacksjs/types'
1+
import type { JobOptions } from '@stacksjs/types'
22

33
export class Job {
44
name: JobOptions['name']
55
description: JobOptions['description']
6-
schedule: JobOptions['schedule']
7-
run: JobOptions['run']
6+
handle: JobOptions['handle']
87
tries: JobOptions['tries']
98
backoff: JobOptions['backoff']
109

11-
constructor({ name, description, schedule, run, tries, backoff }: JobOptions) {
10+
constructor({ name, description, handle, tries, backoff }: JobOptions) {
1211
this.name = name
1312
this.description = description
14-
this.schedule = schedule
15-
this.run = run
13+
this.handle = handle
1614
this.tries = tries
1715
this.backoff = backoff
1816
}

.stacks/core/router/src/middleware.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import type { MiddlewareType } from '@stacksjs/types'
66
export class Middleware implements MiddlewareType {
77
name: string
88
priority: number
9+
// eslint-disable-next-line @typescript-eslint/ban-types
910
handle: Function
1011

1112
constructor(data: MiddlewareType) {
@@ -22,10 +23,6 @@ async function importMiddlewares(directory: any) {
2223
const files = await readdir(directory)
2324

2425
for (const file of files) {
25-
// Skip non-JavaScript files
26-
if (path.extname(file) !== '.ts')
27-
continue
28-
2926
// Dynamically import the middleware
3027
const imported = await import(path.join(directory, file))
3128
middlewares.push(imported.default)

.stacks/core/utils/scripts/export-size.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { markdownTable } from 'markdown-table'
33
import filesize from 'filesize'
44
import { fs } from '@stacksjs/storage'
5-
import { type PackageManifest } from '@vueuse/metadata'
5+
import type { PackageManifest } from '@vueuse/metadata'
66
import { getExportsSize } from '../src/export-size'
77
import { version } from '../package.json'
88

.stacks/core/utils/src/throttle.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/**
22
* Throttle a function.
33
*
4-
* @param {Function} fn
5-
* @param {number} [wait]
6-
* @returns {Function}
4+
* @param {Function} fn - The function to throttle.
5+
* @param {number} [wait] - The time to wait between function calls.
6+
* @returns {Function} - A new function that throttles the calls to the original function.
77
*
88
* @example
99
* ```ts

app/models/User.ts

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,13 @@ export default defineModel({
2020
validator: {
2121
// rule: validate.string('test').min(3).max(255),
2222
rule: validator.string().minLength(3).maxLength(255),
23-
default: 'test',
23+
// default: 'test',
2424
message: 'Name must be between 3 and 255 characters',
2525
},
2626

2727
factory: () => faker.person.fullName(),
2828
},
2929

30-
status: {
31-
validator: {
32-
rule: validator.enum(['active', 'inactive']),
33-
message: 'Status must be either active or inactive',
34-
},
35-
36-
factory: () => faker.random.arrayElement(['active', 'inactive']),
37-
},
38-
3930
email: {
4031
unique: true,
4132

@@ -56,11 +47,4 @@ export default defineModel({
5647
factory: () => faker.internet.password(),
5748
},
5849
},
59-
60-
attributes: { // optional accessors & mutators
61-
firstName: {
62-
get: (value: string) => value.toUpperCase(),
63-
set: (value: string) => value.toLowerCase(),
64-
},
65-
},
6650
})

app/notifications/welcome.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
export default new Email({ // or Sms or PushNotification or Webhook or Chat or Notification
2-
name: 'welcome',
3-
subject: 'Welcome to Stacks',
4-
to: ({ user }) => user.email,
5-
from: ({ config }) => config.email.from,
6-
template: 'welcome', // resolves the ./resources/mails/welcome.ts mail template
7-
})
1+
// export default new Email({ // or Sms or PushNotification or Webhook or Chat or Notification
2+
// name: 'welcome',
3+
// subject: 'Welcome to Stacks',
4+
// to: ({ user }) => user.email,
5+
// from: ({ config }) => config.email.from,
6+
// template: 'welcome', // resolves the ./resources/mails/welcome.ts mail template
7+
// })
88

99
// export default defineEmail({ // or defineSms or definePushNotification or defineWebhook or defineChat or defineNotification
1010
// name: 'welcome',

config/cache.ts

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,39 +9,36 @@ import type { CacheConfig } from '@stacksjs/types'
99
* you have any questions, feel free to reach out via Discord or GitHub Discussions.
1010
*/
1111
export default {
12-
driver: env.CACHE_DRIVER || 'redis',
13-
prefix: env.CACHE_PREFIX || 'stacks',
14-
ttl: env.CACHE_TTL || 3600,
12+
driver: 'redis',
13+
prefix: 'stacks',
14+
ttl: 3600,
1515

1616
drivers: {
1717
dynamodb: {
1818
key: env.AWS_ACCESS_KEY_ID || '',
1919
secret: env.AWS_SECRET_ACCESS_KEY || '',
2020
region: env.AWS_DEFAULT_REGION || 'us-east-1',
21-
table: env.DYNAMODB_CACHE_TABLE || 'cache',
22-
endpoint: env.DYNAMODB_ENDPOINT || '',
21+
table: 'cache',
22+
endpoint: '',
2323
},
2424

2525
memcached: {
26-
persistent_id: env.MEMCACHED_PERSISTENT_ID || '',
27-
sasl: [
28-
env.MEMCACHED_USERNAME || '',
29-
env.MEMCACHED_PASSWORD || '',
30-
],
26+
persistent_id: '',
27+
sasl: ['', ''],
3128
options: {
3229
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
3330
},
3431
servers: [{
35-
host: env.MEMCACHED_HOST || '127.0.0.1',
36-
port: env.MEMCACHED_PORT || 11211,
32+
host: '127.0.0.1',
33+
port: 11211,
3734
weight: 100,
3835
}],
3936
},
4037

4138
redis: {
4239
connection: 'cache',
43-
host: env.REDIS_HOST || '127.0.0.1',
44-
port: env.REDIS_PORT || 6379,
40+
host: '127.0.0.1',
41+
port: 6379,
4542
},
4643
},
4744
} satisfies CacheConfig

0 commit comments

Comments
 (0)