Skip to content

Commit 2a03c12

Browse files
committed
chore: wip
1 parent 606d10a commit 2a03c12

File tree

5 files changed

+42
-23
lines changed

5 files changed

+42
-23
lines changed

storage/framework/core/database/src/migrations.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type { Err, Ok, Result } from '@stacksjs/error-handling'
22
import type { MigrationResult } from 'kysely'
3-
import { $ } from 'bun'
43
import { log } from '@stacksjs/cli'
54
import { database } from '@stacksjs/config'
65
import { err, handleError, ok } from '@stacksjs/error-handling'
@@ -119,7 +118,7 @@ export async function haveModelFieldsChangedSinceLastMigration(modelPath: string
119118

120119
// now that we know the date, we need to check the git history for changes to the model file since that date
121120
const cmd = ``
122-
const gitHistory = await $`${cmd}`.text()
121+
const gitHistory = await Bun.$`${cmd}`.text()
123122

124123
// if there are updates, then we need to check whether
125124
// the updates include the any updates to the model

storage/framework/core/database/src/seeder.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type { Model, RelationConfig } from '@stacksjs/types'
2-
import { randomUUIDv7 } from 'bun'
32
import { italic, log } from '@stacksjs/cli'
43
import { db } from '@stacksjs/database'
54
import { fetchOtherModelRelations, getModelName, getRelationType, getTableName } from '@stacksjs/orm'
@@ -112,12 +111,12 @@ async function seedPivotRelation(relation: RelationConfig): Promise<any> {
112111
}
113112

114113
if (relationalModelUuid)
115-
record.uuid = randomUUIDv7()
114+
record.uuid = Bun.randomUUIDv7()
116115

117116
const data = await db.insertInto(relationModelTable).values(record).executeTakeFirstOrThrow()
118117

119118
if (useUuid)
120-
record2.uuid = randomUUIDv7()
119+
record2.uuid = Bun.randomUUIDv7()
121120

122121
const data2 = await db.insertInto(relationTable).values(record2).executeTakeFirstOrThrow()
123122
const relationData = data.insertId || 1
@@ -161,7 +160,7 @@ async function seedModelRelation(modelName: string): Promise<bigint | number> {
161160
}
162161

163162
if (useUuid)
164-
record.uuid = randomUUIDv7()
163+
record.uuid = Bun.randomUUIDv7()
165164

166165
const data = await db.insertInto(tableName).values(record).executeTakeFirstOrThrow()
167166

storage/framework/core/payments/src/billable/transaction.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import type { TransactionModel } from '../../../../orm/src/models/Transaction'
1+
// import type { TransactionModel } from '../../../../orm/src/models/Transaction'
22
import type { UserModel } from '../../../../orm/src/models/User'
3-
import Product from '../../../../orm/src/models/Product'
4-
import { Transaction } from '../../../../orm/src/models/Transaction'
3+
// import Product from '../../../../orm/src/models/Product'
4+
// import { Transaction } from '../../../../orm/src/models/Transaction'
55

66
export interface ManageTransaction {
77
store: (user: UserModel, productId: number) => Promise<TransactionModel>

storage/framework/core/utils/src/hash.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { config } from '@stacksjs/config'
22
import { log } from '@stacksjs/logging'
3-
import { path as p } from '@stacksjs/path'
3+
import { path } from '@stacksjs/path'
44
import { hashPaths } from '@stacksjs/storage'
55

66
export function originRequestFunctionHash(): string | undefined {
77
try {
8-
return hashPaths(p.cloudPath('src/edge'))
8+
return hashPaths(path.cloudPath('src/edge'))
99
}
1010
catch (error: any) {
1111
log.error('Are we in a Docker container? Failed to hash paths. Error below:')
@@ -14,21 +14,21 @@ export function originRequestFunctionHash(): string | undefined {
1414
}
1515
}
1616

17-
const docsSrc = [p.projectPath('docs'), p.frameworkPath('docs/dist')]
17+
const docsSrc = [path.projectPath('docs'), path.frameworkPath('docs/dist')]
1818

1919
export function websiteSourceHash(): string | undefined {
2020
const websiteSrc = [
21-
p.projectPath('resources/views'),
22-
p.projectPath('resources/assets'),
23-
p.projectPath('resources/lang'),
24-
p.projectPath('resources/functions'),
25-
p.projectPath('resources/components'),
26-
p.projectPath('resources/modules'),
27-
p.projectPath('resources/stores'),
28-
p.frameworkPath('views/web'),
21+
path.projectPath('resources/views'),
22+
path.projectPath('resources/assets'),
23+
path.projectPath('resources/lang'),
24+
path.projectPath('resources/functions'),
25+
path.projectPath('resources/components'),
26+
path.projectPath('resources/modules'),
27+
path.projectPath('resources/stores'),
28+
path.frameworkPath('views/web'),
2929
]
3030

31-
return config.app.docMode === true ? hashPaths(docsSrc) : hashPaths(websiteSrc)
31+
return config.appath.docMode === true ? hashPaths(docsSrc) : hashPaths(websiteSrc)
3232
}
3333

3434
export function docsSourceHash(): string | undefined {
Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,25 @@
1-
import { semver } from 'bun'
21
import { version } from '../package.json'
32

4-
export { semver, version }
3+
export const semver: typeof Bun.semver = Bun.semver
4+
5+
export function isVersionGreaterThan(version: string, compareVersion: string): boolean {
6+
return Bun.semver.order(version, compareVersion) === 1
7+
}
8+
9+
export function isVersionLessThan(version: string, compareVersion: string): boolean {
10+
return Bun.semver.order(version, compareVersion) === -1
11+
}
12+
13+
export function isVersionEqual(version: string, compareVersion: string): boolean {
14+
return Bun.semver.order(version, compareVersion) === 0
15+
}
16+
17+
export function isVersionGreaterThanOrEqual(version: string, compareVersion: string): boolean {
18+
return Bun.semver.order(version, compareVersion) >= 0
19+
}
20+
21+
export function isVersionLessThanOrEqual(version: string, compareVersion: string): boolean {
22+
return Bun.semver.order(version, compareVersion) <= 0
23+
}
24+
25+
export { version }

0 commit comments

Comments
 (0)