@feathersjs/generators 5.0.0-pre.36 → 5.0.0-pre.38
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 +19 -0
- package/README.md +0 -1
- package/lib/app/index.d.ts +38 -5
- package/lib/app/index.js +11 -21
- package/lib/app/index.js.map +1 -1
- package/lib/app/index.ts +18 -41
- package/lib/app/templates/app.tpl.js +10 -9
- package/lib/app/templates/app.tpl.js.map +1 -1
- package/lib/app/templates/app.tpl.ts +12 -9
- package/lib/app/templates/channels.tpl.js +1 -6
- package/lib/app/templates/channels.tpl.js.map +1 -1
- package/lib/app/templates/channels.tpl.ts +7 -9
- package/lib/app/templates/client.test.tpl.js +1 -1
- package/lib/app/templates/client.test.tpl.js.map +1 -1
- package/lib/app/templates/client.test.tpl.ts +4 -2
- package/lib/app/templates/client.tpl.js +1 -1
- package/lib/app/templates/client.tpl.js.map +1 -1
- package/lib/app/templates/client.tpl.ts +7 -4
- package/lib/app/templates/configuration.tpl.js +8 -4
- package/lib/app/templates/configuration.tpl.js.map +1 -1
- package/lib/app/templates/configuration.tpl.ts +15 -8
- package/lib/app/templates/declarations.tpl.js +4 -2
- package/lib/app/templates/declarations.tpl.js.map +1 -1
- package/lib/app/templates/declarations.tpl.ts +7 -2
- package/lib/app/templates/package.json.tpl.js +9 -3
- package/lib/app/templates/package.json.tpl.js.map +1 -1
- package/lib/app/templates/package.json.tpl.ts +9 -2
- package/lib/authentication/index.d.ts +3 -38
- package/lib/authentication/index.js +8 -23
- package/lib/authentication/index.js.map +1 -1
- package/lib/authentication/index.ts +58 -75
- package/lib/authentication/templates/authentication.tpl.js +4 -4
- package/lib/authentication/templates/authentication.tpl.js.map +1 -1
- package/lib/authentication/templates/authentication.tpl.ts +2 -1
- package/lib/authentication/templates/client.test.tpl.js +5 -5
- package/lib/authentication/templates/client.test.tpl.js.map +1 -1
- package/lib/authentication/templates/client.test.tpl.ts +11 -7
- package/lib/commons.d.ts +24 -3
- package/lib/commons.js +33 -1
- package/lib/commons.js.map +1 -1
- package/lib/commons.ts +41 -3
- package/lib/connection/index.d.ts +3 -20
- package/lib/connection/index.js +13 -10
- package/lib/connection/index.js.map +1 -1
- package/lib/connection/index.ts +58 -50
- package/lib/connection/templates/knex.tpl.js +10 -1
- package/lib/connection/templates/knex.tpl.js.map +1 -1
- package/lib/connection/templates/knex.tpl.ts +6 -0
- package/lib/connection/templates/mongodb.tpl.js +15 -9
- package/lib/connection/templates/mongodb.tpl.js.map +1 -1
- package/lib/connection/templates/mongodb.tpl.ts +20 -10
- package/lib/service/index.d.ts +4 -0
- package/lib/service/index.js +82 -73
- package/lib/service/index.js.map +1 -1
- package/lib/service/index.ts +94 -74
- package/lib/service/templates/client.tpl.js +2 -3
- package/lib/service/templates/client.tpl.js.map +1 -1
- package/lib/service/templates/client.tpl.ts +14 -14
- package/lib/service/templates/schema.json.tpl.js +43 -17
- package/lib/service/templates/schema.json.tpl.js.map +1 -1
- package/lib/service/templates/schema.json.tpl.ts +57 -16
- package/lib/service/templates/schema.typebox.tpl.js +46 -11
- package/lib/service/templates/schema.typebox.tpl.js.map +1 -1
- package/lib/service/templates/schema.typebox.tpl.ts +63 -11
- package/lib/service/templates/service.tpl.d.ts +1 -1
- package/lib/service/templates/service.tpl.js +6 -2
- package/lib/service/templates/service.tpl.js.map +1 -1
- package/lib/service/templates/service.tpl.ts +11 -2
- package/lib/service/templates/shared.tpl.js +2 -2
- package/lib/service/templates/shared.tpl.js.map +1 -1
- package/lib/service/templates/shared.tpl.ts +13 -10
- package/lib/service/type/custom.tpl.js +1 -1
- package/lib/service/type/custom.tpl.js.map +1 -1
- package/lib/service/type/custom.tpl.ts +1 -1
- package/lib/service/type/knex.tpl.js +14 -8
- package/lib/service/type/knex.tpl.js.map +1 -1
- package/lib/service/type/knex.tpl.ts +21 -10
- package/lib/service/type/mongodb.tpl.js +1 -1
- package/lib/service/type/mongodb.tpl.js.map +1 -1
- package/lib/service/type/mongodb.tpl.ts +1 -1
- package/package.json +29 -24
- package/lib/authentication/templates/knex.tpl.d.ts +0 -2
- package/lib/authentication/templates/knex.tpl.js +0 -45
- package/lib/authentication/templates/knex.tpl.js.map +0 -1
- package/lib/authentication/templates/knex.tpl.ts +0 -62
- package/lib/authentication/templates/schema.json.tpl.d.ts +0 -2
- package/lib/authentication/templates/schema.json.tpl.js +0 -104
- package/lib/authentication/templates/schema.json.tpl.js.map +0 -1
- package/lib/authentication/templates/schema.json.tpl.ts +0 -125
- package/lib/authentication/templates/schema.typebox.tpl.d.ts +0 -3
- package/lib/authentication/templates/schema.typebox.tpl.js +0 -87
- package/lib/authentication/templates/schema.typebox.tpl.js.map +0 -1
- package/lib/authentication/templates/schema.typebox.tpl.ts +0 -109
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
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.38](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.37...v5.0.0-pre.38) (2023-02-17)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **generators:** Final tweaks to the generators ([#3060](https://github.com/feathersjs/feathers/issues/3060)) ([1bf1544](https://github.com/feathersjs/feathers/commit/1bf1544fa8deeaa44ba354fb539dc3f1fd187767))
|
|
11
|
+
- **schema:** Add schema helper for handling Object ids ([#3058](https://github.com/feathersjs/feathers/issues/3058)) ([1393bed](https://github.com/feathersjs/feathers/commit/1393bed81a9ee814de6aab0e537af83e667591a2))
|
|
12
|
+
|
|
13
|
+
# [5.0.0-pre.37](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.36...v5.0.0-pre.37) (2023-02-09)
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
- **generators:** Add schema selection to CI test matrix ([#3035](https://github.com/feathersjs/feathers/issues/3035)) ([7484b16](https://github.com/feathersjs/feathers/commit/7484b164fba4ac2ee379dc5c6363f964f45e94d3))
|
|
18
|
+
- **generators:** Fix Knex migration generated filename ([#3033](https://github.com/feathersjs/feathers/issues/3033)) ([1ac18a7](https://github.com/feathersjs/feathers/commit/1ac18a7143173d973af982772678834f7a7334f7))
|
|
19
|
+
- **generators:** Generated app does not start when choosing JSON schema ([#3034](https://github.com/feathersjs/feathers/issues/3034)) ([7b8250b](https://github.com/feathersjs/feathers/commit/7b8250bd535c3c5ec7429a65139335ad43616ae0))
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
|
|
23
|
+
- **mongodb:** Add Object ID keyword converter and update MongoDB CLI & docs ([#3041](https://github.com/feathersjs/feathers/issues/3041)) ([ca0994e](https://github.com/feathersjs/feathers/commit/ca0994eaecb5a31f310bc980d106834e11f24f41))
|
|
24
|
+
|
|
6
25
|
# [5.0.0-pre.36](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.35...v5.0.0-pre.36) (2023-01-29)
|
|
7
26
|
|
|
8
27
|
### Bug Fixes
|
package/README.md
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# @feathersjs/generators
|
|
2
2
|
|
|
3
3
|
[](https://github.com/feathersjs/feathers/actions?query=workflow%3ACI)
|
|
4
|
-
[](https://david-dm.org/feathersjs/feathers?path=packages/generators)
|
|
5
4
|
[](https://www.npmjs.com/package/@feathersjs/cli)
|
|
6
5
|
|
|
7
6
|
> Feathers core code generators used by the CLI powered by [Pinion](https://github.com/feathershq/pinion/)
|
package/lib/app/index.d.ts
CHANGED
|
@@ -8,10 +8,6 @@ export interface AppGeneratorData extends FeathersAppInfo {
|
|
|
8
8
|
* A short description of the app
|
|
9
9
|
*/
|
|
10
10
|
description: string;
|
|
11
|
-
/**
|
|
12
|
-
* The selected user authentication strategies
|
|
13
|
-
*/
|
|
14
|
-
authStrategies: string[];
|
|
15
11
|
/**
|
|
16
12
|
* The database connection string
|
|
17
13
|
*/
|
|
@@ -20,10 +16,47 @@ export interface AppGeneratorData extends FeathersAppInfo {
|
|
|
20
16
|
* The source folder where files are put
|
|
21
17
|
*/
|
|
22
18
|
lib: string;
|
|
19
|
+
/**
|
|
20
|
+
* Generate a client
|
|
21
|
+
*/
|
|
22
|
+
client: boolean;
|
|
23
23
|
}
|
|
24
24
|
export type AppGeneratorContext = FeathersBaseContext & AppGeneratorData & {
|
|
25
25
|
dependencies: string[];
|
|
26
26
|
devDependencies: string[];
|
|
27
27
|
};
|
|
28
28
|
export type AppGeneratorArguments = FeathersBaseContext & Partial<AppGeneratorData>;
|
|
29
|
-
export declare const generate: (ctx: AppGeneratorArguments) => Promise<
|
|
29
|
+
export declare const generate: (ctx: AppGeneratorArguments) => Promise<{
|
|
30
|
+
dependencies: string[];
|
|
31
|
+
feathers: FeathersAppInfo;
|
|
32
|
+
pkg: import("../commons").AppPackageJson;
|
|
33
|
+
lib: string;
|
|
34
|
+
test: string;
|
|
35
|
+
language: "ts" | "js";
|
|
36
|
+
dependencyVersions?: import("../commons").DependencyVersions;
|
|
37
|
+
cwd: string;
|
|
38
|
+
_?: (string | number)[];
|
|
39
|
+
pinion: import("@feathershq/pinion").Configuration;
|
|
40
|
+
/**
|
|
41
|
+
* The application name
|
|
42
|
+
*/
|
|
43
|
+
name: string;
|
|
44
|
+
/**
|
|
45
|
+
* A short description of the app
|
|
46
|
+
*/
|
|
47
|
+
description: string;
|
|
48
|
+
/**
|
|
49
|
+
* The database connection string
|
|
50
|
+
*/
|
|
51
|
+
connectionString: string;
|
|
52
|
+
/**
|
|
53
|
+
* Generate a client
|
|
54
|
+
*/
|
|
55
|
+
client: boolean;
|
|
56
|
+
database: "mongodb" | "mysql" | "postgresql" | "sqlite" | "mssql" | "other";
|
|
57
|
+
packager: "yarn" | "npm" | "pnpm";
|
|
58
|
+
transports: ("rest" | "websockets")[];
|
|
59
|
+
framework: "koa" | "express";
|
|
60
|
+
schema: false | "typebox" | "json";
|
|
61
|
+
devDependencies: string[];
|
|
62
|
+
}>;
|
package/lib/app/index.js
CHANGED
|
@@ -8,7 +8,6 @@ const path_1 = require("path");
|
|
|
8
8
|
const chalk_1 = __importDefault(require("chalk"));
|
|
9
9
|
const pinion_1 = require("@feathershq/pinion");
|
|
10
10
|
const commons_1 = require("../commons");
|
|
11
|
-
const authentication_1 = require("../authentication");
|
|
12
11
|
const connection_1 = require("../connection");
|
|
13
12
|
const generate = (ctx) => (0, pinion_1.generator)(ctx)
|
|
14
13
|
.then((0, commons_1.initializeBaseContext)())
|
|
@@ -78,23 +77,26 @@ const generate = (ctx) => (0, pinion_1.generator)(ctx)
|
|
|
78
77
|
{ value: 'pnpm', name: 'pnpm' }
|
|
79
78
|
]
|
|
80
79
|
},
|
|
80
|
+
{
|
|
81
|
+
name: 'client',
|
|
82
|
+
type: 'confirm',
|
|
83
|
+
when: ctx.client === undefined,
|
|
84
|
+
message: (answers) => `Generate ${answers.language === 'ts' ? 'end-to-end typed ' : ''}client?`,
|
|
85
|
+
suffix: chalk_1.default.grey(' Can be used with React, Angular, Vue, React Native, Node.js etc.')
|
|
86
|
+
},
|
|
81
87
|
{
|
|
82
88
|
type: 'list',
|
|
83
89
|
name: 'schema',
|
|
84
90
|
when: !ctx.schema,
|
|
85
91
|
message: 'What is your preferred schema (model) definition format?',
|
|
92
|
+
suffix: chalk_1.default.grey(' Schemas allow to type, validate, secure and populate your data and configuration'),
|
|
86
93
|
choices: [
|
|
87
94
|
{ value: 'typebox', name: `TypeBox ${chalk_1.default.grey('(recommended)')}` },
|
|
88
|
-
{ value: 'json', name: 'JSON schema' }
|
|
95
|
+
{ value: 'json', name: 'JSON schema' },
|
|
96
|
+
{ value: false, name: `No schema ${chalk_1.default.grey('(not recommended)')}` }
|
|
89
97
|
]
|
|
90
98
|
},
|
|
91
|
-
...(0, connection_1.prompts)(ctx)
|
|
92
|
-
...(0, authentication_1.prompts)({
|
|
93
|
-
...ctx,
|
|
94
|
-
service: 'user',
|
|
95
|
-
path: 'users',
|
|
96
|
-
entity: 'user'
|
|
97
|
-
})
|
|
99
|
+
...(0, connection_1.prompts)(ctx)
|
|
98
100
|
]))
|
|
99
101
|
.then((0, pinion_1.runGenerators)(__dirname, 'templates'))
|
|
100
102
|
.then((0, pinion_1.copyFiles)((0, pinion_1.fromFile)(__dirname, 'static'), (0, pinion_1.toFile)('.')))
|
|
@@ -106,18 +108,6 @@ const generate = (ctx) => (0, pinion_1.generator)(ctx)
|
|
|
106
108
|
dependencies
|
|
107
109
|
};
|
|
108
110
|
})
|
|
109
|
-
.then((0, pinion_1.when)(({ authStrategies }) => authStrategies.length > 0, async (ctx) => {
|
|
110
|
-
const { dependencies } = await (0, authentication_1.generate)({
|
|
111
|
-
...ctx,
|
|
112
|
-
service: 'user',
|
|
113
|
-
path: 'users',
|
|
114
|
-
entity: 'user'
|
|
115
|
-
});
|
|
116
|
-
return {
|
|
117
|
-
...ctx,
|
|
118
|
-
dependencies
|
|
119
|
-
};
|
|
120
|
-
}))
|
|
121
111
|
.then((0, pinion_1.install)(({ transports, framework, dependencyVersions, dependencies, schema }) => {
|
|
122
112
|
const hasSocketio = transports.includes('websockets');
|
|
123
113
|
dependencies.push('@feathersjs/feathers', '@feathersjs/errors', '@feathersjs/schema', '@feathersjs/configuration', '@feathersjs/transport-commons', '@feathersjs/adapter-commons', '@feathersjs/authentication', '@feathersjs/authentication-client', 'winston');
|
package/lib/app/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/app/index.ts"],"names":[],"mappings":";;;;;;AAAA,+BAA0B;AAC1B,kDAAyB;AACzB,+
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/app/index.ts"],"names":[],"mappings":";;;;;;AAAA,+BAA0B;AAC1B,kDAAyB;AACzB,+CAA2G;AAC3G,wCAAqG;AACrG,8CAA6F;AAiCtF,MAAM,QAAQ,GAAG,CAAC,GAA0B,EAAE,EAAE,CACrD,IAAA,kB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
9
|
-
copyFiles,
|
|
10
|
-
toFile,
|
|
11
|
-
when
|
|
12
|
-
} from '@feathershq/pinion'
|
|
3
|
+
import { generator, prompt, runGenerators, fromFile, install, copyFiles, toFile } from '@feathershq/pinion'
|
|
13
4
|
import { FeathersBaseContext, FeathersAppInfo, initializeBaseContext, addVersions } from '../commons'
|
|
14
|
-
import { generate as authenticationGenerator, prompts as authenticationPrompts } from '../authentication'
|
|
15
5
|
import { generate as connectionGenerator, prompts as connectionPrompts } from '../connection'
|
|
16
6
|
|
|
17
7
|
export interface AppGeneratorData extends FeathersAppInfo {
|
|
@@ -23,10 +13,6 @@ export interface AppGeneratorData extends FeathersAppInfo {
|
|
|
23
13
|
* A short description of the app
|
|
24
14
|
*/
|
|
25
15
|
description: string
|
|
26
|
-
/**
|
|
27
|
-
* The selected user authentication strategies
|
|
28
|
-
*/
|
|
29
|
-
authStrategies: string[]
|
|
30
16
|
/**
|
|
31
17
|
* The database connection string
|
|
32
18
|
*/
|
|
@@ -35,6 +21,10 @@ export interface AppGeneratorData extends FeathersAppInfo {
|
|
|
35
21
|
* The source folder where files are put
|
|
36
22
|
*/
|
|
37
23
|
lib: string
|
|
24
|
+
/**
|
|
25
|
+
* Generate a client
|
|
26
|
+
*/
|
|
27
|
+
client: boolean
|
|
38
28
|
}
|
|
39
29
|
|
|
40
30
|
export type AppGeneratorContext = FeathersBaseContext &
|
|
@@ -116,23 +106,28 @@ export const generate = (ctx: AppGeneratorArguments) =>
|
|
|
116
106
|
{ value: 'pnpm', name: 'pnpm' }
|
|
117
107
|
]
|
|
118
108
|
},
|
|
109
|
+
{
|
|
110
|
+
name: 'client',
|
|
111
|
+
type: 'confirm',
|
|
112
|
+
when: ctx.client === undefined,
|
|
113
|
+
message: (answers) => `Generate ${answers.language === 'ts' ? 'end-to-end typed ' : ''}client?`,
|
|
114
|
+
suffix: chalk.grey(' Can be used with React, Angular, Vue, React Native, Node.js etc.')
|
|
115
|
+
},
|
|
119
116
|
{
|
|
120
117
|
type: 'list',
|
|
121
118
|
name: 'schema',
|
|
122
119
|
when: !ctx.schema,
|
|
123
120
|
message: 'What is your preferred schema (model) definition format?',
|
|
121
|
+
suffix: chalk.grey(
|
|
122
|
+
' Schemas allow to type, validate, secure and populate your data and configuration'
|
|
123
|
+
),
|
|
124
124
|
choices: [
|
|
125
125
|
{ value: 'typebox', name: `TypeBox ${chalk.grey('(recommended)')}` },
|
|
126
|
-
{ value: 'json', name: 'JSON schema' }
|
|
126
|
+
{ value: 'json', name: 'JSON schema' },
|
|
127
|
+
{ value: false, name: `No schema ${chalk.grey('(not recommended)')}` }
|
|
127
128
|
]
|
|
128
129
|
},
|
|
129
|
-
...connectionPrompts(ctx)
|
|
130
|
-
...authenticationPrompts({
|
|
131
|
-
...ctx,
|
|
132
|
-
service: 'user',
|
|
133
|
-
path: 'users',
|
|
134
|
-
entity: 'user'
|
|
135
|
-
})
|
|
130
|
+
...connectionPrompts(ctx)
|
|
136
131
|
])
|
|
137
132
|
)
|
|
138
133
|
.then(runGenerators(__dirname, 'templates'))
|
|
@@ -146,24 +141,6 @@ export const generate = (ctx: AppGeneratorArguments) =>
|
|
|
146
141
|
dependencies
|
|
147
142
|
}
|
|
148
143
|
})
|
|
149
|
-
.then(
|
|
150
|
-
when<AppGeneratorContext>(
|
|
151
|
-
({ authStrategies }) => authStrategies.length > 0,
|
|
152
|
-
async (ctx) => {
|
|
153
|
-
const { dependencies } = await authenticationGenerator({
|
|
154
|
-
...ctx,
|
|
155
|
-
service: 'user',
|
|
156
|
-
path: 'users',
|
|
157
|
-
entity: 'user'
|
|
158
|
-
})
|
|
159
|
-
|
|
160
|
-
return {
|
|
161
|
-
...ctx,
|
|
162
|
-
dependencies
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
)
|
|
166
|
-
)
|
|
167
144
|
.then(
|
|
168
145
|
install<AppGeneratorContext>(
|
|
169
146
|
({ transports, framework, dependencyVersions, dependencies, schema }) => {
|
|
@@ -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 tsKoaApp = ({ transports }) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/application.html
|
|
6
|
+
const tsKoaApp = ({ transports, schema }) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/application.html
|
|
7
7
|
import { feathers } from '@feathersjs/feathers'
|
|
8
8
|
import configuration from '@feathersjs/configuration'
|
|
9
9
|
import {
|
|
@@ -11,16 +11,16 @@ import {
|
|
|
11
11
|
} from '@feathersjs/koa'
|
|
12
12
|
${transports.includes('websockets') ? "import socketio from '@feathersjs/socketio'" : ''}
|
|
13
13
|
|
|
14
|
+
${schema !== false ? `import { configurationValidator } from './configuration'` : ''}
|
|
14
15
|
import type { Application } from './declarations'
|
|
15
|
-
import { configurationValidator } from './configuration'
|
|
16
16
|
import { logError } from './hooks/log-error'
|
|
17
17
|
import { services } from './services/index'
|
|
18
|
-
import { channels } from './channels'
|
|
18
|
+
${transports.includes('websockets') ? `import { channels } from './channels'` : ''}
|
|
19
19
|
|
|
20
20
|
const app: Application = koa(feathers())
|
|
21
21
|
|
|
22
22
|
// Load our app configuration (see config/ folder)
|
|
23
|
-
app.configure(configuration(configurationValidator))
|
|
23
|
+
app.configure(configuration(${schema !== false ? 'configurationValidator' : ''}))
|
|
24
24
|
|
|
25
25
|
// Set up Koa middleware
|
|
26
26
|
app.use(cors())
|
|
@@ -36,10 +36,11 @@ ${transports.includes('websockets')
|
|
|
36
36
|
cors: {
|
|
37
37
|
origin: app.get('origins')
|
|
38
38
|
}
|
|
39
|
-
}))
|
|
39
|
+
}))
|
|
40
|
+
app.configure(channels)`
|
|
40
41
|
: ''}
|
|
41
42
|
app.configure(services)
|
|
42
|
-
|
|
43
|
+
|
|
43
44
|
|
|
44
45
|
// Register hooks that run on all service methods
|
|
45
46
|
app.hooks({
|
|
@@ -58,7 +59,7 @@ app.hooks({
|
|
|
58
59
|
|
|
59
60
|
export { app }
|
|
60
61
|
`;
|
|
61
|
-
const tsExpressApp = ({ transports }) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/application.html
|
|
62
|
+
const tsExpressApp = ({ transports, schema }) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/application.html
|
|
62
63
|
import { feathers } from '@feathersjs/feathers'
|
|
63
64
|
import express, {
|
|
64
65
|
rest, json, urlencoded, cors,
|
|
@@ -68,7 +69,7 @@ import configuration from '@feathersjs/configuration'
|
|
|
68
69
|
${transports.includes('websockets') ? "import socketio from '@feathersjs/socketio'" : ''}
|
|
69
70
|
|
|
70
71
|
import type { Application } from './declarations'
|
|
71
|
-
import { configurationValidator } from './configuration'
|
|
72
|
+
${schema !== false ? `import { configurationValidator } from './configuration'` : ''}
|
|
72
73
|
import { logger } from './logger'
|
|
73
74
|
import { logError } from './hooks/log-error'
|
|
74
75
|
import { services } from './services/index'
|
|
@@ -77,7 +78,7 @@ import { channels } from './channels'
|
|
|
77
78
|
const app: Application = express(feathers())
|
|
78
79
|
|
|
79
80
|
// Load app configuration
|
|
80
|
-
app.configure(configuration(configurationValidator))
|
|
81
|
+
app.configure(configuration(${schema !== false ? 'configurationValidator' : ''}))
|
|
81
82
|
app.use(cors())
|
|
82
83
|
app.use(json())
|
|
83
84
|
app.use(urlencoded({ extended: true }))
|
|
@@ -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,EAChB,UAAU,
|
|
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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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"}
|
|
@@ -3,7 +3,8 @@ import { renderSource } from '../../commons'
|
|
|
3
3
|
import { AppGeneratorContext } from '../index'
|
|
4
4
|
|
|
5
5
|
const tsKoaApp = ({
|
|
6
|
-
transports
|
|
6
|
+
transports,
|
|
7
|
+
schema
|
|
7
8
|
}: AppGeneratorContext) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/application.html
|
|
8
9
|
import { feathers } from '@feathersjs/feathers'
|
|
9
10
|
import configuration from '@feathersjs/configuration'
|
|
@@ -12,16 +13,16 @@ import {
|
|
|
12
13
|
} from '@feathersjs/koa'
|
|
13
14
|
${transports.includes('websockets') ? "import socketio from '@feathersjs/socketio'" : ''}
|
|
14
15
|
|
|
16
|
+
${schema !== false ? `import { configurationValidator } from './configuration'` : ''}
|
|
15
17
|
import type { Application } from './declarations'
|
|
16
|
-
import { configurationValidator } from './configuration'
|
|
17
18
|
import { logError } from './hooks/log-error'
|
|
18
19
|
import { services } from './services/index'
|
|
19
|
-
import { channels } from './channels'
|
|
20
|
+
${transports.includes('websockets') ? `import { channels } from './channels'` : ''}
|
|
20
21
|
|
|
21
22
|
const app: Application = koa(feathers())
|
|
22
23
|
|
|
23
24
|
// Load our app configuration (see config/ folder)
|
|
24
|
-
app.configure(configuration(configurationValidator))
|
|
25
|
+
app.configure(configuration(${schema !== false ? 'configurationValidator' : ''}))
|
|
25
26
|
|
|
26
27
|
// Set up Koa middleware
|
|
27
28
|
app.use(cors())
|
|
@@ -38,11 +39,12 @@ ${
|
|
|
38
39
|
cors: {
|
|
39
40
|
origin: app.get('origins')
|
|
40
41
|
}
|
|
41
|
-
}))
|
|
42
|
+
}))
|
|
43
|
+
app.configure(channels)`
|
|
42
44
|
: ''
|
|
43
45
|
}
|
|
44
46
|
app.configure(services)
|
|
45
|
-
|
|
47
|
+
|
|
46
48
|
|
|
47
49
|
// Register hooks that run on all service methods
|
|
48
50
|
app.hooks({
|
|
@@ -63,7 +65,8 @@ export { app }
|
|
|
63
65
|
`
|
|
64
66
|
|
|
65
67
|
const tsExpressApp = ({
|
|
66
|
-
transports
|
|
68
|
+
transports,
|
|
69
|
+
schema
|
|
67
70
|
}: AppGeneratorContext) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/application.html
|
|
68
71
|
import { feathers } from '@feathersjs/feathers'
|
|
69
72
|
import express, {
|
|
@@ -74,7 +77,7 @@ import configuration from '@feathersjs/configuration'
|
|
|
74
77
|
${transports.includes('websockets') ? "import socketio from '@feathersjs/socketio'" : ''}
|
|
75
78
|
|
|
76
79
|
import type { Application } from './declarations'
|
|
77
|
-
import { configurationValidator } from './configuration'
|
|
80
|
+
${schema !== false ? `import { configurationValidator } from './configuration'` : ''}
|
|
78
81
|
import { logger } from './logger'
|
|
79
82
|
import { logError } from './hooks/log-error'
|
|
80
83
|
import { services } from './services/index'
|
|
@@ -83,7 +86,7 @@ import { channels } from './channels'
|
|
|
83
86
|
const app: Application = express(feathers())
|
|
84
87
|
|
|
85
88
|
// Load app configuration
|
|
86
|
-
app.configure(configuration(configurationValidator))
|
|
89
|
+
app.configure(configuration(${schema !== false ? 'configurationValidator' : ''}))
|
|
87
90
|
app.use(cors())
|
|
88
91
|
app.use(json())
|
|
89
92
|
app.use(urlencoded({ extended: true }))
|
|
@@ -11,11 +11,6 @@ import type { Application, HookContext } from './declarations'
|
|
|
11
11
|
import { logger } from './logger'
|
|
12
12
|
|
|
13
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
14
|
logger.warn('Publishing all events to all authenticated users. See \`channels.${language}\` and https://dove.feathersjs.com/api/channels.html for more information.')
|
|
20
15
|
|
|
21
16
|
app.on('connection', (connection: RealTimeConnection) => {
|
|
@@ -45,6 +40,6 @@ export const channels = (app: Application) => {
|
|
|
45
40
|
})
|
|
46
41
|
}
|
|
47
42
|
`;
|
|
48
|
-
const generate = (ctx) => (0, pinion_1.generator)(ctx).then((0, commons_1.renderSource)(template, (0, pinion_1.toFile)(({ lib }) => lib, 'channels')));
|
|
43
|
+
const generate = (ctx) => (0, pinion_1.generator)(ctx).then((0, pinion_1.when)(({ transports }) => transports.includes('websockets'), (0, commons_1.renderSource)(template, (0, pinion_1.toFile)(({ lib }) => lib, 'channels'))));
|
|
49
44
|
exports.generate = generate;
|
|
50
45
|
//# sourceMappingURL=channels.tpl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channels.tpl.js","sourceRoot":"","sources":["../../../src/app/templates/channels.tpl.ts"],"names":[],"mappings":";;;AAAA,+
|
|
1
|
+
{"version":3,"file":"channels.tpl.js","sourceRoot":"","sources":["../../../src/app/templates/channels.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAA4D;AAC5D,2CAA4C;AAG5C,MAAM,QAAQ,GAAG,CAAC,EAChB,QAAQ,EACY,EAAE,EAAE,CAAC,QAAQ,CAAC;;;;;;;;kFAQ8C,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BzF,CAAA;AAEM,MAAM,QAAQ,GAAG,CAAC,GAAwB,EAAE,EAAE,CACnD,IAAA,kBAAS,EAAC,GAAG,CAAC,CAAC,IAAI,CACjB,IAAA,aAAI,EACF,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC,EACrD,IAAA,sBAAY,EACV,QAAQ,EACR,IAAA,eAAM,EAAsB,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,UAAU,CAAC,CAC1D,CACF,CACF,CAAA;AATU,QAAA,QAAQ,YASlB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { generator, toFile } from '@feathershq/pinion'
|
|
1
|
+
import { generator, toFile, when } from '@feathershq/pinion'
|
|
2
2
|
import { renderSource } from '../../commons'
|
|
3
3
|
import { AppGeneratorContext } from '../index'
|
|
4
4
|
|
|
@@ -12,11 +12,6 @@ import type { Application, HookContext } from './declarations'
|
|
|
12
12
|
import { logger } from './logger'
|
|
13
13
|
|
|
14
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
15
|
logger.warn('Publishing all events to all authenticated users. See \`channels.${language}\` and https://dove.feathersjs.com/api/channels.html for more information.')
|
|
21
16
|
|
|
22
17
|
app.on('connection', (connection: RealTimeConnection) => {
|
|
@@ -49,8 +44,11 @@ export const channels = (app: Application) => {
|
|
|
49
44
|
|
|
50
45
|
export const generate = (ctx: AppGeneratorContext) =>
|
|
51
46
|
generator(ctx).then(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
when<AppGeneratorContext>(
|
|
48
|
+
({ transports }) => transports.includes('websockets'),
|
|
49
|
+
renderSource(
|
|
50
|
+
template,
|
|
51
|
+
toFile<AppGeneratorContext>(({ lib }) => lib, 'channels')
|
|
52
|
+
)
|
|
55
53
|
)
|
|
56
54
|
)
|
|
@@ -22,6 +22,6 @@ describe('client tests', () => {
|
|
|
22
22
|
})
|
|
23
23
|
})
|
|
24
24
|
`;
|
|
25
|
-
const generate = (ctx) => (0, pinion_1.generator)(ctx).then((0, commons_1.renderSource)(template, (0, pinion_1.toFile)('test', 'client.test')));
|
|
25
|
+
const generate = (ctx) => (0, pinion_1.generator)(ctx).then((0, pinion_1.when)((ctx) => ctx.client, (0, commons_1.renderSource)(template, (0, pinion_1.toFile)('test', 'client.test'))));
|
|
26
26
|
exports.generate = generate;
|
|
27
27
|
//# sourceMappingURL=client.test.tpl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.test.tpl.js","sourceRoot":"","sources":["../../../src/app/templates/client.test.tpl.ts"],"names":[],"mappings":";;;AAAA,+
|
|
1
|
+
{"version":3,"file":"client.test.tpl.js","sourceRoot":"","sources":["../../../src/app/templates/client.test.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAA4D;AAC5D,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,CACjB,IAAA,aAAI,EAAsB,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,EAAE,IAAA,sBAAY,EAAC,QAAQ,EAAE,IAAA,eAAM,EAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,CACtG,CAAA;AAHU,QAAA,QAAQ,YAGlB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { generator, toFile } from '@feathershq/pinion'
|
|
1
|
+
import { generator, toFile, when } from '@feathershq/pinion'
|
|
2
2
|
import { renderSource } from '../../commons'
|
|
3
3
|
import { AppGeneratorContext } from '../index'
|
|
4
4
|
|
|
@@ -23,4 +23,6 @@ describe('client tests', () => {
|
|
|
23
23
|
`
|
|
24
24
|
|
|
25
25
|
export const generate = (ctx: AppGeneratorContext) =>
|
|
26
|
-
generator(ctx).then(
|
|
26
|
+
generator(ctx).then(
|
|
27
|
+
when<AppGeneratorContext>((ctx) => ctx.client, renderSource(template, toFile('test', 'client.test')))
|
|
28
|
+
)
|
|
@@ -38,6 +38,6 @@ export const createClient = <Configuration = any> (
|
|
|
38
38
|
return client
|
|
39
39
|
}
|
|
40
40
|
`;
|
|
41
|
-
const generate = async (ctx) => (0, pinion_1.generator)(ctx).then((0, commons_1.renderSource)(template, (0, pinion_1.toFile)(({ lib }) => lib, 'client')));
|
|
41
|
+
const generate = async (ctx) => (0, pinion_1.generator)(ctx).then((0, pinion_1.when)((ctx) => ctx.client, (0, commons_1.renderSource)(template, (0, pinion_1.toFile)(({ lib }) => lib, 'client'))));
|
|
42
42
|
exports.generate = generate;
|
|
43
43
|
//# sourceMappingURL=client.tpl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.tpl.js","sourceRoot":"","sources":["../../../src/app/templates/client.tpl.ts"],"names":[],"mappings":";;;AAAA,+
|
|
1
|
+
{"version":3,"file":"client.tpl.js","sourceRoot":"","sources":["../../../src/app/templates/client.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAA4D;AAC5D,2CAA4C;AAG5C,MAAM,QAAQ,GAAG,CAAC,EAChB,IAAI,EACJ,QAAQ,EACY,EAAE,EAAE,CAAC,QAAQ,CAAC;;;;;;;;;;;;;;;eAerB,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,mBAAmB,IAAI;;;;;;;;;;;;;;;;;;;CAmBrE,CAAA;AAEM,MAAM,QAAQ,GAAG,KAAK,EAAE,GAAwB,EAAE,EAAE,CACzD,IAAA,kBAAS,EAAC,GAAG,CAAC,CAAC,IAAI,CACjB,IAAA,aAAI,EACF,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,EACnB,IAAA,sBAAY,EACV,QAAQ,EACR,IAAA,eAAM,EAAsB,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,QAAQ,CAAC,CACxD,CACF,CACF,CAAA;AATU,QAAA,QAAQ,YASlB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { generator, toFile } from '@feathershq/pinion'
|
|
1
|
+
import { generator, toFile, when } from '@feathershq/pinion'
|
|
2
2
|
import { renderSource } from '../../commons'
|
|
3
3
|
import { AppGeneratorContext } from '../index'
|
|
4
4
|
|
|
@@ -43,8 +43,11 @@ export const createClient = <Configuration = any> (
|
|
|
43
43
|
|
|
44
44
|
export const generate = async (ctx: AppGeneratorContext) =>
|
|
45
45
|
generator(ctx).then(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
when<AppGeneratorContext>(
|
|
47
|
+
(ctx) => ctx.client,
|
|
48
|
+
renderSource(
|
|
49
|
+
template,
|
|
50
|
+
toFile<AppGeneratorContext>(({ lib }) => lib, 'client')
|
|
51
|
+
)
|
|
49
52
|
)
|
|
50
53
|
)
|
|
@@ -18,17 +18,21 @@ const customEnvironment = {
|
|
|
18
18
|
__name: 'PORT',
|
|
19
19
|
__format: 'number'
|
|
20
20
|
},
|
|
21
|
-
host: 'HOSTNAME'
|
|
21
|
+
host: 'HOSTNAME',
|
|
22
|
+
authentication: {
|
|
23
|
+
secret: 'FEATHERS_SECRET'
|
|
24
|
+
}
|
|
22
25
|
};
|
|
23
26
|
const testConfig = {
|
|
24
27
|
port: 8998
|
|
25
28
|
};
|
|
26
|
-
const configurationJsonTemplate = ({}) =>
|
|
29
|
+
const configurationJsonTemplate = ({}) => `import { defaultAppSettings, getValidator } from '@feathersjs/schema'
|
|
27
30
|
import type { FromSchema } from '@feathersjs/schema'
|
|
28
31
|
|
|
29
32
|
import { dataValidator } from './validators'
|
|
30
33
|
|
|
31
34
|
export const configurationSchema = {
|
|
35
|
+
$id: 'configuration',
|
|
32
36
|
type: 'object',
|
|
33
37
|
additionalProperties: false,
|
|
34
38
|
required: [ 'host', 'port', 'public' ],
|
|
@@ -44,7 +48,7 @@ export const configurationValidator = getValidator(configurationSchema, dataVali
|
|
|
44
48
|
|
|
45
49
|
export type ApplicationConfiguration = FromSchema<typeof configurationSchema>
|
|
46
50
|
`;
|
|
47
|
-
const configurationTypeboxTemplate = ({}) =>
|
|
51
|
+
const configurationTypeboxTemplate = ({}) => `import { Type, getValidator, defaultAppConfiguration } from '@feathersjs/typebox'
|
|
48
52
|
import type { Static } from '@feathersjs/typebox'
|
|
49
53
|
|
|
50
54
|
import { dataValidator } from './validators'
|
|
@@ -66,6 +70,6 @@ const generate = (ctx) => (0, pinion_1.generator)(ctx)
|
|
|
66
70
|
.then((0, pinion_1.writeJSON)(defaultConfig, (0, pinion_1.toFile)('config', 'default.json')))
|
|
67
71
|
.then((0, pinion_1.writeJSON)(testConfig, (0, pinion_1.toFile)('config', 'test.json')))
|
|
68
72
|
.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')));
|
|
73
|
+
.then((0, pinion_1.when)((ctx) => ctx.schema !== false, (0, commons_1.renderSource)(async (ctx) => ctx.schema === 'typebox' ? configurationTypeboxTemplate(ctx) : configurationJsonTemplate(ctx), (0, pinion_1.toFile)(({ lib }) => lib, 'configuration'))));
|
|
70
74
|
exports.generate = generate;
|
|
71
75
|
//# sourceMappingURL=configuration.tpl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configuration.tpl.js","sourceRoot":"","sources":["../../../src/app/templates/configuration.tpl.ts"],"names":[],"mappings":";;;AAAA,+
|
|
1
|
+
{"version":3,"file":"configuration.tpl.js","sourceRoot":"","sources":["../../../src/app/templates/configuration.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAAuE;AACvE,2CAA4C;AAG5C,MAAM,aAAa,GAAG,CAAC,EAAuB,EAAE,EAAE,CAAC,CAAC;IAClD,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,IAAI;IACV,MAAM,EAAE,WAAW;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