@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.
- package/dist/lib/class/class.factory.js +9 -2
- package/dist/lib/class/files/ts/__name__.__specFileSuffix__.ts +1 -1
- package/dist/lib/controller/controller.factory.js +1 -0
- package/dist/lib/controller/files/ts/__name__.controller.__specFileSuffix__.ts +1 -1
- package/dist/lib/filter/files/ts/__name__.filter.__specFileSuffix__.ts +1 -1
- package/dist/lib/filter/filter.factory.js +9 -2
- package/dist/lib/gateway/files/ts/__name__.gateway.__specFileSuffix__.ts +1 -1
- package/dist/lib/gateway/gateway.factory.js +1 -0
- package/dist/lib/guard/files/ts/__name__.guard.__specFileSuffix__.ts +1 -1
- package/dist/lib/guard/guard.factory.js +9 -2
- package/dist/lib/interceptor/files/ts/__name__.interceptor.__specFileSuffix__.ts +1 -1
- package/dist/lib/interceptor/interceptor.factory.js +9 -2
- package/dist/lib/library/files/ts/src/__name__.module.ts +1 -1
- package/dist/lib/library/files/ts/src/__name__.service.__specFileSuffix__.ts +1 -1
- package/dist/lib/library/files/ts/src/index.ts +2 -2
- package/dist/lib/library/library.factory.js +15 -8
- package/dist/lib/middleware/files/ts/__name__.middleware.__specFileSuffix__.ts +1 -1
- package/dist/lib/middleware/middleware.factory.js +9 -2
- package/dist/lib/pipe/files/ts/__name__.pipe.__specFileSuffix__.ts +1 -1
- package/dist/lib/pipe/pipe.factory.js +9 -2
- package/dist/lib/provider/files/ts/__name__.__specFileSuffix__.ts +1 -1
- package/dist/lib/provider/provider.factory.js +1 -0
- package/dist/lib/resolver/files/ts/__name__.resolver.__specFileSuffix__.ts +1 -1
- package/dist/lib/resolver/resolver.factory.js +1 -0
- package/dist/lib/resource/files/ts/__name__.controller.__specFileSuffix__.ts +2 -2
- package/dist/lib/resource/files/ts/__name__.gateway.__specFileSuffix__.ts +2 -2
- package/dist/lib/resource/files/ts/__name__.resolver.__specFileSuffix__.ts +2 -2
- package/dist/lib/resource/files/ts/__name__.service.__specFileSuffix__.ts +1 -1
- package/dist/lib/resource/resource.factory.js +1 -0
- package/dist/lib/service/files/ts/__name__.service.__specFileSuffix__.ts +1 -1
- package/dist/lib/service/service.factory.js +1 -0
- package/dist/lib/sub-app/files/ts/src/__name__.controller.__specFileSuffix__.ts +2 -2
- package/dist/lib/sub-app/files/ts/src/__name__.controller.ts +1 -1
- package/dist/lib/sub-app/files/ts/src/__name__.module.ts +2 -2
- package/dist/lib/sub-app/files/ts/src/main.ts +1 -1
- package/dist/lib/sub-app/files/ts/test/app.e2e-__specFileSuffix__.ts +1 -1
- package/dist/lib/sub-app/files/ts/tsconfig.app.json +1 -1
- package/dist/lib/sub-app/sub-app.factory.js +15 -8
- package/dist/lib/sub-app/workspace/ts/tsconfig.app.json +1 -1
- 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([
|
|
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);
|
|
@@ -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;
|
|
@@ -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([
|
|
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),
|
|
@@ -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([
|
|
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([
|
|
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) %>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
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
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
|
}
|
|
@@ -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([
|
|
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);
|
|
@@ -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([
|
|
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;
|
|
@@ -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
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
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
|
}
|