Skip to content

Commit 9ab15dd

Browse files
committed
chore: wip
1 parent 4f64a50 commit 9ab15dd

File tree

18 files changed

+128
-71
lines changed

18 files changed

+128
-71
lines changed

storage/framework/core/error-handling/build.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@ const result = await Bun.build({
1313
sourcemap: 'linked',
1414
minify: true,
1515
external: ['@stacksjs/cli', '@stacksjs/path'],
16-
// plugins: [dts()],
16+
plugins: [
17+
dts({
18+
root: './src',
19+
outdir: './dist',
20+
}),
21+
],
1722
})
1823

1924
await outro({

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export class ErrorHandler {
1515
static shouldExitProcess = true
1616

1717
static handle(err: Error | ErrorMessage | unknown, options?: ErrorOptions): Error {
18-
this.shouldExitProcess = options?.shouldExit !== false ?? true
18+
this.shouldExitProcess = options?.shouldExit !== false
1919
if (options?.silent !== true) this.writeErrorToConsole(err)
2020

2121
let error: Error

storage/framework/core/logging/build.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ const result = await Bun.build({
2020
'@stacksjs/types',
2121
'@stacksjs/validation',
2222
],
23-
// plugins: [dts()],
23+
plugins: [
24+
dts({
25+
root: './src',
26+
outdir: './dist',
27+
}),
28+
],
2429
})
2530

2631
await outro({

storage/framework/core/spreadsheets/build.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { dts } from 'bun-plugin-dts-auto'
12
import { intro, outro } from '../build/src'
23

34
const { startTime } = await intro({
@@ -11,6 +12,12 @@ const result = await Bun.build({
1112
target: 'bun',
1213
sourcemap: 'linked',
1314
minify: true,
15+
plugins: [
16+
dts({
17+
root: './src',
18+
outdir: './dist',
19+
}),
20+
],
1421
})
1522

1623
await outro({

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

Lines changed: 10 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,11 @@
1-
/**
2-
* Content is the data structure that represents the spreadsheet content.
3-
*
4-
* @example
5-
* const content: Content = {
6-
* headings: ['Name', 'Age', 'City'],
7-
* data: [
8-
* ['John Doe', 30, 'New York'],
9-
* ['Jane Smith', 25, 'London'],
10-
* ['Bob Johnson', 35, 'Paris']
11-
* ]
12-
* }
13-
*/
14-
export interface Content {
15-
headings: string[]
16-
data: (string | number)[][]
17-
}
18-
19-
export type SpreadsheetType = 'csv' | 'excel'
20-
21-
export interface SpreadsheetContent {
22-
content: string | Uint8Array
23-
type: SpreadsheetType
24-
}
25-
26-
export type SpreadsheetOptions = Partial<{
27-
type: SpreadsheetType
28-
}>
29-
30-
type FileExtension = '.csv' | '.xlsx'
31-
32-
export type Spreadsheet = {
33-
(
34-
data: Content,
35-
): {
36-
csv: () => SpreadsheetWrapper
37-
excel: () => SpreadsheetWrapper
38-
store: (path: string) => Promise<void>
39-
generateCSV: () => SpreadsheetWrapper
40-
generateExcel: () => SpreadsheetWrapper
41-
}
42-
create: (data: Content, options: SpreadsheetOptions) => SpreadsheetContent
43-
generate: (data: Content, options: SpreadsheetOptions) => string | Uint8Array
44-
generateCSV: (content: Content) => SpreadsheetWrapper
45-
generateExcel: (content: Content) => SpreadsheetWrapper
46-
store: (spreadsheet: SpreadsheetContent, path: string) => Promise<void>
47-
download: (spreadsheet: SpreadsheetContent, filename: string) => Response
48-
}
1+
import type {
2+
Content,
3+
FileExtension,
4+
Spreadsheet,
5+
SpreadsheetContent,
6+
SpreadsheetOptions,
7+
SpreadsheetType,
8+
} from './types'
499

5010
export const spreadsheet: Spreadsheet = Object.assign(
5111
(data: Content) => ({
@@ -255,3 +215,5 @@ export function generateExcelContent(content: Content): Uint8Array {
255215

256216
return Uint8Array.from(Buffer.concat([...zipData, ...centralDirectory, endOfCentralDirectory]))
257217
}
218+
219+
export * from './types'
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import type { SpreadsheetWrapper } from './'
2+
3+
/**
4+
* Content is the data structure that represents the spreadsheet content.
5+
*
6+
* @example
7+
* const content: Content = {
8+
* headings: ['Name', 'Age', 'City'],
9+
* data: [
10+
* ['John Doe', 30, 'New York'],
11+
* ['Jane Smith', 25, 'London'],
12+
* ['Bob Johnson', 35, 'Paris']
13+
* ]
14+
* }
15+
*/
16+
export interface Content {
17+
headings: string[]
18+
data: (string | number)[][]
19+
}
20+
21+
export type SpreadsheetType = 'csv' | 'excel'
22+
23+
export interface SpreadsheetContent {
24+
content: string | Uint8Array
25+
type: SpreadsheetType
26+
}
27+
28+
export type SpreadsheetOptions = Partial<{
29+
type: SpreadsheetType
30+
}>
31+
32+
export type FileExtension = '.csv' | '.xlsx'
33+
34+
export type Spreadsheet = {
35+
(
36+
data: Content,
37+
): {
38+
csv: () => SpreadsheetWrapper
39+
excel: () => SpreadsheetWrapper
40+
store: (path: string) => Promise<void>
41+
generateCSV: () => SpreadsheetWrapper
42+
generateExcel: () => SpreadsheetWrapper
43+
}
44+
create: (data: Content, options: SpreadsheetOptions) => SpreadsheetContent
45+
generate: (data: Content, options: SpreadsheetOptions) => string | Uint8Array
46+
generateCSV: (content: Content) => SpreadsheetWrapper
47+
generateExcel: (content: Content) => SpreadsheetWrapper
48+
store: (spreadsheet: SpreadsheetContent, path: string) => Promise<void>
49+
download: (spreadsheet: SpreadsheetContent, filename: string) => Response
50+
}

storage/framework/core/spreadsheets/tests/spreadsheet.test.ts renamed to storage/framework/core/spreadsheets/tests/spreadsheets.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { afterEach, beforeEach, describe, expect, it } from 'bun:test'
22
import { existsSync, unlinkSync } from 'node:fs'
3-
import type { Content } from '../src/index'
43
import { createSpreadsheet, spreadsheet } from '../src/index'
4+
import type { Content } from '../src/types'
55

6-
describe('Bun Spreadsheets', () => {
6+
describe('bun-spreadsheets', () => {
77
let testData: Content
88

99
beforeEach(() => {

storage/framework/core/storage/build.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ const result = await Bun.build({
2828
'bun',
2929
],
3030
plugins: [
31-
// dts({
32-
// root: './src',
33-
// outdir: './dist',
34-
// }),
31+
dts({
32+
root: './src',
33+
outdir: './dist',
34+
}),
3535
],
3636
})
3737

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// type Visibility = 'public' | 'private'
22

33
// export function setVisibility(path: string, visibility: Visibility) {
4-
export function setVisibility() {
4+
export function setVisibility(): string {
55
return 'wip'
66
}

storage/framework/core/testing/build.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { dts } from 'bun-plugin-dts-auto'
12
import { intro, outro } from '../build/src'
23

34
const { startTime } = await intro({
@@ -11,7 +12,12 @@ const result = await Bun.build({
1112
target: 'bun',
1213
sourcemap: 'linked',
1314
minify: true,
14-
external: ['@playwright/test'],
15+
plugins: [
16+
dts({
17+
root: './src',
18+
outdir: './dist',
19+
}),
20+
],
1521
})
1622

1723
await outro({

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ export async function refreshDatabase(): Promise<void> {
2828
await setupDatabase()
2929

3030
if (driver === 'mysql') await truncateMysql()
31-
3231
if (driver === 'sqlite') await truncateSqlite()
3332
}
3433

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
export { GlobalRegistrator } from '@happy-dom/global-registrator'
1+
import { GlobalRegistrator } from '@happy-dom/global-registrator'
22

3-
export function enableBrowserFeatures() {
4-
return GlobalRegistrator.register()
3+
export function enableBrowserFeatures(): void {
4+
GlobalRegistrator.register()
55
}
66

7-
export function setupTestEnvironment() {
7+
export function setupTestEnvironment(): void {
88
process.env.NODE_ENV = 'test'
99
process.env.APP_ENV = 'test'
10-
return GlobalRegistrator.register()
10+
11+
GlobalRegistrator.register()
1112
}
13+
14+
export { GlobalRegistrator }

storage/framework/core/tinker/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"scripts": {
2222
"build": "echo 'wip'",
2323
"prepublishOnly": "bun run build",
24+
"test": "bun test",
2425
"typecheck": "bun tsc --noEmit"
2526
},
2627
"devDependencies": {

storage/framework/core/tunnel/build.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { dts } from 'bun-plugin-dts-auto'
12
import { intro, outro } from '../build/src'
23

34
const { startTime } = await intro({
@@ -11,6 +12,12 @@ const result = await Bun.build({
1112
target: 'bun',
1213
sourcemap: 'linked',
1314
minify: true,
15+
plugins: [
16+
dts({
17+
root: './src',
18+
outdir: './dist',
19+
}),
20+
],
1421
})
1522

1623
await outro({

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { localTunnel } from './tunnel'
1+
import { type LocalTunnel, localTunnel } from './tunnel'
22

3-
export async function createLocalTunnel(port: number) {
3+
export async function createLocalTunnel(port: number): Promise<LocalTunnel> {
44
return await localTunnel({ port })
55
}
66

storage/framework/core/tunnel/src/tunnel.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
export async function localTunnel(options?: { port: number }) {
1+
// wip
2+
export type LocalTunnel = string
3+
4+
export async function localTunnel(options?: { port: number }): Promise<LocalTunnel> {
25
const port = 3000
36

47
if (!options?.port) options = { port }

storage/framework/core/ui/build.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { dts } from 'bun-plugin-dts-auto'
12
import { intro, outro } from '../build/src'
23

34
const { startTime } = await intro({
@@ -12,6 +13,12 @@ const result = await Bun.build({
1213
sourcemap: 'linked',
1314
minify: true,
1415
external: ['@stacksjs/config'],
16+
plugins: [
17+
dts({
18+
root: './src',
19+
outdir: './dist',
20+
}),
21+
],
1522
})
1623

1724
await outro({

storage/framework/core/ui/src/unocss.config.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { presetForms } from '@julr/unocss-preset-forms'
22
import { ui } from '@stacksjs/config'
33
import {
4-
defineConfig,
4+
type UserConfig as UnoConfig,
55
presetAttributify,
66
presetIcons,
77
presetTypography,
@@ -13,7 +13,7 @@ import {
1313
} from 'unocss'
1414
import { presetHeadlessUi } from 'unocss-preset-primitives'
1515

16-
export default defineConfig({
16+
const config: UnoConfig = {
1717
shortcuts: ui.shortcuts,
1818

1919
content: {
@@ -74,4 +74,6 @@ export default defineConfig({
7474
},
7575
},
7676
},
77-
})
77+
}
78+
79+
export default config

0 commit comments

Comments
 (0)