@feathersjs/cli 5.0.0-pre.34 → 5.0.0-pre.36

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 (173) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/LICENSE +1 -1
  3. package/README.md +1 -1
  4. package/lib/index.d.ts +6 -2
  5. package/lib/index.js +59 -2
  6. package/lib/index.js.map +1 -1
  7. package/package.json +28 -30
  8. package/lib/app/index.d.ts +0 -29
  9. package/lib/app/index.js +0 -146
  10. package/lib/app/index.js.map +0 -1
  11. package/lib/app/index.ts +0 -228
  12. package/lib/app/static/.gitignore +0 -121
  13. package/lib/app/templates/app.test.tpl.d.ts +0 -2
  14. package/lib/app/templates/app.test.tpl.js +0 -49
  15. package/lib/app/templates/app.test.tpl.js.map +0 -1
  16. package/lib/app/templates/app.test.tpl.ts +0 -50
  17. package/lib/app/templates/app.tpl.d.ts +0 -2
  18. package/lib/app/templates/app.tpl.js +0 -123
  19. package/lib/app/templates/app.tpl.js.map +0 -1
  20. package/lib/app/templates/app.tpl.ts +0 -138
  21. package/lib/app/templates/channels.tpl.d.ts +0 -2
  22. package/lib/app/templates/channels.tpl.js +0 -49
  23. package/lib/app/templates/channels.tpl.js.map +0 -1
  24. package/lib/app/templates/channels.tpl.ts +0 -55
  25. package/lib/app/templates/client.test.tpl.d.ts +0 -2
  26. package/lib/app/templates/client.test.tpl.js +0 -27
  27. package/lib/app/templates/client.test.tpl.js.map +0 -1
  28. package/lib/app/templates/client.test.tpl.ts +0 -26
  29. package/lib/app/templates/client.tpl.d.ts +0 -2
  30. package/lib/app/templates/client.tpl.js +0 -38
  31. package/lib/app/templates/client.tpl.js.map +0 -1
  32. package/lib/app/templates/client.tpl.ts +0 -45
  33. package/lib/app/templates/configuration.tpl.d.ts +0 -2
  34. package/lib/app/templates/configuration.tpl.js +0 -71
  35. package/lib/app/templates/configuration.tpl.js.map +0 -1
  36. package/lib/app/templates/configuration.tpl.ts +0 -82
  37. package/lib/app/templates/declarations.tpl.d.ts +0 -2
  38. package/lib/app/templates/declarations.tpl.js +0 -28
  39. package/lib/app/templates/declarations.tpl.js.map +0 -1
  40. package/lib/app/templates/declarations.tpl.ts +0 -37
  41. package/lib/app/templates/index.html.tpl.d.ts +0 -2
  42. package/lib/app/templates/index.html.tpl.js +0 -45
  43. package/lib/app/templates/index.html.tpl.js.map +0 -1
  44. package/lib/app/templates/index.html.tpl.ts +0 -44
  45. package/lib/app/templates/index.tpl.d.ts +0 -2
  46. package/lib/app/templates/index.tpl.js +0 -18
  47. package/lib/app/templates/index.tpl.js.map +0 -1
  48. package/lib/app/templates/index.tpl.ts +0 -22
  49. package/lib/app/templates/logger.tpl.d.ts +0 -3
  50. package/lib/app/templates/logger.tpl.js +0 -45
  51. package/lib/app/templates/logger.tpl.js.map +0 -1
  52. package/lib/app/templates/logger.tpl.ts +0 -56
  53. package/lib/app/templates/package.json.tpl.d.ts +0 -2
  54. package/lib/app/templates/package.json.tpl.js +0 -58
  55. package/lib/app/templates/package.json.tpl.js.map +0 -1
  56. package/lib/app/templates/package.json.tpl.ts +0 -71
  57. package/lib/app/templates/prettierrc.tpl.d.ts +0 -2
  58. package/lib/app/templates/prettierrc.tpl.js +0 -11
  59. package/lib/app/templates/prettierrc.tpl.js.map +0 -1
  60. package/lib/app/templates/prettierrc.tpl.ts +0 -14
  61. package/lib/app/templates/readme.md.tpl.d.ts +0 -2
  62. package/lib/app/templates/readme.md.tpl.js +0 -54
  63. package/lib/app/templates/readme.md.tpl.js.map +0 -1
  64. package/lib/app/templates/readme.md.tpl.ts +0 -57
  65. package/lib/app/templates/services.tpl.d.ts +0 -2
  66. package/lib/app/templates/services.tpl.js +0 -15
  67. package/lib/app/templates/services.tpl.js.map +0 -1
  68. package/lib/app/templates/services.tpl.ts +0 -20
  69. package/lib/app/templates/tsconfig.json.tpl.d.ts +0 -2
  70. package/lib/app/templates/tsconfig.json.tpl.js +0 -22
  71. package/lib/app/templates/tsconfig.json.tpl.js.map +0 -1
  72. package/lib/app/templates/tsconfig.json.tpl.ts +0 -28
  73. package/lib/app/templates/validators.tpl.d.ts +0 -2
  74. package/lib/app/templates/validators.tpl.js +0 -36
  75. package/lib/app/templates/validators.tpl.js.map +0 -1
  76. package/lib/app/templates/validators.tpl.ts +0 -40
  77. package/lib/authentication/index.d.ts +0 -73
  78. package/lib/authentication/index.js +0 -107
  79. package/lib/authentication/index.js.map +0 -1
  80. package/lib/authentication/index.ts +0 -126
  81. package/lib/authentication/templates/authentication.tpl.d.ts +0 -2
  82. package/lib/authentication/templates/authentication.tpl.js +0 -40
  83. package/lib/authentication/templates/authentication.tpl.js.map +0 -1
  84. package/lib/authentication/templates/authentication.tpl.ts +0 -51
  85. package/lib/authentication/templates/client.test.tpl.d.ts +0 -2
  86. package/lib/authentication/templates/client.test.tpl.js +0 -62
  87. package/lib/authentication/templates/client.test.tpl.js.map +0 -1
  88. package/lib/authentication/templates/client.test.tpl.ts +0 -74
  89. package/lib/authentication/templates/config.tpl.d.ts +0 -2
  90. package/lib/authentication/templates/config.tpl.js +0 -50
  91. package/lib/authentication/templates/config.tpl.js.map +0 -1
  92. package/lib/authentication/templates/config.tpl.ts +0 -57
  93. package/lib/authentication/templates/declarations.tpl.d.ts +0 -2
  94. package/lib/authentication/templates/declarations.tpl.js +0 -19
  95. package/lib/authentication/templates/declarations.tpl.js.map +0 -1
  96. package/lib/authentication/templates/declarations.tpl.ts +0 -34
  97. package/lib/authentication/templates/knex.tpl.d.ts +0 -2
  98. package/lib/authentication/templates/knex.tpl.js +0 -45
  99. package/lib/authentication/templates/knex.tpl.js.map +0 -1
  100. package/lib/authentication/templates/knex.tpl.ts +0 -62
  101. package/lib/authentication/templates/schema.json.tpl.d.ts +0 -2
  102. package/lib/authentication/templates/schema.json.tpl.js +0 -103
  103. package/lib/authentication/templates/schema.json.tpl.js.map +0 -1
  104. package/lib/authentication/templates/schema.json.tpl.ts +0 -124
  105. package/lib/authentication/templates/schema.typebox.tpl.d.ts +0 -3
  106. package/lib/authentication/templates/schema.typebox.tpl.js +0 -86
  107. package/lib/authentication/templates/schema.typebox.tpl.js.map +0 -1
  108. package/lib/authentication/templates/schema.typebox.tpl.ts +0 -108
  109. package/lib/cli.d.ts +0 -6
  110. package/lib/cli.js +0 -75
  111. package/lib/cli.js.map +0 -1
  112. package/lib/cli.ts +0 -68
  113. package/lib/commons.d.ts +0 -150
  114. package/lib/commons.js +0 -198
  115. package/lib/commons.js.map +0 -1
  116. package/lib/commons.ts +0 -284
  117. package/lib/connection/index.d.ts +0 -55
  118. package/lib/connection/index.js +0 -88
  119. package/lib/connection/index.js.map +0 -1
  120. package/lib/connection/index.ts +0 -123
  121. package/lib/connection/templates/knex.tpl.d.ts +0 -2
  122. package/lib/connection/templates/knex.tpl.js +0 -48
  123. package/lib/connection/templates/knex.tpl.js.map +0 -1
  124. package/lib/connection/templates/knex.tpl.ts +0 -67
  125. package/lib/connection/templates/mongodb.tpl.d.ts +0 -2
  126. package/lib/connection/templates/mongodb.tpl.js +0 -34
  127. package/lib/connection/templates/mongodb.tpl.js.map +0 -1
  128. package/lib/connection/templates/mongodb.tpl.ts +0 -40
  129. package/lib/hook/index.d.ts +0 -22
  130. package/lib/hook/index.js +0 -43
  131. package/lib/hook/index.js.map +0 -1
  132. package/lib/hook/index.ts +0 -47
  133. package/lib/hook/templates/hook.tpl.d.ts +0 -2
  134. package/lib/hook/templates/hook.tpl.js +0 -22
  135. package/lib/hook/templates/hook.tpl.js.map +0 -1
  136. package/lib/hook/templates/hook.tpl.ts +0 -33
  137. package/lib/index.ts +0 -2
  138. package/lib/service/index.d.ts +0 -64
  139. package/lib/service/index.js +0 -116
  140. package/lib/service/index.js.map +0 -1
  141. package/lib/service/index.ts +0 -191
  142. package/lib/service/templates/client.tpl.d.ts +0 -2
  143. package/lib/service/templates/client.tpl.js +0 -31
  144. package/lib/service/templates/client.tpl.js.map +0 -1
  145. package/lib/service/templates/client.tpl.ts +0 -57
  146. package/lib/service/templates/schema.json.tpl.d.ts +0 -2
  147. package/lib/service/templates/schema.json.tpl.js +0 -83
  148. package/lib/service/templates/schema.json.tpl.js.map +0 -1
  149. package/lib/service/templates/schema.json.tpl.ts +0 -98
  150. package/lib/service/templates/schema.typebox.tpl.d.ts +0 -2
  151. package/lib/service/templates/schema.typebox.tpl.js +0 -61
  152. package/lib/service/templates/schema.typebox.tpl.js.map +0 -1
  153. package/lib/service/templates/schema.typebox.tpl.ts +0 -76
  154. package/lib/service/templates/service.tpl.d.ts +0 -3
  155. package/lib/service/templates/service.tpl.js +0 -112
  156. package/lib/service/templates/service.tpl.js.map +0 -1
  157. package/lib/service/templates/service.tpl.ts +0 -152
  158. package/lib/service/templates/test.tpl.d.ts +0 -2
  159. package/lib/service/templates/test.tpl.js +0 -25
  160. package/lib/service/templates/test.tpl.js.map +0 -1
  161. package/lib/service/templates/test.tpl.ts +0 -33
  162. package/lib/service/type/custom.tpl.d.ts +0 -3
  163. package/lib/service/type/custom.tpl.js +0 -98
  164. package/lib/service/type/custom.tpl.js.map +0 -1
  165. package/lib/service/type/custom.tpl.ts +0 -109
  166. package/lib/service/type/knex.tpl.d.ts +0 -3
  167. package/lib/service/type/knex.tpl.js +0 -71
  168. package/lib/service/type/knex.tpl.js.map +0 -1
  169. package/lib/service/type/knex.tpl.ts +0 -92
  170. package/lib/service/type/mongodb.tpl.d.ts +0 -3
  171. package/lib/service/type/mongodb.tpl.js +0 -50
  172. package/lib/service/type/mongodb.tpl.js.map +0 -1
  173. package/lib/service/type/mongodb.tpl.ts +0 -62
@@ -1,38 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generate = void 0;
4
- const pinion_1 = require("@feathershq/pinion");
5
- const commons_1 = require("../../commons");
6
- const template = ({ name, language }) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/client.html
7
- import { feathers } from '@feathersjs/feathers'
8
- import type { TransportConnection, Params } from '@feathersjs/feathers'
9
- import authenticationClient from '@feathersjs/authentication-client'
10
- import type { AuthenticationClientOptions } from '@feathersjs/authentication-client'
11
-
12
- export interface ServiceTypes {
13
- //
14
- }
15
-
16
- /**
17
- * Returns a ${language === 'ts' ? 'typed' : ''} client for the ${name} app.
18
- *
19
- * @param connection The REST or Socket.io Feathers client connection
20
- * @param authenticationOptions Additional settings for the authentication client
21
- * @see https://dove.feathersjs.com/api/client.html
22
- * @returns The Feathers client application
23
- */
24
- export const createClient = <Configuration = any> (
25
- connection: TransportConnection<ServiceTypes>,
26
- authenticationOptions: Partial<AuthenticationClientOptions> = {}
27
- ) => {
28
- const client = feathers<ServiceTypes, Configuration>()
29
-
30
- client.configure(connection)
31
- client.configure(authenticationClient(authenticationOptions))
32
-
33
- return client
34
- }
35
- `;
36
- const generate = async (ctx) => (0, pinion_1.generator)(ctx).then((0, commons_1.renderSource)(template, (0, pinion_1.toFile)(({ lib }) => lib, 'client')));
37
- exports.generate = generate;
38
- //# sourceMappingURL=client.tpl.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.tpl.js","sourceRoot":"","sources":["../../../src/app/templates/client.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAAsD;AACtD,2CAA4C;AAG5C,MAAM,QAAQ,GAAG,CAAC,EAChB,IAAI,EACJ,QAAQ,EACY,EAAE,EAAE,CAAC,QAAQ,CAAC;;;;;;;;;;;eAWrB,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,mBAAmB,IAAI;;;;;;;;;;;;;;;;;;CAkBrE,CAAA;AAEM,MAAM,QAAQ,GAAG,KAAK,EAAE,GAAwB,EAAE,EAAE,CACzD,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,QAAQ,CAAC,CACxD,CACF,CAAA;AANU,QAAA,QAAQ,YAMlB"}
@@ -1,45 +0,0 @@
1
- import { generator, toFile } from '@feathershq/pinion'
2
- import { renderSource } from '../../commons'
3
- import { AppGeneratorContext } from '../index'
4
-
5
- const template = ({
6
- name,
7
- language
8
- }: AppGeneratorContext) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/client.html
9
- import { feathers } from '@feathersjs/feathers'
10
- import type { TransportConnection, Params } from '@feathersjs/feathers'
11
- import authenticationClient from '@feathersjs/authentication-client'
12
- import type { AuthenticationClientOptions } from '@feathersjs/authentication-client'
13
-
14
- export interface ServiceTypes {
15
- //
16
- }
17
-
18
- /**
19
- * Returns a ${language === 'ts' ? 'typed' : ''} client for the ${name} app.
20
- *
21
- * @param connection The REST or Socket.io Feathers client connection
22
- * @param authenticationOptions Additional settings for the authentication client
23
- * @see https://dove.feathersjs.com/api/client.html
24
- * @returns The Feathers client application
25
- */
26
- export const createClient = <Configuration = any> (
27
- connection: TransportConnection<ServiceTypes>,
28
- authenticationOptions: Partial<AuthenticationClientOptions> = {}
29
- ) => {
30
- const client = feathers<ServiceTypes, Configuration>()
31
-
32
- client.configure(connection)
33
- client.configure(authenticationClient(authenticationOptions))
34
-
35
- return client
36
- }
37
- `
38
-
39
- export const generate = async (ctx: AppGeneratorContext) =>
40
- generator(ctx).then(
41
- renderSource(
42
- template,
43
- toFile<AppGeneratorContext>(({ lib }) => lib, 'client')
44
- )
45
- )
@@ -1,2 +0,0 @@
1
- import { AppGeneratorContext } from '../index';
2
- export declare const generate: (ctx: AppGeneratorContext) => Promise<AppGeneratorContext>;
@@ -1,71 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generate = void 0;
4
- const pinion_1 = require("@feathershq/pinion");
5
- const commons_1 = require("../../commons");
6
- const defaultConfig = ({}) => ({
7
- host: 'localhost',
8
- port: 3030,
9
- public: './public/',
10
- origins: ['http://localhost:3030'],
11
- paginate: {
12
- default: 10,
13
- max: 50
14
- }
15
- });
16
- const customEnvironment = {
17
- port: {
18
- __name: 'PORT',
19
- __format: 'number'
20
- },
21
- host: 'HOSTNAME'
22
- };
23
- const testConfig = {
24
- port: 8998
25
- };
26
- const configurationJsonTemplate = ({}) => /* ts */ `import { defaultAppSettings, getValidator } from '@feathersjs/schema'
27
- import type { FromSchema } from '@feathersjs/schema'
28
-
29
- import { dataValidator } from './validators'
30
-
31
- export const configurationSchema = {
32
- type: 'object',
33
- additionalProperties: false,
34
- required: [ 'host', 'port', 'public' ],
35
- properties: {
36
- ...defaultAppSettings,
37
- host: { type: 'string' },
38
- port: { type: 'number' },
39
- public: { type: 'string' }
40
- }
41
- } as const
42
-
43
- export const configurationValidator = getValidator(configurationSchema, dataValidator)
44
-
45
- export type ApplicationConfiguration = FromSchema<typeof configurationSchema>
46
- `;
47
- const configurationTypeboxTemplate = ({}) => /* ts */ `import { Type, getValidator, defaultAppConfiguration } from '@feathersjs/typebox'
48
- import type { Static } from '@feathersjs/typebox'
49
-
50
- import { dataValidator } from './validators'
51
-
52
- export const configurationSchema = Type.Intersect([
53
- defaultAppConfiguration,
54
- Type.Object({
55
- host: Type.String(),
56
- port: Type.Number(),
57
- public: Type.String()
58
- })
59
- ])
60
-
61
- export type ApplicationConfiguration = Static<typeof configurationSchema>
62
-
63
- export const configurationValidator = getValidator(configurationSchema, dataValidator)
64
- `;
65
- const generate = (ctx) => (0, pinion_1.generator)(ctx)
66
- .then((0, pinion_1.writeJSON)(defaultConfig, (0, pinion_1.toFile)('config', 'default.json')))
67
- .then((0, pinion_1.writeJSON)(testConfig, (0, pinion_1.toFile)('config', 'test.json')))
68
- .then((0, pinion_1.writeJSON)(customEnvironment, (0, pinion_1.toFile)('config', 'custom-environment-variables.json')))
69
- .then((0, commons_1.renderSource)(async (ctx) => ctx.schema === 'typebox' ? configurationTypeboxTemplate(ctx) : configurationJsonTemplate(ctx), (0, pinion_1.toFile)(({ lib }) => lib, 'configuration')));
70
- exports.generate = generate;
71
- //# sourceMappingURL=configuration.tpl.js.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,EACV,KAAK,EAAE,GAAG,EAAE,EAAE,CACZ,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,4BAA4B,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,yBAAyB,CAAC,GAAG,CAAC,EAC/F,IAAA,eAAM,EAAsB,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,eAAe,CAAC,CAC/D,CACF,CAAA;AAXQ,QAAA,QAAQ,YAWhB"}
@@ -1,82 +0,0 @@
1
- import { generator, toFile, writeJSON } from '@feathershq/pinion'
2
- import { renderSource } from '../../commons'
3
- import { AppGeneratorContext } from '../index'
4
-
5
- const defaultConfig = ({}: AppGeneratorContext) => ({
6
- host: 'localhost',
7
- port: 3030,
8
- public: './public/',
9
- origins: ['http://localhost:3030'],
10
- paginate: {
11
- default: 10,
12
- max: 50
13
- }
14
- })
15
-
16
- const customEnvironment = {
17
- port: {
18
- __name: 'PORT',
19
- __format: 'number'
20
- },
21
- host: 'HOSTNAME'
22
- }
23
-
24
- const testConfig = {
25
- port: 8998
26
- }
27
-
28
- const configurationJsonTemplate =
29
- ({}: AppGeneratorContext) => /* ts */ `import { defaultAppSettings, getValidator } from '@feathersjs/schema'
30
- import type { FromSchema } from '@feathersjs/schema'
31
-
32
- import { dataValidator } from './validators'
33
-
34
- export const configurationSchema = {
35
- type: 'object',
36
- additionalProperties: false,
37
- required: [ 'host', 'port', 'public' ],
38
- properties: {
39
- ...defaultAppSettings,
40
- host: { type: 'string' },
41
- port: { type: 'number' },
42
- public: { type: 'string' }
43
- }
44
- } as const
45
-
46
- export const configurationValidator = getValidator(configurationSchema, dataValidator)
47
-
48
- export type ApplicationConfiguration = FromSchema<typeof configurationSchema>
49
- `
50
-
51
- const configurationTypeboxTemplate =
52
- ({}: AppGeneratorContext) => /* ts */ `import { Type, getValidator, defaultAppConfiguration } from '@feathersjs/typebox'
53
- import type { Static } from '@feathersjs/typebox'
54
-
55
- import { dataValidator } from './validators'
56
-
57
- export const configurationSchema = Type.Intersect([
58
- defaultAppConfiguration,
59
- Type.Object({
60
- host: Type.String(),
61
- port: Type.Number(),
62
- public: Type.String()
63
- })
64
- ])
65
-
66
- export type ApplicationConfiguration = Static<typeof configurationSchema>
67
-
68
- export const configurationValidator = getValidator(configurationSchema, dataValidator)
69
- `
70
-
71
- export const generate = (ctx: AppGeneratorContext) =>
72
- generator(ctx)
73
- .then(writeJSON(defaultConfig, toFile('config', 'default.json')))
74
- .then(writeJSON(testConfig, toFile('config', 'test.json')))
75
- .then(writeJSON(customEnvironment, toFile('config', 'custom-environment-variables.json')))
76
- .then(
77
- renderSource(
78
- async (ctx) =>
79
- ctx.schema === 'typebox' ? configurationTypeboxTemplate(ctx) : configurationJsonTemplate(ctx),
80
- toFile<AppGeneratorContext>(({ lib }) => lib, 'configuration')
81
- )
82
- )
@@ -1,2 +0,0 @@
1
- import { AppGeneratorContext } from '../index';
2
- export declare const generate: (ctx: AppGeneratorContext) => Promise<AppGeneratorContext>;
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generate = void 0;
4
- const pinion_1 = require("@feathershq/pinion");
5
- const template = ({ framework }) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/typescript.html
6
- import { HookContext as FeathersHookContext, NextFunction } from '@feathersjs/feathers'
7
- import { Application as FeathersApplication } from '@feathersjs/${framework}'
8
- import { ApplicationConfiguration } from './configuration'
9
-
10
- export { NextFunction }
11
-
12
- // The types for app.get(name) and app.set(name)
13
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
14
- export interface Configuration extends ApplicationConfiguration {}
15
-
16
- // A mapping of service names to types. Will be extended in service files.
17
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
18
- export interface ServiceTypes {}
19
-
20
- // The application instance type that will be used everywhere else
21
- export type Application = FeathersApplication<ServiceTypes, Configuration>
22
-
23
- // The context for hook functions - can be typed with a service class
24
- export type HookContext<S = any> = FeathersHookContext<Application, S>
25
- `;
26
- const generate = (ctx) => (0, pinion_1.generator)(ctx).then((0, pinion_1.when)(({ language }) => language === 'ts', (0, pinion_1.renderTemplate)(template, (0, pinion_1.toFile)(({ lib }) => lib, 'declarations.ts'))));
27
- exports.generate = generate;
28
- //# sourceMappingURL=declarations.tpl.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"declarations.tpl.js","sourceRoot":"","sources":["../../../src/app/templates/declarations.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAA4E;AAG5E,MAAM,QAAQ,GAAG,CAAC,EAChB,SAAS,EACW,EAAE,EAAE,CAAC,QAAQ,CAAC;;kEAE8B,SAAS;;;;;;;;;;;;;;;;;;CAkB1E,CAAA;AAEM,MAAM,QAAQ,GAAG,CAAC,GAAwB,EAAE,EAAE,CACnD,IAAA,kBAAS,EAAC,GAAG,CAAC,CAAC,IAAI,CACjB,IAAA,aAAI,EACF,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,QAAQ,KAAK,IAAI,EACnC,IAAA,uBAAc,EACZ,QAAQ,EACR,IAAA,eAAM,EAAsB,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,iBAAiB,CAAC,CACjE,CACF,CACF,CAAA;AATU,QAAA,QAAQ,YASlB"}
@@ -1,37 +0,0 @@
1
- import { generator, toFile, when, renderTemplate } from '@feathershq/pinion'
2
- import { AppGeneratorContext } from '../index'
3
-
4
- const template = ({
5
- framework
6
- }: AppGeneratorContext) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/typescript.html
7
- import { HookContext as FeathersHookContext, NextFunction } from '@feathersjs/feathers'
8
- import { Application as FeathersApplication } from '@feathersjs/${framework}'
9
- import { ApplicationConfiguration } from './configuration'
10
-
11
- export { NextFunction }
12
-
13
- // The types for app.get(name) and app.set(name)
14
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
15
- export interface Configuration extends ApplicationConfiguration {}
16
-
17
- // A mapping of service names to types. Will be extended in service files.
18
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
19
- export interface ServiceTypes {}
20
-
21
- // The application instance type that will be used everywhere else
22
- export type Application = FeathersApplication<ServiceTypes, Configuration>
23
-
24
- // The context for hook functions - can be typed with a service class
25
- export type HookContext<S = any> = FeathersHookContext<Application, S>
26
- `
27
-
28
- export const generate = (ctx: AppGeneratorContext) =>
29
- generator(ctx).then(
30
- when<AppGeneratorContext>(
31
- ({ language }) => language === 'ts',
32
- renderTemplate(
33
- template,
34
- toFile<AppGeneratorContext>(({ lib }) => lib, 'declarations.ts')
35
- )
36
- )
37
- )
@@ -1,2 +0,0 @@
1
- import { AppGeneratorContext } from '../index';
2
- export declare const generate: (ctx: AppGeneratorContext) => Promise<AppGeneratorContext>;
@@ -1,45 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generate = void 0;
4
- const pinion_1 = require("@feathershq/pinion");
5
- const template = ({ name, description }) => /* html */ `<!DOCTYPE html>
6
- <html lang="en">
7
- <head>
8
- <title>${name}</title>
9
- <meta name="description" content="${description}">
10
- <meta name="viewport" content="width=device-width, initial-scale=1">
11
- <style>
12
- * {
13
- margin: 0;
14
- padding: 0;
15
- box-sizing: border-box;
16
- }
17
-
18
- html {
19
- height: 100%;
20
- }
21
-
22
- body {
23
- min-height: 100%;
24
- display: flex;
25
- align-items: center;
26
- }
27
-
28
- img.logo {
29
- display: block;
30
- margin: auto auto;
31
- width: 30%;
32
- max-width: 100%;
33
- max-height: 100%;
34
- }
35
- </style>
36
- </head>
37
- <body>
38
- <img class="logo" src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjUwMCIgaGVpZ2h0PSIyNTAwIiB2aWV3Qm94PSIwIDAgMjU2IDI1NiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJ4TWlkWU1pZCI+PHBhdGggZD0iTTEyOCA5L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zMTUtMy45NzkgMTAuMjkxLTMxLjA0NyAxMC45OTQtMzkuMzkxLjE3Ni0yLjA5My41ODMtNC42NTcuMjY4LTguMzk4IDAgMC05Ljk0MSAyLjE3Ny0xMi4wMTQgMS40MjQgMi4xMDQtLjIzNyAxMi4yNjMtNC4xNCAxMi4yNjMtNC4xNCAxLjgwMS0xNi4yMTMgMi4zNTgtNDIuMDkxLTMuNDEzLTQzLjE0MXptLTM2LjM4IDE3MS42OTFjLS43OTUgMTkuNDk2LTEuMjk0IDI1LjAwNC0yLjExNSAyOS42MDEtLjM3OS44NTctLjc1OC45OTctMS4xMzgtLjA5NS0zLjQ3Ny0xNS45OTItMy4yMjQtMTM2LjQzOCAzNi40MDktMTkxLjI0MS0yMy4wNSA0Mi4wOTItMzMuNTM1IDEyMi44NjEtMzMuMTU2IDE2MS43MzV6IiBmaWxsPSIjMzMzIi8+PC9zdmc+" />
39
- </body>
40
- </html>
41
-
42
- `;
43
- const generate = (ctx) => (0, pinion_1.generator)(ctx).then((0, pinion_1.renderTemplate)(template, (0, pinion_1.toFile)('public', 'index.html')));
44
- exports.generate = generate;
45
- //# sourceMappingURL=index.html.tpl.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.html.tpl.js","sourceRoot":"","sources":["../../../src/app/templates/index.html.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAAsE;AAGtE,MAAM,QAAQ,GAAG,CAAC,EAAE,IAAI,EAAE,WAAW,EAAuB,EAAE,EAAE,CAAC,UAAU,CAAC;;;aAG/D,IAAI;wCACuB,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiClD,CAAA;AAEM,MAAM,QAAQ,GAAG,CAAC,GAAwB,EAAE,EAAE,CACnD,IAAA,kBAAS,EAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAA,uBAAc,EAAC,QAAQ,EAAE,IAAA,eAAM,EAAC,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,CAAA;AADlE,QAAA,QAAQ,YAC0D"}
@@ -1,44 +0,0 @@
1
- import { generator, renderTemplate, toFile } from '@feathershq/pinion'
2
- import { AppGeneratorContext } from '../index'
3
-
4
- const template = ({ name, description }: AppGeneratorContext) => /* html */ `<!DOCTYPE html>
5
- <html lang="en">
6
- <head>
7
- <title>${name}</title>
8
- <meta name="description" content="${description}">
9
- <meta name="viewport" content="width=device-width, initial-scale=1">
10
- <style>
11
- * {
12
- margin: 0;
13
- padding: 0;
14
- box-sizing: border-box;
15
- }
16
-
17
- html {
18
- height: 100%;
19
- }
20
-
21
- body {
22
- min-height: 100%;
23
- display: flex;
24
- align-items: center;
25
- }
26
-
27
- img.logo {
28
- display: block;
29
- margin: auto auto;
30
- width: 30%;
31
- max-width: 100%;
32
- max-height: 100%;
33
- }
34
- </style>
35
- </head>
36
- <body>
37
- <img class="logo" src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjUwMCIgaGVpZ2h0PSIyNTAwIiB2aWV3Qm94PSIwIDAgMjU2IDI1NiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJ4TWlkWU1pZCI+PHBhdGggZD0iTTEyOCA5LjEwMmM2NS42NjUgMCAxMTguODk4IDUzLjIzMyAxMTguODk4IDExOC44OTggMCA2NS42NjUtNTMuMjMzIDExOC44OTgtMTE4Ljg5OCAxMTguODk4QzYyLjMzNSAyNDYuODk4IDkuMTAyIDE5My42NjUgOS4xMDIgMTI4IDkuMTAyIDYyLjMzNSA2Mi4zMzUgOS4xMDIgMTI4IDkuMTAyTTEyOCAwQzU3LjQyMSAwIDAgNTcuNDIxIDAgMTI4YzAgNzAuNTc5IDU3LjQyMSAxMjggMTI4IDEyOCA3MC41NzkgMCAxMjgtNTcuNDIxIDEyOC0xMjhDMjU2IDU3LjQyMSAxOTguNTc5IDAgMTI4IDBtMjAuODMgMjUuNTI0Yy0xMC40My0xLjg5Ni0zNS42NTEgMzYuNDA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TItMzMuNTM1IDEyMi44NjEtMzMuMTU2IDE2MS43MzV6IiBmaWxsPSIjMzMzIi8+PC9zdmc+" />
38
- </body>
39
- </html>
40
-
41
- `
42
-
43
- export const generate = (ctx: AppGeneratorContext) =>
44
- generator(ctx).then(renderTemplate(template, toFile('public', 'index.html')))
@@ -1,2 +0,0 @@
1
- import { AppGeneratorContext } from '../index';
2
- export declare const generate: (ctx: AppGeneratorContext) => Promise<AppGeneratorContext>;
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generate = void 0;
4
- const pinion_1 = require("@feathershq/pinion");
5
- const commons_1 = require("../../commons");
6
- const template = ({}) => /* ts */ `import { app } from './app'
7
- import { logger } from './logger'
8
-
9
- const port = app.get('port')
10
- const host = app.get('host')
11
-
12
- app.listen(port).then(() => {
13
- logger.info(\`Feathers app listening on http://\${host}:\${port}\`)
14
- })
15
- `;
16
- const generate = (ctx) => (0, pinion_1.generator)(ctx).then((0, commons_1.renderSource)(template, (0, pinion_1.toFile)(({ lib }) => lib, 'index')));
17
- exports.generate = generate;
18
- //# sourceMappingURL=index.tpl.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.tpl.js","sourceRoot":"","sources":["../../../src/app/templates/index.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAAsD;AACtD,2CAA4C;AAG5C,MAAM,QAAQ,GAAG,CAAC,EAAuB,EAAE,EAAE,CAAC,QAAQ,CAAC;;;;;;;;;CAStD,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,OAAO,CAAC,CACvD,CACF,CAAA;AANU,QAAA,QAAQ,YAMlB"}
@@ -1,22 +0,0 @@
1
- import { generator, toFile } from '@feathershq/pinion'
2
- import { renderSource } from '../../commons'
3
- import { AppGeneratorContext } from '../index'
4
-
5
- const template = ({}: AppGeneratorContext) => /* ts */ `import { app } from './app'
6
- import { logger } from './logger'
7
-
8
- const port = app.get('port')
9
- const host = app.get('host')
10
-
11
- app.listen(port).then(() => {
12
- logger.info(\`Feathers app listening on http://\${host}:\${port}\`)
13
- })
14
- `
15
-
16
- export const generate = (ctx: AppGeneratorContext) =>
17
- generator(ctx).then(
18
- renderSource(
19
- template,
20
- toFile<AppGeneratorContext>(({ lib }) => lib, 'index')
21
- )
22
- )
@@ -1,3 +0,0 @@
1
- import { AppGeneratorContext } from '../index';
2
- export declare const logErrorTemplate = "// For more information about this file see https://dove.feathersjs.com/guides/cli/log-error.html\nimport type { HookContext, NextFunction } from '../declarations'\nimport { logger } from '../logger'\n\nexport const logError = async (context: HookContext, next: NextFunction) => {\n try {\n await next()\n } catch (error: any) {\n logger.error(error.stack)\n \n // Log validation errors\n if (error.data) {\n logger.error(error.data)\n }\n\n throw error\n }\n}\n";
3
- export declare const generate: (ctx: AppGeneratorContext) => Promise<AppGeneratorContext>;
@@ -1,45 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generate = exports.logErrorTemplate = void 0;
4
- const pinion_1 = require("@feathershq/pinion");
5
- const commons_1 = require("../../commons");
6
- const template = ({}) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/logging.html
7
- import { createLogger, format, transports } from 'winston'
8
-
9
- // Configure the Winston logger. For the complete documentation see https://github.com/winstonjs/winston
10
- export const logger = createLogger({
11
- // To see more detailed errors, change this to 'debug'
12
- level: 'info',
13
- format: format.combine(
14
- format.splat(),
15
- format.simple()
16
- ),
17
- transports: [
18
- new transports.Console()
19
- ]
20
- })
21
- `;
22
- exports.logErrorTemplate = `// For more information about this file see https://dove.feathersjs.com/guides/cli/log-error.html
23
- import type { HookContext, NextFunction } from '../declarations'
24
- import { logger } from '../logger'
25
-
26
- export const logError = async (context: HookContext, next: NextFunction) => {
27
- try {
28
- await next()
29
- } catch (error: any) {
30
- logger.error(error.stack)
31
-
32
- // Log validation errors
33
- if (error.data) {
34
- logger.error(error.data)
35
- }
36
-
37
- throw error
38
- }
39
- }
40
- `;
41
- const generate = (ctx) => (0, pinion_1.generator)(ctx)
42
- .then((0, commons_1.renderSource)(template, (0, pinion_1.toFile)(({ lib }) => lib, 'logger')))
43
- .then((0, commons_1.renderSource)(exports.logErrorTemplate, (0, pinion_1.toFile)(({ lib }) => lib, 'hooks', 'log-error')));
44
- exports.generate = generate;
45
- //# sourceMappingURL=logger.tpl.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger.tpl.js","sourceRoot":"","sources":["../../../src/app/templates/logger.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAAsD;AACtD,2CAA4C;AAG5C,MAAM,QAAQ,GACZ,CAAC,EAAuB,EAAE,EAAE,CAAC,QAAQ,CAAC;;;;;;;;;;;;;;;CAevC,CAAA;AAEY,QAAA,gBAAgB,GAAY;;;;;;;;;;;;;;;;;;CAkBxC,CAAA;AAEM,MAAM,QAAQ,GAAG,CAAC,GAAwB,EAAE,EAAE,CACnD,IAAA,kBAAS,EAAC,GAAG,CAAC;KACX,IAAI,CACH,IAAA,sBAAY,EACV,QAAQ,EACR,IAAA,eAAM,EAAsB,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,QAAQ,CAAC,CACxD,CACF;KACA,IAAI,CACH,IAAA,sBAAY,EACV,wBAAgB,EAChB,IAAA,eAAM,EAAsB,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,WAAW,CAAC,CACpE,CACF,CAAA;AAbQ,QAAA,QAAQ,YAahB"}
@@ -1,56 +0,0 @@
1
- import { generator, toFile } from '@feathershq/pinion'
2
- import { renderSource } from '../../commons'
3
- import { AppGeneratorContext } from '../index'
4
-
5
- const template =
6
- ({}: AppGeneratorContext) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/logging.html
7
- import { createLogger, format, transports } from 'winston'
8
-
9
- // Configure the Winston logger. For the complete documentation see https://github.com/winstonjs/winston
10
- export const logger = createLogger({
11
- // To see more detailed errors, change this to 'debug'
12
- level: 'info',
13
- format: format.combine(
14
- format.splat(),
15
- format.simple()
16
- ),
17
- transports: [
18
- new transports.Console()
19
- ]
20
- })
21
- `
22
-
23
- export const logErrorTemplate = /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/log-error.html
24
- import type { HookContext, NextFunction } from '../declarations'
25
- import { logger } from '../logger'
26
-
27
- export const logError = async (context: HookContext, next: NextFunction) => {
28
- try {
29
- await next()
30
- } catch (error: any) {
31
- logger.error(error.stack)
32
-
33
- // Log validation errors
34
- if (error.data) {
35
- logger.error(error.data)
36
- }
37
-
38
- throw error
39
- }
40
- }
41
- `
42
-
43
- export const generate = (ctx: AppGeneratorContext) =>
44
- generator(ctx)
45
- .then(
46
- renderSource(
47
- template,
48
- toFile<AppGeneratorContext>(({ lib }) => lib, 'logger')
49
- )
50
- )
51
- .then(
52
- renderSource(
53
- logErrorTemplate,
54
- toFile<AppGeneratorContext>(({ lib }) => lib, 'hooks', 'log-error')
55
- )
56
- )
@@ -1,2 +0,0 @@
1
- import { AppGeneratorContext } from '../index';
2
- export declare const generate: (ctx: AppGeneratorContext) => Promise<AppGeneratorContext>;
@@ -1,58 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generate = void 0;
4
- const pinion_1 = require("@feathershq/pinion");
5
- const jsPackageJson = (lib) => ({
6
- type: 'module',
7
- scripts: {
8
- start: `node ${lib}`,
9
- dev: `nodemon ${lib}/`,
10
- prettier: 'npx prettier "**/*.js" --write',
11
- mocha: 'cross-env NODE_ENV=test mocha test/ --recursive --exit',
12
- test: 'npm run mocha',
13
- 'bundle:client': 'npm pack --pack-destination ./public'
14
- }
15
- });
16
- const tsPackageJson = (lib) => ({
17
- scripts: {
18
- dev: `nodemon -x ts-node ${lib}/index.ts`,
19
- compile: 'shx rm -rf lib/ && tsc',
20
- start: 'node lib/',
21
- prettier: 'npx prettier "**/*.ts" --write',
22
- mocha: 'cross-env NODE_ENV=test mocha test/ --require ts-node/register --recursive --extension .ts --exit',
23
- test: 'npm run mocha',
24
- 'bundle:client': 'npm run compile && npm pack --pack-destination ./public'
25
- }
26
- });
27
- const packageJson = ({ name, description, language, packager, database, framework, transports, lib, test, schema }) => ({
28
- name,
29
- description,
30
- version: '0.0.0',
31
- homepage: '',
32
- private: true,
33
- keywords: ['feathers'],
34
- author: {},
35
- contributors: [],
36
- bugs: {},
37
- engines: {
38
- node: `>= ${process.version.substring(1)}`
39
- },
40
- feathers: {
41
- language,
42
- packager,
43
- database,
44
- framework,
45
- transports,
46
- schema
47
- },
48
- directories: {
49
- lib,
50
- test
51
- },
52
- files: ['lib/client.js', 'lib/**/*.d.ts'],
53
- main: language === 'ts' ? 'lib/client' : `${lib}/client`,
54
- ...(language === 'ts' ? tsPackageJson(lib) : jsPackageJson(lib))
55
- });
56
- const generate = (ctx) => (0, pinion_1.generator)(ctx).then((0, pinion_1.writeJSON)(packageJson, (0, pinion_1.toFile)('package.json')));
57
- exports.generate = generate;
58
- //# sourceMappingURL=package.json.tpl.js.map