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

Update script not working on Windows #389

Closed
rise-above-the-machines opened this issue Jan 6, 2025 · 10 comments
Closed

Update script not working on Windows #389

rise-above-the-machines opened this issue Jan 6, 2025 · 10 comments
Labels
bug Something isn't working

Comments

@rise-above-the-machines
Copy link

Describe the bug
The update script is failing

next-forge version
I am using version 2.21.11

To Reproduce
Steps to reproduce the behavior:

  1. Windows 11, VSCode Terminal, PS C:\Users\16478\Documents\my-apps\winnerr>
    Running: npx next-forge@latest update --from 2.21.11 --to 3.0.14

Expected behavior
[Log]
Preparing to update from v2.21.11 to v3.0.14...
Creating temporary directory...
Cloning next-forge...
Checking out version v2.21.11...
Checking out version v3.0.14...
Computing diff between versions...
fatal: Invalid path '/.github': No such file or directory
Failed to update project: Command failed: git diff v2.21.11 v3.0.14 -- .github/CODE_OF_CONDUCT.md
fatal: Invalid path '/.github': No such file or directory

I have a hidden .git folder but no .github
So I
PS C:\Users\16478\Documents\my-apps\winnerr> mkdir .github

Directory: C:\Users\16478\Documents\my-apps\winnerr

Mode LastWriteTime Length Name


d----- 2025-01-06 11:22 AM .github

PS C:\Users\16478\Documents\my-apps\winnerr> npx next-forge@latest update --from 2.21.11 --to 3.0.14
Preparing to update from v2.21.11 to v3.0.14...
Creating temporary directory...
Cloning next-forge...
Checking out version v2.21.11...
Checking out version v3.0.14...
Computing diff between versions...
fatal: Invalid path '/.github': No such file or directory
Failed to update project: Command failed: git diff v2.21.11 v3.0.14 -- .github/CODE_OF_CONDUCT.md
fatal: Invalid path '/.github': No such file or directory

PS C:\Users\16478\Documents\my-apps\winnerr> cd .github

touch CODE_OF_CONDUCT.md
touch CONTRIBUTING.md
touch SECURITY.md
mkdir ISSUE_TEMPLATE
mkdir workflows
touch : The term 'touch' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the
name, or if a path was included, verify that the path is correct and try again.
At line:2 char:1

  • touch CODE_OF_CONDUCT.md
  •   + CategoryInfo          : ObjectNotFound: (touch:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    
    

touch : The term 'touch' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the
name, or if a path was included, verify that the path is correct and try again.
At line:3 char:1

  • touch CONTRIBUTING.md
  •   + CategoryInfo          : ObjectNotFound: (touch:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    
    

touch : The term 'touch' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the
name, or if a path was included, verify that the path is correct and try again.
At line:4 char:1

  • touch SECURITY.md
  •   + CategoryInfo          : ObjectNotFound: (touch:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    
    
    
      Directory: C:\Users\16478\Documents\my-apps\winnerr\.github
    
    
    

Mode LastWriteTime Length Name


d----- 2025-01-06 11:23 AM ISSUE_TEMPLATE
d----- 2025-01-06 11:23 AM workflows

PS C:\Users\16478\Documents\my-apps\winnerr.github> ni CODE_OF_CONDUCT.md

ni CONTRIBUTING.md
ni SECURITY.md

Directory: C:\Users\16478\Documents\my-apps\winnerr\.github

Mode LastWriteTime Length Name


-a---- 2025-01-06 11:23 AM 0 CODE_OF_CONDUCT.md
-a---- 2025-01-06 11:23 AM 0 CONTRIBUTING.md
-a---- 2025-01-06 11:23 AM 0 SECURITY.md

PS C:\Users\16478\Documents\my-apps\winnerr.github> npx next-forge@latest update --from 2.21.11 --to 3.0.14
Preparing to update from v2.21.11 to v3.0.14...
Creating temporary directory...
Cloning next-forge...
Checking out version v2.21.11...
Checking out version v3.0.14...
Computing diff between versions...
fatal: Invalid path '/.github': No such file or directory
Failed to update project: Command failed: git diff v2.21.11 v3.0.14 -- .github/CODE_OF_CONDUCT.md
fatal: Invalid path '/.github': No such file or directory

PS C:\Users\16478\Documents\my-apps\winnerr.github>

@rise-above-the-machines rise-above-the-machines added the bug Something isn't working label Jan 6, 2025
@rise-above-the-machines rise-above-the-machines changed the title PS C:\Users\16478\Documents\my-apps\winnerr> npx next-forge@latest update --from 2.21.11 --to 3.0.14 Preparing to update from v2.21.11 to v3.0.14... Creating temporary directory... Cloning next-forge... Checking out version v2.21.11... Checking out version v3.0.14... Computing diff between versions... fatal: Invalid path '/.github': No such file or directory Failed to update project: Command failed: git diff v2.21.11 v3.0.14 -- \.github/CODE_OF_CONDUCT\.md fatal: Invalid path '/.github': No such file or directory Update script not working Jan 6, 2025
@haydenbleasel
Copy link
Owner

Hey @rise-above-the-machines thanks for reporting! I think it's due to the windows pathing schema. I assumed /.github but on Windows it's \.github. I'll have to rework the script to take this into account.

@haydenbleasel
Copy link
Owner

haydenbleasel commented Jan 6, 2025

Fixed it locally, just installing a Windows VM to verify.

@rise-above-the-machines
Copy link
Author

rise-above-the-machines commented Jan 6, 2025

My pleasure and THANK YOU! Please let em know if there's anything I can do to help.

@rise-above-the-machines
Copy link
Author

rise-above-the-machines commented Jan 9, 2025

Hey @rise-above-the-machines thanks for reporting! I think it's due to the windows pathing schema. I assumed /.github but on Windows it's \.github. I'll have to rework the script to take this into account.

Btw im pushing to github and have /.git , whats /.github and should I create it manually or what?


one side question, in the docs https://docs.next-forge.com/migrations/documentation/fumadocs#search
it says
Search
app/api/search/route.ts contains the Route Handler for search, it is powered by Orama by default.

I cant find this anywhere int he app. Is this an old doc or is ORama still in here? Im wondering how to add advanced search and if Orama is in the structure. Any info is appricaited <3

@haydenbleasel haydenbleasel changed the title Update script not working Update script not working on Windows Jan 9, 2025
haydenbleasel added a commit that referenced this issue Jan 9, 2025
@haydenbleasel
Copy link
Owner

@rise-above-the-machines I've pushed an update that uses Node's path.join instead of assuming /, would you be able to try it out?

@rise-above-the-machines
Copy link
Author

rise-above-the-machines commented Jan 10, 2025

Thanks for your feedback.

I tried but no luck :)

PS C:\Users\16478\Documents\my-apps\next-forge-3> npx next-forge@latest update --from 2.21.11 --to 3.0.19
Need to install the following packages:
[email protected]
Ok to proceed? (y) y

Preparing to update from v2.21.11 to v3.0.19...
Creating temporary directory...
Cloning next-forge...
Checking out version v2.21.11...
Checking out version v3.0.19...
Computing diff between versions...
fatal: Invalid path '/.github': No such file or directory
Failed to update project: Command failed: git diff v2.21.11 v3.0.19 -- .github/CODE_OF_CONDUCT.md
fatal: Invalid path '/.github': No such file or directory

So then I tried copying the .github folder from next-forge-update to my apps root folder and running the command again:
PS C:\Users\16478\Documents\my-apps\next-forge-3> npx next-forge@latest update --from 2.21.11 --to 3.0.19
Preparing to update from v2.21.11 to v3.0.19...
Creating temporary directory...
Cloning next-forge...
Checking out version v2.21.11...
Checking out version v3.0.19...
Computing diff between versions...
fatal: Invalid path '/.github': No such file or directory
Failed to update project: Command failed: git diff v2.21.11 v3.0.19 -- .github/CODE_OF_CONDUCT.md
fatal: Invalid path '/.github': No such file or directory

I'm always pushing to github, but just incase, tried git init to have initialize one if needed.
*Note: in my C:\Users\16478\Documents\my-apps\next-forge-3 , i have a .git folder (it's hidden folder). Perhaps on your system it looks for .github but on windows it's .git ?
Cause I cant figure a way to initaite github in windows and create a .github except manual.

PS C:\Users\16478\Documents\my-apps\next-forge-3> npx next-forge@latest update --from 2.21.11 --to 3.0.19
Preparing to update from v2.21.11 to v3.0.19...
Creating temporary directory...
Cloning next-forge...
Checking out version v2.21.11...
Checking out version v3.0.19...
Computing diff between versions...
fatal: Invalid path '/.github': No such file or directory
Failed to update project: Command failed: git diff v2.21.11 v3.0.19 -- .github/CODE_OF_CONDUCT.md
fatal: Invalid path '/.github': No such file or directory

PS C:\Users\16478\Documents\my-apps\next-forge-3>

@Ale1x
Copy link

Ale1x commented Jan 11, 2025

Getting the same error.
Next-forge version: 3.0.9
want to update to latest

@haydenbleasel
Copy link
Owner

Quick update: it's got to do with how I'm parsing the filenames.

Currently it's comparing .github/CODE_OF_CONDUCT.md or \.github/CODE_OF_CONDUCT\.md

Should be .\.github\CODE_OF_CONDUCT.md

haydenbleasel added a commit that referenced this issue Jan 12, 2025
@haydenbleasel
Copy link
Owner

@Ale1x @rise-above-the-machines Issue is fixed! Simplifying the cleanFileName function did the trick. Just tried it on my Windows VM and it worked like a charm.

@winnerr-ca
Copy link

Thank you ! I managed to make it work by creating an .md file, but it wasn’t entirely smooth sailing. Some files in my project were "reset," which I understand might be normal during the process. For example the sidebar.

Could you please update the guide with more detailed instructions on how to transfer without losing or resetting existing files? This would be incredibly helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants