@feathersjs/cli 5.0.0-pre.29 → 5.0.0-pre.31

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 (163) hide show
  1. package/CHANGELOG.md +30 -37
  2. package/bin/feathers +3 -6
  3. package/lib/app/index.js +33 -10
  4. package/lib/app/index.js.map +1 -1
  5. package/lib/app/index.ts +88 -51
  6. package/lib/app/templates/app.test.tpl.js +1 -1
  7. package/lib/app/templates/app.test.tpl.js.map +1 -1
  8. package/lib/app/templates/app.test.tpl.ts +1 -2
  9. package/lib/app/templates/app.tpl.js +7 -7
  10. package/lib/app/templates/app.tpl.js.map +1 -1
  11. package/lib/app/templates/app.tpl.ts +7 -9
  12. package/lib/app/templates/channels.tpl.js +1 -1
  13. package/lib/app/templates/channels.tpl.js.map +1 -1
  14. package/lib/app/templates/channels.tpl.ts +1 -2
  15. package/lib/app/templates/{configuration.tpl.d.ts → client.test.tpl.d.ts} +0 -0
  16. package/lib/app/templates/client.test.tpl.js +27 -0
  17. package/lib/app/templates/client.test.tpl.js.map +1 -0
  18. package/lib/app/templates/client.test.tpl.ts +26 -0
  19. package/lib/app/templates/client.tpl.js +3 -3
  20. package/lib/app/templates/client.tpl.js.map +1 -1
  21. package/lib/app/templates/client.tpl.ts +3 -4
  22. package/lib/app/templates/declarations.tpl.js +3 -3
  23. package/lib/app/templates/declarations.tpl.js.map +1 -1
  24. package/lib/app/templates/declarations.tpl.ts +5 -4
  25. package/lib/app/templates/index.html.tpl.js +12 -52
  26. package/lib/app/templates/index.html.tpl.js.map +1 -1
  27. package/lib/app/templates/index.html.tpl.ts +12 -53
  28. package/lib/app/templates/index.tpl.js +1 -1
  29. package/lib/app/templates/index.tpl.js.map +1 -1
  30. package/lib/app/templates/index.tpl.ts +1 -2
  31. package/lib/app/templates/logger.tpl.js +9 -3
  32. package/lib/app/templates/logger.tpl.js.map +1 -1
  33. package/lib/app/templates/logger.tpl.ts +10 -4
  34. package/lib/app/templates/package.json.tpl.js +4 -3
  35. package/lib/app/templates/package.json.tpl.js.map +1 -1
  36. package/lib/app/templates/package.json.tpl.ts +5 -3
  37. package/lib/app/templates/readme.md.tpl.js +11 -7
  38. package/lib/app/templates/readme.md.tpl.js.map +1 -1
  39. package/lib/app/templates/readme.md.tpl.ts +15 -8
  40. package/lib/app/templates/schemas.tpl.d.ts +2 -0
  41. package/lib/app/templates/schemas.tpl.js +75 -0
  42. package/lib/app/templates/schemas.tpl.js.map +1 -0
  43. package/lib/app/templates/schemas.tpl.ts +89 -0
  44. package/lib/app/templates/services.tpl.js +1 -1
  45. package/lib/app/templates/services.tpl.js.map +1 -1
  46. package/lib/app/templates/services.tpl.ts +1 -2
  47. package/lib/authentication/index.d.ts +5 -3
  48. package/lib/authentication/index.js +12 -3
  49. package/lib/authentication/index.js.map +1 -1
  50. package/lib/authentication/index.ts +23 -5
  51. package/lib/authentication/templates/authentication.tpl.js +1 -1
  52. package/lib/authentication/templates/authentication.tpl.js.map +1 -1
  53. package/lib/authentication/templates/authentication.tpl.ts +3 -2
  54. package/lib/authentication/templates/{test.tpl.d.ts → client.test.tpl.d.ts} +0 -0
  55. package/lib/authentication/templates/client.test.tpl.js +66 -0
  56. package/lib/authentication/templates/client.test.tpl.js.map +1 -0
  57. package/lib/authentication/templates/client.test.tpl.ts +80 -0
  58. package/lib/{service/templates/schema.tpl.d.ts → authentication/templates/client.tpl.d.ts} +1 -1
  59. package/lib/authentication/templates/client.tpl.js +14 -0
  60. package/lib/authentication/templates/client.tpl.js.map +1 -0
  61. package/lib/authentication/templates/client.tpl.ts +19 -0
  62. package/lib/authentication/templates/config.tpl.js +1 -1
  63. package/lib/authentication/templates/config.tpl.js.map +1 -1
  64. package/lib/authentication/templates/config.tpl.ts +1 -1
  65. package/lib/authentication/templates/declarations.tpl.js +3 -3
  66. package/lib/authentication/templates/declarations.tpl.js.map +1 -1
  67. package/lib/authentication/templates/declarations.tpl.ts +9 -4
  68. package/lib/authentication/templates/knex.tpl.js +4 -4
  69. package/lib/authentication/templates/knex.tpl.js.map +1 -1
  70. package/lib/authentication/templates/knex.tpl.ts +5 -5
  71. package/lib/authentication/templates/{user.resolver.tpl.d.ts → schema.json.tpl.d.ts} +0 -0
  72. package/lib/authentication/templates/schema.json.tpl.js +92 -0
  73. package/lib/authentication/templates/schema.json.tpl.js.map +1 -0
  74. package/lib/authentication/templates/schema.json.tpl.ts +108 -0
  75. package/lib/authentication/templates/{user.schema.tpl.d.ts → schema.typebox.tpl.d.ts} +1 -0
  76. package/lib/authentication/templates/schema.typebox.tpl.js +77 -0
  77. package/lib/authentication/templates/schema.typebox.tpl.js.map +1 -0
  78. package/lib/authentication/templates/schema.typebox.tpl.ts +94 -0
  79. package/lib/cli.d.ts +6 -0
  80. package/lib/cli.js +75 -0
  81. package/lib/cli.js.map +1 -0
  82. package/lib/cli.ts +68 -0
  83. package/lib/commons.d.ts +14 -1
  84. package/lib/commons.js +24 -4
  85. package/lib/commons.js.map +1 -1
  86. package/lib/commons.ts +29 -1
  87. package/lib/connection/index.d.ts +5 -3
  88. package/lib/connection/index.js +5 -3
  89. package/lib/connection/index.js.map +1 -1
  90. package/lib/connection/index.ts +19 -5
  91. package/lib/connection/templates/knex.tpl.js +2 -12
  92. package/lib/connection/templates/knex.tpl.js.map +1 -1
  93. package/lib/connection/templates/knex.tpl.ts +6 -20
  94. package/lib/connection/templates/mongodb.tpl.js +1 -3
  95. package/lib/connection/templates/mongodb.tpl.js.map +1 -1
  96. package/lib/connection/templates/mongodb.tpl.ts +1 -12
  97. package/lib/hook/index.d.ts +1 -1
  98. package/lib/hook/index.js +3 -0
  99. package/lib/hook/index.js.map +1 -1
  100. package/lib/hook/index.ts +3 -1
  101. package/lib/hook/templates/hook.tpl.js +2 -3
  102. package/lib/hook/templates/hook.tpl.js.map +1 -1
  103. package/lib/hook/templates/hook.tpl.ts +5 -3
  104. package/lib/index.d.ts +2 -16
  105. package/lib/index.js +16 -24
  106. package/lib/index.js.map +1 -1
  107. package/lib/index.ts +2 -28
  108. package/lib/service/index.d.ts +10 -60
  109. package/lib/service/index.js +41 -4
  110. package/lib/service/index.js.map +1 -1
  111. package/lib/service/index.ts +61 -7
  112. package/lib/service/templates/client.tpl.js +21 -18
  113. package/lib/service/templates/client.tpl.js.map +1 -1
  114. package/lib/service/templates/client.tpl.ts +52 -24
  115. package/lib/service/templates/{class.tpl.d.ts → schema.json.tpl.d.ts} +0 -0
  116. package/lib/service/templates/schema.json.tpl.js +75 -0
  117. package/lib/service/templates/schema.json.tpl.js.map +1 -0
  118. package/lib/service/templates/schema.json.tpl.ts +87 -0
  119. package/lib/service/templates/{resolver.tpl.d.ts → schema.typebox.tpl.d.ts} +0 -0
  120. package/lib/service/templates/schema.typebox.tpl.js +55 -0
  121. package/lib/service/templates/schema.typebox.tpl.js.map +1 -0
  122. package/lib/service/templates/schema.typebox.tpl.ts +67 -0
  123. package/lib/service/templates/service.tpl.d.ts +1 -0
  124. package/lib/service/templates/service.tpl.js +67 -15
  125. package/lib/service/templates/service.tpl.js.map +1 -1
  126. package/lib/service/templates/service.tpl.ts +98 -19
  127. package/lib/service/templates/test.tpl.js +1 -1
  128. package/lib/service/templates/test.tpl.js.map +1 -1
  129. package/lib/service/templates/test.tpl.ts +1 -2
  130. package/lib/service/type/custom.tpl.d.ts +1 -2
  131. package/lib/service/type/custom.tpl.js +32 -25
  132. package/lib/service/type/custom.tpl.js.map +1 -1
  133. package/lib/service/type/custom.tpl.ts +44 -35
  134. package/lib/service/type/knex.tpl.d.ts +1 -3
  135. package/lib/service/type/knex.tpl.js +37 -25
  136. package/lib/service/type/knex.tpl.js.map +1 -1
  137. package/lib/service/type/knex.tpl.ts +54 -31
  138. package/lib/service/type/mongodb.tpl.d.ts +1 -2
  139. package/lib/service/type/mongodb.tpl.js +32 -20
  140. package/lib/service/type/mongodb.tpl.js.map +1 -1
  141. package/lib/service/type/mongodb.tpl.ts +49 -29
  142. package/package.json +24 -23
  143. package/lib/app/templates/configuration.tpl.js +0 -45
  144. package/lib/app/templates/configuration.tpl.js.map +0 -1
  145. package/lib/app/templates/configuration.tpl.ts +0 -50
  146. package/lib/authentication/templates/test.tpl.js +0 -43
  147. package/lib/authentication/templates/test.tpl.js.map +0 -1
  148. package/lib/authentication/templates/test.tpl.ts +0 -50
  149. package/lib/authentication/templates/user.resolver.tpl.js +0 -98
  150. package/lib/authentication/templates/user.resolver.tpl.js.map +0 -1
  151. package/lib/authentication/templates/user.resolver.tpl.ts +0 -111
  152. package/lib/authentication/templates/user.schema.tpl.js +0 -79
  153. package/lib/authentication/templates/user.schema.tpl.js.map +0 -1
  154. package/lib/authentication/templates/user.schema.tpl.ts +0 -87
  155. package/lib/service/templates/class.tpl.js +0 -63
  156. package/lib/service/templates/class.tpl.js.map +0 -1
  157. package/lib/service/templates/class.tpl.ts +0 -79
  158. package/lib/service/templates/resolver.tpl.js +0 -73
  159. package/lib/service/templates/resolver.tpl.js.map +0 -1
  160. package/lib/service/templates/resolver.tpl.ts +0 -78
  161. package/lib/service/templates/schema.tpl.js +0 -75
  162. package/lib/service/templates/schema.tpl.js.map +0 -1
  163. package/lib/service/templates/schema.tpl.ts +0 -80
package/CHANGELOG.md CHANGED
@@ -3,77 +3,70 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- # [5.0.0-pre.29](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.28...v5.0.0-pre.29) (2022-09-16)
7
-
6
+ # [5.0.0-pre.31](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.30...v5.0.0-pre.31) (2022-10-12)
8
7
 
9
8
  ### Features
10
9
 
11
- * Add CORS support to oAuth, Express, Koa and generated application ([#2744](https://github.com/feathersjs/feathers/issues/2744)) ([fd218f2](https://github.com/feathersjs/feathers/commit/fd218f289f8ca4c101e9938e8683e2efef6e8131))
12
- * **authentication-oauth:** Koa and transport independent oAuth authentication ([#2737](https://github.com/feathersjs/feathers/issues/2737)) ([9231525](https://github.com/feathersjs/feathers/commit/9231525a24bb790ba9c5d940f2867a9c727691c9))
13
- * **cli:** Add custom environment variable support to generated application ([#2751](https://github.com/feathersjs/feathers/issues/2751)) ([c7bf80d](https://github.com/feathersjs/feathers/commit/c7bf80d82c28c190e3f0136d51af5b7de1bc4868))
14
- * **cli:** Adding ClientService to CLI ([#2750](https://github.com/feathersjs/feathers/issues/2750)) ([1d45427](https://github.com/feathersjs/feathers/commit/1d45427988521ac028755cbe128685fcdf34f636))
15
-
10
+ - **cli:** Generate full client test suite and improve typed client ([#2788](https://github.com/feathersjs/feathers/issues/2788)) ([57119b6](https://github.com/feathersjs/feathers/commit/57119b6bb2797f7297cf054268a248c093ecd538))
11
+ - **cli:** Improve generated schema definitions ([#2783](https://github.com/feathersjs/feathers/issues/2783)) ([474a9fd](https://github.com/feathersjs/feathers/commit/474a9fda2107e9bcf357746320a8e00cda8182b6))
16
12
 
13
+ # [5.0.0-pre.30](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.29...v5.0.0-pre.30) (2022-10-07)
17
14
 
15
+ ### Bug Fixes
18
16
 
17
+ - **core:** Ensure setup and teardown can be overriden and maintain hook functionality ([#2779](https://github.com/feathersjs/feathers/issues/2779)) ([ab580cb](https://github.com/feathersjs/feathers/commit/ab580cbcaa68d19144d86798c13bf564f9d424a6))
19
18
 
20
- # [5.0.0-pre.28](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.27...v5.0.0-pre.28) (2022-08-03)
19
+ ### Features
21
20
 
21
+ - **cli:** Add ability to `npm init feathers` ([#2755](https://github.com/feathersjs/feathers/issues/2755)) ([d734931](https://github.com/feathersjs/feathers/commit/d734931ffd4f983a05d9e771ce0e43b696c2bc0e))
22
+ - **cli:** Improve CLI interface ([#2753](https://github.com/feathersjs/feathers/issues/2753)) ([c7e1b7e](https://github.com/feathersjs/feathers/commit/c7e1b7e80aacb84441908c3d73512d9cf7557f7e))
23
+ - **core:** Allow to unregister services at runtime ([#2756](https://github.com/feathersjs/feathers/issues/2756)) ([d16601f](https://github.com/feathersjs/feathers/commit/d16601f2277dca5357866ffdefba2a611f6dc7fa))
24
+ - **schema:** Make schemas validation library independent and add TypeBox support ([#2772](https://github.com/feathersjs/feathers/issues/2772)) ([44172d9](https://github.com/feathersjs/feathers/commit/44172d99b566d11d9ceda04f1d0bf72b6d05ce76))
22
25
 
23
- ### Bug Fixes
26
+ # [5.0.0-pre.29](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.28...v5.0.0-pre.29) (2022-09-16)
24
27
 
25
- * **cli:** Improve generated application and client ([#2701](https://github.com/feathersjs/feathers/issues/2701)) ([bd55ffb](https://github.com/feathersjs/feathers/commit/bd55ffb812e89bf215f4515e7f137656ea888c3f))
28
+ ### Features
26
29
 
30
+ - Add CORS support to oAuth, Express, Koa and generated application ([#2744](https://github.com/feathersjs/feathers/issues/2744)) ([fd218f2](https://github.com/feathersjs/feathers/commit/fd218f289f8ca4c101e9938e8683e2efef6e8131))
31
+ - **authentication-oauth:** Koa and transport independent oAuth authentication ([#2737](https://github.com/feathersjs/feathers/issues/2737)) ([9231525](https://github.com/feathersjs/feathers/commit/9231525a24bb790ba9c5d940f2867a9c727691c9))
32
+ - **cli:** Add custom environment variable support to generated application ([#2751](https://github.com/feathersjs/feathers/issues/2751)) ([c7bf80d](https://github.com/feathersjs/feathers/commit/c7bf80d82c28c190e3f0136d51af5b7de1bc4868))
33
+ - **cli:** Adding ClientService to CLI ([#2750](https://github.com/feathersjs/feathers/issues/2750)) ([1d45427](https://github.com/feathersjs/feathers/commit/1d45427988521ac028755cbe128685fcdf34f636))
27
34
 
35
+ # [5.0.0-pre.28](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.27...v5.0.0-pre.28) (2022-08-03)
28
36
 
37
+ ### Bug Fixes
29
38
 
39
+ - **cli:** Improve generated application and client ([#2701](https://github.com/feathersjs/feathers/issues/2701)) ([bd55ffb](https://github.com/feathersjs/feathers/commit/bd55ffb812e89bf215f4515e7f137656ea888c3f))
30
40
 
31
41
  # [5.0.0-pre.27](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.26...v5.0.0-pre.27) (2022-07-13)
32
42
 
33
-
34
43
  ### Bug Fixes
35
44
 
36
- * **cli:** Fix flaky authentication migration and SQL id schema types ([#2676](https://github.com/feathersjs/feathers/issues/2676)) ([04ce9a5](https://github.com/feathersjs/feathers/commit/04ce9a53f4226cd6283f9dc241876e90ddf48618))
37
-
45
+ - **cli:** Fix flaky authentication migration and SQL id schema types ([#2676](https://github.com/feathersjs/feathers/issues/2676)) ([04ce9a5](https://github.com/feathersjs/feathers/commit/04ce9a53f4226cd6283f9dc241876e90ddf48618))
38
46
 
39
47
  ### Features
40
48
 
41
- * **cli:** Add support for Prettier ([#2684](https://github.com/feathersjs/feathers/issues/2684)) ([83aa8f9](https://github.com/feathersjs/feathers/commit/83aa8f9f212cb122d831dca8858852b0ac9b4da8))
42
- * **cli:** Improve generated application folder structure ([#2678](https://github.com/feathersjs/feathers/issues/2678)) ([d114557](https://github.com/feathersjs/feathers/commit/d114557721e73d6302aa88c11e3726dbcbd5c92b))
43
-
44
-
45
-
46
-
49
+ - **cli:** Add support for Prettier ([#2684](https://github.com/feathersjs/feathers/issues/2684)) ([83aa8f9](https://github.com/feathersjs/feathers/commit/83aa8f9f212cb122d831dca8858852b0ac9b4da8))
50
+ - **cli:** Improve generated application folder structure ([#2678](https://github.com/feathersjs/feathers/issues/2678)) ([d114557](https://github.com/feathersjs/feathers/commit/d114557721e73d6302aa88c11e3726dbcbd5c92b))
47
51
 
48
52
  # [5.0.0-pre.26](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.25...v5.0.0-pre.26) (2022-06-22)
49
53
 
50
-
51
54
  ### Bug Fixes
52
55
 
53
- * **cli:** Fix compilation folders that got mixed up ([fc4cb74](https://github.com/feathersjs/feathers/commit/fc4cb742f7f9164096d9319b13dfaaa5f54686a6))
54
-
55
-
56
-
57
-
56
+ - **cli:** Fix compilation folders that got mixed up ([fc4cb74](https://github.com/feathersjs/feathers/commit/fc4cb742f7f9164096d9319b13dfaaa5f54686a6))
58
57
 
59
58
  # [5.0.0-pre.25](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.24...v5.0.0-pre.25) (2022-06-22)
60
59
 
61
-
62
60
  ### Bug Fixes
63
61
 
64
- * **cli:** Generator fixes to work with the new guide ([#2674](https://github.com/feathersjs/feathers/issues/2674)) ([b773fa5](https://github.com/feathersjs/feathers/commit/b773fa5dbd7ff450cfb2f7b93e64882592262712))
65
-
66
-
67
-
68
-
62
+ - **cli:** Generator fixes to work with the new guide ([#2674](https://github.com/feathersjs/feathers/issues/2674)) ([b773fa5](https://github.com/feathersjs/feathers/commit/b773fa5dbd7ff450cfb2f7b93e64882592262712))
69
63
 
70
64
  # [5.0.0-pre.24](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.23...v5.0.0-pre.24) (2022-06-21)
71
65
 
72
-
73
66
  ### Features
74
67
 
75
- * **cli:** Add generators for new Knex SQL database adapter ([#2673](https://github.com/feathersjs/feathers/issues/2673)) ([0fb2c0f](https://github.com/feathersjs/feathers/commit/0fb2c0f629116f71184b8698c383af8cfd149688))
76
- * **cli:** Add hook generator ([#2667](https://github.com/feathersjs/feathers/issues/2667)) ([24e4bc0](https://github.com/feathersjs/feathers/commit/24e4bc04a67fadee0e6a96a8389d788faba5c305))
77
- * **cli:** Add support for JavaScript to the new CLI ([#2668](https://github.com/feathersjs/feathers/issues/2668)) ([ebac587](https://github.com/feathersjs/feathers/commit/ebac587f7d00dc7607c3f546352d79f79b89a5d4))
78
- * **cli:** Add typed client to a generated app ([#2669](https://github.com/feathersjs/feathers/issues/2669)) ([5b801b5](https://github.com/feathersjs/feathers/commit/5b801b5017ddc3eaa95622b539f51d605916bc86))
79
- * **cli:** Initial Feathers v5 CLI and Pinion generator ([#2578](https://github.com/feathersjs/feathers/issues/2578)) ([7f59ae7](https://github.com/feathersjs/feathers/commit/7f59ae7f1471895ba8a82aa4702f1a23f71b7682))
68
+ - **cli:** Add generators for new Knex SQL database adapter ([#2673](https://github.com/feathersjs/feathers/issues/2673)) ([0fb2c0f](https://github.com/feathersjs/feathers/commit/0fb2c0f629116f71184b8698c383af8cfd149688))
69
+ - **cli:** Add hook generator ([#2667](https://github.com/feathersjs/feathers/issues/2667)) ([24e4bc0](https://github.com/feathersjs/feathers/commit/24e4bc04a67fadee0e6a96a8389d788faba5c305))
70
+ - **cli:** Add support for JavaScript to the new CLI ([#2668](https://github.com/feathersjs/feathers/issues/2668)) ([ebac587](https://github.com/feathersjs/feathers/commit/ebac587f7d00dc7607c3f546352d79f79b89a5d4))
71
+ - **cli:** Add typed client to a generated app ([#2669](https://github.com/feathersjs/feathers/issues/2669)) ([5b801b5](https://github.com/feathersjs/feathers/commit/5b801b5017ddc3eaa95622b539f51d605916bc86))
72
+ - **cli:** Initial Feathers v5 CLI and Pinion generator ([#2578](https://github.com/feathersjs/feathers/issues/2578)) ([7f59ae7](https://github.com/feathersjs/feathers/commit/7f59ae7f1471895ba8a82aa4702f1a23f71b7682))
package/bin/feathers CHANGED
@@ -1,9 +1,6 @@
1
1
  #!/usr/bin/env node
2
- 'use strict';
2
+ 'use strict'
3
3
 
4
- const { yargs } = require('@feathershq/pinion')
5
- const { command } = require('../lib')
4
+ const { program } = require('../lib')
6
5
 
7
- const cli = cmd => command(yargs(cmd)).argv
8
-
9
- cli(process.argv.slice(2));
6
+ program.parse()
package/lib/app/index.js CHANGED
@@ -11,6 +11,7 @@ const commons_1 = require("../commons");
11
11
  const authentication_1 = require("../authentication");
12
12
  const connection_1 = require("../connection");
13
13
  const generate = (ctx) => (0, pinion_1.generator)(ctx)
14
+ .then((0, commons_1.initializeBaseContext)())
14
15
  .then((ctx) => ({
15
16
  ...ctx,
16
17
  dependencies: [],
@@ -32,7 +33,13 @@ const generate = (ctx) => (0, pinion_1.generator)(ctx)
32
33
  type: 'input',
33
34
  when: !ctx.name,
34
35
  message: 'What is the name of your application?',
35
- default: ctx.cwd.split(path_1.sep).pop()
36
+ default: ctx.cwd.split(path_1.sep).pop(),
37
+ validate: (input) => {
38
+ if (ctx.dependencyVersions[input]) {
39
+ return `Application can not have the same name as a dependency`;
40
+ }
41
+ return true;
42
+ }
36
43
  },
37
44
  {
38
45
  name: 'description',
@@ -67,30 +74,43 @@ const generate = (ctx) => (0, pinion_1.generator)(ctx)
67
74
  message: 'Which package manager are you using?',
68
75
  choices: [
69
76
  { value: 'npm', name: 'npm' },
70
- { value: 'yarn', name: 'Yarn' }
77
+ { value: 'yarn', name: 'Yarn' },
78
+ { value: 'pnpm', name: 'pnpm' }
79
+ ]
80
+ },
81
+ {
82
+ type: 'list',
83
+ name: 'schema',
84
+ when: !ctx.schema,
85
+ message: 'What is your preferred schema (model) definition format?',
86
+ choices: [
87
+ { value: 'typebox', name: `TypeBox ${chalk_1.default.grey('(recommended)')}` },
88
+ { value: 'json', name: 'JSON schema' }
71
89
  ]
72
90
  },
73
91
  ...(0, connection_1.prompts)(ctx),
74
92
  ...(0, authentication_1.prompts)({
75
93
  ...ctx,
76
- service: 'users',
94
+ service: 'user',
95
+ path: 'users',
77
96
  entity: 'user'
78
97
  })
79
98
  ]))
80
99
  .then((0, pinion_1.runGenerators)(__dirname, 'templates'))
81
100
  .then((0, pinion_1.copyFiles)((0, pinion_1.fromFile)(__dirname, 'static'), (0, pinion_1.toFile)('.')))
82
101
  .then((0, commons_1.initializeBaseContext)())
83
- .then((0, pinion_1.when)(({ authStrategies }) => authStrategies.length > 0, async (ctx) => {
102
+ .then(async (ctx) => {
84
103
  const { dependencies } = await (0, connection_1.generate)(ctx);
85
104
  return {
86
105
  ...ctx,
87
106
  dependencies
88
107
  };
89
- }))
108
+ })
90
109
  .then((0, pinion_1.when)(({ authStrategies }) => authStrategies.length > 0, async (ctx) => {
91
110
  const { dependencies } = await (0, authentication_1.generate)({
92
111
  ...ctx,
93
- service: 'users',
112
+ service: 'user',
113
+ path: 'users',
94
114
  entity: 'user'
95
115
  });
96
116
  return {
@@ -98,7 +118,7 @@ const generate = (ctx) => (0, pinion_1.generator)(ctx)
98
118
  dependencies
99
119
  };
100
120
  }))
101
- .then((0, pinion_1.install)(({ transports, framework, dependencyVersions, dependencies }) => {
121
+ .then((0, pinion_1.install)(({ transports, framework, dependencyVersions, dependencies, schema }) => {
102
122
  const hasSocketio = transports.includes('websockets');
103
123
  dependencies.push('@feathersjs/feathers', '@feathersjs/errors', '@feathersjs/schema', '@feathersjs/configuration', '@feathersjs/transport-commons', '@feathersjs/authentication', 'winston');
104
124
  if (hasSocketio) {
@@ -110,14 +130,17 @@ const generate = (ctx) => (0, pinion_1.generator)(ctx)
110
130
  if (framework === 'express') {
111
131
  dependencies.push('@feathersjs/express', 'compression');
112
132
  }
133
+ if (schema === 'typebox') {
134
+ dependencies.push('@feathersjs/typebox');
135
+ }
113
136
  return (0, commons_1.addVersions)(dependencies, dependencyVersions);
114
- }))
137
+ }, false, ctx.packager))
115
138
  .then((0, pinion_1.install)(({ language, framework, devDependencies, dependencyVersions }) => {
116
- devDependencies.push('nodemon', 'axios', 'mocha', 'cross-env', 'prettier');
139
+ devDependencies.push('nodemon', 'axios', 'mocha', 'cross-env', 'prettier', '@feathersjs/cli', '@feathersjs/rest-client', '@feathersjs/authentication-client');
117
140
  if (language === 'ts') {
118
141
  devDependencies.push('@types/mocha', framework === 'koa' ? '@types/koa-static' : '@types/compression', '@types/node', 'nodemon', 'ts-node', 'typescript', 'shx');
119
142
  }
120
143
  return (0, commons_1.addVersions)(devDependencies, dependencyVersions);
121
- }, true));
144
+ }, true, ctx.packager));
122
145
  exports.generate = generate;
123
146
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/app/index.ts"],"names":[],"mappings":";;;;;;AAAA,+BAA0B;AAC1B,kDAAyB;AACzB,+CAS2B;AAC3B,wCAAqG;AACrG,sDAAyG;AACzG,8CAA6F;AAiCtF,MAAM,QAAQ,GAAG,CAAC,GAA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,WAAW,EACX,UAAU,EACV,iBAAiB,EACjB,yBAAyB,EACzB,mCAAmC,CACpC,CAAA;IAED,IAAI,QAAQ,KAAK,IAAI,EAAE;QACrB,eAAe,CAAC,IAAI,CAClB,cAAc,EACd,SAAS,KAAK,KAAK,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,oBAAoB,EAChE,aAAa,EACb,SAAS,EACT,SAAS,EACT,YAAY,EACZ,KAAK,CACN,CAAA;KACF;IAED,OAAO,IAAA,qBAAW,EAAC,eAAe,EAAE,kBAAkB,CAAC,CAAA;AACzD,CAAC,EACD,IAAI,EACJ,GAAG,CAAC,QAAQ,CACb,CACF,CAAA;AA3LQ,QAAA,QAAQ,YA2LhB"}
package/lib/app/index.ts CHANGED
@@ -47,6 +47,7 @@ export type AppGeneratorArguments = FeathersBaseContext & Partial<AppGeneratorDa
47
47
 
48
48
  export const generate = (ctx: AppGeneratorArguments) =>
49
49
  generator(ctx)
50
+ .then(initializeBaseContext())
50
51
  .then((ctx) => ({
51
52
  ...ctx,
52
53
  dependencies: [],
@@ -69,7 +70,14 @@ export const generate = (ctx: AppGeneratorArguments) =>
69
70
  type: 'input',
70
71
  when: !ctx.name,
71
72
  message: 'What is the name of your application?',
72
- default: ctx.cwd.split(sep).pop()
73
+ default: ctx.cwd.split(sep).pop(),
74
+ validate: (input) => {
75
+ if (ctx.dependencyVersions[input]) {
76
+ return `Application can not have the same name as a dependency`
77
+ }
78
+
79
+ return true
80
+ }
73
81
  },
74
82
  {
75
83
  name: 'description',
@@ -104,13 +112,25 @@ export const generate = (ctx: AppGeneratorArguments) =>
104
112
  message: 'Which package manager are you using?',
105
113
  choices: [
106
114
  { value: 'npm', name: 'npm' },
107
- { value: 'yarn', name: 'Yarn' }
115
+ { value: 'yarn', name: 'Yarn' },
116
+ { value: 'pnpm', name: 'pnpm' }
117
+ ]
118
+ },
119
+ {
120
+ type: 'list',
121
+ name: 'schema',
122
+ when: !ctx.schema,
123
+ message: 'What is your preferred schema (model) definition format?',
124
+ choices: [
125
+ { value: 'typebox', name: `TypeBox ${chalk.grey('(recommended)')}` },
126
+ { value: 'json', name: 'JSON schema' }
108
127
  ]
109
128
  },
110
129
  ...connectionPrompts(ctx),
111
130
  ...authenticationPrompts({
112
131
  ...ctx,
113
- service: 'users',
132
+ service: 'user',
133
+ path: 'users',
114
134
  entity: 'user'
115
135
  })
116
136
  ])
@@ -118,26 +138,22 @@ export const generate = (ctx: AppGeneratorArguments) =>
118
138
  .then(runGenerators(__dirname, 'templates'))
119
139
  .then(copyFiles(fromFile(__dirname, 'static'), toFile('.')))
120
140
  .then(initializeBaseContext())
121
- .then(
122
- when<AppGeneratorContext>(
123
- ({ authStrategies }) => authStrategies.length > 0,
124
- async (ctx) => {
125
- const { dependencies } = await connectionGenerator(ctx)
141
+ .then(async (ctx) => {
142
+ const { dependencies } = await connectionGenerator(ctx)
126
143
 
127
- return {
128
- ...ctx,
129
- dependencies
130
- }
131
- }
132
- )
133
- )
144
+ return {
145
+ ...ctx,
146
+ dependencies
147
+ }
148
+ })
134
149
  .then(
135
150
  when<AppGeneratorContext>(
136
151
  ({ authStrategies }) => authStrategies.length > 0,
137
152
  async (ctx) => {
138
153
  const { dependencies } = await authenticationGenerator({
139
154
  ...ctx,
140
- service: 'users',
155
+ service: 'user',
156
+ path: 'users',
141
157
  entity: 'user'
142
158
  })
143
159
 
@@ -149,50 +165,71 @@ export const generate = (ctx: AppGeneratorArguments) =>
149
165
  )
150
166
  )
151
167
  .then(
152
- install<AppGeneratorContext>(({ transports, framework, dependencyVersions, dependencies }) => {
153
- const hasSocketio = transports.includes('websockets')
168
+ install<AppGeneratorContext>(
169
+ ({ transports, framework, dependencyVersions, dependencies, schema }) => {
170
+ const hasSocketio = transports.includes('websockets')
154
171
 
155
- dependencies.push(
156
- '@feathersjs/feathers',
157
- '@feathersjs/errors',
158
- '@feathersjs/schema',
159
- '@feathersjs/configuration',
160
- '@feathersjs/transport-commons',
161
- '@feathersjs/authentication',
162
- 'winston'
163
- )
172
+ dependencies.push(
173
+ '@feathersjs/feathers',
174
+ '@feathersjs/errors',
175
+ '@feathersjs/schema',
176
+ '@feathersjs/configuration',
177
+ '@feathersjs/transport-commons',
178
+ '@feathersjs/authentication',
179
+ 'winston'
180
+ )
164
181
 
165
- if (hasSocketio) {
166
- dependencies.push('@feathersjs/socketio')
167
- }
182
+ if (hasSocketio) {
183
+ dependencies.push('@feathersjs/socketio')
184
+ }
168
185
 
169
- if (framework === 'koa') {
170
- dependencies.push('@feathersjs/koa', 'koa-static')
171
- }
186
+ if (framework === 'koa') {
187
+ dependencies.push('@feathersjs/koa', 'koa-static')
188
+ }
172
189
 
173
- if (framework === 'express') {
174
- dependencies.push('@feathersjs/express', 'compression')
175
- }
190
+ if (framework === 'express') {
191
+ dependencies.push('@feathersjs/express', 'compression')
192
+ }
193
+
194
+ if (schema === 'typebox') {
195
+ dependencies.push('@feathersjs/typebox')
196
+ }
176
197
 
177
- return addVersions(dependencies, dependencyVersions)
178
- })
198
+ return addVersions(dependencies, dependencyVersions)
199
+ },
200
+ false,
201
+ ctx.packager
202
+ )
179
203
  )
180
204
  .then(
181
- install<AppGeneratorContext>(({ language, framework, devDependencies, dependencyVersions }) => {
182
- devDependencies.push('nodemon', 'axios', 'mocha', 'cross-env', 'prettier')
183
-
184
- if (language === 'ts') {
205
+ install<AppGeneratorContext>(
206
+ ({ language, framework, devDependencies, dependencyVersions }) => {
185
207
  devDependencies.push(
186
- '@types/mocha',
187
- framework === 'koa' ? '@types/koa-static' : '@types/compression',
188
- '@types/node',
189
208
  'nodemon',
190
- 'ts-node',
191
- 'typescript',
192
- 'shx'
209
+ 'axios',
210
+ 'mocha',
211
+ 'cross-env',
212
+ 'prettier',
213
+ '@feathersjs/cli',
214
+ '@feathersjs/rest-client',
215
+ '@feathersjs/authentication-client'
193
216
  )
194
- }
195
217
 
196
- return addVersions(devDependencies, dependencyVersions)
197
- }, true)
218
+ if (language === 'ts') {
219
+ devDependencies.push(
220
+ '@types/mocha',
221
+ framework === 'koa' ? '@types/koa-static' : '@types/compression',
222
+ '@types/node',
223
+ 'nodemon',
224
+ 'ts-node',
225
+ 'typescript',
226
+ 'shx'
227
+ )
228
+ }
229
+
230
+ return addVersions(devDependencies, dependencyVersions)
231
+ },
232
+ true,
233
+ ctx.packager
234
+ )
198
235
  )
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.generate = void 0;
4
4
  const pinion_1 = require("@feathershq/pinion");
5
5
  const commons_1 = require("../../commons");
6
- const template = ({ lib }) => `import assert from 'assert'
6
+ const template = ({ lib }) => /* ts */ `import assert from 'assert'
7
7
  import axios from 'axios'
8
8
  import type { Server } from 'http'
9
9
  import { app } from '../${lib}/app'
@@ -1 +1 @@
1
- {"version":3,"file":"app.test.tpl.js","sourceRoot":"","sources":["../../../src/app/templates/app.test.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAAsD;AACtD,2CAA4C;AAG5C,MAAM,QAAQ,GAAG,CAAC,EAAE,GAAG,EAAuB,EAAE,EAAE,CAChD;;;0BAGwB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoC5B,CAAA;AAEM,MAAM,QAAQ,GAAG,CAAC,GAAwB,EAAE,EAAE,CACnD,IAAA,kBAAS,EAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAA,sBAAY,EAAC,QAAQ,EAAE,IAAA,eAAM,EAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,CAAA;AAD5D,QAAA,QAAQ,YACoD"}
1
+ {"version":3,"file":"app.test.tpl.js","sourceRoot":"","sources":["../../../src/app/templates/app.test.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAAsD;AACtD,2CAA4C;AAG5C,MAAM,QAAQ,GAAG,CAAC,EAAE,GAAG,EAAuB,EAAE,EAAE,CAAC,QAAQ,CAAC;;;0BAGlC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoC5B,CAAA;AAEM,MAAM,QAAQ,GAAG,CAAC,GAAwB,EAAE,EAAE,CACnD,IAAA,kBAAS,EAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAA,sBAAY,EAAC,QAAQ,EAAE,IAAA,eAAM,EAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,CAAA;AAD5D,QAAA,QAAQ,YACoD"}
@@ -2,8 +2,7 @@ import { generator, toFile } from '@feathershq/pinion'
2
2
  import { renderSource } from '../../commons'
3
3
  import { AppGeneratorContext } from '../index'
4
4
 
5
- const template = ({ lib }: AppGeneratorContext) =>
6
- `import assert from 'assert'
5
+ const template = ({ lib }: AppGeneratorContext) => /* ts */ `import assert from 'assert'
7
6
  import axios from 'axios'
8
7
  import type { Server } from 'http'
9
8
  import { app } from '../${lib}/app'
@@ -3,14 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.generate = void 0;
4
4
  const pinion_1 = require("@feathershq/pinion");
5
5
  const commons_1 = require("../../commons");
6
- const tsKoaApp = ({ transports }) => `import serveStatic from 'koa-static'
6
+ const tsKoaApp = ({ transports }) => /* ts */ `import serveStatic from 'koa-static'
7
7
  import { feathers } from '@feathersjs/feathers'
8
8
  import configuration from '@feathersjs/configuration'
9
9
  import { koa, rest, bodyParser, errorHandler, parseAuthentication, cors } from '@feathersjs/koa'
10
10
  ${transports.includes('websockets') ? "import socketio from '@feathersjs/socketio'" : ''}
11
11
 
12
12
  import type { Application } from './declarations'
13
- import { configurationSchema } from './configuration'
13
+ import { configurationValidator } from './schemas/configuration'
14
14
  import { logErrorHook } from './logger'
15
15
  import { services } from './services/index'
16
16
  import { channels } from './channels'
@@ -18,12 +18,12 @@ import { channels } from './channels'
18
18
  const app: Application = koa(feathers())
19
19
 
20
20
  // Load our app configuration (see config/ folder)
21
- app.configure(configuration(configurationSchema))
21
+ app.configure(configuration(configurationValidator))
22
22
 
23
23
  // Set up Koa middleware
24
+ app.use(cors())
24
25
  app.use(serveStatic(app.get('public')))
25
26
  app.use(errorHandler())
26
- app.use(cors())
27
27
  app.use(parseAuthentication())
28
28
  app.use(bodyParser())
29
29
 
@@ -56,7 +56,7 @@ app.hooks({
56
56
 
57
57
  export { app }
58
58
  `;
59
- const tsExpressApp = ({ transports }) => `import compress from 'compression'
59
+ const tsExpressApp = ({ transports }) => /* ts */ `import compress from 'compression'
60
60
 
61
61
  import { feathers } from '@feathersjs/feathers'
62
62
  import express, {
@@ -67,7 +67,7 @@ import configuration from '@feathersjs/configuration'
67
67
  ${transports.includes('websockets') ? "import socketio from '@feathersjs/socketio'" : ''}
68
68
 
69
69
  import type { Application } from './declarations'
70
- import { configurationSchema } from './configuration'
70
+ import { configurationValidator } from './schemas/configuration'
71
71
  import { logger, logErrorHook } from './logger'
72
72
  import { services } from './services/index'
73
73
  import { channels } from './channels'
@@ -75,7 +75,7 @@ import { channels } from './channels'
75
75
  const app: Application = express(feathers())
76
76
 
77
77
  // Load app configuration
78
- app.configure(configuration(configurationSchema))
78
+ app.configure(configuration(configurationValidator))
79
79
  app.use(cors())
80
80
  app.use(compress())
81
81
  app.use(json())
@@ -1 +1 @@
1
- {"version":3,"file":"app.tpl.js","sourceRoot":"","sources":["../../../src/app/templates/app.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAAsD;AACtD,2CAA4C;AAG5C,MAAM,QAAQ,GAAG,CAAC,EAAE,UAAU,EAAuB,EAAE,EAAE,CACvD;;;;EAIA,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,6CAA6C,CAAC,CAAC,CAAC,EAAE;;;;;;;;;;;;;;;;;;;;;;EAuBtF,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC;IAC/B,CAAC,CAAC;;;;IAIF;IACA,CAAC,CAAC,EACN;;;;;;;;;;;;;;;;;;;;CAoBC,CAAA;AAED,MAAM,YAAY,GAAG,CAAC,EAAE,UAAU,EAAuB,EAAE,EAAE,CAC3D;;;;;;;;EAQA,UAAU,CAAC,QAAQ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C,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,6CAA6C,CAAC,CAAC,CAAC,EAAE;;;;;;;;;;;;;;;;;;;;;EAsBtF,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC;IAC/B,CAAC,CAAC;;;;IAIF;IACA,CAAC,CAAC,EACN;;;;;;;;;;;;;;;;;;;;;;;;CAwBC,CAAA;AAED,MAAM,QAAQ,GAAG,CAAC,GAAwB,EAAE,EAAE,CAC5C,GAAG,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;AAE1D,MAAM,QAAQ,GAAG,CAAC,GAAwB,EAAE,EAAE,CACnD,IAAA,kBAAS,EAAC,GAAG,CAAC,CAAC,IAAI,CACjB,IAAA,sBAAY,EACV,QAAQ,EACR,IAAA,eAAM,EAAsB,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,CACrD,CACF,CAAA;AANU,QAAA,QAAQ,YAMlB"}
@@ -2,15 +2,14 @@ import { generator, toFile } from '@feathershq/pinion'
2
2
  import { renderSource } from '../../commons'
3
3
  import { AppGeneratorContext } from '../index'
4
4
 
5
- const tsKoaApp = ({ transports }: AppGeneratorContext) =>
6
- `import serveStatic from 'koa-static'
5
+ const tsKoaApp = ({ transports }: AppGeneratorContext) => /* ts */ `import serveStatic from 'koa-static'
7
6
  import { feathers } from '@feathersjs/feathers'
8
7
  import configuration from '@feathersjs/configuration'
9
8
  import { koa, rest, bodyParser, errorHandler, parseAuthentication, cors } from '@feathersjs/koa'
10
9
  ${transports.includes('websockets') ? "import socketio from '@feathersjs/socketio'" : ''}
11
10
 
12
11
  import type { Application } from './declarations'
13
- import { configurationSchema } from './configuration'
12
+ import { configurationValidator } from './schemas/configuration'
14
13
  import { logErrorHook } from './logger'
15
14
  import { services } from './services/index'
16
15
  import { channels } from './channels'
@@ -18,12 +17,12 @@ import { channels } from './channels'
18
17
  const app: Application = koa(feathers())
19
18
 
20
19
  // Load our app configuration (see config/ folder)
21
- app.configure(configuration(configurationSchema))
20
+ app.configure(configuration(configurationValidator))
22
21
 
23
22
  // Set up Koa middleware
23
+ app.use(cors())
24
24
  app.use(serveStatic(app.get('public')))
25
25
  app.use(errorHandler())
26
- app.use(cors())
27
26
  app.use(parseAuthentication())
28
27
  app.use(bodyParser())
29
28
 
@@ -59,8 +58,7 @@ app.hooks({
59
58
  export { app }
60
59
  `
61
60
 
62
- const tsExpressApp = ({ transports }: AppGeneratorContext) =>
63
- `import compress from 'compression'
61
+ const tsExpressApp = ({ transports }: AppGeneratorContext) => /* ts */ `import compress from 'compression'
64
62
 
65
63
  import { feathers } from '@feathersjs/feathers'
66
64
  import express, {
@@ -71,7 +69,7 @@ import configuration from '@feathersjs/configuration'
71
69
  ${transports.includes('websockets') ? "import socketio from '@feathersjs/socketio'" : ''}
72
70
 
73
71
  import type { Application } from './declarations'
74
- import { configurationSchema } from './configuration'
72
+ import { configurationValidator } from './schemas/configuration'
75
73
  import { logger, logErrorHook } from './logger'
76
74
  import { services } from './services/index'
77
75
  import { channels } from './channels'
@@ -79,7 +77,7 @@ import { channels } from './channels'
79
77
  const app: Application = express(feathers())
80
78
 
81
79
  // Load app configuration
82
- app.configure(configuration(configurationSchema))
80
+ app.configure(configuration(configurationValidator))
83
81
  app.use(cors())
84
82
  app.use(compress())
85
83
  app.use(json())
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.generate = void 0;
4
4
  const pinion_1 = require("@feathershq/pinion");
5
5
  const commons_1 = require("../../commons");
6
- const template = ({ language }) => `import '@feathersjs/transport-commons'
6
+ const template = ({ language }) => /* ts */ `import '@feathersjs/transport-commons'
7
7
  import type { Application, HookContext } from './declarations'
8
8
  import { logger } from './logger'
9
9
 
@@ -1 +1 @@
1
- {"version":3,"file":"channels.tpl.js","sourceRoot":"","sources":["../../../src/app/templates/channels.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAAsD;AACtD,2CAA4C;AAG5C,MAAM,QAAQ,GAAG,CAAC,EAAE,QAAQ,EAAuB,EAAE,EAAE,CACrD;;;;;;;;;;kFAUgF,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuDzF,CAAA;AAEM,MAAM,QAAQ,GAAG,CAAC,GAAwB,EAAE,EAAE,CACnD,IAAA,kBAAS,EAAC,GAAG,CAAC,CAAC,IAAI,CACjB,IAAA,sBAAY,EACV,QAAQ,EACR,IAAA,eAAM,EAAsB,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,UAAU,CAAC,CAC1D,CACF,CAAA;AANU,QAAA,QAAQ,YAMlB"}
1
+ {"version":3,"file":"channels.tpl.js","sourceRoot":"","sources":["../../../src/app/templates/channels.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAAsD;AACtD,2CAA4C;AAG5C,MAAM,QAAQ,GAAG,CAAC,EAAE,QAAQ,EAAuB,EAAE,EAAE,CAAC,QAAQ,CAAC;;;;;;;;;;kFAUiB,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuDzF,CAAA;AAEM,MAAM,QAAQ,GAAG,CAAC,GAAwB,EAAE,EAAE,CACnD,IAAA,kBAAS,EAAC,GAAG,CAAC,CAAC,IAAI,CACjB,IAAA,sBAAY,EACV,QAAQ,EACR,IAAA,eAAM,EAAsB,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,UAAU,CAAC,CAC1D,CACF,CAAA;AANU,QAAA,QAAQ,YAMlB"}
@@ -2,8 +2,7 @@ import { generator, toFile } from '@feathershq/pinion'
2
2
  import { renderSource } from '../../commons'
3
3
  import { AppGeneratorContext } from '../index'
4
4
 
5
- const template = ({ language }: AppGeneratorContext) =>
6
- `import '@feathersjs/transport-commons'
5
+ const template = ({ language }: AppGeneratorContext) => /* ts */ `import '@feathersjs/transport-commons'
7
6
  import type { Application, HookContext } from './declarations'
8
7
  import { logger } from './logger'
9
8