@feathersjs/generators 5.0.0-pre.35
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/CHANGELOG.md +10 -0
- package/LICENSE +22 -0
- package/README.md +23 -0
- package/lib/app/index.d.ts +29 -0
- package/lib/app/index.js +146 -0
- package/lib/app/index.js.map +1 -0
- package/lib/app/index.ts +228 -0
- package/lib/app/static/.gitignore +121 -0
- package/lib/app/templates/app.test.tpl.d.ts +2 -0
- package/lib/app/templates/app.test.tpl.js +49 -0
- package/lib/app/templates/app.test.tpl.js.map +1 -0
- package/lib/app/templates/app.test.tpl.ts +50 -0
- package/lib/app/templates/app.tpl.d.ts +2 -0
- package/lib/app/templates/app.tpl.js +123 -0
- package/lib/app/templates/app.tpl.js.map +1 -0
- package/lib/app/templates/app.tpl.ts +138 -0
- package/lib/app/templates/channels.tpl.d.ts +2 -0
- package/lib/app/templates/channels.tpl.js +50 -0
- package/lib/app/templates/channels.tpl.js.map +1 -0
- package/lib/app/templates/channels.tpl.ts +56 -0
- package/lib/app/templates/client.test.tpl.d.ts +2 -0
- package/lib/app/templates/client.test.tpl.js +27 -0
- package/lib/app/templates/client.test.tpl.js.map +1 -0
- package/lib/app/templates/client.test.tpl.ts +26 -0
- package/lib/app/templates/client.tpl.d.ts +2 -0
- package/lib/app/templates/client.tpl.js +38 -0
- package/lib/app/templates/client.tpl.js.map +1 -0
- package/lib/app/templates/client.tpl.ts +45 -0
- package/lib/app/templates/configuration.tpl.d.ts +2 -0
- package/lib/app/templates/configuration.tpl.js +71 -0
- package/lib/app/templates/configuration.tpl.js.map +1 -0
- package/lib/app/templates/configuration.tpl.ts +82 -0
- package/lib/app/templates/declarations.tpl.d.ts +2 -0
- package/lib/app/templates/declarations.tpl.js +28 -0
- package/lib/app/templates/declarations.tpl.js.map +1 -0
- package/lib/app/templates/declarations.tpl.ts +37 -0
- package/lib/app/templates/index.html.tpl.d.ts +2 -0
- package/lib/app/templates/index.html.tpl.js +45 -0
- package/lib/app/templates/index.html.tpl.js.map +1 -0
- package/lib/app/templates/index.html.tpl.ts +44 -0
- package/lib/app/templates/index.tpl.d.ts +2 -0
- package/lib/app/templates/index.tpl.js +22 -0
- package/lib/app/templates/index.tpl.js.map +1 -0
- package/lib/app/templates/index.tpl.ts +26 -0
- package/lib/app/templates/logger.tpl.d.ts +3 -0
- package/lib/app/templates/logger.tpl.js +45 -0
- package/lib/app/templates/logger.tpl.js.map +1 -0
- package/lib/app/templates/logger.tpl.ts +56 -0
- package/lib/app/templates/package.json.tpl.d.ts +2 -0
- package/lib/app/templates/package.json.tpl.js +58 -0
- package/lib/app/templates/package.json.tpl.js.map +1 -0
- package/lib/app/templates/package.json.tpl.ts +71 -0
- package/lib/app/templates/prettierrc.tpl.d.ts +2 -0
- package/lib/app/templates/prettierrc.tpl.js +11 -0
- package/lib/app/templates/prettierrc.tpl.js.map +1 -0
- package/lib/app/templates/prettierrc.tpl.ts +14 -0
- package/lib/app/templates/readme.md.tpl.d.ts +2 -0
- package/lib/app/templates/readme.md.tpl.js +54 -0
- package/lib/app/templates/readme.md.tpl.js.map +1 -0
- package/lib/app/templates/readme.md.tpl.ts +57 -0
- package/lib/app/templates/services.tpl.d.ts +2 -0
- package/lib/app/templates/services.tpl.js +15 -0
- package/lib/app/templates/services.tpl.js.map +1 -0
- package/lib/app/templates/services.tpl.ts +20 -0
- package/lib/app/templates/tsconfig.json.tpl.d.ts +2 -0
- package/lib/app/templates/tsconfig.json.tpl.js +22 -0
- package/lib/app/templates/tsconfig.json.tpl.js.map +1 -0
- package/lib/app/templates/tsconfig.json.tpl.ts +28 -0
- package/lib/app/templates/validators.tpl.d.ts +2 -0
- package/lib/app/templates/validators.tpl.js +36 -0
- package/lib/app/templates/validators.tpl.js.map +1 -0
- package/lib/app/templates/validators.tpl.ts +40 -0
- package/lib/authentication/index.d.ts +73 -0
- package/lib/authentication/index.js +107 -0
- package/lib/authentication/index.js.map +1 -0
- package/lib/authentication/index.ts +126 -0
- package/lib/authentication/templates/authentication.tpl.d.ts +2 -0
- package/lib/authentication/templates/authentication.tpl.js +40 -0
- package/lib/authentication/templates/authentication.tpl.js.map +1 -0
- package/lib/authentication/templates/authentication.tpl.ts +51 -0
- package/lib/authentication/templates/client.test.tpl.d.ts +2 -0
- package/lib/authentication/templates/client.test.tpl.js +62 -0
- package/lib/authentication/templates/client.test.tpl.js.map +1 -0
- package/lib/authentication/templates/client.test.tpl.ts +74 -0
- package/lib/authentication/templates/config.tpl.d.ts +2 -0
- package/lib/authentication/templates/config.tpl.js +50 -0
- package/lib/authentication/templates/config.tpl.js.map +1 -0
- package/lib/authentication/templates/config.tpl.ts +57 -0
- package/lib/authentication/templates/declarations.tpl.d.ts +2 -0
- package/lib/authentication/templates/declarations.tpl.js +19 -0
- package/lib/authentication/templates/declarations.tpl.js.map +1 -0
- package/lib/authentication/templates/declarations.tpl.ts +34 -0
- package/lib/authentication/templates/knex.tpl.d.ts +2 -0
- package/lib/authentication/templates/knex.tpl.js +45 -0
- package/lib/authentication/templates/knex.tpl.js.map +1 -0
- package/lib/authentication/templates/knex.tpl.ts +62 -0
- package/lib/authentication/templates/schema.json.tpl.d.ts +2 -0
- package/lib/authentication/templates/schema.json.tpl.js +103 -0
- package/lib/authentication/templates/schema.json.tpl.js.map +1 -0
- package/lib/authentication/templates/schema.json.tpl.ts +124 -0
- package/lib/authentication/templates/schema.typebox.tpl.d.ts +3 -0
- package/lib/authentication/templates/schema.typebox.tpl.js +86 -0
- package/lib/authentication/templates/schema.typebox.tpl.js.map +1 -0
- package/lib/authentication/templates/schema.typebox.tpl.ts +108 -0
- package/lib/commons.d.ts +150 -0
- package/lib/commons.js +198 -0
- package/lib/commons.js.map +1 -0
- package/lib/commons.ts +284 -0
- package/lib/connection/index.d.ts +55 -0
- package/lib/connection/index.js +88 -0
- package/lib/connection/index.js.map +1 -0
- package/lib/connection/index.ts +123 -0
- package/lib/connection/templates/knex.tpl.d.ts +2 -0
- package/lib/connection/templates/knex.tpl.js +48 -0
- package/lib/connection/templates/knex.tpl.js.map +1 -0
- package/lib/connection/templates/knex.tpl.ts +67 -0
- package/lib/connection/templates/mongodb.tpl.d.ts +2 -0
- package/lib/connection/templates/mongodb.tpl.js +34 -0
- package/lib/connection/templates/mongodb.tpl.js.map +1 -0
- package/lib/connection/templates/mongodb.tpl.ts +40 -0
- package/lib/hook/index.d.ts +22 -0
- package/lib/hook/index.js +43 -0
- package/lib/hook/index.js.map +1 -0
- package/lib/hook/index.ts +47 -0
- package/lib/hook/templates/hook.tpl.d.ts +2 -0
- package/lib/hook/templates/hook.tpl.js +22 -0
- package/lib/hook/templates/hook.tpl.js.map +1 -0
- package/lib/hook/templates/hook.tpl.ts +33 -0
- package/lib/index.d.ts +7 -0
- package/lib/index.js +37 -0
- package/lib/index.js.map +1 -0
- package/lib/index.ts +8 -0
- package/lib/service/index.d.ts +64 -0
- package/lib/service/index.js +116 -0
- package/lib/service/index.js.map +1 -0
- package/lib/service/index.ts +191 -0
- package/lib/service/templates/client.tpl.d.ts +2 -0
- package/lib/service/templates/client.tpl.js +30 -0
- package/lib/service/templates/client.tpl.js.map +1 -0
- package/lib/service/templates/client.tpl.ts +56 -0
- package/lib/service/templates/schema.json.tpl.d.ts +2 -0
- package/lib/service/templates/schema.json.tpl.js +83 -0
- package/lib/service/templates/schema.json.tpl.js.map +1 -0
- package/lib/service/templates/schema.json.tpl.ts +98 -0
- package/lib/service/templates/schema.typebox.tpl.d.ts +2 -0
- package/lib/service/templates/schema.typebox.tpl.js +61 -0
- package/lib/service/templates/schema.typebox.tpl.js.map +1 -0
- package/lib/service/templates/schema.typebox.tpl.ts +76 -0
- package/lib/service/templates/service.tpl.d.ts +3 -0
- package/lib/service/templates/service.tpl.js +112 -0
- package/lib/service/templates/service.tpl.js.map +1 -0
- package/lib/service/templates/service.tpl.ts +152 -0
- package/lib/service/templates/test.tpl.d.ts +2 -0
- package/lib/service/templates/test.tpl.js +25 -0
- package/lib/service/templates/test.tpl.js.map +1 -0
- package/lib/service/templates/test.tpl.ts +33 -0
- package/lib/service/type/custom.tpl.d.ts +3 -0
- package/lib/service/type/custom.tpl.js +98 -0
- package/lib/service/type/custom.tpl.js.map +1 -0
- package/lib/service/type/custom.tpl.ts +109 -0
- package/lib/service/type/knex.tpl.d.ts +3 -0
- package/lib/service/type/knex.tpl.js +71 -0
- package/lib/service/type/knex.tpl.js.map +1 -0
- package/lib/service/type/knex.tpl.ts +92 -0
- package/lib/service/type/mongodb.tpl.d.ts +3 -0
- package/lib/service/type/mongodb.tpl.js +50 -0
- package/lib/service/type/mongodb.tpl.js.map +1 -0
- package/lib/service/type/mongodb.tpl.ts +62 -0
- package/package.json +89 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { generator, toFile } from '@feathershq/pinion'
|
|
2
|
+
import { renderSource } from '../../commons'
|
|
3
|
+
import { AppGeneratorContext } from '../index'
|
|
4
|
+
|
|
5
|
+
const template = ({
|
|
6
|
+
lib
|
|
7
|
+
}: AppGeneratorContext) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/app.test.html
|
|
8
|
+
import assert from 'assert'
|
|
9
|
+
import axios from 'axios'
|
|
10
|
+
import type { Server } from 'http'
|
|
11
|
+
import { app } from '../${lib}/app'
|
|
12
|
+
|
|
13
|
+
const port = app.get('port')
|
|
14
|
+
const appUrl = \`http://\${app.get('host')}:\${port}\`
|
|
15
|
+
|
|
16
|
+
describe('Feathers application tests', () => {
|
|
17
|
+
let server: Server
|
|
18
|
+
|
|
19
|
+
before(async () => {
|
|
20
|
+
server = await app.listen(port)
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
after(async () => {
|
|
24
|
+
await app.teardown()
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
it('starts and shows the index page', async () => {
|
|
28
|
+
const { data } = await axios.get<string>(appUrl)
|
|
29
|
+
|
|
30
|
+
assert.ok(data.indexOf('<html lang="en">') !== -1)
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
it('shows a 404 JSON error', async () => {
|
|
34
|
+
try {
|
|
35
|
+
await axios.get(\`\${appUrl}/path/to/nowhere\`, {
|
|
36
|
+
responseType: 'json'
|
|
37
|
+
})
|
|
38
|
+
assert.fail('should never get here')
|
|
39
|
+
} catch (error: any) {
|
|
40
|
+
const { response } = error
|
|
41
|
+
assert.strictEqual(response?.status, 404)
|
|
42
|
+
assert.strictEqual(response?.data?.code, 404)
|
|
43
|
+
assert.strictEqual(response?.data?.name, 'NotFound')
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
})
|
|
47
|
+
`
|
|
48
|
+
|
|
49
|
+
export const generate = (ctx: AppGeneratorContext) =>
|
|
50
|
+
generator(ctx).then(renderSource(template, toFile('test', 'app.test')))
|
|
@@ -0,0 +1,123 @@
|
|
|
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 tsKoaApp = ({ transports }) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/application.html
|
|
7
|
+
import { feathers } from '@feathersjs/feathers'
|
|
8
|
+
import configuration from '@feathersjs/configuration'
|
|
9
|
+
import {
|
|
10
|
+
koa, rest, bodyParser, errorHandler, parseAuthentication, cors, serveStatic
|
|
11
|
+
} from '@feathersjs/koa'
|
|
12
|
+
${transports.includes('websockets') ? "import socketio from '@feathersjs/socketio'" : ''}
|
|
13
|
+
|
|
14
|
+
import type { Application } from './declarations'
|
|
15
|
+
import { configurationValidator } from './configuration'
|
|
16
|
+
import { logError } from './hooks/log-error'
|
|
17
|
+
import { services } from './services/index'
|
|
18
|
+
import { channels } from './channels'
|
|
19
|
+
|
|
20
|
+
const app: Application = koa(feathers())
|
|
21
|
+
|
|
22
|
+
// Load our app configuration (see config/ folder)
|
|
23
|
+
app.configure(configuration(configurationValidator))
|
|
24
|
+
|
|
25
|
+
// Set up Koa middleware
|
|
26
|
+
app.use(cors())
|
|
27
|
+
app.use(serveStatic(app.get('public')))
|
|
28
|
+
app.use(errorHandler())
|
|
29
|
+
app.use(parseAuthentication())
|
|
30
|
+
app.use(bodyParser())
|
|
31
|
+
|
|
32
|
+
// Configure services and transports
|
|
33
|
+
app.configure(rest())
|
|
34
|
+
${transports.includes('websockets')
|
|
35
|
+
? `app.configure(socketio({
|
|
36
|
+
cors: {
|
|
37
|
+
origin: app.get('origins')
|
|
38
|
+
}
|
|
39
|
+
}))`
|
|
40
|
+
: ''}
|
|
41
|
+
app.configure(services)
|
|
42
|
+
app.configure(channels)
|
|
43
|
+
|
|
44
|
+
// Register hooks that run on all service methods
|
|
45
|
+
app.hooks({
|
|
46
|
+
around: {
|
|
47
|
+
all: [ logError ]
|
|
48
|
+
},
|
|
49
|
+
before: {},
|
|
50
|
+
after: {},
|
|
51
|
+
error: {}
|
|
52
|
+
})
|
|
53
|
+
// Register application setup and teardown hooks here
|
|
54
|
+
app.hooks({
|
|
55
|
+
setup: [],
|
|
56
|
+
teardown: []
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
export { app }
|
|
60
|
+
`;
|
|
61
|
+
const tsExpressApp = ({ transports }) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/application.html
|
|
62
|
+
import { feathers } from '@feathersjs/feathers'
|
|
63
|
+
import express, {
|
|
64
|
+
rest, json, urlencoded, cors,
|
|
65
|
+
serveStatic, notFound, errorHandler
|
|
66
|
+
} from '@feathersjs/express'
|
|
67
|
+
import configuration from '@feathersjs/configuration'
|
|
68
|
+
${transports.includes('websockets') ? "import socketio from '@feathersjs/socketio'" : ''}
|
|
69
|
+
|
|
70
|
+
import type { Application } from './declarations'
|
|
71
|
+
import { configurationValidator } from './configuration'
|
|
72
|
+
import { logger } from './logger'
|
|
73
|
+
import { logError } from './hooks/log-error'
|
|
74
|
+
import { services } from './services/index'
|
|
75
|
+
import { channels } from './channels'
|
|
76
|
+
|
|
77
|
+
const app: Application = express(feathers())
|
|
78
|
+
|
|
79
|
+
// Load app configuration
|
|
80
|
+
app.configure(configuration(configurationValidator))
|
|
81
|
+
app.use(cors())
|
|
82
|
+
app.use(json())
|
|
83
|
+
app.use(urlencoded({ extended: true }))
|
|
84
|
+
// Host the public folder
|
|
85
|
+
app.use('/', serveStatic(app.get('public')))
|
|
86
|
+
|
|
87
|
+
// Configure services and real-time functionality
|
|
88
|
+
app.configure(rest())
|
|
89
|
+
${transports.includes('websockets')
|
|
90
|
+
? `app.configure(socketio({
|
|
91
|
+
cors: {
|
|
92
|
+
origin: app.get('origins')
|
|
93
|
+
}
|
|
94
|
+
}))`
|
|
95
|
+
: ''}
|
|
96
|
+
app.configure(services)
|
|
97
|
+
app.configure(channels)
|
|
98
|
+
|
|
99
|
+
// Configure a middleware for 404s and the error handler
|
|
100
|
+
app.use(notFound())
|
|
101
|
+
app.use(errorHandler({ logger }))
|
|
102
|
+
|
|
103
|
+
// Register hooks that run on all service methods
|
|
104
|
+
app.hooks({
|
|
105
|
+
around: {
|
|
106
|
+
all: [ logError ]
|
|
107
|
+
},
|
|
108
|
+
before: {},
|
|
109
|
+
after: {},
|
|
110
|
+
error: {}
|
|
111
|
+
})
|
|
112
|
+
// Register application setup and teardown hooks here
|
|
113
|
+
app.hooks({
|
|
114
|
+
setup: [],
|
|
115
|
+
teardown: []
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
export { app }
|
|
119
|
+
`;
|
|
120
|
+
const template = (ctx) => ctx.framework === 'express' ? tsExpressApp(ctx) : tsKoaApp(ctx);
|
|
121
|
+
const generate = (ctx) => (0, pinion_1.generator)(ctx).then((0, commons_1.renderSource)(template, (0, pinion_1.toFile)(({ lib }) => lib, 'app')));
|
|
122
|
+
exports.generate = generate;
|
|
123
|
+
//# sourceMappingURL=app.tpl.js.map
|
|
@@ -0,0 +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,EAChB,UAAU,EACU,EAAE,EAAE,CAAC,QAAQ,CAAC;;;;;;EAMlC,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,EACpB,UAAU,EACU,EAAE,EAAE,CAAC,QAAQ,CAAC;;;;;;;EAOlC,UAAU,CAAC,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"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { generator, toFile } from '@feathershq/pinion'
|
|
2
|
+
import { renderSource } from '../../commons'
|
|
3
|
+
import { AppGeneratorContext } from '../index'
|
|
4
|
+
|
|
5
|
+
const tsKoaApp = ({
|
|
6
|
+
transports
|
|
7
|
+
}: AppGeneratorContext) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/application.html
|
|
8
|
+
import { feathers } from '@feathersjs/feathers'
|
|
9
|
+
import configuration from '@feathersjs/configuration'
|
|
10
|
+
import {
|
|
11
|
+
koa, rest, bodyParser, errorHandler, parseAuthentication, cors, serveStatic
|
|
12
|
+
} from '@feathersjs/koa'
|
|
13
|
+
${transports.includes('websockets') ? "import socketio from '@feathersjs/socketio'" : ''}
|
|
14
|
+
|
|
15
|
+
import type { Application } from './declarations'
|
|
16
|
+
import { configurationValidator } from './configuration'
|
|
17
|
+
import { logError } from './hooks/log-error'
|
|
18
|
+
import { services } from './services/index'
|
|
19
|
+
import { channels } from './channels'
|
|
20
|
+
|
|
21
|
+
const app: Application = koa(feathers())
|
|
22
|
+
|
|
23
|
+
// Load our app configuration (see config/ folder)
|
|
24
|
+
app.configure(configuration(configurationValidator))
|
|
25
|
+
|
|
26
|
+
// Set up Koa middleware
|
|
27
|
+
app.use(cors())
|
|
28
|
+
app.use(serveStatic(app.get('public')))
|
|
29
|
+
app.use(errorHandler())
|
|
30
|
+
app.use(parseAuthentication())
|
|
31
|
+
app.use(bodyParser())
|
|
32
|
+
|
|
33
|
+
// Configure services and transports
|
|
34
|
+
app.configure(rest())
|
|
35
|
+
${
|
|
36
|
+
transports.includes('websockets')
|
|
37
|
+
? `app.configure(socketio({
|
|
38
|
+
cors: {
|
|
39
|
+
origin: app.get('origins')
|
|
40
|
+
}
|
|
41
|
+
}))`
|
|
42
|
+
: ''
|
|
43
|
+
}
|
|
44
|
+
app.configure(services)
|
|
45
|
+
app.configure(channels)
|
|
46
|
+
|
|
47
|
+
// Register hooks that run on all service methods
|
|
48
|
+
app.hooks({
|
|
49
|
+
around: {
|
|
50
|
+
all: [ logError ]
|
|
51
|
+
},
|
|
52
|
+
before: {},
|
|
53
|
+
after: {},
|
|
54
|
+
error: {}
|
|
55
|
+
})
|
|
56
|
+
// Register application setup and teardown hooks here
|
|
57
|
+
app.hooks({
|
|
58
|
+
setup: [],
|
|
59
|
+
teardown: []
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
export { app }
|
|
63
|
+
`
|
|
64
|
+
|
|
65
|
+
const tsExpressApp = ({
|
|
66
|
+
transports
|
|
67
|
+
}: AppGeneratorContext) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/application.html
|
|
68
|
+
import { feathers } from '@feathersjs/feathers'
|
|
69
|
+
import express, {
|
|
70
|
+
rest, json, urlencoded, cors,
|
|
71
|
+
serveStatic, notFound, errorHandler
|
|
72
|
+
} from '@feathersjs/express'
|
|
73
|
+
import configuration from '@feathersjs/configuration'
|
|
74
|
+
${transports.includes('websockets') ? "import socketio from '@feathersjs/socketio'" : ''}
|
|
75
|
+
|
|
76
|
+
import type { Application } from './declarations'
|
|
77
|
+
import { configurationValidator } from './configuration'
|
|
78
|
+
import { logger } from './logger'
|
|
79
|
+
import { logError } from './hooks/log-error'
|
|
80
|
+
import { services } from './services/index'
|
|
81
|
+
import { channels } from './channels'
|
|
82
|
+
|
|
83
|
+
const app: Application = express(feathers())
|
|
84
|
+
|
|
85
|
+
// Load app configuration
|
|
86
|
+
app.configure(configuration(configurationValidator))
|
|
87
|
+
app.use(cors())
|
|
88
|
+
app.use(json())
|
|
89
|
+
app.use(urlencoded({ extended: true }))
|
|
90
|
+
// Host the public folder
|
|
91
|
+
app.use('/', serveStatic(app.get('public')))
|
|
92
|
+
|
|
93
|
+
// Configure services and real-time functionality
|
|
94
|
+
app.configure(rest())
|
|
95
|
+
${
|
|
96
|
+
transports.includes('websockets')
|
|
97
|
+
? `app.configure(socketio({
|
|
98
|
+
cors: {
|
|
99
|
+
origin: app.get('origins')
|
|
100
|
+
}
|
|
101
|
+
}))`
|
|
102
|
+
: ''
|
|
103
|
+
}
|
|
104
|
+
app.configure(services)
|
|
105
|
+
app.configure(channels)
|
|
106
|
+
|
|
107
|
+
// Configure a middleware for 404s and the error handler
|
|
108
|
+
app.use(notFound())
|
|
109
|
+
app.use(errorHandler({ logger }))
|
|
110
|
+
|
|
111
|
+
// Register hooks that run on all service methods
|
|
112
|
+
app.hooks({
|
|
113
|
+
around: {
|
|
114
|
+
all: [ logError ]
|
|
115
|
+
},
|
|
116
|
+
before: {},
|
|
117
|
+
after: {},
|
|
118
|
+
error: {}
|
|
119
|
+
})
|
|
120
|
+
// Register application setup and teardown hooks here
|
|
121
|
+
app.hooks({
|
|
122
|
+
setup: [],
|
|
123
|
+
teardown: []
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
export { app }
|
|
127
|
+
`
|
|
128
|
+
|
|
129
|
+
const template = (ctx: AppGeneratorContext) =>
|
|
130
|
+
ctx.framework === 'express' ? tsExpressApp(ctx) : tsKoaApp(ctx)
|
|
131
|
+
|
|
132
|
+
export const generate = (ctx: AppGeneratorContext) =>
|
|
133
|
+
generator(ctx).then(
|
|
134
|
+
renderSource(
|
|
135
|
+
template,
|
|
136
|
+
toFile<AppGeneratorContext>(({ lib }) => lib, 'app')
|
|
137
|
+
)
|
|
138
|
+
)
|
|
@@ -0,0 +1,50 @@
|
|
|
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 = ({ language }) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/channels.html
|
|
7
|
+
import type { RealTimeConnection, Params } from '@feathersjs/feathers'
|
|
8
|
+
import type { AuthenticationResult } from '@feathersjs/authentication'
|
|
9
|
+
import '@feathersjs/transport-commons'
|
|
10
|
+
import type { Application, HookContext } from './declarations'
|
|
11
|
+
import { logger } from './logger'
|
|
12
|
+
|
|
13
|
+
export const channels = (app: Application) => {
|
|
14
|
+
if(typeof app.channel !== 'function') {
|
|
15
|
+
// If no real-time functionality has been configured just return
|
|
16
|
+
return
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
logger.warn('Publishing all events to all authenticated users. See \`channels.${language}\` and https://dove.feathersjs.com/api/channels.html for more information.')
|
|
20
|
+
|
|
21
|
+
app.on('connection', (connection: RealTimeConnection) => {
|
|
22
|
+
// On a new real-time connection, add it to the anonymous channel
|
|
23
|
+
app.channel('anonymous').join(connection)
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
app.on('login', (authResult: AuthenticationResult, { connection }: Params) => {
|
|
27
|
+
// connection can be undefined if there is no
|
|
28
|
+
// real-time connection, e.g. when logging in via REST
|
|
29
|
+
if(connection) {
|
|
30
|
+
// The connection is no longer anonymous, remove it
|
|
31
|
+
app.channel('anonymous').leave(connection)
|
|
32
|
+
|
|
33
|
+
// Add it to the authenticated user channel
|
|
34
|
+
app.channel('authenticated').join(connection)
|
|
35
|
+
}
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
// eslint-disable-next-line no-unused-vars
|
|
39
|
+
app.publish((data: any, context: HookContext) => {
|
|
40
|
+
// Here you can add event publishers to channels set up in \`channels.js\`
|
|
41
|
+
// To publish only for a specific event use \`app.publish(eventname, () => {})\`
|
|
42
|
+
|
|
43
|
+
// e.g. to publish all service events to all authenticated users use
|
|
44
|
+
return app.channel('authenticated')
|
|
45
|
+
})
|
|
46
|
+
}
|
|
47
|
+
`;
|
|
48
|
+
const generate = (ctx) => (0, pinion_1.generator)(ctx).then((0, commons_1.renderSource)(template, (0, pinion_1.toFile)(({ lib }) => lib, 'channels')));
|
|
49
|
+
exports.generate = generate;
|
|
50
|
+
//# sourceMappingURL=channels.tpl.js.map
|
|
@@ -0,0 +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,EAChB,QAAQ,EACY,EAAE,EAAE,CAAC,QAAQ,CAAC;;;;;;;;;;;;;kFAa8C,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BzF,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"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { generator, toFile } from '@feathershq/pinion'
|
|
2
|
+
import { renderSource } from '../../commons'
|
|
3
|
+
import { AppGeneratorContext } from '../index'
|
|
4
|
+
|
|
5
|
+
const template = ({
|
|
6
|
+
language
|
|
7
|
+
}: AppGeneratorContext) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/channels.html
|
|
8
|
+
import type { RealTimeConnection, Params } from '@feathersjs/feathers'
|
|
9
|
+
import type { AuthenticationResult } from '@feathersjs/authentication'
|
|
10
|
+
import '@feathersjs/transport-commons'
|
|
11
|
+
import type { Application, HookContext } from './declarations'
|
|
12
|
+
import { logger } from './logger'
|
|
13
|
+
|
|
14
|
+
export const channels = (app: Application) => {
|
|
15
|
+
if(typeof app.channel !== 'function') {
|
|
16
|
+
// If no real-time functionality has been configured just return
|
|
17
|
+
return
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
logger.warn('Publishing all events to all authenticated users. See \`channels.${language}\` and https://dove.feathersjs.com/api/channels.html for more information.')
|
|
21
|
+
|
|
22
|
+
app.on('connection', (connection: RealTimeConnection) => {
|
|
23
|
+
// On a new real-time connection, add it to the anonymous channel
|
|
24
|
+
app.channel('anonymous').join(connection)
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
app.on('login', (authResult: AuthenticationResult, { connection }: Params) => {
|
|
28
|
+
// connection can be undefined if there is no
|
|
29
|
+
// real-time connection, e.g. when logging in via REST
|
|
30
|
+
if(connection) {
|
|
31
|
+
// The connection is no longer anonymous, remove it
|
|
32
|
+
app.channel('anonymous').leave(connection)
|
|
33
|
+
|
|
34
|
+
// Add it to the authenticated user channel
|
|
35
|
+
app.channel('authenticated').join(connection)
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
// eslint-disable-next-line no-unused-vars
|
|
40
|
+
app.publish((data: any, context: HookContext) => {
|
|
41
|
+
// Here you can add event publishers to channels set up in \`channels.js\`
|
|
42
|
+
// To publish only for a specific event use \`app.publish(eventname, () => {})\`
|
|
43
|
+
|
|
44
|
+
// e.g. to publish all service events to all authenticated users use
|
|
45
|
+
return app.channel('authenticated')
|
|
46
|
+
})
|
|
47
|
+
}
|
|
48
|
+
`
|
|
49
|
+
|
|
50
|
+
export const generate = (ctx: AppGeneratorContext) =>
|
|
51
|
+
generator(ctx).then(
|
|
52
|
+
renderSource(
|
|
53
|
+
template,
|
|
54
|
+
toFile<AppGeneratorContext>(({ lib }) => lib, 'channels')
|
|
55
|
+
)
|
|
56
|
+
)
|
|
@@ -0,0 +1,27 @@
|
|
|
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 = ({ lib }) => /* ts */ `import assert from 'assert'
|
|
7
|
+
import axios from 'axios'
|
|
8
|
+
import type { Server } from 'http'
|
|
9
|
+
import { app } from '../${lib}/app'
|
|
10
|
+
import { createClient } from '../${lib}/client'
|
|
11
|
+
|
|
12
|
+
import rest from '@feathersjs/rest-client'
|
|
13
|
+
|
|
14
|
+
const port = app.get('port')
|
|
15
|
+
const appUrl = \`http://\${app.get('host')}:\${port}\`
|
|
16
|
+
|
|
17
|
+
describe('client tests', () => {
|
|
18
|
+
const client = createClient(rest(appUrl).axios(axios))
|
|
19
|
+
|
|
20
|
+
it('initialized the client', () => {
|
|
21
|
+
assert.ok(client)
|
|
22
|
+
})
|
|
23
|
+
})
|
|
24
|
+
`;
|
|
25
|
+
const generate = (ctx) => (0, pinion_1.generator)(ctx).then((0, commons_1.renderSource)(template, (0, pinion_1.toFile)('test', 'client.test')));
|
|
26
|
+
exports.generate = generate;
|
|
27
|
+
//# sourceMappingURL=client.test.tpl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.test.tpl.js","sourceRoot":"","sources":["../../../src/app/templates/client.test.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAAsD;AACtD,2CAA4C;AAG5C,MAAM,QAAQ,GAAG,CAAC,EAAE,GAAG,EAAuB,EAAE,EAAE,CAAC,QAAQ,CAAC;;;0BAGlC,GAAG;mCACM,GAAG;;;;;;;;;;;;;;CAcrC,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,aAAa,CAAC,CAAC,CAAC,CAAA;AAD/D,QAAA,QAAQ,YACuD"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { generator, toFile } from '@feathershq/pinion'
|
|
2
|
+
import { renderSource } from '../../commons'
|
|
3
|
+
import { AppGeneratorContext } from '../index'
|
|
4
|
+
|
|
5
|
+
const template = ({ lib }: AppGeneratorContext) => /* ts */ `import assert from 'assert'
|
|
6
|
+
import axios from 'axios'
|
|
7
|
+
import type { Server } from 'http'
|
|
8
|
+
import { app } from '../${lib}/app'
|
|
9
|
+
import { createClient } from '../${lib}/client'
|
|
10
|
+
|
|
11
|
+
import rest from '@feathersjs/rest-client'
|
|
12
|
+
|
|
13
|
+
const port = app.get('port')
|
|
14
|
+
const appUrl = \`http://\${app.get('host')}:\${port}\`
|
|
15
|
+
|
|
16
|
+
describe('client tests', () => {
|
|
17
|
+
const client = createClient(rest(appUrl).axios(axios))
|
|
18
|
+
|
|
19
|
+
it('initialized the client', () => {
|
|
20
|
+
assert.ok(client)
|
|
21
|
+
})
|
|
22
|
+
})
|
|
23
|
+
`
|
|
24
|
+
|
|
25
|
+
export const generate = (ctx: AppGeneratorContext) =>
|
|
26
|
+
generator(ctx).then(renderSource(template, toFile('test', 'client.test')))
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
)
|
|
@@ -0,0 +1,71 @@
|
|
|
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.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration.tpl.js","sourceRoot":"","sources":["../../../src/app/templates/configuration.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAAiE;AACjE,2CAA4C;AAG5C,MAAM,aAAa,GAAG,CAAC,EAAuB,EAAE,EAAE,CAAC,CAAC;IAClD,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,IAAI;IACV,MAAM,EAAE,WAAW;IACnB,OAAO,EAAE,CAAC,uBAAuB,CAAC;IAClC,QAAQ,EAAE;QACR,OAAO,EAAE,EAAE;QACX,GAAG,EAAE,EAAE;KACR;CACF,CAAC,CAAA;AAEF,MAAM,iBAAiB,GAAG;IACxB,IAAI,EAAE;QACJ,MAAM,EAAE,MAAM;QACd,QAAQ,EAAE,QAAQ;KACnB;IACD,IAAI,EAAE,UAAU;CACjB,CAAA;AAED,MAAM,UAAU,GAAG;IACjB,IAAI,EAAE,IAAI;CACX,CAAA;AAED,MAAM,yBAAyB,GAC7B,CAAC,EAAuB,EAAE,EAAE,CAAC,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;CAoBvC,CAAA;AAED,MAAM,4BAA4B,GAChC,CAAC,EAAuB,EAAE,EAAE,CAAC,QAAQ,CAAC;;;;;;;;;;;;;;;;;CAiBvC,CAAA;AAEM,MAAM,QAAQ,GAAG,CAAC,GAAwB,EAAE,EAAE,CACnD,IAAA,kBAAS,EAAC,GAAG,CAAC;KACX,IAAI,CAAC,IAAA,kBAAS,EAAC,aAAa,EAAE,IAAA,eAAM,EAAC,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC;KAChE,IAAI,CAAC,IAAA,kBAAS,EAAC,UAAU,EAAE,IAAA,eAAM,EAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC;KAC1D,IAAI,CAAC,IAAA,kBAAS,EAAC,iBAAiB,EAAE,IAAA,eAAM,EAAC,QAAQ,EAAE,mCAAmC,CAAC,CAAC,CAAC;KACzF,IAAI,CACH,IAAA,sBAAY,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"}
|