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(nest): added es2021 support for nest generators #17726

Merged
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
7 changes: 4 additions & 3 deletions docs/generated/packages/nest/generators/library.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@
"default": "node"
},
"target": {
"description": "The ES target, Nest suggest using es6 or higher.",
"description": "The ES target, Nest suggest using es2021 or higher.",
"type": "string",
"default": "es6",
"default": "es2021",
"enum": [
"es5",
"es6",
Expand All @@ -104,7 +104,8 @@
"es2017",
"es2018",
"es2019",
"es2020"
"es2020",
"es2021"
]
},
"strict": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe('application generator', () => {
`apps/${appDirectory}/tsconfig.app.json`
);
expect(tsConfig.compilerOptions.emitDecoratorMetadata).toBe(true);
expect(tsConfig.compilerOptions.target).toBe('es2015');
expect(tsConfig.compilerOptions.target).toBe('es2021');
expect(tsConfig.exclude).toEqual([
'jest.config.ts',
'src/**/*.spec.ts',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export function updateTsConfig(tree: Tree, options: NormalizedOptions): void {
joinPathFragments(options.appProjectRoot, 'tsconfig.app.json'),
(json) => {
json.compilerOptions.emitDecoratorMetadata = true;
json.compilerOptions.target = 'es2015';
json.compilerOptions.target = 'es2021';
if (options.strict) {
json.compilerOptions = {
...json.compilerOptions,
Expand Down
6 changes: 3 additions & 3 deletions packages/nest/src/generators/library/library.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,14 +302,14 @@ describe('lib', () => {
expect(tsconfigJson.compilerOptions.target).toEqual('es6');
});

it('should set target to es2020 in tsconfig.lib.json', async () => {
await libraryGenerator(tree, { name: libName, target: 'es2020' });
it('should set target to es2021 in tsconfig.lib.json', async () => {
await libraryGenerator(tree, { name: libName, target: 'es2021' });

const tsconfigJson = readJson(
tree,
`libs/${libFileName}/tsconfig.lib.json`
);
expect(tsconfigJson.compilerOptions.target).toEqual('es2020');
expect(tsconfigJson.compilerOptions.target).toEqual('es2021');
});
});

Expand Down
3 changes: 2 additions & 1 deletion packages/nest/src/generators/library/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ export interface LibraryGeneratorOptions {
| 'es2017'
| 'es2018'
| 'es2019'
| 'es2020';
| 'es2020'
| 'es2021';
testEnvironment?: 'jsdom' | 'node';
unitTestRunner?: UnitTestRunner;
standaloneConfig?: boolean;
Expand Down
7 changes: 4 additions & 3 deletions packages/nest/src/generators/library/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@
"default": "node"
},
"target": {
"description": "The ES target, Nest suggest using es6 or higher.",
"description": "The ES target, Nest suggest using es2021 or higher.",
"type": "string",
"default": "es6",
"default": "es2021",
"enum": [
"es5",
"es6",
Expand All @@ -104,7 +104,8 @@
"es2017",
"es2018",
"es2019",
"es2020"
"es2020",
"es2021"
]
},
"strict": {
Expand Down