codemods
codemods copied to clipboard
Script not working in monorepo: `Not a git repository: backend/.git`
We originally used the strapi-starter-gatsby-corporate template to set up our website. This sets up two folders in a single Git repo: backend
(Strapi) and frontend
(Gatsby). Now that I'm trying to upgrade/migrate it to v4, I'm running into the error below, as the script is looking for a .git
folder in the backend
folder, while we only have a .git
folder in the root folder of our project.
Could you please add an option to ignore this check? I can make sure myself that my Git working tree is clean 😉 thanks!
% npx @strapi/codemods migrate:application backend
npx: installed 568 in 40.029s
error: Command failed with exit code 128: git --git-dir=backend/.git --work-tree=backend status --porcelain
fatal: not a git repository: 'backend/.git'
I was able to use codemods for my monorepo in a way that does not make me proud, but it was a small project so the manual work was insignificant
# Copy workspace to a new folder
rsync -av --progress workspace/path/ ../pretend-to-not-be-a-monorepo
# Go to the new folder
cd ../pretend-to-not-be-a-monorepo
# Init fake git repo
git init
git add .
git commit -m 'Initial commit'
# Migrate fake repo
npx @strapi/codemods migrate
Then I used a mix of rsync and git diff
to move the changes back to my monorepo.
It would be good to have this work in a monorepo automatically.
While the work is in progress I did what @ertrzyiks did, but I didn't move it out of the project, I only initialised the git repo inside the ./backend, then once that satisfied the codemods migration, I ran rm -rf ./backend/.git and I was ok to commit to the main repo again.
Why is a code transform script messing with my source control?