Skip to content

Commit eb1aae6

Browse files
committed
chore: wip
chore: wip chore: wip chore: wip
1 parent 99c6b7b commit eb1aae6

File tree

17 files changed

+33
-42
lines changed

17 files changed

+33
-42
lines changed

storage/framework/core/actions/src/helpers/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as storage from '@stacksjs/storage'
22
import { buddyOptions, runCommand, runCommands } from '@stacksjs/cli'
33
import { log } from '@stacksjs/logging'
44
import * as p from '@stacksjs/path'
5-
import type { ActionOptions, StacksError, Subprocess } from '@stacksjs/types'
5+
import type { ActionOptions, Subprocess } from '@stacksjs/types'
66
import type { Result } from '@stacksjs/error-handling'
77
import { err, handleError } from '@stacksjs/error-handling'
88

@@ -13,7 +13,7 @@ import { err, handleError } from '@stacksjs/error-handling'
1313
* @param options The options to pass to the command.
1414
* @returns The result of the command.
1515
*/
16-
export async function runAction(action: string, options?: ActionOptions): Promise<Result<Subprocess, StacksError>> {
16+
export async function runAction(action: string, options?: ActionOptions): Promise<Result<Subprocess, Error>> {
1717
const opts = buddyOptions()
1818
const path = p.relativeActionsPath(`${action}.ts`)
1919
const cmd = `bun --bun ${path} ${opts}`.trimEnd()

storage/framework/core/arrays/src/helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ export function sample<T>(arr: T[], count: number) {
266266
export function shuffle<T>(array: T[]): T[] {
267267
for (let i = array.length - 1; i > 0; i--) {
268268
const j = Math.floor(Math.random() * (i + 1));
269-
[array[i], array[j]] = [array[j], array[i]]
269+
[array[i]!, array[j]!] = [array[j]!, array[i]!]
270270
}
271271
return array
272272
}

storage/framework/core/cli/src/exec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import process from 'node:process'
22
import { type Result, err, handleError, ok } from '@stacksjs/error-handling'
3-
import type { CliOptions, StacksError, Subprocess } from '@stacksjs/types'
3+
import type { CliOptions, Subprocess } from '@stacksjs/types'
44
import { ExitCode } from '@stacksjs/types'
55
import { log } from './'
66

@@ -24,7 +24,7 @@ import { log } from './'
2424
* const result = await exec('ls', { cwd: '/home' })
2525
* ```
2626
*/
27-
export async function exec(command: string | string[], options?: CliOptions): Promise<Result<Subprocess, StacksError>> {
27+
export async function exec(command: string | string[], options?: CliOptions): Promise<Result<Subprocess, Error>> {
2828
const cmd = Array.isArray(command)
2929
? command
3030
: command.match(/(?:[^\s"]+|"[^"]*")+/g)

storage/framework/core/error-handling/src/handler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export class ErrorHandler {
1010
static logFile = logsPath('errors.log')
1111

1212
static handle(err: ErrorDescription | Error, options?: ErrorOptions | Error) {
13-
// lets only write to the console if we are not in silent mode
13+
// let's only write to the console if we are not in silent mode
1414
if (!(options instanceof Error) && options?.silent !== false)
1515
this.writeErrorToConsole(err, options)
1616

storage/framework/core/scheduler/src/index.ts

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

3-
export { CronJob } from './job'
3+
export { CronJob as BunCronJob } from './job'
44
export { CronTime } from './time'
55

66
export type {

storage/framework/core/scheduler/src/job.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,8 @@ export class CronJob<OC extends CronOnCompleteCommand | null = null, C = null> {
233233
startTime = Date.now()
234234
// eslint-disable-next-line ts/no-use-before-define
235235
this._timeout = setTimeout(callbackWrapper, t)
236-
if (this.unrefTimeout && typeof this._timeout.unref === 'function')
237-
this._timeout.unref()
236+
if (this.unrefTimeout && typeof this._timeout!.unref === 'function')
237+
this._timeout!.unref()
238238
}
239239

240240
// The callback wrapper checks if it needs to sleep another period or not

storage/framework/core/scheduler/src/schedule.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import { CronTime } from './time'
66
export class Schedule {
77
private cronPattern: string = ''
88
private timezone: string = 'America/Los_Angeles'
9-
private task: () => void
10-
private cmd?: string
9+
private readonly task: () => void
10+
// private cmd?: string
1111

1212
constructor(task: () => void) {
1313
this.task = task

storage/framework/core/search-engine/src/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { searchEngine } from '@stacksjs/config'
21
import type { UiEngine } from '@stacksjs/ui'
32
import { useStorage } from '@stacksjs/utils'
43

@@ -33,8 +32,9 @@ export const sort = computed(() => table.sort)
3332
export const sorts = computed(() => table.sorts)
3433

3534
export function client() {
36-
if (searchEngine.driver === 'meilisearch')
37-
return meilisearch
35+
// if (searchEngine.driver === 'meilisearch')
36+
// return meilisearch
37+
return 'wip-search-me'
3838
}
3939

4040
export function useSearchEngine() {
@@ -55,8 +55,8 @@ export function calculatePagination() {
5555
from = 1
5656

5757
let to = from + offset * 2
58-
if (to >= lastPage)
59-
to = lastPage
58+
if (to >= (lastPage as number))
59+
to = lastPage as number
6060

6161
const allPages = []
6262
for (let page = from; page <= to; page++)

storage/framework/core/storage/src/files.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type { BunFile, PathLike } from 'bun'
21
import type { JsonFile, PackageJson, TextFile } from '@stacksjs/types'
32
import { detectIndent, detectNewline } from '@stacksjs/strings'
43
import { dirname, join, path as p } from '@stacksjs/path'
@@ -25,13 +24,11 @@ export async function readPackageJson(name: string, cwd?: string) {
2524
return file.data as PackageJson
2625
}
2726

28-
type Path = BunFile | PathLike
29-
type Data = Blob | TypedArray | ArrayBufferLike | string | BlobPart[]
30-
3127
/**
3228
* Writes the given text to the specified file.
3329
*/
34-
export async function writeFile(path: Path, data: Data): Promise<number> {
30+
export async function writeFile(path: string, data: any): Promise<number> {
31+
// export async function writeFile(path: Path, data: Data): Promise<number> {
3532
if (typeof path === 'string') {
3633
const dirPath = dirname(path)
3734
if (!await existsSync(dirPath))

storage/framework/core/types/src/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export type Writable =
2929

3030
export type In = Readable
3131
export type Out = Writable
32-
export type Err = Writable
32+
// export type Err = Writable // TODO: find a workaround for this to not clash with our other Err export
3333

3434
/**
3535
* The file descriptor for the standard input. It may be:

0 commit comments

Comments
 (0)