Skip to content

Commit

Permalink
fix: add types to standaloneMigrations
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Krick <matt.krick@gmail.com>
  • Loading branch information
mattkrick committed Oct 25, 2024
1 parent 2c49dce commit 71f2677
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/gql-executor/modules.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
import '../server/types/modules'
import '../server/types/webpackEnv'
import '../server/types/webpackEnv.d'
2 changes: 1 addition & 1 deletion packages/server/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default [
...base,
{
ignores: [
'types/webpackEnv.ts',
'types/webpackEnv.d.ts',
'postgres/migrations',
'**/generated/',
'**/*/githubTypes.ts',
Expand Down
File renamed without changes.
10 changes: 4 additions & 6 deletions scripts/toolboxSrc/standaloneMigrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {Migrator} from 'kysely'
import path from 'path'
import {migrations} from '../../.config/kyselyMigrations'
import getKysely from '../../packages/server/postgres/getKysely'
import '../../packages/server/types/webpackEnv.d'
import '../webpack/utils/dotenv'
import pgEnsureExtensions from './pgEnsureExtensions'

Expand All @@ -14,13 +15,10 @@ const migratePG = async () => {
// pgm uses a dynamic require statement, which doesn't work with webpack
// if we ignore that dynamic require, we'd still have to include the migrations directory AND any dependencies it might have
// by processing through webpack's require.context, we let webpack handle everything
const context = (require as any).context(
'../../packages/server/postgres/migrations',
false,
/.ts$/
)
const context = require.context('../../packages/server/postgres/migrations', false, /.ts$/)
const collector: Record<string, any> = {}
context.keys().forEach((relativePath: any) => {
const migrationPaths = context.keys()
migrationPaths.forEach((relativePath) => {
const {name} = path.parse(relativePath)
collector[name] = context(relativePath)
})
Expand Down

0 comments on commit 71f2677

Please sign in to comment.