Skip to content

Commit

Permalink
Minimal codemod fixes (#3715)
Browse files Browse the repository at this point in the history
* fix removing trailing comma when removing BlitzConfig from next.config.js during codemod

* fix codemod for consolidating pages
  • Loading branch information
Dillon Raphael authored Aug 12, 2022
1 parent 8b9ad3f commit f88702c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 21 deletions.
5 changes: 5 additions & 0 deletions .changeset/lovely-berries-sell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@blitzjs/codemod": patch
---

Remove trailing comma when removing BlitzConfig from next.config.js & Fix codemod so if route (eg. `app/auth/pages`) convert to (eg. `pages/`) instead of (eg. `pages/auth`)
5 changes: 3 additions & 2 deletions packages/codemod/src/upgrade-legacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const upgradeLegacy = async () => {
}

if (c.name === "imported") {
j(c).remove()
j(c.parentPath).remove()
}
})
}
Expand Down Expand Up @@ -625,7 +625,7 @@ const upgradeLegacy = async () => {
}
} else {
arr.push({
model: file,
model: "",
path: dirPath + "/" + file + "/pages",
})
break
Expand Down Expand Up @@ -659,6 +659,7 @@ const upgradeLegacy = async () => {
// If the directory exists without a sub model (sub page directory), loop through the directory manually move each file/directory
if (fs.existsSync(path.join(path.resolve("pages"), pages.model))) {
let subs = fs.readdirSync(pages.path)

subs.forEach((sub) => {
fs.moveSync(
path.join(pages.path, sub),
Expand Down
34 changes: 15 additions & 19 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f88702c

Please sign in to comment.