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

fix: Comment out unused import line in seed script template #11171

Merged
merged 3 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion __fixtures__/test-project/scripts/seed.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { db } from 'api/src/lib/db'

// Manually apply seeds via the `yarn rw prisma db seed` command.
Expand Down
2 changes: 1 addition & 1 deletion __fixtures__/test-project/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
"postcss": "^8.4.41",
"postcss-loader": "^8.1.1",
"prettier-plugin-tailwindcss": "^0.5.12",
"tailwindcss": "^3.4.7"
"tailwindcss": "^3.4.9"
}
}
3 changes: 1 addition & 2 deletions packages/create-redwood-app/templates/js/scripts/seed.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// eslint-disable-next-line no-unused-vars
import { db } from 'api/src/lib/db'
// import { db } from 'api/src/lib/db'

// Manually apply seeds via the `yarn rw prisma db seed` command.
//
Expand Down
3 changes: 1 addition & 2 deletions packages/create-redwood-app/templates/ts/scripts/seed.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { db } from 'api/src/lib/db'
// import { db } from 'api/src/lib/db'

// Manually apply seeds via the `yarn rw prisma db seed` command.
//
Expand Down
10 changes: 9 additions & 1 deletion tasks/test-project/codemods/seed.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,13 @@ export default (file, api) => {
const j = api.jscodeshift
const root = j(file.source)

return root.find(j.TryStatement).insertBefore(createPosts).toSource()
let newSource = root.find(j.TryStatement).insertBefore(createPosts).toSource()

// Uncomment the db import line
newSource = newSource.replace(
"// import { db } from 'api/src/lib/db'",
"import { db } from 'api/src/lib/db'",
)

return newSource
}
Loading