-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
Hi!
I have an electron/drizzle app with the following config:
drizzle.config.ts
import type { Config } from 'drizzle-kit'
import { DatabaseConfig } from './src/libs/config'
export default {
schema: './database/schema.ts',
out: './database/migrations',
driver: 'better-sqlite',
dbCredentials: {
url: DatabaseConfig.databaseName
},
verbose: true,
strict: true
} satisfies Config
config.ts
import path from 'path'
import { app } from 'electron'
import { is } from '@electron-toolkit/utils'
const databaseFileName = 'database.db'
export const defaultDatabaseName =
!app || is.dev ? databaseFileName : path.join(app.getPath('userData'), databaseFileName)
export const databaseName = process.env.VITE_DATABASE_NAME || defaultDatabaseName
export const DatabaseConfig = {
databaseName: databaseName
}
When I run drizzle:generate
I get the following error:
/home/<user>/.nvm/versions/node/v21.7.1/bin/npm run drizzle:generate
> <project>@1.0.0-alpha20 drizzle:generate
> drizzle-kit generate:sqlite
drizzle-kit: v0.20.14
drizzle-orm: v0.30.6
No config path provided, using default 'drizzle.config.ts'
Reading config file '/home/<user>/path/to/<project>/drizzle.config.ts'
/home/<user>/path/to/<project>/node_modules/@electron-toolkit/utils/dist/index.cjs:6
dev: !electron.app.isPackaged
^
TypeError: Cannot read properties of undefined (reading 'isPackaged')
at Object.<anonymous> (/home/<user>/path/to/<project>/node_modules/@electron-toolkit/utils/dist/index.cjs:6:22)
at Module._compile (node:internal/modules/cjs/loader:1368:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1426:10)
at Object.newLoader (/home/<user>/path/to/<project>/node_modules/drizzle-kit/bin.cjs:8648:13)
at extensions..js (/home/<user>/path/to/<project>/node_modules/drizzle-kit/bin.cjs:11176:28)
at Module.load (node:internal/modules/cjs/loader:1205:32)
at Module._load (node:internal/modules/cjs/loader:1021:12)
at Module.require (node:internal/modules/cjs/loader:1230:19)
at require (node:internal/modules/helpers:179:18)
at Object.<anonymous> (/home/<user>/path/to/<project>/src/libs/config.ts:3:20)
Node.js v21.7.1
Process finished with exit code 1
I created PR #12 as a possible solution.
Any thoughts?
Electron-Toolkit Version
3.0.0
Electron Version
28.2.0
Validations
- Follow the Code of Conduct.
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working