Skip to content

Commit

Permalink
feat(nextjs): scope include to src
Browse files Browse the repository at this point in the history
  • Loading branch information
jaysoo committed Nov 15, 2024
1 parent f5b5ede commit e453615
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
13 changes: 7 additions & 6 deletions packages/next/src/generators/application/application.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -916,18 +916,19 @@ describe('app (legacy)', () => {
"dist",
"node_modules",
"jest.config.ts",
"**/*.spec.ts",
"**/*.test.ts",
"src/**/*.spec.ts",
"src/**/*.test.ts",
".next",
"eslint.config.js",
"eslint.config.cjs",
"eslint.config.mjs",
],
"extends": "../tsconfig.base.json",
"include": [
"**/*.ts",
"**/*.tsx",
"**/*.js",
"**/*.jsx",
"src/**/*.ts",
"src/**/*.tsx",
"src/**/*.js",
"src/**/*.jsx",
"../myapp/.next/types/**/*.ts",
"../dist/myapp/.next/types/**/*.ts",
"next-env.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions packages/next/src/generators/application/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ export async function applicationGeneratorInternal(host: Tree, schema: Schema) {
moduleResolution: 'bundler',
},
options.linter === 'eslint'
? ['eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
: undefined,
? ['.next', 'eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
: ['.next'],
options.src ? 'src' : '.'
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@ export function createApplicationFiles(host: Tree, options: NormalizedSchema) {
'.next/types/**/*.ts'
);

// scope tsconfig to the project directory so that it doesn't include other projects/libs
const rootPath = options.rootProject
? options.src
? 'src/'
: options.appDir
? 'app/'
: 'pages/'
: '';
const rootPath =
options.rootProject || isUsingTsSolutionSetup(host)
? options.src
? 'src/'
: options.appDir
? 'app/'
: 'pages/'
: '';

const templateVariables = {
...names(options.name),
...options,
Expand Down

0 comments on commit e453615

Please sign in to comment.