Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix regex issue Update rollup.config.ts #365

Closed

Conversation

ursulabauer
Copy link
Contributor

Description

I noticed a bug in the regex used for transforming package names. The current code attempts to access x[1] in the replacement function, which can be undefined if x is a single character (like - or /). This causes the script to fail.

I’ve fixed it by using x.slice(1) instead, which safely handles single-character cases. Here's the corrected line:

const name = pkg.name.split("/")[1].replace(/[-/]./g, (x: string) => x.slice(1).toUpperCase())  

This change ensures the script works as expected without errors.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have run yarn style without getting any errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Fix regex issue in package name transformation
@cedoor
Copy link
Member

cedoor commented Jan 13, 2025

Hi @ursulabauer, package names in this repo should always follow the following format: @zk-kit/<package-name>. So it's fine if that script fails, as it means that the name is not supported.

@cedoor cedoor closed this Jan 13, 2025
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.

2 participants