You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Further, you can negate default options by prefixing them with --no- (e.g., --no-eslint).
When I tried to use --no-import-alias, I thought that it would automatically use the default alias (@/*), but it does not.
Why?
Each option has --no prefix control but import-alias has no --no prefix control to give default value to program.
In an Interactive approach, the user can select a prompt; Would you like to customize the default import alias (@/*)? No / Yes. If the user selects no, then the default alias is applied with @/*.
How?
Implementing a condition solve the problem for general purpose. If arguments includes --no-import-alias then the importAlias section automatically apply the default value.
The reason will be displayed to describe this comment to others. Learn more.
Currently our non-interactive tests specify the --import-alias="@/*" arg but this seems like a good alternative so the default doesn't need to be known. Could you update one of the tests doing the previous behavior with this instead?
...
[TEST] $ /Users/kuzeykose/Developer/next.js/packages/create-next-app/dist/index.js javascript-test --js --no-tailwind --eslint --src-dir --no-app --no-import-alias {
options: {
cwd: '/var/folders/gf/ywpfzlgs0fvdjjy7p33c756w0000gn/T/next-test-cdnymn938t'
}
}
at log (integration/create-next-app/lib/utils.ts:33:11)
▲ Next.js 14.1.1-canary.54
- Local: http://localhost:62608
✓ Ready in 2.5s
○ Compiling / ...
✓ Compiled / in 1020ms (291 modules)
✓ Compiled /api/hello in 26ms (82 modules)
▲ Next.js 14.1.1-canary.54
- Local: http://localhost:62621
✓ Ready in 1028ms
○ Compiling / ...
✓ Compiled / in 918ms (291 modules)
✓ Compiled /api/hello in 26ms (82 modules)
...
PASS test/integration/create-next-app/templates-pages.test.ts (77.905 s)
create-next-app templates
✓ should prompt user to choose if --ts or --js is not provided (7521 ms)
✓ should create TS projects with --ts, --typescript (13703 ms)
✓ should create TS projects with --ts, --typescript --src-dir (12984 ms)
✓ should create JS projects with --js, --javascript (12977 ms)
✓ should create JS projects with --js, --javascript --src-dir (12707 ms)
✓ should prompt user to choose if --import-alias is not provided (7058 ms)
✓ should work with --tailwind and --src together (4413 ms)
✓ should prompt user to choose if --tailwind or --no-tailwind is not provided (6145 ms)
Test Suites: 1 passed, 1 total
Tests: 8 passed, 8 total
Snapshots: 1 passed, 1 total
Time: 77.936 s
for app:
...
[TEST] $ /Users/kuzeykose/Developer/next.js/packages/create-next-app/dist/index.js appdir-test --js --no-tailwind --app --eslint --src-dir --no-import-alias {
options: {
cwd: '/var/folders/gf/ywpfzlgs0fvdjjy7p33c756w0000gn/T/next-test-ic7b511dvtq',
stdio: 'inherit'
}
}
at log (integration/create-next-app/lib/utils.ts:33:11)
RUNS test/integration/create-next-app/templates-app.test.ts
Creating a new Next.js app in /private/var/folders/gf/ywpfzlgs0fvdjjy7p33c756w0000gn/T/next-test-ic7b511dvtq/appdir-test.
Using pnpm.
Initializing project with template: app
Installing dependencies:
- react
- react-dom
- next
Installing devDependencies:
- eslint
- eslint-config-next
RUNS test/integration/create-next-app/templates-app.test.ts
Packages: +294
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
RUNS test/integration/create-next-app/templates-app.test.ts
dependencies:
+ next 14.1.1-canary.54
+ react 18.2.0
+ react-dom 18.2.0
devDependencies:
+ eslint 8.56.0
+ eslint-config-next 14.1.1-canary.54
Done in 5.3s
Initialized a git repository.
Success! Created appdir-test at /private/var/folders/gf/ywpfzlgs0fvdjjy7p33c756w0000gn/T/next-test-ic7b511dvtq/appdir ▲ Next.js 14.1.1-canary.54
- Local: http://localhost:62779
✓ Ready in 2.5s
○ Compiling / ...
✓ Compiled / in 1576ms (519 modules)
▲ Next.js 14.1.1-canary.54
- Local: http://localhost:62791
✓ Ready in 1115ms
○ Compiling / ...
✓ Compiled / in 1280ms (519 modules)
...
PASS test/integration/create-next-app/templates-app.test.ts (55.119 s)
create-next-app --app
✓ should create TS appDir projects with --ts (13864 ms)
✓ should create JS appDir projects with --js (13455 ms)
✓ should create JS appDir projects with --js --src-dir (13556 ms)
✓ should create Tailwind CSS appDir projects with --tailwind (13907 ms)
Test Suites: 1 passed, 1 total
Tests: 4 passed, 4 total
Snapshots: 0 total
Time: 55.144 s, estimated 58 s
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
CI approvedApprove running CI for forkcreate-next-appRelated to our CLI tool for quickly starting a new Next.js application.locked
3 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
The create-next-app documentation under API reference says that;
When I tried to use --no-import-alias, I thought that it would automatically use the default alias (@/*), but it does not.
Why?
Each option has --no prefix control but import-alias has no --no prefix control to give default value to program.
In an Interactive approach, the user can select a prompt;
Would you like to customize the default import alias (@/*)? No / Yes.
If the user selects no, then the default alias is applied with @/*.How?
Implementing a condition solve the problem for general purpose. If arguments includes
--no-import-alias
then the importAlias section automatically apply the default value.