Skip to content

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

Closed

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.

> [email protected] 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.

Activity

  1. added
    bug
    dev tools
    on Jan 3, 2025
  2. Lermatroid commented on Feb 15, 2025

    @Lermatroid
    Contributor

    I am having this issue as well. Did you ever find a fix?

  3. lachiejames commented on Feb 16, 2025

    @lachiejames
    ContributorAuthor

    I am having this issue as well. Did you ever find a fix?

    @Lermatroid I deleted the raycast/extensions fork from my personal Github, then ran the command again, and it rebuilt the PR from scratch with 0 contributors. More of a workaround than a fix.

  4. lachiejames commented on Feb 16, 2025

    @lachiejames
    ContributorAuthor

    Oops didn't mean to mark as 'closed' when replying 😅

  5. Lermatroid commented on Feb 17, 2025

    @Lermatroid
    Contributor

    Yeah that is unfortunate, I have a PR in the middle of review and don't want to reset it since it has already had some feedback given.

  6. Patrick-web commented on Feb 28, 2025

    @Patrick-web
    Contributor

    Yeah that is unfortunate, I have a PR in the middle of review and don't want to reset it since it has already had some feedback given.

    same

  7. mechelon commented on Mar 1, 2025

    @mechelon
    Contributor

    I'm running into the same problem. My fork is up to date, all done, still can't publish. :(

    ~/Dev/raycast-sink/raycast-extensions/extensions/can-i-php ext/can-i-php
    ❯ npx ray publish
    wait  - validate package.json file ..
    ready  - validate package.json file
    ready  - validate package-lock.json
    ready  - validate other lock files
    ready  - validate extension icons
    ready  - validate extension metadata
    ready  - run ESLint
    ready  - run Prettier 3.2.5
    ready  - getting fork
    ready  - preparing clone
    error  - checking for new contributions
    some contributions are available. Pull them using `npx @raycast/api@latest pull-contributions`
    
    ~/Dev/raycast-sink/raycast-extensions/extensions/can-i-php ext/can-i-php
    ❯ npx @raycast/api@latest pull-contributions
    ready  - getting fork
    ready  - preparing clone
    error  - pulling new contributions
    failed running git Command failed: git pull origin ext/can-i-php --ff-only
    From https://github.com/mechelon/raycast-extensions
     * branch                ext/can-i-php -> FETCH_HEAD
    fatal: Not possible to fast-forward, aborting.
    
    
    From https://github.com/mechelon/raycast-extensions
     * branch                ext/can-i-php -> FETCH_HEAD
    fatal: Not possible to fast-forward, aborting.
    

    The only workaround I found was delete my fork from my GH account, fork my extension via the Raycast UI and apply the changes. That's fine for small stuff, but still. 😅

  8. mathieudutour commented on Oct 31, 2025

    @mathieudutour
    Member

    That should be fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugdev tools

    Type

    No type

    Fields

    Priority

    None yet

    Severity

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions