-
Notifications
You must be signed in to change notification settings - Fork 27.5k
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
bug(create-next-app): cli unpacks files it shouldn't from example path #43130
Labels
create-next-app
Related to our CLI tool for quickly starting a new Next.js application.
Comments
11 tasks
Note: the repro no longer works (or fails if you look at it that way) since we renamed the example to not have this conflict, but it should be pretty easy to reproduce on any repo |
balazsorban44
added
create-next-app
Related to our CLI tool for quickly starting a new Next.js application.
kind: bug
and removed
bug
Issue was opened via the bug report template.
labels
Nov 21, 2022
ijjk
pushed a commit
that referenced
this issue
Nov 22, 2022
<!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change that you're making: --> Closes #43130 This fixes the bug where the CLI copies files it shouldn't, by adding a `/` separator at the end of the directory name. Given `examples/next-prisma-starter` and `examples/next-prisma-starter-websockets`, only files inside the `examples/next-prisma-starter` will now be copied. Here is a repo created by the CLI after this fix, using ```bash # Inside packages/create-next-app pnpm build node dist/index.js --example https://github.com/trpc/trpc --example-path examples/next-prisma-starter ``` https://github.com/juliusmarminge/create-next-app-bugfix ## Bug - [x] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have a helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see `contributing.md` ## Documentation / Examples - [x] Make sure the linting passes by running `pnpm build && pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
jankaifer
pushed a commit
to jankaifer/next.js
that referenced
this issue
Nov 23, 2022
<!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change that you're making: --> Closes vercel#43130 This fixes the bug where the CLI copies files it shouldn't, by adding a `/` separator at the end of the directory name. Given `examples/next-prisma-starter` and `examples/next-prisma-starter-websockets`, only files inside the `examples/next-prisma-starter` will now be copied. Here is a repo created by the CLI after this fix, using ```bash # Inside packages/create-next-app pnpm build node dist/index.js --example https://github.com/trpc/trpc --example-path examples/next-prisma-starter ``` https://github.com/juliusmarminge/create-next-app-bugfix ## Bug - [x] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have a helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see `contributing.md` ## Documentation / Examples - [x] Make sure the linting passes by running `pnpm build && pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Verify canary release
Provide environment information
next info
not valid since it's not related to any specific repoWhat browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
Describe the Bug
When using the
--example-path
flag with the CLI,create-next-app
ends up unpacking files it shouldn't.For example, given a repo contains
next-prisma-starter
andnext-prisma-starter-websockets
, runningnpx create-next-app --example https://github.com/trpc/trpc --example-path examples/next-prisma-starter
,create-next-app
would combine the output with all the files matching both these directories, since it will unpack any file whose name starts withexamples/next-prisma-starter
.This is the failing logic:
next.js/packages/create-next-app/helpers/examples.ts
Lines 103 to 106 in ecfd2f4
Expected Behavior
When running
I expect the output repository to be the same as this: https://github.com/trpc/trpc/tree/next/examples/next-prisma-starter
Link to reproduction - Issues with a link to complete (but minimal) reproduction code will be addressed faster
https://github.com/juliusmarminge/create-next-app-bug-repro
To Reproduce
Run
and browse to
src/pages/api/auth
. This file does not exist in the template repo, but is included in the outputted project created by the CLIcomparison:
expected: https://github.com/trpc/trpc/tree/next/examples/next-prisma-starter/src/pages/api
actual: https://github.com/juliusmarminge/create-next-app-bug-repro/tree/main/src/pages/api
The text was updated successfully, but these errors were encountered: