Skip to content

Add rename script for my-element component#5306

Open
Jah-yee wants to merge 2 commits into
lit:mainfrom
Jah-yee:add/rename-script-for-my-element
Open

Add rename script for my-element component#5306
Jah-yee wants to merge 2 commits into
lit:mainfrom
Jah-yee:add/rename-script-for-my-element

Conversation

@Jah-yee

@Jah-yee Jah-yee commented Apr 18, 2026

Copy link
Copy Markdown

Good day

This PR adds a scripts/rename.js script that helps users rename the my-element component to a custom name, addressing issue #2619.

Changes

  • scripts/rename.js: New script that automates the renaming process
  • package.json: Added rename script command and updated clean script for flexibility
  • README.md: Added documentation on how to use the rename script

How it works

The rename script performs the following steps:

  1. Validates the new name (must start with lowercase letter, contain only lowercase letters, numbers, and hyphens)
  2. Performs a project-wide find and replace of my-element with the new name
  3. Renames src/my-element.ts to src/<new-name>.ts
  4. Renames src/test/my-element_test.ts to src/test/<new-name>_test.ts
  5. Updates references in index.html and package.json

Usage

Testing

  • Verified the script syntax is correct with node --check scripts/rename.js
  • The script handles validation errors gracefully

Thank you for your attention. If there are any issues or suggestions, please leave a comment and I will address them promptly.

Warmly,
RoomWithOutRoof

This adds a scripts/rename.js script that helps users rename the my-element
component to a custom name. The script:

1. Performs a project-wide find and replace of 'my-element' with the new name
2. Renames src/my-element.ts to src/<new-name>.ts
3. Renames src/test/my-element_test.ts to src/test/<new-name>_test.ts
4. Updates references in index.html and package.json

The README has been updated with instructions on how to use the script.

Fixes lit#2619
@Jah-yee Jah-yee requested a review from kevinpschaaf as a code owner April 18, 2026 12:27
@changeset-bot

changeset-bot Bot commented Apr 18, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c6f66ef

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@lit/lit-starter-ts Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

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.

1 participant