Skip to content

npm run publish Doesn't Properly Handle Moved/Deleted Files and Causes Workflow Issues #16142

@lachiejames

Description

@lachiejames

Description

When using npm run publish to update my extension #15992, I encountered a series of problems stemming from how the command handled moved or deleted files. Specifically, when I moved some image files from one folder to another and ran the publish command, it only added the new files to the updated folder but failed to remove the original files from their previous location. This led to duplicate images appearing in my pull request (PR)—one set in the original folder and one set in the new folder.

This issue caused unexpected behaviors and confusion in subsequent attempts to publish updates, including:

  • PRs not reflecting changes accurately (e.g., deleted files still appearing in the PR).
  • Deleting the local fork in the .config/raycast/public-extensions-fork directory and rerunning the npm run publish command created a new, separate pull request Add elevenlabs-tts extension #16140 instead of updating the existing one.

npm run publish fails, claiming new contributions are available, which is expected because a new commit was added by a contributor here.

> elevenlabs-tts@1.0.0 publish
> npx @raycast/api@latest publish

wait  - validate package.json file ..  /Users/lachiejames/dev/misc/raycast/raycast-elevenlabs-tts/package.json
...
error  - checking for new contributions
some contributions are available. Pull them using `npx @raycast/api@latest pull-contributions`

npx @raycast/api@latest pull-contributions fails with this git error

ready  - getting fork
ready  - preparing clone
error  - pulling new contributions
failed running git Command failed: git pull origin ext/elevenlabs-tts --ff-only
From https://github.com/lachiejames/raycast-extensions
 * branch                ext/elevenlabs-tts -> FETCH_HEAD
fatal: Not possible to fast-forward, aborting.

For reference, here are the related commits:

Steps To Reproduce

  1. Create an extension that includes image assets in a folder (e.g., assets/).
  2. Run npm run publish to create the PR
  3. Move the images to a new folder (e.g., images/) locally.
  4. Run npm run publish to update the PR.
  5. Observe that the PR now includes the new files in images/ but does not remove the original files from assets/, causing duplicates.

Current Behaviour

  • When files (e.g., images) are moved from one folder to another and npm run publish is run:
    • The new files are added to the PR in their updated location.
    • The original files are not removed from the PR, causing duplicates (one set in the old location and one set in the new location).
  • Deleting the local .config/raycast/public-extensions-fork folder and rerunning npm run publish:
    • Does not recover or fix the original PR but instead creates an entirely new PR.
    • Leaves the previous PR in a partially updated, inconsistent state.
  • Attempts to manually fix the PR or mirror changes made by others in the PR history do not always resolve the issue due to the underlying mismatch in file management between local changes and the PR.

Expected Behaviour

  • When files are moved or deleted in the extension repository:
    • The publish command should properly detect and reflect these changes in the PR.
    • Files removed from the original location should be deleted from the PR, and files added to a new location should be the only changes reflected.
  • Deleting the local .config/raycast/public-extensions-fork folder and rerunning npm run publish should:
    • Update the existing PR, not create a new one.
    • Ensure consistent behavior regardless of whether a local fork exists, preserving the PR's integrity.
  • The publish workflow should have a reliable, predictable process for managing moved or deleted files, ensuring the PR accurately represents local changes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdev toolsDev tools (CLI, Manage Extensions, npm, etc)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions