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

feat: Add option to enable Turbopack with create-next-app #65926

Merged
merged 20 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix(CI): some it tests out of describe and added --no-turbo
  • Loading branch information
devjiwonchoi committed May 18, 2024
commit b86c5dc0420231098333c900bcf2c371e31e6f75
2 changes: 1 addition & 1 deletion packages/create-next-app/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ async function run(): Promise<void> {
}
}

if (!program.turbo) {
if (!program.turbo && !process.argv.includes('--no-turbo')) {
if (ciInfo.isCI) {
program.turbo = getPrefOrDefault('turbo')
} else {
Expand Down
2 changes: 2 additions & 0 deletions test/integration/create-next-app/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ describe.skip('create-next-app', () => {
projectName,
'--ts',
'--app',
'--no-turbo',
'--no-eslint',
'--no-tailwind',
'--no-src-dir',
Expand Down Expand Up @@ -99,6 +100,7 @@ describe.skip('create-next-app', () => {
projectName,
'--ts',
'--app',
'--no-turbo',
'--no-eslint',
'--no-tailwind',
'--no-src-dir',
Expand Down
114 changes: 58 additions & 56 deletions test/integration/create-next-app/package-manager/bun.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ describe.skip('create-next-app with package manager bun', () => {
'--ts',
'--app',
'--use-bun',
'--no-turbo',
'--no-eslint',
'--no-src-dir',
'--no-tailwind',
Expand All @@ -55,72 +56,73 @@ describe.skip('create-next-app with package manager bun', () => {
})
})
})
})

it('should use bun when user-agent is bun', async () => {
await useTempDir(async (cwd) => {
const projectName = 'user-agent-bun'
const res = await run(
[
projectName,
'--ts',
'--app',
'--no-eslint',
'--no-src-dir',
'--no-tailwind',
'--no-import-alias',
],
nextInstall.installDir,
{
cwd,
env: { npm_config_user_agent: 'bun' },
}
)
it('should use bun when user-agent is bun', async () => {
await useTempDir(async (cwd) => {
const projectName = 'user-agent-bun'
const res = await run(
[
projectName,
'--ts',
'--app',
'--no-turbo',
'--no-eslint',
'--no-src-dir',
'--no-tailwind',
'--no-import-alias',
],
nextInstall.installDir,
{
cwd,
env: { npm_config_user_agent: 'bun' },
}
)

expect(res.exitCode).toBe(0)
projectFilesShouldExist({
cwd,
projectName,
files,
expect(res.exitCode).toBe(0)
projectFilesShouldExist({
cwd,
projectName,
files,
})
})
})
})

it('should use bun for --use-bun flag with example', async () => {
await useTempDir(async (cwd) => {
const projectName = 'use-bun-with-example'
const res = await run(
[projectName, '--use-bun', '--example', FULL_EXAMPLE_PATH],
nextInstall.installDir,
{ cwd }
)
it('should use bun for --use-bun flag with example', async () => {
await useTempDir(async (cwd) => {
const projectName = 'use-bun-with-example'
const res = await run(
[projectName, '--use-bun', '--example', FULL_EXAMPLE_PATH],
nextInstall.installDir,
{ cwd }
)

expect(res.exitCode).toBe(0)
projectFilesShouldExist({
cwd,
projectName,
files,
expect(res.exitCode).toBe(0)
projectFilesShouldExist({
cwd,
projectName,
files,
})
})
})
})

it('should use bun when user-agent is bun with example', async () => {
await useTempDir(async (cwd) => {
const projectName = 'user-agent-bun-with-example'
const res = await run(
[projectName, '--example', FULL_EXAMPLE_PATH],
nextInstall.installDir,
{
cwd,
env: { npm_config_user_agent: 'bun' },
}
)
it('should use bun when user-agent is bun with example', async () => {
await useTempDir(async (cwd) => {
const projectName = 'user-agent-bun-with-example'
const res = await run(
[projectName, '--example', FULL_EXAMPLE_PATH],
nextInstall.installDir,
{
cwd,
env: { npm_config_user_agent: 'bun' },
}
)

expect(res.exitCode).toBe(0)
projectFilesShouldExist({
cwd,
projectName,
files,
expect(res.exitCode).toBe(0)
projectFilesShouldExist({
cwd,
projectName,
files,
})
})
})
})
2 changes: 2 additions & 0 deletions test/integration/create-next-app/package-manager/npm.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ describe.skip('create-next-app with package manager npm', () => {
'--ts',
'--app',
'--use-npm',
'--no-turbo',
'--no-eslint',
'--no-src-dir',
'--no-tailwind',
Expand Down Expand Up @@ -58,6 +59,7 @@ it('should use npm when user-agent is npm', async () => {
projectName,
'--ts',
'--app',
'--no-turbo',
'--no-eslint',
'--no-src-dir',
'--no-tailwind',
Expand Down
114 changes: 58 additions & 56 deletions test/integration/create-next-app/package-manager/pnpm.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ describe.skip('create-next-app with package manager pnpm', () => {
'--ts',
'--app',
'--use-pnpm',
'--no-turbo',
'--no-eslint',
'--no-src-dir',
'--no-tailwind',
Expand All @@ -56,72 +57,73 @@ describe.skip('create-next-app with package manager pnpm', () => {
})
})
})
})

it('should use pnpm when user-agent is pnpm', async () => {
await useTempDir(async (cwd) => {
const projectName = 'user-agent-pnpm'
const res = await run(
[
projectName,
'--ts',
'--app',
'--no-eslint',
'--no-src-dir',
'--no-tailwind',
'--no-import-alias',
],
nextInstall.installDir,
{
cwd,
env: { npm_config_user_agent: 'pnpm' },
}
)
it('should use pnpm when user-agent is pnpm', async () => {
await useTempDir(async (cwd) => {
const projectName = 'user-agent-pnpm'
const res = await run(
[
projectName,
'--ts',
'--app',
'--no-turbo',
'--no-eslint',
'--no-src-dir',
'--no-tailwind',
'--no-import-alias',
],
nextInstall.installDir,
{
cwd,
env: { npm_config_user_agent: 'pnpm' },
}
)

expect(res.exitCode).toBe(0)
projectFilesShouldExist({
cwd,
projectName,
files,
expect(res.exitCode).toBe(0)
projectFilesShouldExist({
cwd,
projectName,
files,
})
})
})
})

it('should use pnpm for --use-pnpm flag with example', async () => {
await useTempDir(async (cwd) => {
const projectName = 'use-pnpm-with-example'
const res = await run(
[projectName, '--use-pnpm', '--example', FULL_EXAMPLE_PATH],
nextInstall.installDir,
{ cwd }
)
it('should use pnpm for --use-pnpm flag with example', async () => {
await useTempDir(async (cwd) => {
const projectName = 'use-pnpm-with-example'
const res = await run(
[projectName, '--use-pnpm', '--example', FULL_EXAMPLE_PATH],
nextInstall.installDir,
{ cwd }
)

expect(res.exitCode).toBe(0)
projectFilesShouldExist({
cwd,
projectName,
files,
expect(res.exitCode).toBe(0)
projectFilesShouldExist({
cwd,
projectName,
files,
})
})
})
})

it('should use pnpm when user-agent is pnpm with example', async () => {
await useTempDir(async (cwd) => {
const projectName = 'user-agent-pnpm-with-example'
const res = await run(
[projectName, '--example', FULL_EXAMPLE_PATH],
nextInstall.installDir,
{
cwd,
env: { npm_config_user_agent: 'pnpm' },
}
)
it('should use pnpm when user-agent is pnpm with example', async () => {
await useTempDir(async (cwd) => {
const projectName = 'user-agent-pnpm-with-example'
const res = await run(
[projectName, '--example', FULL_EXAMPLE_PATH],
nextInstall.installDir,
{
cwd,
env: { npm_config_user_agent: 'pnpm' },
}
)

expect(res.exitCode).toBe(0)
projectFilesShouldExist({
cwd,
projectName,
files,
expect(res.exitCode).toBe(0)
projectFilesShouldExist({
cwd,
projectName,
files,
})
})
})
})
Loading