Skip to content
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
11 changes: 10 additions & 1 deletion packages/create-next-app/templates/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,16 @@ export const installTemplate = async ({
stats: false,
// We don't want to modify compiler options in [ts/js]config.json
// and none of the files in the .git folder
ignore: ["tsconfig.json", "jsconfig.json", ".git/**/*"],
// TODO: Refactor this to be an allowlist, rather than a denylist,
// to avoid corrupting files that weren't intended to be replaced

ignore: [
"tsconfig.json",
"jsconfig.json",
".git/**/*",
"**/fonts/**",
"**/favicon.ico",
],
});
const writeSema = new Sema(8, { capacity: files.length });
await Promise.all(
Expand Down
2 changes: 1 addition & 1 deletion test/integration/create-next-app/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const createNextApp = (
delete cloneEnv.RUN_ID
delete cloneEnv.BUILD_NUMBER

cloneEnv.NEXT_PRIVATE_TEST_VERSION = '14.2.3'
cloneEnv.NEXT_PRIVATE_TEST_VERSION = testVersion ?? 'latest'

return spawn('node', [cli].concat(args), {
...options,
Expand Down
2 changes: 1 addition & 1 deletion test/integration/create-next-app/prompts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ let testVersion
beforeAll(async () => {
// TODO: investigate moving this post publish or create deployed GH#57025
// tarballs to avoid these failing while a publish is in progress
testVersion = 'canary'
testVersion = 'latest'
// const span = new Span({ name: 'parent' })
// testVersion = (
// await createNextInstall({ onlyPackages: true, parentSpan: span })
Expand Down
2 changes: 1 addition & 1 deletion test/integration/create-next-app/templates/app.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ beforeAll(async () => {
if (testVersion) return
// TODO: investigate moving this post publish or create deployed GH#57025
// tarballs to avoid these failing while a publish is in progress
testVersion = 'canary'
testVersion = 'latest'
// const span = new Span({ name: 'parent' })
// testVersion = (
// await createNextInstall({ onlyPackages: true, parentSpan: span })
Expand Down
77 changes: 77 additions & 0 deletions test/integration/create-next-app/templates/matrix.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import {
createNextApp,
spawnExitPromise,
tryNextDev,
useTempDir,
} from '../utils'

let testVersion
beforeAll(async () => {
if (testVersion) return
// TODO: investigate moving this post publish or create deployed GH#57025
// tarballs to avoid these failing while a publish is in progress
testVersion = 'latest'
// const span = new Span({ name: 'parent' })
// testVersion = (
// await createNextInstall({ onlyPackages: true, parentSpan: span })
// ).get('next')
})

describe.each(['app', 'pages'] as const)(
'CNA options matrix - %s',
(pagesOrApp) => {
const allFlagValues = {
app: [pagesOrApp === 'app' ? '--app' : '--no-app'],
ts: ['--js', '--ts'],
importAlias: [
'--import-alias=@acme/*',
'--import-alias=@/*',
'--no-import-alias',
],
// doesn't affect if the app builds or not
// eslint: ['--eslint', '--no-eslint'],
eslint: ['--eslint'],
srcDir: ['--src-dir', '--no-src-dir'],
tailwind: ['--tailwind', '--no-tailwind'],
// shouldn't affect if the app builds or not
// packageManager: ['--use-npm', '--use-pnpm', '--use-yarn', '--use-bun'],
}

const getPermutations = <T>(items: T[][]): T[][] => {
if (!items.length) return [[]]
const [first, ...rest] = items
const children = getPermutations(rest)
return first.flatMap((value) =>
children.map((child) => [value, ...child])
)
}

const flagPermutations = getPermutations(Object.values(allFlagValues))
const testCases = flagPermutations.map((flags) => ({
name: flags.join(' '),
flags,
}))

let id = 0
it.each(testCases)('$name', async ({ flags }) => {
await useTempDir(async (cwd) => {
const projectName = `cna-matrix-${pagesOrApp}-${id++}`
const childProcess = createNextApp(
[projectName, ...flags],
{
cwd,
},
testVersion
)

const exitCode = await spawnExitPromise(childProcess)
expect(exitCode).toBe(0)

await tryNextDev({
cwd,
projectName,
})
})
})
}
)
2 changes: 1 addition & 1 deletion test/integration/create-next-app/templates/pages.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ let testVersion
beforeAll(async () => {
// TODO: investigate moving this post publish or create deployed GH#57025
// tarballs to avoid these failing while a publish is in progress
testVersion = 'canary'
testVersion = 'latest'
// const span = new Span({ name: 'parent' })
// testVersion = (
// await createNextInstall({ onlyPackages: true, parentSpan: span })
Expand Down
2 changes: 1 addition & 1 deletion test/integration/create-next-app/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const run = (
env: {
...process.env,
...options.env,
NEXT_PRIVATE_TEST_VERSION: '14.2.3',
NEXT_PRIVATE_TEST_VERSION: 'latest',
},
})

Expand Down