@gapi/schematics 1.8.122
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/.prettierrc +4 -0
- package/README.md +35 -0
- package/collection.json +99 -0
- package/dist/lib/application/application.factory.d.ts +3 -0
- package/dist/lib/application/application.factory.js +35 -0
- package/dist/lib/application/application.factory.test.ts +88 -0
- package/dist/lib/application/application.factory.ts +54 -0
- package/dist/lib/application/application.schema.d.ts +34 -0
- package/dist/lib/application/files/js/.babelrc +4 -0
- package/dist/lib/application/files/js/.prettierrc +4 -0
- package/dist/lib/application/files/js/README.md +37 -0
- package/dist/lib/application/files/js/index.js +3 -0
- package/dist/lib/application/files/js/jsconfig.json +9 -0
- package/dist/lib/application/files/js/nest-cli.json +5 -0
- package/dist/lib/application/files/js/nodemon.json +6 -0
- package/dist/lib/application/files/js/package.json +46 -0
- package/dist/lib/application/files/js/src/app.controller.js +15 -0
- package/dist/lib/application/files/js/src/app.controller.spec.js +22 -0
- package/dist/lib/application/files/js/src/app.module.js +10 -0
- package/dist/lib/application/files/js/src/app.service.js +8 -0
- package/dist/lib/application/files/js/src/main.js +9 -0
- package/dist/lib/application/files/js/test/app.e2e-spec.js +23 -0
- package/dist/lib/application/files/js/test/jest-e2e.json +5 -0
- package/dist/lib/application/files/ts/.prettierrc +4 -0
- package/dist/lib/application/files/ts/README.md +75 -0
- package/dist/lib/application/files/ts/nest-cli.json +5 -0
- package/dist/lib/application/files/ts/nodemon-debug.json +6 -0
- package/dist/lib/application/files/ts/nodemon.json +6 -0
- package/dist/lib/application/files/ts/package.json +58 -0
- package/dist/lib/application/files/ts/src/app.controller.spec.ts +22 -0
- package/dist/lib/application/files/ts/src/app.controller.ts +12 -0
- package/dist/lib/application/files/ts/src/app.module.ts +10 -0
- package/dist/lib/application/files/ts/src/app.service.ts +8 -0
- package/dist/lib/application/files/ts/src/main.ts +8 -0
- package/dist/lib/application/files/ts/test/app.e2e-spec.ts +23 -0
- package/dist/lib/application/files/ts/test/jest-e2e.json +9 -0
- package/dist/lib/application/files/ts/tsconfig.build.json +4 -0
- package/dist/lib/application/files/ts/tsconfig.json +14 -0
- package/dist/lib/application/files/ts/tslint.json +18 -0
- package/dist/lib/application/schema.json +49 -0
- package/dist/lib/class/class.factory.d.ts +3 -0
- package/dist/lib/class/class.factory.js +35 -0
- package/dist/lib/class/class.factory.test.ts +100 -0
- package/dist/lib/class/class.factory.ts +54 -0
- package/dist/lib/class/class.schema.d.ts +28 -0
- package/dist/lib/class/files/js/__name__.js +1 -0
- package/dist/lib/class/files/js/__name__.spec.js +7 -0
- package/dist/lib/class/files/ts/__name__.spec.ts +7 -0
- package/dist/lib/class/files/ts/__name__.ts +1 -0
- package/dist/lib/class/schema.json +39 -0
- package/dist/lib/client-app/angular/angular.factory.d.ts +3 -0
- package/dist/lib/client-app/angular/angular.factory.js +97 -0
- package/dist/lib/client-app/angular/angular.factory.ts +139 -0
- package/dist/lib/client-app/angular/angular.schema.d.ts +32 -0
- package/dist/lib/client-app/angular/files/angular.constants.ts +4 -0
- package/dist/lib/client-app/angular/files/angular.module.ts +41 -0
- package/dist/lib/client-app/angular/files/angular.providers.ts +27 -0
- package/dist/lib/client-app/angular/files/angular.utils.ts +19 -0
- package/dist/lib/client-app/angular/files/interfaces/angular-options.interface.ts +87 -0
- package/dist/lib/client-app/angular/files/loaders/abstract.loader.ts +16 -0
- package/dist/lib/client-app/angular/files/loaders/express.loader.ts +25 -0
- package/dist/lib/client-app/angular/files/loaders/fastify.loader.ts +34 -0
- package/dist/lib/client-app/angular/files/loaders/noop.loader.ts +12 -0
- package/dist/lib/client-app/angular/schema.json +24 -0
- package/dist/lib/component/component.factory.d.ts +3 -0
- package/dist/lib/component/component.factory.js +62 -0
- package/dist/lib/component/component.factory.test.ts +191 -0
- package/dist/lib/component/component.factory.ts +91 -0
- package/dist/lib/component/component.schema.d.ts +44 -0
- package/dist/lib/component/files/js/__name__.component.js +56 -0
- package/dist/lib/component/files/js/__name__.component.spec.js +31 -0
- package/dist/lib/component/files/ts/__name__.component.spec.ts +31 -0
- package/dist/lib/component/files/ts/__name__.component.ts +56 -0
- package/dist/lib/component/schema.json +47 -0
- package/dist/lib/configuration/configuration.factory.d.ts +3 -0
- package/dist/lib/configuration/configuration.factory.js +24 -0
- package/dist/lib/configuration/configuration.factory.test.ts +60 -0
- package/dist/lib/configuration/configuration.factory.ts +35 -0
- package/dist/lib/configuration/configuration.schema.d.ts +18 -0
- package/dist/lib/configuration/files/js/nest-cli.json +5 -0
- package/dist/lib/configuration/files/ts/nest-cli.json +5 -0
- package/dist/lib/controller/controller.factory.d.ts +3 -0
- package/dist/lib/controller/controller.factory.js +62 -0
- package/dist/lib/controller/controller.factory.test.ts +191 -0
- package/dist/lib/controller/controller.factory.ts +91 -0
- package/dist/lib/controller/controller.schema.d.ts +44 -0
- package/dist/lib/controller/files/js/__name__.controller.js +24 -0
- package/dist/lib/controller/files/js/__name__.controller.spec.js +61 -0
- package/dist/lib/controller/files/ts/__name__.controller.spec.ts +61 -0
- package/dist/lib/controller/files/ts/__name__.controller.ts +24 -0
- package/dist/lib/controller/schema.json +47 -0
- package/dist/lib/decorator/decorator.factory.d.ts +3 -0
- package/dist/lib/decorator/decorator.factory.js +32 -0
- package/dist/lib/decorator/decorator.factory.test.ts +111 -0
- package/dist/lib/decorator/decorator.factory.ts +48 -0
- package/dist/lib/decorator/decorator.schema.d.ts +24 -0
- package/dist/lib/decorator/files/js/__name__.decorator.js +3 -0
- package/dist/lib/decorator/files/ts/__name__.decorator.ts +3 -0
- package/dist/lib/decorator/schema.json +35 -0
- package/dist/lib/defaults.d.ts +6 -0
- package/dist/lib/defaults.js +9 -0
- package/dist/lib/defaults.ts +6 -0
- package/dist/lib/effect/effect.factory.d.ts +3 -0
- package/dist/lib/effect/effect.factory.js +62 -0
- package/dist/lib/effect/effect.factory.test.ts +190 -0
- package/dist/lib/effect/effect.factory.ts +91 -0
- package/dist/lib/effect/effect.schema.d.ts +44 -0
- package/dist/lib/effect/files/js/__name__.effect.js +11 -0
- package/dist/lib/effect/files/js/__name__.effect.spec.js +17 -0
- package/dist/lib/effect/files/ts/__name__.effect.spec.ts +17 -0
- package/dist/lib/effect/files/ts/__name__.effect.ts +11 -0
- package/dist/lib/effect/schema.json +39 -0
- package/dist/lib/filter/files/js/__name__.filter.js +6 -0
- package/dist/lib/filter/files/js/__name__.filter.spec.js +7 -0
- package/dist/lib/filter/files/ts/__name__.filter.spec.ts +7 -0
- package/dist/lib/filter/files/ts/__name__.filter.ts +6 -0
- package/dist/lib/filter/filter.factory.d.ts +3 -0
- package/dist/lib/filter/filter.factory.js +33 -0
- package/dist/lib/filter/filter.factory.test.ts +147 -0
- package/dist/lib/filter/filter.factory.ts +51 -0
- package/dist/lib/filter/filter.schema.d.ts +28 -0
- package/dist/lib/filter/schema.json +39 -0
- package/dist/lib/gateway/files/js/__name__.gateway.js +9 -0
- package/dist/lib/gateway/files/js/__name__.gateway.spec.js +18 -0
- package/dist/lib/gateway/files/ts/__name__.gateway.spec.ts +18 -0
- package/dist/lib/gateway/files/ts/__name__.gateway.ts +9 -0
- package/dist/lib/gateway/gateway.factory.d.ts +3 -0
- package/dist/lib/gateway/gateway.factory.js +61 -0
- package/dist/lib/gateway/gateway.factory.test.ts +147 -0
- package/dist/lib/gateway/gateway.factory.ts +92 -0
- package/dist/lib/gateway/gateway.schema.d.ts +36 -0
- package/dist/lib/gateway/schema.json +39 -0
- package/dist/lib/guard/files/js/__name__.guard.js +17 -0
- package/dist/lib/guard/files/js/__name__.guard.spec.js +7 -0
- package/dist/lib/guard/files/ts/__name__.guard.spec.ts +7 -0
- package/dist/lib/guard/files/ts/__name__.guard.ts +17 -0
- package/dist/lib/guard/guard.factory.d.ts +3 -0
- package/dist/lib/guard/guard.factory.js +33 -0
- package/dist/lib/guard/guard.factory.test.ts +156 -0
- package/dist/lib/guard/guard.factory.ts +51 -0
- package/dist/lib/guard/guard.schema.d.ts +28 -0
- package/dist/lib/guard/schema.json +39 -0
- package/dist/lib/interceptor/files/js/__name__.interceptor.js +18 -0
- package/dist/lib/interceptor/files/js/__name__.interceptor.spec.js +7 -0
- package/dist/lib/interceptor/files/ts/__name__.interceptor.spec.ts +7 -0
- package/dist/lib/interceptor/files/ts/__name__.interceptor.ts +19 -0
- package/dist/lib/interceptor/interceptor.factory.d.ts +3 -0
- package/dist/lib/interceptor/interceptor.factory.js +33 -0
- package/dist/lib/interceptor/interceptor.factory.test.ts +146 -0
- package/dist/lib/interceptor/interceptor.factory.ts +51 -0
- package/dist/lib/interceptor/interceptor.schema.d.ts +28 -0
- package/dist/lib/interceptor/schema.json +39 -0
- package/dist/lib/interface/files/__name__.interface.ts +1 -0
- package/dist/lib/interface/interface.factory.d.ts +3 -0
- package/dist/lib/interface/interface.factory.js +31 -0
- package/dist/lib/interface/interface.factory.test.ts +84 -0
- package/dist/lib/interface/interface.factory.ts +47 -0
- package/dist/lib/interface/interface.schema.d.ts +20 -0
- package/dist/lib/interface/schema.json +31 -0
- package/dist/lib/library/files/js/.babelrc +4 -0
- package/dist/lib/library/files/js/jsconfig.json +9 -0
- package/dist/lib/library/files/js/package.json +8 -0
- package/dist/lib/library/files/js/src/__name__.module.js +8 -0
- package/dist/lib/library/files/js/src/__name__.service.js +4 -0
- package/dist/lib/library/files/js/src/__name__.service.spec.js +18 -0
- package/dist/lib/library/files/js/src/index.js +2 -0
- package/dist/lib/library/files/ts/package.json +8 -0
- package/dist/lib/library/files/ts/src/__name__.module.ts +8 -0
- package/dist/lib/library/files/ts/src/__name__.service.spec.ts +18 -0
- package/dist/lib/library/files/ts/src/__name__.service.ts +4 -0
- package/dist/lib/library/files/ts/src/index.ts +2 -0
- package/dist/lib/library/files/ts/tsconfig.lib.json +5 -0
- package/dist/lib/library/files/ts/tslint.json +3 -0
- package/dist/lib/library/library.factory.d.ts +3 -0
- package/dist/lib/library/library.factory.js +97 -0
- package/dist/lib/library/library.factory.test.ts +68 -0
- package/dist/lib/library/library.factory.ts +158 -0
- package/dist/lib/library/library.schema.d.ts +24 -0
- package/dist/lib/library/schema.json +37 -0
- package/dist/lib/module/files/js/__name__.module.js +4 -0
- package/dist/lib/module/files/ts/__name__.module.ts +4 -0
- package/dist/lib/module/module.factory.d.ts +3 -0
- package/dist/lib/module/module.factory.js +54 -0
- package/dist/lib/module/module.factory.test.ts +165 -0
- package/dist/lib/module/module.factory.ts +79 -0
- package/dist/lib/module/module.schema.d.ts +36 -0
- package/dist/lib/module/schema.json +40 -0
- package/dist/lib/pipe/files/js/__name__.pipe.js +8 -0
- package/dist/lib/pipe/files/js/__name__.pipe.spec.js +7 -0
- package/dist/lib/pipe/files/ts/__name__.pipe.spec.ts +7 -0
- package/dist/lib/pipe/files/ts/__name__.pipe.ts +8 -0
- package/dist/lib/pipe/pipe.factory.d.ts +3 -0
- package/dist/lib/pipe/pipe.factory.js +33 -0
- package/dist/lib/pipe/pipe.factory.test.ts +141 -0
- package/dist/lib/pipe/pipe.factory.ts +51 -0
- package/dist/lib/pipe/pipe.schema.d.ts +28 -0
- package/dist/lib/pipe/schema.json +39 -0
- package/dist/lib/plugin/files/js/__name__.plugin.js +28 -0
- package/dist/lib/plugin/files/js/__name__.plugin.spec.js +7 -0
- package/dist/lib/plugin/files/ts/__name__.plugin.spec.ts +7 -0
- package/dist/lib/plugin/files/ts/__name__.plugin.ts +28 -0
- package/dist/lib/plugin/plugin.factory.d.ts +3 -0
- package/dist/lib/plugin/plugin.factory.js +61 -0
- package/dist/lib/plugin/plugin.factory.test.ts +191 -0
- package/dist/lib/plugin/plugin.factory.ts +91 -0
- package/dist/lib/plugin/plugin.schema.d.ts +44 -0
- package/dist/lib/plugin/schema.json +52 -0
- package/dist/lib/provider/files/js/__name__.js +4 -0
- package/dist/lib/provider/files/js/__name__.spec.js +17 -0
- package/dist/lib/provider/files/ts/__name__.spec.ts +17 -0
- package/dist/lib/provider/files/ts/__name__.ts +4 -0
- package/dist/lib/provider/provider.factory.d.ts +3 -0
- package/dist/lib/provider/provider.factory.js +59 -0
- package/dist/lib/provider/provider.factory.test.ts +151 -0
- package/dist/lib/provider/provider.factory.ts +89 -0
- package/dist/lib/provider/provider.schema.d.ts +44 -0
- package/dist/lib/provider/schema.json +39 -0
- package/dist/lib/resolver/files/js/__name__.resolver.js +4 -0
- package/dist/lib/resolver/files/js/__name__.resolver.spec.js +18 -0
- package/dist/lib/resolver/files/ts/__name__.resolver.spec.ts +18 -0
- package/dist/lib/resolver/files/ts/__name__.resolver.ts +4 -0
- package/dist/lib/resolver/resolver.factory.d.ts +3 -0
- package/dist/lib/resolver/resolver.factory.js +61 -0
- package/dist/lib/resolver/resolver.factory.test.ts +117 -0
- package/dist/lib/resolver/resolver.factory.ts +92 -0
- package/dist/lib/resolver/resolver.schema.d.ts +36 -0
- package/dist/lib/resolver/schema.json +39 -0
- package/dist/lib/service/files/js/__name__.service.js +4 -0
- package/dist/lib/service/files/js/__name__.service.spec.js +17 -0
- package/dist/lib/service/files/ts/__name__.service.spec.ts +17 -0
- package/dist/lib/service/files/ts/__name__.service.ts +4 -0
- package/dist/lib/service/schema.json +39 -0
- package/dist/lib/service/service.factory.d.ts +3 -0
- package/dist/lib/service/service.factory.js +62 -0
- package/dist/lib/service/service.factory.test.ts +190 -0
- package/dist/lib/service/service.factory.ts +91 -0
- package/dist/lib/service/service.schema.d.ts +44 -0
- package/dist/lib/type/files/js/__name__.type.js +10 -0
- package/dist/lib/type/files/ts/__name__.type.ts +10 -0
- package/dist/lib/type/schema.json +43 -0
- package/dist/lib/type/type.factory.d.ts +3 -0
- package/dist/lib/type/type.factory.js +61 -0
- package/dist/lib/type/type.factory.test.ts +191 -0
- package/dist/lib/type/type.factory.ts +91 -0
- package/dist/lib/type/type.schema.d.ts +44 -0
- package/dist/utils/metadata.manager.d.ts +13 -0
- package/dist/utils/metadata.manager.js +159 -0
- package/dist/utils/metadata.manager.ts +219 -0
- package/dist/utils/module-import.declarator.d.ts +11 -0
- package/dist/utils/module-import.declarator.js +37 -0
- package/dist/utils/module-import.declarator.ts +41 -0
- package/dist/utils/module-metadata.declarator.d.ts +4 -0
- package/dist/utils/module-metadata.declarator.js +12 -0
- package/dist/utils/module-metadata.declarator.ts +14 -0
- package/dist/utils/module.declarator.d.ts +22 -0
- package/dist/utils/module.declarator.js +29 -0
- package/dist/utils/module.declarator.ts +41 -0
- package/dist/utils/module.finder.d.ts +13 -0
- package/dist/utils/module.finder.js +24 -0
- package/dist/utils/module.finder.ts +32 -0
- package/dist/utils/name.parser.d.ts +13 -0
- package/dist/utils/name.parser.js +20 -0
- package/dist/utils/name.parser.ts +29 -0
- package/dist/utils/path.solver.d.ts +5 -0
- package/dist/utils/path.solver.js +15 -0
- package/dist/utils/path.solver.ts +17 -0
- package/dist/utils/source-root.helpers.d.ts +6 -0
- package/dist/utils/source-root.helpers.js +25 -0
- package/dist/utils/source-root.helpers.ts +30 -0
- package/package.json +44 -0
- package/src/lib/application/application.factory.test.ts +88 -0
- package/src/lib/application/application.factory.ts +54 -0
- package/src/lib/application/application.schema.d.ts +34 -0
- package/src/lib/application/files/js/.babelrc +4 -0
- package/src/lib/application/files/js/.prettierrc +4 -0
- package/src/lib/application/files/js/README.md +37 -0
- package/src/lib/application/files/js/index.js +3 -0
- package/src/lib/application/files/js/jsconfig.json +9 -0
- package/src/lib/application/files/js/nest-cli.json +5 -0
- package/src/lib/application/files/js/nodemon.json +6 -0
- package/src/lib/application/files/js/package.json +46 -0
- package/src/lib/application/files/js/src/app.controller.js +15 -0
- package/src/lib/application/files/js/src/app.controller.spec.js +22 -0
- package/src/lib/application/files/js/src/app.module.js +10 -0
- package/src/lib/application/files/js/src/app.service.js +8 -0
- package/src/lib/application/files/js/src/main.js +9 -0
- package/src/lib/application/files/js/test/app.e2e-spec.js +23 -0
- package/src/lib/application/files/js/test/jest-e2e.json +5 -0
- package/src/lib/application/files/ts/.prettierrc +4 -0
- package/src/lib/application/files/ts/README.md +75 -0
- package/src/lib/application/files/ts/nest-cli.json +5 -0
- package/src/lib/application/files/ts/nodemon-debug.json +6 -0
- package/src/lib/application/files/ts/nodemon.json +6 -0
- package/src/lib/application/files/ts/package.json +58 -0
- package/src/lib/application/files/ts/src/app.controller.spec.ts +22 -0
- package/src/lib/application/files/ts/src/app.controller.ts +12 -0
- package/src/lib/application/files/ts/src/app.module.ts +10 -0
- package/src/lib/application/files/ts/src/app.service.ts +8 -0
- package/src/lib/application/files/ts/src/main.ts +8 -0
- package/src/lib/application/files/ts/test/app.e2e-spec.ts +23 -0
- package/src/lib/application/files/ts/test/jest-e2e.json +9 -0
- package/src/lib/application/files/ts/tsconfig.build.json +4 -0
- package/src/lib/application/files/ts/tsconfig.json +14 -0
- package/src/lib/application/files/ts/tslint.json +18 -0
- package/src/lib/application/schema.json +49 -0
- package/src/lib/class/class.factory.test.ts +100 -0
- package/src/lib/class/class.factory.ts +54 -0
- package/src/lib/class/class.schema.d.ts +28 -0
- package/src/lib/class/files/js/__name__.js +1 -0
- package/src/lib/class/files/js/__name__.spec.js +7 -0
- package/src/lib/class/files/ts/__name__.spec.ts +7 -0
- package/src/lib/class/files/ts/__name__.ts +1 -0
- package/src/lib/class/schema.json +39 -0
- package/src/lib/client-app/angular/angular.factory.ts +139 -0
- package/src/lib/client-app/angular/angular.schema.d.ts +32 -0
- package/src/lib/client-app/angular/files/angular.constants.ts +4 -0
- package/src/lib/client-app/angular/files/angular.module.ts +41 -0
- package/src/lib/client-app/angular/files/angular.providers.ts +27 -0
- package/src/lib/client-app/angular/files/angular.utils.ts +19 -0
- package/src/lib/client-app/angular/files/interfaces/angular-options.interface.ts +87 -0
- package/src/lib/client-app/angular/files/loaders/abstract.loader.ts +16 -0
- package/src/lib/client-app/angular/files/loaders/express.loader.ts +25 -0
- package/src/lib/client-app/angular/files/loaders/fastify.loader.ts +34 -0
- package/src/lib/client-app/angular/files/loaders/noop.loader.ts +12 -0
- package/src/lib/client-app/angular/schema.json +24 -0
- package/src/lib/component/component.factory.test.ts +191 -0
- package/src/lib/component/component.factory.ts +91 -0
- package/src/lib/component/component.schema.d.ts +44 -0
- package/src/lib/component/files/js/__name__.component.js +56 -0
- package/src/lib/component/files/js/__name__.component.spec.js +31 -0
- package/src/lib/component/files/ts/__name__.component.spec.ts +31 -0
- package/src/lib/component/files/ts/__name__.component.ts +56 -0
- package/src/lib/component/schema.json +47 -0
- package/src/lib/configuration/configuration.factory.test.ts +60 -0
- package/src/lib/configuration/configuration.factory.ts +35 -0
- package/src/lib/configuration/configuration.schema.d.ts +18 -0
- package/src/lib/configuration/files/js/nest-cli.json +5 -0
- package/src/lib/configuration/files/ts/nest-cli.json +5 -0
- package/src/lib/controller/controller.factory.test.ts +191 -0
- package/src/lib/controller/controller.factory.ts +91 -0
- package/src/lib/controller/controller.schema.d.ts +44 -0
- package/src/lib/controller/files/js/__name__.controller.js +24 -0
- package/src/lib/controller/files/js/__name__.controller.spec.js +61 -0
- package/src/lib/controller/files/ts/__name__.controller.spec.ts +61 -0
- package/src/lib/controller/files/ts/__name__.controller.ts +24 -0
- package/src/lib/controller/schema.json +47 -0
- package/src/lib/decorator/decorator.factory.test.ts +111 -0
- package/src/lib/decorator/decorator.factory.ts +48 -0
- package/src/lib/decorator/decorator.schema.d.ts +24 -0
- package/src/lib/decorator/files/js/__name__.decorator.js +3 -0
- package/src/lib/decorator/files/ts/__name__.decorator.ts +3 -0
- package/src/lib/decorator/schema.json +35 -0
- package/src/lib/defaults.ts +6 -0
- package/src/lib/effect/effect.factory.test.ts +190 -0
- package/src/lib/effect/effect.factory.ts +91 -0
- package/src/lib/effect/effect.schema.d.ts +44 -0
- package/src/lib/effect/files/js/__name__.effect.js +11 -0
- package/src/lib/effect/files/js/__name__.effect.spec.js +17 -0
- package/src/lib/effect/files/ts/__name__.effect.spec.ts +17 -0
- package/src/lib/effect/files/ts/__name__.effect.ts +11 -0
- package/src/lib/effect/schema.json +39 -0
- package/src/lib/filter/files/js/__name__.filter.js +6 -0
- package/src/lib/filter/files/js/__name__.filter.spec.js +7 -0
- package/src/lib/filter/files/ts/__name__.filter.spec.ts +7 -0
- package/src/lib/filter/files/ts/__name__.filter.ts +6 -0
- package/src/lib/filter/filter.factory.test.ts +147 -0
- package/src/lib/filter/filter.factory.ts +51 -0
- package/src/lib/filter/filter.schema.d.ts +28 -0
- package/src/lib/filter/schema.json +39 -0
- package/src/lib/gateway/files/js/__name__.gateway.js +9 -0
- package/src/lib/gateway/files/js/__name__.gateway.spec.js +18 -0
- package/src/lib/gateway/files/ts/__name__.gateway.spec.ts +18 -0
- package/src/lib/gateway/files/ts/__name__.gateway.ts +9 -0
- package/src/lib/gateway/gateway.factory.test.ts +147 -0
- package/src/lib/gateway/gateway.factory.ts +92 -0
- package/src/lib/gateway/gateway.schema.d.ts +36 -0
- package/src/lib/gateway/schema.json +39 -0
- package/src/lib/guard/files/js/__name__.guard.js +17 -0
- package/src/lib/guard/files/js/__name__.guard.spec.js +7 -0
- package/src/lib/guard/files/ts/__name__.guard.spec.ts +7 -0
- package/src/lib/guard/files/ts/__name__.guard.ts +17 -0
- package/src/lib/guard/guard.factory.test.ts +156 -0
- package/src/lib/guard/guard.factory.ts +51 -0
- package/src/lib/guard/guard.schema.d.ts +28 -0
- package/src/lib/guard/schema.json +39 -0
- package/src/lib/interceptor/files/js/__name__.interceptor.js +18 -0
- package/src/lib/interceptor/files/js/__name__.interceptor.spec.js +7 -0
- package/src/lib/interceptor/files/ts/__name__.interceptor.spec.ts +7 -0
- package/src/lib/interceptor/files/ts/__name__.interceptor.ts +19 -0
- package/src/lib/interceptor/interceptor.factory.test.ts +146 -0
- package/src/lib/interceptor/interceptor.factory.ts +51 -0
- package/src/lib/interceptor/interceptor.schema.d.ts +28 -0
- package/src/lib/interceptor/schema.json +39 -0
- package/src/lib/interface/files/__name__.interface.ts +1 -0
- package/src/lib/interface/interface.factory.test.ts +84 -0
- package/src/lib/interface/interface.factory.ts +47 -0
- package/src/lib/interface/interface.schema.d.ts +20 -0
- package/src/lib/interface/schema.json +31 -0
- package/src/lib/library/files/js/.babelrc +4 -0
- package/src/lib/library/files/js/jsconfig.json +9 -0
- package/src/lib/library/files/js/package.json +8 -0
- package/src/lib/library/files/js/src/__name__.module.js +8 -0
- package/src/lib/library/files/js/src/__name__.service.js +4 -0
- package/src/lib/library/files/js/src/__name__.service.spec.js +18 -0
- package/src/lib/library/files/js/src/index.js +2 -0
- package/src/lib/library/files/ts/package.json +8 -0
- package/src/lib/library/files/ts/src/__name__.module.ts +8 -0
- package/src/lib/library/files/ts/src/__name__.service.spec.ts +18 -0
- package/src/lib/library/files/ts/src/__name__.service.ts +4 -0
- package/src/lib/library/files/ts/src/index.ts +2 -0
- package/src/lib/library/files/ts/tsconfig.lib.json +5 -0
- package/src/lib/library/files/ts/tslint.json +3 -0
- package/src/lib/library/library.factory.test.ts +68 -0
- package/src/lib/library/library.factory.ts +158 -0
- package/src/lib/library/library.schema.d.ts +24 -0
- package/src/lib/library/schema.json +37 -0
- package/src/lib/module/files/js/__name__.module.js +4 -0
- package/src/lib/module/files/ts/__name__.module.ts +4 -0
- package/src/lib/module/module.factory.test.ts +165 -0
- package/src/lib/module/module.factory.ts +79 -0
- package/src/lib/module/module.schema.d.ts +36 -0
- package/src/lib/module/schema.json +40 -0
- package/src/lib/pipe/files/js/__name__.pipe.js +8 -0
- package/src/lib/pipe/files/js/__name__.pipe.spec.js +7 -0
- package/src/lib/pipe/files/ts/__name__.pipe.spec.ts +7 -0
- package/src/lib/pipe/files/ts/__name__.pipe.ts +8 -0
- package/src/lib/pipe/pipe.factory.test.ts +141 -0
- package/src/lib/pipe/pipe.factory.ts +51 -0
- package/src/lib/pipe/pipe.schema.d.ts +28 -0
- package/src/lib/pipe/schema.json +39 -0
- package/src/lib/plugin/files/js/__name__.plugin.js +28 -0
- package/src/lib/plugin/files/js/__name__.plugin.spec.js +7 -0
- package/src/lib/plugin/files/ts/__name__.plugin.spec.ts +7 -0
- package/src/lib/plugin/files/ts/__name__.plugin.ts +28 -0
- package/src/lib/plugin/plugin.factory.d.ts +3 -0
- package/src/lib/plugin/plugin.factory.js +61 -0
- package/src/lib/plugin/plugin.factory.test.ts +191 -0
- package/src/lib/plugin/plugin.factory.ts +91 -0
- package/src/lib/plugin/plugin.schema.d.ts +44 -0
- package/src/lib/plugin/schema.json +52 -0
- package/src/lib/provider/files/js/__name__.js +4 -0
- package/src/lib/provider/files/js/__name__.spec.js +17 -0
- package/src/lib/provider/files/ts/__name__.spec.ts +17 -0
- package/src/lib/provider/files/ts/__name__.ts +4 -0
- package/src/lib/provider/provider.factory.d.ts +3 -0
- package/src/lib/provider/provider.factory.js +59 -0
- package/src/lib/provider/provider.factory.test.ts +151 -0
- package/src/lib/provider/provider.factory.ts +89 -0
- package/src/lib/provider/provider.schema.d.ts +44 -0
- package/src/lib/provider/schema.json +39 -0
- package/src/lib/resolver/files/js/__name__.resolver.js +4 -0
- package/src/lib/resolver/files/js/__name__.resolver.spec.js +18 -0
- package/src/lib/resolver/files/ts/__name__.resolver.spec.ts +18 -0
- package/src/lib/resolver/files/ts/__name__.resolver.ts +4 -0
- package/src/lib/resolver/resolver.factory.test.ts +117 -0
- package/src/lib/resolver/resolver.factory.ts +92 -0
- package/src/lib/resolver/resolver.schema.d.ts +36 -0
- package/src/lib/resolver/schema.json +39 -0
- package/src/lib/service/files/js/__name__.service.js +4 -0
- package/src/lib/service/files/js/__name__.service.spec.js +17 -0
- package/src/lib/service/files/ts/__name__.service.spec.ts +17 -0
- package/src/lib/service/files/ts/__name__.service.ts +4 -0
- package/src/lib/service/schema.json +39 -0
- package/src/lib/service/service.factory.test.ts +190 -0
- package/src/lib/service/service.factory.ts +91 -0
- package/src/lib/service/service.schema.d.ts +44 -0
- package/src/lib/type/files/js/__name__.type.js +10 -0
- package/src/lib/type/files/ts/__name__.type.ts +10 -0
- package/src/lib/type/schema.json +43 -0
- package/src/lib/type/type.factory.d.ts +3 -0
- package/src/lib/type/type.factory.js +61 -0
- package/src/lib/type/type.factory.test.ts +191 -0
- package/src/lib/type/type.factory.ts +91 -0
- package/src/lib/type/type.schema.d.ts +44 -0
- package/src/utils/metadata.manager.ts +219 -0
- package/src/utils/module-import.declarator.ts +41 -0
- package/src/utils/module-metadata.declarator.ts +14 -0
- package/src/utils/module.declarator.ts +41 -0
- package/src/utils/module.finder.ts +32 -0
- package/src/utils/name.parser.ts +29 -0
- package/src/utils/path.solver.ts +17 -0
- package/src/utils/source-root.helpers.ts +30 -0
- package/tsconfig.json +26 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { join, Path, strings } from '@angular-devkit/core';
|
|
2
|
+
import {
|
|
3
|
+
apply,
|
|
4
|
+
branchAndMerge,
|
|
5
|
+
chain,
|
|
6
|
+
filter,
|
|
7
|
+
mergeWith,
|
|
8
|
+
move,
|
|
9
|
+
noop,
|
|
10
|
+
Rule,
|
|
11
|
+
SchematicContext,
|
|
12
|
+
template,
|
|
13
|
+
Tree,
|
|
14
|
+
url,
|
|
15
|
+
} from '@angular-devkit/schematics';
|
|
16
|
+
import {
|
|
17
|
+
DeclarationOptions,
|
|
18
|
+
ModuleDeclarator,
|
|
19
|
+
} from '../../utils/module.declarator';
|
|
20
|
+
import { ModuleFinder } from '../../utils/module.finder';
|
|
21
|
+
import { Location, NameParser } from '../../utils/name.parser';
|
|
22
|
+
import { mergeSourceRoot } from '../../utils/source-root.helpers';
|
|
23
|
+
import { DEFAULT_LANGUAGE } from '../defaults';
|
|
24
|
+
import { ControllerOptions } from './component.schema';
|
|
25
|
+
|
|
26
|
+
const ELEMENT_METADATA = 'components';
|
|
27
|
+
const ELEMENT_TYPE = 'component';
|
|
28
|
+
|
|
29
|
+
export function main(options: ControllerOptions): Rule {
|
|
30
|
+
options = transform(options);
|
|
31
|
+
return (tree: Tree, context: SchematicContext) => {
|
|
32
|
+
return branchAndMerge(
|
|
33
|
+
chain([
|
|
34
|
+
mergeSourceRoot(options),
|
|
35
|
+
mergeWith(generate(options)),
|
|
36
|
+
addDeclarationToModule(options),
|
|
37
|
+
]),
|
|
38
|
+
)(tree, context);
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function transform(source: ControllerOptions): ControllerOptions {
|
|
43
|
+
const target: ControllerOptions = Object.assign({}, source);
|
|
44
|
+
target.metadata = ELEMENT_METADATA;
|
|
45
|
+
target.type = ELEMENT_TYPE;
|
|
46
|
+
|
|
47
|
+
const location: Location = new NameParser().parse(target);
|
|
48
|
+
target.name = strings.dasherize(location.name);
|
|
49
|
+
target.path = strings.dasherize(location.path);
|
|
50
|
+
target.language =
|
|
51
|
+
target.language !== undefined ? target.language : DEFAULT_LANGUAGE;
|
|
52
|
+
|
|
53
|
+
target.path = target.flat
|
|
54
|
+
? target.path
|
|
55
|
+
: join(target.path as Path, target.name);
|
|
56
|
+
return target;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function generate(options: ControllerOptions) {
|
|
60
|
+
return (context: SchematicContext) =>
|
|
61
|
+
apply(url(join('./files' as Path, options.language)), [
|
|
62
|
+
options.spec ? noop() : filter(path => !path.endsWith('.spec.ts')),
|
|
63
|
+
template({
|
|
64
|
+
...strings,
|
|
65
|
+
...options,
|
|
66
|
+
}),
|
|
67
|
+
move(options.path),
|
|
68
|
+
])(context);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function addDeclarationToModule(options: ControllerOptions): Rule {
|
|
72
|
+
return (tree: Tree) => {
|
|
73
|
+
if (options.skipImport !== undefined && options.skipImport) {
|
|
74
|
+
return tree;
|
|
75
|
+
}
|
|
76
|
+
options.module = new ModuleFinder(tree).find({
|
|
77
|
+
name: options.name,
|
|
78
|
+
path: options.path as Path,
|
|
79
|
+
});
|
|
80
|
+
if (!options.module) {
|
|
81
|
+
return tree;
|
|
82
|
+
}
|
|
83
|
+
const content = tree.read(options.module).toString();
|
|
84
|
+
const declarator: ModuleDeclarator = new ModuleDeclarator();
|
|
85
|
+
tree.overwrite(
|
|
86
|
+
options.module,
|
|
87
|
+
declarator.declare(content, options as DeclarationOptions),
|
|
88
|
+
);
|
|
89
|
+
return tree;
|
|
90
|
+
};
|
|
91
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Path } from '@angular-devkit/core';
|
|
2
|
+
|
|
3
|
+
export interface ControllerOptions {
|
|
4
|
+
/**
|
|
5
|
+
* The name of the controller.
|
|
6
|
+
*/
|
|
7
|
+
name: string;
|
|
8
|
+
/**
|
|
9
|
+
* The path to create the controller.
|
|
10
|
+
*/
|
|
11
|
+
path?: string | Path;
|
|
12
|
+
/**
|
|
13
|
+
* The path to insert the controller declaration.
|
|
14
|
+
*/
|
|
15
|
+
module?: Path;
|
|
16
|
+
/**
|
|
17
|
+
* Directive to insert declaration in module.
|
|
18
|
+
*/
|
|
19
|
+
skipImport?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Metadata name affected by declaration insertion.
|
|
22
|
+
*/
|
|
23
|
+
metadata?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Nest element type name
|
|
26
|
+
*/
|
|
27
|
+
type?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Application language.
|
|
30
|
+
*/
|
|
31
|
+
language?: string;
|
|
32
|
+
/**
|
|
33
|
+
* The source root path
|
|
34
|
+
*/
|
|
35
|
+
sourceRoot?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Specifies if a spec file is generated.
|
|
38
|
+
*/
|
|
39
|
+
spec?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Flag to indicate if a directory is created.
|
|
42
|
+
*/
|
|
43
|
+
flat?: boolean;
|
|
44
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import {
|
|
2
|
+
html,
|
|
3
|
+
Component,
|
|
4
|
+
async,
|
|
5
|
+
LitElement,
|
|
6
|
+
property,
|
|
7
|
+
OnInit,
|
|
8
|
+
OnDestroy,
|
|
9
|
+
OnUpdate,
|
|
10
|
+
queryAll
|
|
11
|
+
} from '@rxdi/lit-html';
|
|
12
|
+
import { timer } from 'rxjs';
|
|
13
|
+
import { map } from 'rxjs/operators';
|
|
14
|
+
import { RouteParams } from '@rxdi/router';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @customElement '<%= dasherize(name) %>-component'
|
|
18
|
+
*/
|
|
19
|
+
@Component({
|
|
20
|
+
selector: '<%= dasherize(name) %>-component',
|
|
21
|
+
template(this: <%= classify(name) %>Component) {
|
|
22
|
+
return html`
|
|
23
|
+
<header>
|
|
24
|
+
<h1>${this.name}</h1>
|
|
25
|
+
</header>
|
|
26
|
+
${async(this.timer)} ${JSON.stringify(this.params)}
|
|
27
|
+
<div>
|
|
28
|
+
1
|
|
29
|
+
</div>
|
|
30
|
+
<div>
|
|
31
|
+
2
|
|
32
|
+
</div>
|
|
33
|
+
`;
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
export class <%= classify(name) %>Component extends LitElement implements OnInit, OnDestroy, OnUpdate {
|
|
37
|
+
@property() private name: string;
|
|
38
|
+
|
|
39
|
+
@RouteParams() private params: any;
|
|
40
|
+
|
|
41
|
+
@queryAll('div') private divs: HTMLElement[];
|
|
42
|
+
|
|
43
|
+
private timer = timer(1, 1000).pipe(map(v => v));
|
|
44
|
+
|
|
45
|
+
OnInit() {
|
|
46
|
+
console.log('<%= classify(name) %>Component component init');
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
OnDestroy() {
|
|
50
|
+
console.log('<%= classify(name) %>Component component destroyed');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
OnUpdate() {
|
|
54
|
+
console.log('<%= classify(name) %>Component component updated');
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Container, createTestBed } from '@rxdi/core';
|
|
2
|
+
import { <%= classify(name) %>Component } from './<%= name %>.component';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
describe('<%= classify(name) %>Component', () => {
|
|
6
|
+
beforeAll(async () => {
|
|
7
|
+
await createTestBed({
|
|
8
|
+
components: [<%= classify(name) %>Component]
|
|
9
|
+
}).toPromise();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
afterEach(() => {
|
|
13
|
+
// The jsdom instance is shared across test cases in a single file so reset the DOM
|
|
14
|
+
while (document.body.firstChild) {
|
|
15
|
+
document.body.removeChild(document.body.firstChild);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('should be defined', done => {
|
|
20
|
+
expect(Container.has(<%= classify(name) %>Component)).toBeTruthy();
|
|
21
|
+
done();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('displays greeting', () => {
|
|
25
|
+
const element = Container.get(<%= classify(name) %>Component);
|
|
26
|
+
element['render']();
|
|
27
|
+
document.body.appendChild(element);
|
|
28
|
+
const div = document.querySelector('<%= dasherize(name) %>-component');
|
|
29
|
+
expect(div.textContent).toBe('');
|
|
30
|
+
});
|
|
31
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Container, createTestBed } from '@rxdi/core';
|
|
2
|
+
import { <%= classify(name) %>Component } from './<%= name %>.component';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
describe('<%= classify(name) %>Component', () => {
|
|
6
|
+
beforeAll(async () => {
|
|
7
|
+
await createTestBed({
|
|
8
|
+
components: [<%= classify(name) %>Component]
|
|
9
|
+
}).toPromise();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
afterEach(() => {
|
|
13
|
+
// The jsdom instance is shared across test cases in a single file so reset the DOM
|
|
14
|
+
while (document.body.firstChild) {
|
|
15
|
+
document.body.removeChild(document.body.firstChild);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('should be defined', done => {
|
|
20
|
+
expect(Container.has(<%= classify(name) %>Component)).toBeTruthy();
|
|
21
|
+
done();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('displays greeting', () => {
|
|
25
|
+
const element = Container.get(<%= classify(name) %>Component);
|
|
26
|
+
element['render']();
|
|
27
|
+
document.body.appendChild(element);
|
|
28
|
+
const div = document.querySelector('<%= dasherize(name) %>-component');
|
|
29
|
+
expect(div.textContent).toBe('');
|
|
30
|
+
});
|
|
31
|
+
});
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import {
|
|
2
|
+
html,
|
|
3
|
+
Component,
|
|
4
|
+
async,
|
|
5
|
+
LitElement,
|
|
6
|
+
property,
|
|
7
|
+
OnInit,
|
|
8
|
+
OnDestroy,
|
|
9
|
+
OnUpdate,
|
|
10
|
+
queryAll
|
|
11
|
+
} from '@rxdi/lit-html';
|
|
12
|
+
import { timer } from 'rxjs';
|
|
13
|
+
import { map } from 'rxjs/operators';
|
|
14
|
+
import { RouteParams } from '@rxdi/router';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @customElement '<%= dasherize(name) %>-component'
|
|
18
|
+
*/
|
|
19
|
+
@Component({
|
|
20
|
+
selector: '<%= dasherize(name) %>-component',
|
|
21
|
+
template(this: <%= classify(name) %>Component) {
|
|
22
|
+
return html`
|
|
23
|
+
<header>
|
|
24
|
+
<h1>${this.name}</h1>
|
|
25
|
+
</header>
|
|
26
|
+
${async(this.timer)} ${JSON.stringify(this.params)}
|
|
27
|
+
<div>
|
|
28
|
+
1
|
|
29
|
+
</div>
|
|
30
|
+
<div>
|
|
31
|
+
2
|
|
32
|
+
</div>
|
|
33
|
+
`;
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
export class <%= classify(name) %>Component extends LitElement implements OnInit, OnDestroy, OnUpdate {
|
|
37
|
+
@property() private name: string;
|
|
38
|
+
|
|
39
|
+
@RouteParams() private params: any;
|
|
40
|
+
|
|
41
|
+
@queryAll('div') private divs: HTMLElement[];
|
|
42
|
+
|
|
43
|
+
private timer = timer(1, 1000).pipe(map(v => v));
|
|
44
|
+
|
|
45
|
+
OnInit() {
|
|
46
|
+
console.log('<%= classify(name) %>Component component init');
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
OnDestroy() {
|
|
50
|
+
console.log('<%= classify(name) %>Component component destroyed');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
OnUpdate() {
|
|
54
|
+
console.log('<%= classify(name) %>Component component updated');
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"id": "SchematicsNestController",
|
|
4
|
+
"title": "@rxdi/core Component Options Schema",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"name": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "The name of the controller.",
|
|
10
|
+
"$default": {
|
|
11
|
+
"$source": "argv",
|
|
12
|
+
"index": 0
|
|
13
|
+
},
|
|
14
|
+
"x-prompt": "What name would you like to use for the controller?"
|
|
15
|
+
},
|
|
16
|
+
"path": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"format": "path",
|
|
19
|
+
"description": "The path to create the controller."
|
|
20
|
+
},
|
|
21
|
+
"language": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"description": "Nest controller language (ts/js)."
|
|
24
|
+
},
|
|
25
|
+
"sourceRoot": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"description": "Nest controller source root directory."
|
|
28
|
+
},
|
|
29
|
+
"skipImport": {
|
|
30
|
+
"description": "Flag to skip the module import.",
|
|
31
|
+
"default": false
|
|
32
|
+
},
|
|
33
|
+
"module": {
|
|
34
|
+
"type": "string",
|
|
35
|
+
"description": "Allows specification of the declaring module."
|
|
36
|
+
},
|
|
37
|
+
"flat": {
|
|
38
|
+
"default": false,
|
|
39
|
+
"description": "Flag to indicate if a directory is created."
|
|
40
|
+
},
|
|
41
|
+
"spec": {
|
|
42
|
+
"default": true,
|
|
43
|
+
"description": "Specifies if a spec file is generated."
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"required": ["name"]
|
|
47
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SchematicTestRunner,
|
|
3
|
+
UnitTestTree,
|
|
4
|
+
} from '@angular-devkit/schematics/testing';
|
|
5
|
+
import * as path from 'path';
|
|
6
|
+
import { ConfigurationOptions } from './configuration.schema';
|
|
7
|
+
|
|
8
|
+
describe('Configuration Factory', () => {
|
|
9
|
+
const runner: SchematicTestRunner = new SchematicTestRunner(
|
|
10
|
+
'.',
|
|
11
|
+
path.join(process.cwd(), 'src/collection.json'),
|
|
12
|
+
);
|
|
13
|
+
it('should manage a default configuation', () => {
|
|
14
|
+
const options: ConfigurationOptions = {
|
|
15
|
+
project: 'project',
|
|
16
|
+
};
|
|
17
|
+
const tree: UnitTestTree = runner.runSchematic('configuration', options);
|
|
18
|
+
const files: string[] = tree.files;
|
|
19
|
+
expect(
|
|
20
|
+
files.find(filename => filename === '/project/nest-cli.json'),
|
|
21
|
+
).not.toBeUndefined();
|
|
22
|
+
expect(JSON.parse(tree.readContent('/project/nest-cli.json'))).toEqual({
|
|
23
|
+
language: 'ts',
|
|
24
|
+
collection: '@nestjs/schematics',
|
|
25
|
+
sourceRoot: 'src',
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
it('should manage provided language input', () => {
|
|
29
|
+
const options: ConfigurationOptions = {
|
|
30
|
+
project: 'project',
|
|
31
|
+
language: 'js',
|
|
32
|
+
};
|
|
33
|
+
const tree: UnitTestTree = runner.runSchematic('configuration', options);
|
|
34
|
+
const files: string[] = tree.files;
|
|
35
|
+
expect(
|
|
36
|
+
files.find(filename => filename === '/project/nest-cli.json'),
|
|
37
|
+
).not.toBeUndefined();
|
|
38
|
+
expect(JSON.parse(tree.readContent('/project/nest-cli.json'))).toEqual({
|
|
39
|
+
language: 'js',
|
|
40
|
+
collection: '@nestjs/schematics',
|
|
41
|
+
sourceRoot: 'src',
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
it('should manage provided collection input', () => {
|
|
45
|
+
const options: ConfigurationOptions = {
|
|
46
|
+
project: 'project',
|
|
47
|
+
collection: 'foo',
|
|
48
|
+
};
|
|
49
|
+
const tree: UnitTestTree = runner.runSchematic('configuration', options);
|
|
50
|
+
const files: string[] = tree.files;
|
|
51
|
+
expect(
|
|
52
|
+
files.find(filename => filename === '/project/nest-cli.json'),
|
|
53
|
+
).not.toBeUndefined();
|
|
54
|
+
expect(JSON.parse(tree.readContent('/project/nest-cli.json'))).toEqual({
|
|
55
|
+
language: 'ts',
|
|
56
|
+
collection: 'foo',
|
|
57
|
+
sourceRoot: 'src',
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { join, Path, strings } from '@angular-devkit/core';
|
|
2
|
+
import {
|
|
3
|
+
apply,
|
|
4
|
+
mergeWith,
|
|
5
|
+
move,
|
|
6
|
+
Rule,
|
|
7
|
+
Source,
|
|
8
|
+
template,
|
|
9
|
+
url,
|
|
10
|
+
} from '@angular-devkit/schematics';
|
|
11
|
+
import { DEFAULT_LANGUAGE } from '../defaults';
|
|
12
|
+
import { ConfigurationOptions } from './configuration.schema';
|
|
13
|
+
|
|
14
|
+
export function main(options: ConfigurationOptions): Rule {
|
|
15
|
+
return mergeWith(generate(transform(options)));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function transform(options: ConfigurationOptions): ConfigurationOptions {
|
|
19
|
+
const target: ConfigurationOptions = Object.assign({}, options);
|
|
20
|
+
target.language =
|
|
21
|
+
target.language !== undefined ? target.language : DEFAULT_LANGUAGE;
|
|
22
|
+
target.collection =
|
|
23
|
+
target.collection !== undefined ? target.collection : '@nestjs/schematics';
|
|
24
|
+
return target;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function generate(options: ConfigurationOptions): Source {
|
|
28
|
+
return apply(url(join('./files' as Path, options.language)), [
|
|
29
|
+
template({
|
|
30
|
+
...strings,
|
|
31
|
+
...options,
|
|
32
|
+
}),
|
|
33
|
+
move(options.project),
|
|
34
|
+
]);
|
|
35
|
+
}
|