-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(nextjs): update to Next.js 13.3.0 (#16130)
- Loading branch information
Showing
13 changed files
with
206 additions
and
77 deletions.
There are no files selected for viewing
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
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
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
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
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
26 changes: 26 additions & 0 deletions
26
packages/next/src/generators/library/lib/normalize-options.spec.ts
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import type { Tree } from '@nrwl/devkit'; | ||
import { Linter } from '@nrwl/linter'; | ||
import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing'; | ||
import { normalizeOptions } from './normalize-options'; | ||
|
||
describe('normalizeOptions', () => { | ||
let tree: Tree; | ||
|
||
beforeEach(() => { | ||
tree = createTreeWithEmptyWorkspace(); | ||
}); | ||
|
||
it('should set importPath and projectRoot', () => { | ||
const options = normalizeOptions(tree, { | ||
name: 'my-lib', | ||
style: 'css', | ||
linter: Linter.None, | ||
unitTestRunner: 'jest', | ||
}); | ||
|
||
expect(options).toMatchObject({ | ||
importPath: '@proj/my-lib', | ||
projectRoot: 'my-lib', | ||
}); | ||
}); | ||
}); |
32 changes: 32 additions & 0 deletions
32
packages/next/src/generators/library/lib/normalize-options.ts
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { | ||
getImportPath, | ||
getWorkspaceLayout, | ||
joinPathFragments, | ||
names, | ||
Tree, | ||
} from '@nrwl/devkit'; | ||
import { Schema } from '../schema'; | ||
|
||
export interface NormalizedSchema extends Schema { | ||
importPath: string; | ||
projectRoot: string; | ||
} | ||
|
||
export function normalizeOptions( | ||
host: Tree, | ||
options: Schema | ||
): NormalizedSchema { | ||
const name = names(options.name).fileName; | ||
const projectDirectory = options.directory | ||
? `${names(options.directory).fileName}/${name}` | ||
: name; | ||
|
||
const { libsDir } = getWorkspaceLayout(host); | ||
const projectRoot = joinPathFragments(libsDir, projectDirectory); | ||
const { npmScope } = getWorkspaceLayout(host); | ||
return { | ||
...options, | ||
importPath: options.importPath ?? getImportPath(npmScope, projectDirectory), | ||
projectRoot, | ||
}; | ||
} |
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
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
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
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
Oops, something went wrong.