Skip to content

fix: refactor migration types to drop glob dependency#886

Merged
ferhatelmas merged 1 commit intomasterfrom
ferhat/glob
Mar 4, 2026
Merged

fix: refactor migration types to drop glob dependency#886
ferhatelmas merged 1 commit intomasterfrom
ferhat/glob

Conversation

@ferhatelmas
Copy link
Member

What kind of change does this PR introduce?

Refactor

What is the current behavior?

Using glob to generate tenant migration types.

What is the new behavior?

Use fs to generate the same file and drop the dependency.

Additional context

Update template to be compatible with lint so that lint formatting doesn't interfere (npm run lint:fix)

Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
@ferhatelmas ferhatelmas requested a review from a team as a code owner March 3, 2026 21:08
@coderabbitai
Copy link

coderabbitai bot commented Mar 3, 2026

📝 Walkthrough

Summary by CodeRabbit

  • Chores
    • Removed unused "glob" package dependency
    • Refactored database migration file discovery mechanism

Walkthrough

This pull request removes the "glob" package and its TypeScript type definitions from dependencies. The migration type generation script is updated to replace glob-based file discovery with direct filesystem directory reading. The updated script reads the migrations/tenant directory, filters for SQL files, sorts by numeric prefix, and generates DBMigration keys conditionally as bare identifiers or quoted strings based on whether filenames are valid JavaScript identifiers.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/scripts/migrations-types.ts`:
- Around line 36-37: The generated key string can be invalid if migration.file
contains quotes or escape characters; update the code that computes key (using
isIdentifier and migration.file in migrations-types.ts) to produce a safely
escaped quoted key when the file is not an identifier (e.g., replace the raw
`'${migration.file}'` interpolation with a proper escaping method such as
JSON.stringify(migration.file) or an equivalent escape routine) so key becomes
either the identifier or a correctly escaped string literal before returning ` 
${key}: ${migration.index},`.

ℹ️ Review info

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Cache: Disabled due to Reviews > Disable Cache setting

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between f1b896b and 1d97426.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (2)
  • package.json
  • src/scripts/migrations-types.ts
💤 Files with no reviewable changes (1)
  • package.json

@ferhatelmas ferhatelmas merged commit f4fa152 into master Mar 4, 2026
2 checks passed
@ferhatelmas ferhatelmas deleted the ferhat/glob branch March 4, 2026 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants