@nestjs/schematics 12.0.0-alpha.4 → 12.0.0-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/lib/class/class.factory.js +9 -2
  2. package/dist/lib/class/files/ts/__name__.__specFileSuffix__.ts +1 -1
  3. package/dist/lib/controller/controller.factory.js +1 -0
  4. package/dist/lib/controller/files/ts/__name__.controller.__specFileSuffix__.ts +1 -1
  5. package/dist/lib/filter/files/ts/__name__.filter.__specFileSuffix__.ts +1 -1
  6. package/dist/lib/filter/filter.factory.js +9 -2
  7. package/dist/lib/gateway/files/ts/__name__.gateway.__specFileSuffix__.ts +1 -1
  8. package/dist/lib/gateway/gateway.factory.js +1 -0
  9. package/dist/lib/guard/files/ts/__name__.guard.__specFileSuffix__.ts +1 -1
  10. package/dist/lib/guard/guard.factory.js +9 -2
  11. package/dist/lib/interceptor/files/ts/__name__.interceptor.__specFileSuffix__.ts +1 -1
  12. package/dist/lib/interceptor/interceptor.factory.js +9 -2
  13. package/dist/lib/library/files/ts/src/__name__.module.ts +1 -1
  14. package/dist/lib/library/files/ts/src/__name__.service.__specFileSuffix__.ts +1 -1
  15. package/dist/lib/library/files/ts/src/index.ts +2 -2
  16. package/dist/lib/library/library.factory.js +15 -8
  17. package/dist/lib/middleware/files/ts/__name__.middleware.__specFileSuffix__.ts +1 -1
  18. package/dist/lib/middleware/middleware.factory.js +9 -2
  19. package/dist/lib/pipe/files/ts/__name__.pipe.__specFileSuffix__.ts +1 -1
  20. package/dist/lib/pipe/pipe.factory.js +9 -2
  21. package/dist/lib/provider/files/ts/__name__.__specFileSuffix__.ts +1 -1
  22. package/dist/lib/provider/provider.factory.js +1 -0
  23. package/dist/lib/resolver/files/ts/__name__.resolver.__specFileSuffix__.ts +1 -1
  24. package/dist/lib/resolver/resolver.factory.js +1 -0
  25. package/dist/lib/resource/files/ts/__name__.controller.__specFileSuffix__.ts +2 -2
  26. package/dist/lib/resource/files/ts/__name__.gateway.__specFileSuffix__.ts +2 -2
  27. package/dist/lib/resource/files/ts/__name__.resolver.__specFileSuffix__.ts +2 -2
  28. package/dist/lib/resource/files/ts/__name__.service.__specFileSuffix__.ts +1 -1
  29. package/dist/lib/resource/resource.factory.js +1 -0
  30. package/dist/lib/service/files/ts/__name__.service.__specFileSuffix__.ts +1 -1
  31. package/dist/lib/service/service.factory.js +1 -0
  32. package/dist/lib/sub-app/files/ts/src/__name__.controller.__specFileSuffix__.ts +2 -2
  33. package/dist/lib/sub-app/files/ts/src/__name__.controller.ts +1 -1
  34. package/dist/lib/sub-app/files/ts/src/__name__.module.ts +2 -2
  35. package/dist/lib/sub-app/files/ts/src/main.ts +1 -1
  36. package/dist/lib/sub-app/files/ts/test/app.e2e-__specFileSuffix__.ts +1 -1
  37. package/dist/lib/sub-app/files/ts/tsconfig.app.json +1 -1
  38. package/dist/lib/sub-app/sub-app.factory.js +15 -8
  39. package/dist/lib/sub-app/workspace/ts/tsconfig.app.json +1 -1
  40. package/package.json +1 -1
@@ -2,11 +2,18 @@ import { join, strings } from '@angular-devkit/core';
2
2
  import { apply, chain, filter, mergeWith, move, noop, SchematicsException, template, url, } from '@angular-devkit/schematics';
3
3
  import { normalizeToKebabOrSnakeCase } from '../../utils/formatting.js';
4
4
  import { NameParser } from '../../utils/name.parser.js';
5
- import { mergeSourceRoot } from '../../utils/source-root.helpers.js';
5
+ import { isEsmProject, mergeSourceRoot, } from '../../utils/source-root.helpers.js';
6
6
  import { DEFAULT_LANGUAGE } from '../defaults.js';
7
7
  export function main(options) {
8
8
  options = transform(options);
9
- return chain([mergeSourceRoot(options), mergeWith(generate(options))]);
9
+ return chain([
10
+ mergeSourceRoot(options),
11
+ (tree) => {
12
+ options.isEsm = isEsmProject(tree);
13
+ return tree;
14
+ },
15
+ mergeWith(generate(options)),
16
+ ]);
10
17
  }
11
18
  function transform(options) {
12
19
  const target = Object.assign({}, options);
@@ -1,4 +1,4 @@
1
- import { <%= classify(className) %> } from './<%= name %>';
1
+ import { <%= classify(className) %> } from './<%= name %><%= isEsm ? '.js' : '' %>';
2
2
 
3
3
  describe('<%= classify(className) %>', () => {
4
4
  it('should be defined', () => {
@@ -11,6 +11,7 @@ const ELEMENT_TYPE = 'controller';
11
11
  export function main(options) {
12
12
  options = transform(options);
13
13
  return (tree, context) => {
14
+ options.isEsm = isEsmProject(tree);
14
15
  return branchAndMerge(chain([
15
16
  mergeSourceRoot(options),
16
17
  mergeWith(generate(options)),
@@ -1,5 +1,5 @@
1
1
  import { Test, TestingModule } from '@nestjs/testing';
2
- import { <%= classify(name) %>Controller } from './<%= name %>.controller';
2
+ import { <%= classify(name) %>Controller } from './<%= name %>.controller<%= isEsm ? '.js' : '' %>';
3
3
 
4
4
  describe('<%= classify(name) %>Controller', () => {
5
5
  let controller: <%= classify(name) %>Controller;
@@ -1,4 +1,4 @@
1
- import { <%= classify(name) %>Filter } from './<%= name %>.filter';
1
+ import { <%= classify(name) %>Filter } from './<%= name %>.filter<%= isEsm ? '.js' : '' %>';
2
2
 
3
3
  describe('<%= classify(name) %>Filter', () => {
4
4
  it('should be defined', () => {
@@ -2,10 +2,17 @@ import { join, strings } from '@angular-devkit/core';
2
2
  import { apply, chain, filter, mergeWith, move, noop, SchematicsException, template, url, } from '@angular-devkit/schematics';
3
3
  import { normalizeToKebabOrSnakeCase } from '../../utils/formatting.js';
4
4
  import { NameParser } from '../../utils/name.parser.js';
5
- import { mergeSourceRoot } from '../../utils/source-root.helpers.js';
5
+ import { isEsmProject, mergeSourceRoot, } from '../../utils/source-root.helpers.js';
6
6
  export function main(options) {
7
7
  options = transform(options);
8
- return chain([mergeSourceRoot(options), mergeWith(generate(options))]);
8
+ return chain([
9
+ mergeSourceRoot(options),
10
+ (tree) => {
11
+ options.isEsm = isEsmProject(tree);
12
+ return tree;
13
+ },
14
+ mergeWith(generate(options)),
15
+ ]);
9
16
  }
10
17
  function transform(options) {
11
18
  const target = Object.assign({}, options);
@@ -1,5 +1,5 @@
1
1
  import { Test, TestingModule } from '@nestjs/testing';
2
- import { <%= classify(name) %>Gateway } from './<%= name %>.gateway';
2
+ import { <%= classify(name) %>Gateway } from './<%= name %>.gateway<%= isEsm ? '.js' : '' %>';
3
3
 
4
4
  describe('<%= classify(name) %>Gateway', () => {
5
5
  let gateway: <%= classify(name) %>Gateway;
@@ -8,6 +8,7 @@ import { isEsmProject, mergeSourceRoot, } from '../../utils/source-root.helpers.
8
8
  export function main(options) {
9
9
  options = transform(options);
10
10
  return (tree, context) => {
11
+ options.isEsm = isEsmProject(tree);
11
12
  return branchAndMerge(chain([
12
13
  mergeSourceRoot(options),
13
14
  addDeclarationToModule(options),
@@ -1,4 +1,4 @@
1
- import { <%= classify(name) %>Guard } from './<%= name %>.guard';
1
+ import { <%= classify(name) %>Guard } from './<%= name %>.guard<%= isEsm ? '.js' : '' %>';
2
2
 
3
3
  describe('<%= classify(name) %>Guard', () => {
4
4
  it('should be defined', () => {
@@ -2,10 +2,17 @@ import { join, strings } from '@angular-devkit/core';
2
2
  import { apply, chain, filter, mergeWith, move, noop, SchematicsException, template, url, } from '@angular-devkit/schematics';
3
3
  import { normalizeToKebabOrSnakeCase } from '../../utils/formatting.js';
4
4
  import { NameParser } from '../../utils/name.parser.js';
5
- import { mergeSourceRoot } from '../../utils/source-root.helpers.js';
5
+ import { isEsmProject, mergeSourceRoot, } from '../../utils/source-root.helpers.js';
6
6
  export function main(options) {
7
7
  options = transform(options);
8
- return chain([mergeSourceRoot(options), mergeWith(generate(options))]);
8
+ return chain([
9
+ mergeSourceRoot(options),
10
+ (tree) => {
11
+ options.isEsm = isEsmProject(tree);
12
+ return tree;
13
+ },
14
+ mergeWith(generate(options)),
15
+ ]);
9
16
  }
10
17
  function transform(options) {
11
18
  const target = Object.assign({}, options);
@@ -1,4 +1,4 @@
1
- import { <%= classify(name) %>Interceptor } from './<%= name %>.interceptor';
1
+ import { <%= classify(name) %>Interceptor } from './<%= name %>.interceptor<%= isEsm ? '.js' : '' %>';
2
2
 
3
3
  describe('<%= classify(name) %>Interceptor', () => {
4
4
  it('should be defined', () => {
@@ -2,10 +2,17 @@ import { join, strings } from '@angular-devkit/core';
2
2
  import { apply, chain, filter, mergeWith, move, noop, SchematicsException, template, url, } from '@angular-devkit/schematics';
3
3
  import { normalizeToKebabOrSnakeCase } from '../../utils/formatting.js';
4
4
  import { NameParser } from '../../utils/name.parser.js';
5
- import { mergeSourceRoot } from '../../utils/source-root.helpers.js';
5
+ import { isEsmProject, mergeSourceRoot, } from '../../utils/source-root.helpers.js';
6
6
  export function main(options) {
7
7
  options = transform(options);
8
- return chain([mergeSourceRoot(options), mergeWith(generate(options))]);
8
+ return chain([
9
+ mergeSourceRoot(options),
10
+ (tree) => {
11
+ options.isEsm = isEsmProject(tree);
12
+ return tree;
13
+ },
14
+ mergeWith(generate(options)),
15
+ ]);
9
16
  }
10
17
  function transform(options) {
11
18
  const target = Object.assign({}, options);
@@ -1,5 +1,5 @@
1
1
  import { Module } from '@nestjs/common';
2
- import { <%= classify(name) %>Service } from './<%= name %>.service';
2
+ import { <%= classify(name) %>Service } from './<%= name %>.service<%= isEsm ? '.js' : '' %>';
3
3
 
4
4
  @Module({
5
5
  providers: [<%= classify(name) %>Service],
@@ -1,5 +1,5 @@
1
1
  import { Test, TestingModule } from '@nestjs/testing';
2
- import { <%= classify(name) %>Service } from './<%= name %>.service';
2
+ import { <%= classify(name) %>Service } from './<%= name %>.service<%= isEsm ? '.js' : '' %>';
3
3
 
4
4
  describe('<%= classify(name) %>Service', () => {
5
5
  let service: <%= classify(name) %>Service;
@@ -1,2 +1,2 @@
1
- export * from './<%= name %>.module';
2
- export * from './<%= name %>.service';
1
+ export * from './<%= name %>.module<%= isEsm ? '.js' : '' %>';
2
+ export * from './<%= name %>.service<%= isEsm ? '.js' : '' %>';
@@ -4,6 +4,7 @@ import { parse } from 'jsonc-parser';
4
4
  import { createModuleNameMapper, inPlaceSortByKeys, normalizeToKebabOrSnakeCase, } from '../../utils/index.js';
5
5
  import { DEFAULT_LANGUAGE, DEFAULT_LIB_PATH, DEFAULT_PATH_NAME, PROJECT_TYPE, } from '../defaults.js';
6
6
  import { FileSystemReader } from '../readers/index.js';
7
+ import { isEsmProject } from '../../utils/source-root.helpers.js';
7
8
  export function main(options) {
8
9
  options = transform(options);
9
10
  return chain([
@@ -11,6 +12,10 @@ export function main(options) {
11
12
  updatePackageJson(options),
12
13
  updateJestEndToEnd(options),
13
14
  updateTsConfig(options.name, options.prefix, options.path),
15
+ (tree) => {
16
+ options.isEsm = isEsmProject(tree);
17
+ return tree;
18
+ },
14
19
  branchAndMerge(mergeWith(generate(options))),
15
20
  ]);
16
21
  }
@@ -198,12 +203,14 @@ function addLibraryToCliOptions(projectRoot, projectName) {
198
203
  };
199
204
  }
200
205
  function generate(options) {
201
- const path = join(options.path, options.name);
202
- return apply(url(join('./files', options.language)), [
203
- template({
204
- ...strings,
205
- ...options,
206
- }),
207
- move(path),
208
- ]);
206
+ return (context) => {
207
+ const path = join(options.path, options.name);
208
+ return apply(url(join('./files', options.language)), [
209
+ template({
210
+ ...strings,
211
+ ...options,
212
+ }),
213
+ move(path),
214
+ ])(context);
215
+ };
209
216
  }
@@ -1,4 +1,4 @@
1
- import { <%= classify(name) %>Middleware } from './<%= name %>.middleware';
1
+ import { <%= classify(name) %>Middleware } from './<%= name %>.middleware<%= isEsm ? '.js' : '' %>';
2
2
 
3
3
  describe('<%= classify(name) %>Middleware', () => {
4
4
  it('should be defined', () => {
@@ -2,10 +2,17 @@ import { join, strings } from '@angular-devkit/core';
2
2
  import { apply, chain, filter, mergeWith, move, noop, SchematicsException, template, url, } from '@angular-devkit/schematics';
3
3
  import { normalizeToKebabOrSnakeCase } from '../../utils/formatting.js';
4
4
  import { NameParser } from '../../utils/name.parser.js';
5
- import { mergeSourceRoot } from '../../utils/source-root.helpers.js';
5
+ import { isEsmProject, mergeSourceRoot, } from '../../utils/source-root.helpers.js';
6
6
  export function main(options) {
7
7
  options = transform(options);
8
- return chain([mergeSourceRoot(options), mergeWith(generate(options))]);
8
+ return chain([
9
+ mergeSourceRoot(options),
10
+ (tree) => {
11
+ options.isEsm = isEsmProject(tree);
12
+ return tree;
13
+ },
14
+ mergeWith(generate(options)),
15
+ ]);
9
16
  }
10
17
  function transform(options) {
11
18
  const target = Object.assign({}, options);
@@ -1,4 +1,4 @@
1
- import { <%= classify(name) %>Pipe } from './<%= name %>.pipe';
1
+ import { <%= classify(name) %>Pipe } from './<%= name %>.pipe<%= isEsm ? '.js' : '' %>';
2
2
 
3
3
  describe('<%= classify(name) %>Pipe', () => {
4
4
  it('should be defined', () => {
@@ -2,10 +2,17 @@ import { join, strings } from '@angular-devkit/core';
2
2
  import { apply, chain, filter, mergeWith, move, noop, SchematicsException, template, url, } from '@angular-devkit/schematics';
3
3
  import { normalizeToKebabOrSnakeCase } from '../../utils/formatting.js';
4
4
  import { NameParser } from '../../utils/name.parser.js';
5
- import { mergeSourceRoot } from '../../utils/source-root.helpers.js';
5
+ import { isEsmProject, mergeSourceRoot, } from '../../utils/source-root.helpers.js';
6
6
  export function main(options) {
7
7
  options = transform(options);
8
- return chain([mergeSourceRoot(options), mergeWith(generate(options))]);
8
+ return chain([
9
+ mergeSourceRoot(options),
10
+ (tree) => {
11
+ options.isEsm = isEsmProject(tree);
12
+ return tree;
13
+ },
14
+ mergeWith(generate(options)),
15
+ ]);
9
16
  }
10
17
  function transform(options) {
11
18
  const target = Object.assign({}, options);
@@ -1,5 +1,5 @@
1
1
  import { Test, TestingModule } from '@nestjs/testing';
2
- import { <%= classify(className) %> } from './<%= name %>';
2
+ import { <%= classify(className) %> } from './<%= name %><%= isEsm ? '.js' : '' %>';
3
3
 
4
4
  describe('<%= classify(className) %>', () => {
5
5
  let provider: <%= classify(className) %>;
@@ -8,6 +8,7 @@ import { isEsmProject, mergeSourceRoot, } from '../../utils/source-root.helpers.
8
8
  export function main(options) {
9
9
  options = transform(options);
10
10
  return (tree, context) => {
11
+ options.isEsm = isEsmProject(tree);
11
12
  return branchAndMerge(chain([
12
13
  mergeSourceRoot(options),
13
14
  addDeclarationToModule(options),
@@ -1,5 +1,5 @@
1
1
  import { Test, TestingModule } from '@nestjs/testing';
2
- import { <%= classify(name) %>Resolver } from './<%= name %>.resolver';
2
+ import { <%= classify(name) %>Resolver } from './<%= name %>.resolver<%= isEsm ? '.js' : '' %>';
3
3
 
4
4
  describe('<%= classify(name) %>Resolver', () => {
5
5
  let resolver: <%= classify(name) %>Resolver;
@@ -8,6 +8,7 @@ import { isEsmProject, mergeSourceRoot, } from '../../utils/source-root.helpers.
8
8
  export function main(options) {
9
9
  options = transform(options);
10
10
  return (tree, context) => {
11
+ options.isEsm = isEsmProject(tree);
11
12
  return branchAndMerge(chain([
12
13
  mergeSourceRoot(options),
13
14
  addDeclarationToModule(options),
@@ -1,6 +1,6 @@
1
1
  import { Test, TestingModule } from '@nestjs/testing';
2
- import { <%= classify(name) %>Controller } from './<%= name %>.controller';
3
- import { <%= classify(name) %>Service } from './<%= name %>.service';
2
+ import { <%= classify(name) %>Controller } from './<%= name %>.controller<%= isEsm ? '.js' : '' %>';
3
+ import { <%= classify(name) %>Service } from './<%= name %>.service<%= isEsm ? '.js' : '' %>';
4
4
 
5
5
  describe('<%= classify(name) %>Controller', () => {
6
6
  let controller: <%= classify(name) %>Controller;
@@ -1,6 +1,6 @@
1
1
  import { Test, TestingModule } from '@nestjs/testing';
2
- import { <%= classify(name) %>Gateway } from './<%= name %>.gateway';
3
- import { <%= classify(name) %>Service } from './<%= name %>.service';
2
+ import { <%= classify(name) %>Gateway } from './<%= name %>.gateway<%= isEsm ? '.js' : '' %>';
3
+ import { <%= classify(name) %>Service } from './<%= name %>.service<%= isEsm ? '.js' : '' %>';
4
4
 
5
5
  describe('<%= classify(name) %>Gateway', () => {
6
6
  let gateway: <%= classify(name) %>Gateway;
@@ -1,6 +1,6 @@
1
1
  import { Test, TestingModule } from '@nestjs/testing';
2
- import { <%= classify(name) %>Resolver } from './<%= name %>.resolver';
3
- import { <%= classify(name) %>Service } from './<%= name %>.service';
2
+ import { <%= classify(name) %>Resolver } from './<%= name %>.resolver<%= isEsm ? '.js' : '' %>';
3
+ import { <%= classify(name) %>Service } from './<%= name %>.service<%= isEsm ? '.js' : '' %>';
4
4
 
5
5
  describe('<%= classify(name) %>Resolver', () => {
6
6
  let resolver: <%= classify(name) %>Resolver;
@@ -1,5 +1,5 @@
1
1
  import { Test, TestingModule } from '@nestjs/testing';
2
- import { <%= classify(name) %>Service } from './<%= name %>.service';
2
+ import { <%= classify(name) %>Service } from './<%= name %>.service<%= isEsm ? '.js' : '' %>';
3
3
 
4
4
  describe('<%= classify(name) %>Service', () => {
5
5
  let service: <%= classify(name) %>Service;
@@ -11,6 +11,7 @@ import { isEsmProject, mergeSourceRoot, } from '../../utils/source-root.helpers.
11
11
  export function main(options) {
12
12
  options = transform(options);
13
13
  return (tree, context) => {
14
+ options.isEsm = isEsmProject(tree);
14
15
  return branchAndMerge(chain([
15
16
  addMappedTypesDependencyIfApplies(options),
16
17
  mergeSourceRoot(options),
@@ -1,5 +1,5 @@
1
1
  import { Test, TestingModule } from '@nestjs/testing';
2
- import { <%= classify(name) %>Service } from './<%= name %>.service';
2
+ import { <%= classify(name) %>Service } from './<%= name %>.service<%= isEsm ? '.js' : '' %>';
3
3
 
4
4
  describe('<%= classify(name) %>Service', () => {
5
5
  let service: <%= classify(name) %>Service;
@@ -11,6 +11,7 @@ function isNullOrUndefined(value) {
11
11
  export function main(options) {
12
12
  options = transform(options);
13
13
  return (tree, context) => {
14
+ options.isEsm = isEsmProject(tree);
14
15
  return branchAndMerge(chain([
15
16
  mergeSourceRoot(options),
16
17
  addDeclarationToModule(options),
@@ -1,6 +1,6 @@
1
1
  import { Test, TestingModule } from '@nestjs/testing';
2
- import { <%= classify(name) %>Controller } from './<%= name %>.controller';
3
- import { <%= classify(name) %>Service } from './<%= name %>.service';
2
+ import { <%= classify(name) %>Controller } from './<%= name %>.controller<%= isEsm ? '.js' : '' %>';
3
+ import { <%= classify(name) %>Service } from './<%= name %>.service<%= isEsm ? '.js' : '' %>';
4
4
 
5
5
  describe('<%= classify(name) %>Controller', () => {
6
6
  let <%= camelize(name) %>Controller: <%= classify(name) %>Controller;
@@ -1,5 +1,5 @@
1
1
  import { Controller, Get } from '@nestjs/common';
2
- import { <%= classify(name) %>Service } from './<%= name %>.service';
2
+ import { <%= classify(name) %>Service } from './<%= name %>.service<%= isEsm ? '.js' : '' %>';
3
3
 
4
4
  @Controller()
5
5
  export class <%= classify(name) %>Controller {
@@ -1,6 +1,6 @@
1
1
  import { Module } from '@nestjs/common';
2
- import { <%= classify(name) %>Controller } from './<%= name %>.controller';
3
- import { <%= classify(name) %>Service } from './<%= name %>.service';
2
+ import { <%= classify(name) %>Controller } from './<%= name %>.controller<%= isEsm ? '.js' : '' %>';
3
+ import { <%= classify(name) %>Service } from './<%= name %>.service<%= isEsm ? '.js' : '' %>';
4
4
 
5
5
  @Module({
6
6
  imports: [],
@@ -1,5 +1,5 @@
1
1
  import { NestFactory } from '@nestjs/core';
2
- import { <%= classify(name) %>Module } from './<%= name %>.module';
2
+ import { <%= classify(name) %>Module } from './<%= name %>.module<%= isEsm ? '.js' : '' %>';
3
3
 
4
4
  async function bootstrap() {
5
5
  const app = await NestFactory.create(<%= classify(name) %>Module);
@@ -1,7 +1,7 @@
1
1
  import { Test, TestingModule } from '@nestjs/testing';
2
2
  import { INestApplication } from '@nestjs/common';
3
3
  import * as request from 'supertest';
4
- import { <%= classify(name)%>Module } from './../src/<%= name %>.module';
4
+ import { <%= classify(name)%>Module } from './../src/<%= name %>.module<%= isEsm ? '.js' : '' %>';
5
5
 
6
6
  describe('<%= classify(name)%>Controller (e2e)', () => {
7
7
  let app: INestApplication;
@@ -2,7 +2,7 @@
2
2
  "extends": "../../tsconfig.json",
3
3
  "compilerOptions": {
4
4
  "composite": true,
5
- "declaration": false,
5
+ "declaration": true,
6
6
  "outDir": "../../dist/apps/<%= name %>"
7
7
  },
8
8
  "include": ["src/**/*"],
@@ -4,6 +4,7 @@ import { existsSync, readFileSync } from 'fs';
4
4
  import { parse, stringify } from 'comment-json';
5
5
  import { inPlaceSortByKeys, normalizeToKebabOrSnakeCase, } from '../../utils/index.js';
6
6
  import { DEFAULT_APPS_PATH, DEFAULT_APP_NAME, DEFAULT_DIR_ENTRY_APP, DEFAULT_LANGUAGE, DEFAULT_LIB_PATH, DEFAULT_PATH_NAME, PROJECT_TYPE, TEST_ENV, } from '../defaults.js';
7
+ import { isEsmProject } from '../../utils/source-root.helpers.js';
7
8
  export function main(options) {
8
9
  const appName = getAppNameFromPackageJson();
9
10
  options = transform(options);
@@ -18,6 +19,10 @@ export function main(options) {
18
19
  ])(tree, context),
19
20
  addAppsToCliOptions(options.path, options.name, appName),
20
21
  addTsConfigReference(options.path, options.name),
22
+ (tree) => {
23
+ options.isEsm = isEsmProject(tree);
24
+ return tree;
25
+ },
21
26
  branchAndMerge(mergeWith(generate(options))),
22
27
  ]);
23
28
  }
@@ -285,12 +290,14 @@ function generateWorkspace(options, appName) {
285
290
  ]);
286
291
  }
287
292
  function generate(options) {
288
- const path = join(options.path, options.name);
289
- return apply(url(join('./files', options.language)), [
290
- template({
291
- ...strings,
292
- ...options,
293
- }),
294
- move(path),
295
- ]);
293
+ return (context) => {
294
+ const path = join(options.path, options.name);
295
+ return apply(url(join('./files', options.language)), [
296
+ template({
297
+ ...strings,
298
+ ...options,
299
+ }),
300
+ move(path),
301
+ ])(context);
302
+ };
296
303
  }
@@ -2,7 +2,7 @@
2
2
  "extends": "../../tsconfig.json",
3
3
  "compilerOptions": {
4
4
  "composite": true,
5
- "declaration": false,
5
+ "declaration": true,
6
6
  "outDir": "../../dist/apps/<%= name %>"
7
7
  },
8
8
  "include": ["src/**/*"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestjs/schematics",
3
- "version": "12.0.0-alpha.4",
3
+ "version": "12.0.0-alpha.5",
4
4
  "description": "Nest - modern, fast, powerful node.js web framework (@schematics)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",