Skip to content

Commit

Permalink
feat(nest): added es2021 support for nest generators (nrwl#17726)
Browse files Browse the repository at this point in the history
Co-authored-by: Caleb Ukle <[email protected]>
  • Loading branch information
2 people authored and meeroslav committed Jun 23, 2023
1 parent 3cf0a42 commit a8bd927
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 12 deletions.
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

0 comments on commit a8bd927

Please sign in to comment.