Skip to content

Commit f17939a

Browse files
committed
Building
1 parent 168378b commit f17939a

47 files changed

Lines changed: 3104 additions & 1237 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/beta-release.yml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
- cron: '0 3 * * *'
77
push:
88
branches:
9-
- get-builds
9+
- june-29
1010
# Allow manual triggering
1111
workflow_dispatch:
1212

@@ -80,11 +80,11 @@ jobs:
8080
run: |
8181
npm run build:beta
8282
83-
- name: Prepare Signing Certificates
84-
run: |
85-
mkdir -p build
86-
echo "${{ secrets.APPLE_CERT }}" | base64 --decode > build/developerID_application.cer
87-
echo "${{ secrets.SPARKLE_KEY }}" | base64 --decode > sparkle.key
83+
# - name: Prepare Signing Certificates
84+
# run: |
85+
# mkdir -p build
86+
# echo "${{ secrets.APPLE_CERT }}" | base64 --decode > build/developerID_application.cer
87+
# echo "${{ secrets.SPARKLE_KEY }}" | base64 --decode > sparkle.key
8888

8989
- name: Setup build environment
9090
run: |
@@ -98,16 +98,19 @@ jobs:
9898
- name: Run Conveyor for Beta Build
9999
uses: hydraulic-software/conveyor/actions/build@v18.1
100100
env:
101-
APPLE_ASP: ${{ secrets.APPLE_ASP }}
102-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
103-
SITE_RELEASE_TOKEN: ${{ secrets.SITE_RELEASE_TOKEN }}
101+
# APPLE_ASP: ${{ secrets.APPLE_ASP }}
102+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
103+
# SITE_RELEASE_TOKEN: ${{ secrets.SITE_RELEASE_TOKEN }}
104104
NODE_ENV: production
105105
ENV: production
106106
MODE: beta
107107
BUILD_VERSION: ${{ needs.generate-version.outputs.beta_version }}
108+
APPLE_NOTARIZATION_ISSUER_ID: ${{ secrets.APPLE_NOTARIZATION_ISSUER_ID }}
109+
APPLE_NOTARIZATION_KEY_ID: ${{ secrets.APPLE_NOTARIZATION_KEY_ID }}
110+
APPLE_NOTARIZATION_PRIVATE_KEY: ${{ secrets.APPLE_NOTARIZATION_PRIVATE_KEY }}
108111
with:
109112
command: make copied-site
110-
signing_key: ${{ secrets.SIGNING_KEY }}
113+
# signing_key: ${{ secrets.SIGNING_KEY }}
111114
extra_flags: -f conveyor.beta.conf
112115
agree_to_license: 1
113116

_scripts/download-libsql.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ interface Platform {
2222
}
2323

2424
// Get version from command line or use default
25-
const version = process.argv[2] || '0.5.0-pre.6'
25+
const version = process.argv[2] || '0.5.13'
2626

2727
// Define the platforms we need
2828
const platforms: Platform[] = [

apps/main/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
},
1010
"dependencies": {
1111
"@slide.code/core": "*",
12-
"fix-path": "^4.0.0"
12+
"bufferutil": "^4.0.9",
13+
"fix-path": "^4.0.0",
14+
"utf-8-validate": "^6.0.5"
1315
}
1416
}

apps/main/src/index.ts

Lines changed: 42 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import {
1515
PubSubClient,
1616
ElectronEventService,
1717
PostHogService,
18-
SentryService,
1918
registerSSRProtocols,
2019
GlobalShortcutService,
2120
registerDeepLinkingProtocol,
@@ -29,106 +28,130 @@ import log from 'electron-log'
2928

3029
import { createAppReady } from '@slide.code/schema/messages'
3130

31+
log.info('[MAIN] 🚀 Starting SlideCode main process')
32+
log.info('[MAIN] 📍 Current working directory:', process.cwd())
33+
log.info('[MAIN] 🔧 Node version:', process.version)
34+
log.info('[MAIN] 🔧 Electron version:', process.versions.electron)
35+
log.info('[MAIN] 📦 App version:', app.getVersion())
36+
3237
// Global references to prevent garbage collection
3338
let eventHandlerFiber: Fiber.RuntimeFiber<any, any> | null = null
3439

3540
// Using the generator approach with Effect.gen
3641
const program = Effect.gen(function* () {
3742
try {
43+
log.info('[MAIN] 🔄 Starting main program execution')
44+
3845
// First register SSR protocols before app is ready and any service initialization
46+
log.info('[MAIN] 🔗 Registering SSR protocols')
3947
yield* registerSSRProtocols
48+
log.info('[MAIN] ✅ SSR protocols registered')
4049

4150
// Register custom protocol for deep linking
51+
log.info('[MAIN] 🔗 Registering deep linking protocol')
4252
yield* registerDeepLinkingProtocol
53+
log.info('[MAIN] ✅ Deep linking protocol registered')
4354

4455
// Get services (these are now scoped to the runtime)
56+
log.info('[MAIN] 🛠️ Initializing services')
4557
// const sentry = yield* SentryService
4658
const update = yield* UpdateRef
4759
const menuService = yield* MenuService
4860
const pubsub = yield* PubSubClient
4961
const electronEventService = yield* ElectronEventService // Get the electron event service
5062
const posthog = yield* PostHogService // Get the PostHog service
51-
const sentry = yield* SentryService
5263
const userRef = yield* UserRef
5364
const dbService = yield* DatabaseService
65+
log.info('[MAIN] ✅ Services initialized')
5466

5567
// const globalShortcutService = yield* GlobalShortcutService
5668
yield* Effect.logInfo('Initializing ElectronEventService')
69+
log.info('[MAIN] 🔄 Initializing ElectronEventService')
5770
yield* electronEventService.initialize
71+
log.info('[MAIN] ✅ ElectronEventService initialized')
5872

5973
// Then do other performance optimizations and instance checks
74+
log.info('[MAIN] ⚡ Applying performance optimizations and checking single instance')
6075
yield* Effect.all([configurePerformanceOptimizations, ensureSingleInstance])
76+
log.info('[MAIN] ✅ Performance optimizations applied and single instance ensured')
6177

6278
// Create vibe-dir and save path to user ref
79+
log.info('[MAIN] 📁 Creating vibe directory')
6380
const vibeDir = yield* createVibeDir
6481
yield* userRef.updateVibeDirectory(vibeDir)
82+
log.info('[MAIN] ✅ Vibe directory created:', vibeDir)
6583

6684
// Get configuration using Effect Config
6785
yield* Effect.logInfo('Loading configuration')
86+
log.info('[MAIN] ⚙️ Loading configuration')
6887
const updateConfig = yield* config.updateConfig
6988
const posthogConfig = yield* config.posthogConfig
7089
const sentryConfig = yield* config.sentryConfig
7190
const dbConfig = yield* config.databaseConfig
72-
73-
// Only initialize Sentry if DSN is available
74-
if (sentryConfig.dsn) {
75-
yield* Effect.logInfo('Initializing Sentry with DSN', sentryConfig.dsn)
76-
yield* sentry.initialize({
77-
...sentryConfig,
78-
dsn: sentryConfig.dsn
79-
})
80-
} else {
81-
yield* Effect.logInfo('Skipping Sentry initialization - DSN not provided')
82-
}
91+
log.info('[MAIN] ✅ Configuration loaded')
8392

8493
// Initialize PostHog if API key is available
8594
if (posthogConfig.apiKey) {
8695
yield* Effect.logInfo('Initializing PostHog')
96+
log.info('[MAIN] 📊 Initializing PostHog')
8797
yield* posthog.initialize({
8898
...posthogConfig,
8999
apiKey: posthogConfig.apiKey
90100
})
91101

92102
yield* posthog.captureAppLaunched()
103+
log.info('[MAIN] ✅ PostHog initialized and app launch captured')
93104
} else {
94105
yield* Effect.logInfo('Skipping PostHog initialization - API key not provided')
106+
log.info('[MAIN] ⚠️ Skipping PostHog initialization - API key not provided')
95107
}
96108

97109
// Wait for app to be ready before proceeding
110+
log.info('[MAIN] ⏳ Waiting for Electron app to be ready')
98111
yield* Effect.promise(() => app.whenReady())
99112
yield* Effect.logInfo('📱 App ready, starting up')
113+
log.info('[MAIN] ✅ Electron app is ready, continuing startup')
100114

101115
// Initialize the update service
102116
if (updateConfig.updateSiteURL) {
103117
yield* Effect.logInfo('Initializing UpdateService', updateConfig)
118+
log.info('[MAIN] 🔄 Initializing UpdateService with URL:', updateConfig.updateSiteURL)
104119
yield* update.initialize({
105120
updateSiteURL: updateConfig.updateSiteURL,
106121
checkInterval: updateConfig.checkInterval,
107122
automaticChecks: updateConfig.automaticChecks
108123
})
124+
log.info('[MAIN] ✅ UpdateService initialized')
109125
} else {
110126
yield* Effect.logInfo('Skipping UpdateService initialization - no URL provided')
127+
log.info('[MAIN] ⚠️ Skipping UpdateService initialization - no URL provided')
111128
}
112129

113130
try {
114131
// Initialize and run migrations in one step
132+
log.info('[MAIN] 🗄️ Initializing database and running migrations', dbConfig)
115133
yield* dbService.initAndMigrate(dbConfig)
134+
log.info('[MAIN] ✅ Database initialized and migrated successfully')
116135
// logger.info('Database initialized and migrated successfully')
117136
} catch (error) {
118137
// logger.error('Database initialization failed:', error)
138+
log.error('[MAIN] ❌ Database initialization failed:', error)
119139
// actions.initFail(`Failed to initialize database. Please restart the application. ${error}`)
120140
return yield* Effect.fail(error)
121141
}
122142

123143
// Handle app events using the ElectronEventService
144+
log.info('[MAIN] 🔄 Setting up event handler stream')
124145
const eventHandler = electronEventService.stream.pipe(
125146
Stream.tap((event) => Effect.logInfo(`🔄 Processing event: ${event._tag}`)),
126147
Stream.tap((event) =>
127148
Effect.sync(() => console.log('🔄 Processing event', JSON.stringify(event, null, 2)))
128149
),
150+
Stream.tap((event) => Effect.sync(() => log.info('[MAIN] 🔄 Processing event:', event._tag))),
129151
Stream.runForEach((event) => {
130152
return Effect.gen(function* () {
131153
yield* Effect.logInfo(`Handling electron event: ${event._tag}`, event)
154+
log.info('[MAIN] 🔄 Handling electron event:', event._tag)
132155

133156
return yield* Match.value(event._tag).pipe(
134157
Match.when('window-all-closed', () =>
@@ -171,13 +194,18 @@ const program = Effect.gen(function* () {
171194
// Fork event handler to run in background and save the fiber
172195
eventHandlerFiber = yield* Effect.fork(eventHandler)
173196
yield* Effect.logInfo('🚀 Event handler started')
197+
log.info('[MAIN] ✅ Event handler started and forked')
174198

175199
// Initialize menu service
200+
log.info('[MAIN] 🍔 Creating application menu')
176201
yield* menuService.createApplicationMenu
202+
log.info('[MAIN] ✅ Application menu created')
177203
// yield* globalShortcutService.initialize
178204

179205
// Send app ready event to trigger SSR demo
206+
log.info('[MAIN] 📢 Publishing AppReady event')
180207
yield* pubsub.publish(createAppReady())
208+
log.info('[MAIN] ✅ AppReady event published')
181209

182210
// yield* subscription.openCheckout('price_1RCoB1QQ3xOop9wog1ScGOe1')
183211

@@ -200,6 +228,7 @@ const program = Effect.gen(function* () {
200228
yield* Effect.never
201229
} finally {
202230
yield* Effect.logInfo('Main program exiting')
231+
log.info('[MAIN] 🔚 Main program exiting')
203232
}
204233
})
205234

apps/main/vite.config.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,20 @@ export default defineConfig({
4747
'electron',
4848
...builtinModules.map((m) => `node:${m}`),
4949
...builtinModules,
50+
'libsql'
5051
// External packages that cause build issues
51-
'conf',
52-
'ajv-formats',
53-
'electron-log',
54-
'@opentelemetry/instrumentation',
55-
'@opentelemetry/api',
56-
'shimmer',
57-
'require-in-the-middle'
52+
// 'conf',
53+
// 'ajv-formats',
54+
// /^@libsql\/.*/
55+
// 'electron-log',
56+
// '@opentelemetry/instrumentation',
57+
// '@opentelemetry/api',
58+
// 'shimmer',
59+
// 'require-in-the-middle'
5860
]
5961
}
62+
},
63+
ssr: {
64+
noExternal: true
6065
}
6166
})

apps/preload/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"format": "npx prettier --check \"**/*.{js,mjs,cjs,ts,mts,cts,vue,json}\""
1414
},
1515
"dependencies": {
16-
"@slide.code/types": "*"
16+
"@slide.code/types": "*",
17+
"effect": "^3.16.11"
1718
}
1819
}

apps/preload/src/rpc.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { contextBridge, ipcRenderer } from 'electron'
2-
import type { FromClientEncoded, FromServerEncoded } from '@effect/rpc/RpcMessage'
32
import { RPC_CHANNELS } from '@slide.code/types'
43

54
/**

apps/preload/vite.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,16 @@ const config = defineConfig({
3939
...builtinModules,
4040
...builtinModules.map((m) => `node:${m}`),
4141
// ...Object.keys(dependencies || {}),
42+
// 'effect',
4243
'electron'
4344
]
4445
},
4546
emptyOutDir: true,
4647
reportCompressedSize: false
48+
},
49+
ssr: {
50+
noExternal: true,
51+
external: ['electron']
4752
}
4853
})
4954

build-modules.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ if [ -d "node_modules" ]; then
3535
echo "📋 Copying specific modules from node_modules.bk to node_modules_build..."
3636

3737
# List of modules to copy
38-
# modules=("@libsql" "@neon-rs" "@trpc" "drizzle-orm" "js-base64" "libsql" "promise-limit" "ws" "zod" "koffi")
39-
modules=("koffi" "kuzu")
38+
modules=("@libsql" "@neon-rs" "drizzle-orm" "detect-libc" "libsql")
39+
# modules=("koffi" "kuzu")
4040

4141
# Copy each module
4242
for module in "${modules[@]}"; do

build-slide-modules.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,10 @@ fi
5050

5151
#Adding main dir
5252
copy_package_dist "main" "apps/main"
53-
copy_package_dist "core" "packages/core"
53+
copy_package_dist "preload" "apps/preload"
54+
# copy_package_dist "core" "packages/core"
5455
# copy_package_dist "ssr-client" "packages/ssr-client"
5556
copy_package_dist "app" "widgets/app"
56-
57+
# copy_package_dist "types" "packages/types"
58+
5759
echo "Done! All dist folders have been copied to node_modules_build/@slide.code"

0 commit comments

Comments
 (0)