@feathersjs/cli 5.0.0-pre.33 → 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 +27 -0
- package/lib/index.d.ts +6 -2
- package/lib/index.js +59 -2
- package/lib/index.js.map +1 -1
- package/package.json +30 -30
- package/lib/app/index.d.ts +0 -29
- package/lib/app/index.js +0 -146
- package/lib/app/index.js.map +0 -1
- package/lib/app/index.ts +0 -227
- package/lib/app/static/.gitignore +0 -121
- package/lib/app/templates/app.test.tpl.d.ts +0 -2
- package/lib/app/templates/app.test.tpl.js +0 -48
- package/lib/app/templates/app.test.tpl.js.map +0 -1
- package/lib/app/templates/app.test.tpl.ts +0 -47
- package/lib/app/templates/app.tpl.d.ts +0 -2
- package/lib/app/templates/app.tpl.js +0 -121
- package/lib/app/templates/app.tpl.js.map +0 -1
- package/lib/app/templates/app.tpl.ts +0 -136
- package/lib/app/templates/channels.tpl.d.ts +0 -2
- package/lib/app/templates/channels.tpl.js +0 -48
- package/lib/app/templates/channels.tpl.js.map +0 -1
- package/lib/app/templates/channels.tpl.ts +0 -54
- package/lib/app/templates/client.test.tpl.d.ts +0 -2
- package/lib/app/templates/client.test.tpl.js +0 -27
- package/lib/app/templates/client.test.tpl.js.map +0 -1
- package/lib/app/templates/client.test.tpl.ts +0 -26
- package/lib/app/templates/client.tpl.d.ts +0 -2
- package/lib/app/templates/client.tpl.js +0 -37
- package/lib/app/templates/client.tpl.js.map +0 -1
- package/lib/app/templates/client.tpl.ts +0 -44
- package/lib/app/templates/config.tpl.d.ts +0 -2
- package/lib/app/templates/config.tpl.js +0 -30
- package/lib/app/templates/config.tpl.js.map +0 -1
- package/lib/app/templates/config.tpl.ts +0 -31
- package/lib/app/templates/declarations.tpl.d.ts +0 -2
- package/lib/app/templates/declarations.tpl.js +0 -27
- package/lib/app/templates/declarations.tpl.js.map +0 -1
- package/lib/app/templates/declarations.tpl.ts +0 -36
- package/lib/app/templates/index.html.tpl.d.ts +0 -2
- package/lib/app/templates/index.html.tpl.js +0 -45
- package/lib/app/templates/index.html.tpl.js.map +0 -1
- package/lib/app/templates/index.html.tpl.ts +0 -44
- package/lib/app/templates/index.tpl.d.ts +0 -2
- package/lib/app/templates/index.tpl.js +0 -18
- package/lib/app/templates/index.tpl.js.map +0 -1
- package/lib/app/templates/index.tpl.ts +0 -22
- package/lib/app/templates/logger.tpl.d.ts +0 -2
- package/lib/app/templates/logger.tpl.js +0 -39
- package/lib/app/templates/logger.tpl.js.map +0 -1
- package/lib/app/templates/logger.tpl.ts +0 -44
- package/lib/app/templates/package.json.tpl.d.ts +0 -2
- package/lib/app/templates/package.json.tpl.js +0 -55
- package/lib/app/templates/package.json.tpl.js.map +0 -1
- package/lib/app/templates/package.json.tpl.ts +0 -68
- package/lib/app/templates/prettierrc.tpl.d.ts +0 -2
- package/lib/app/templates/prettierrc.tpl.js +0 -11
- package/lib/app/templates/prettierrc.tpl.js.map +0 -1
- package/lib/app/templates/prettierrc.tpl.ts +0 -14
- package/lib/app/templates/readme.md.tpl.d.ts +0 -2
- package/lib/app/templates/readme.md.tpl.js +0 -54
- package/lib/app/templates/readme.md.tpl.js.map +0 -1
- package/lib/app/templates/readme.md.tpl.ts +0 -57
- package/lib/app/templates/schemas.tpl.d.ts +0 -2
- package/lib/app/templates/schemas.tpl.js +0 -75
- package/lib/app/templates/schemas.tpl.js.map +0 -1
- package/lib/app/templates/schemas.tpl.ts +0 -89
- package/lib/app/templates/services.tpl.d.ts +0 -2
- package/lib/app/templates/services.tpl.js +0 -14
- package/lib/app/templates/services.tpl.js.map +0 -1
- package/lib/app/templates/services.tpl.ts +0 -18
- package/lib/app/templates/tsconfig.json.tpl.d.ts +0 -2
- package/lib/app/templates/tsconfig.json.tpl.js +0 -22
- package/lib/app/templates/tsconfig.json.tpl.js.map +0 -1
- package/lib/app/templates/tsconfig.json.tpl.ts +0 -28
- package/lib/authentication/index.d.ts +0 -73
- package/lib/authentication/index.js +0 -107
- package/lib/authentication/index.js.map +0 -1
- package/lib/authentication/index.ts +0 -126
- package/lib/authentication/templates/authentication.tpl.d.ts +0 -2
- package/lib/authentication/templates/authentication.tpl.js +0 -39
- package/lib/authentication/templates/authentication.tpl.js.map +0 -1
- package/lib/authentication/templates/authentication.tpl.ts +0 -50
- package/lib/authentication/templates/client.test.tpl.d.ts +0 -2
- package/lib/authentication/templates/client.test.tpl.js +0 -61
- package/lib/authentication/templates/client.test.tpl.js.map +0 -1
- package/lib/authentication/templates/client.test.tpl.ts +0 -73
- package/lib/authentication/templates/client.tpl.d.ts +0 -2
- package/lib/authentication/templates/client.tpl.js +0 -14
- package/lib/authentication/templates/client.tpl.js.map +0 -1
- package/lib/authentication/templates/client.tpl.ts +0 -19
- package/lib/authentication/templates/config.tpl.d.ts +0 -2
- package/lib/authentication/templates/config.tpl.js +0 -50
- package/lib/authentication/templates/config.tpl.js.map +0 -1
- package/lib/authentication/templates/config.tpl.ts +0 -57
- package/lib/authentication/templates/declarations.tpl.d.ts +0 -2
- package/lib/authentication/templates/declarations.tpl.js +0 -19
- package/lib/authentication/templates/declarations.tpl.js.map +0 -1
- package/lib/authentication/templates/declarations.tpl.ts +0 -34
- 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 -93
- package/lib/authentication/templates/schema.json.tpl.js.map +0 -1
- package/lib/authentication/templates/schema.json.tpl.ts +0 -108
- package/lib/authentication/templates/schema.typebox.tpl.d.ts +0 -3
- package/lib/authentication/templates/schema.typebox.tpl.js +0 -78
- package/lib/authentication/templates/schema.typebox.tpl.js.map +0 -1
- package/lib/authentication/templates/schema.typebox.tpl.ts +0 -94
- package/lib/cli.d.ts +0 -6
- package/lib/cli.js +0 -75
- package/lib/cli.js.map +0 -1
- package/lib/cli.ts +0 -68
- package/lib/commons.d.ts +0 -143
- package/lib/commons.js +0 -190
- package/lib/commons.js.map +0 -1
- package/lib/commons.ts +0 -276
- package/lib/connection/index.d.ts +0 -55
- package/lib/connection/index.js +0 -88
- package/lib/connection/index.js.map +0 -1
- package/lib/connection/index.ts +0 -123
- package/lib/connection/templates/knex.tpl.d.ts +0 -2
- package/lib/connection/templates/knex.tpl.js +0 -46
- package/lib/connection/templates/knex.tpl.js.map +0 -1
- package/lib/connection/templates/knex.tpl.ts +0 -63
- package/lib/connection/templates/mongodb.tpl.d.ts +0 -2
- package/lib/connection/templates/mongodb.tpl.js +0 -33
- package/lib/connection/templates/mongodb.tpl.js.map +0 -1
- package/lib/connection/templates/mongodb.tpl.ts +0 -38
- package/lib/hook/index.d.ts +0 -22
- package/lib/hook/index.js +0 -43
- package/lib/hook/index.js.map +0 -1
- package/lib/hook/index.ts +0 -47
- package/lib/hook/templates/hook.tpl.d.ts +0 -2
- package/lib/hook/templates/hook.tpl.js +0 -20
- package/lib/hook/templates/hook.tpl.js.map +0 -1
- package/lib/hook/templates/hook.tpl.ts +0 -31
- package/lib/index.ts +0 -2
- package/lib/service/index.d.ts +0 -64
- package/lib/service/index.js +0 -116
- package/lib/service/index.js.map +0 -1
- package/lib/service/index.ts +0 -191
- package/lib/service/templates/client.tpl.d.ts +0 -2
- package/lib/service/templates/client.tpl.js +0 -31
- package/lib/service/templates/client.tpl.js.map +0 -1
- package/lib/service/templates/client.tpl.ts +0 -57
- package/lib/service/templates/schema.json.tpl.d.ts +0 -2
- package/lib/service/templates/schema.json.tpl.js +0 -75
- package/lib/service/templates/schema.json.tpl.js.map +0 -1
- package/lib/service/templates/schema.json.tpl.ts +0 -87
- package/lib/service/templates/schema.typebox.tpl.d.ts +0 -2
- package/lib/service/templates/schema.typebox.tpl.js +0 -55
- package/lib/service/templates/schema.typebox.tpl.js.map +0 -1
- package/lib/service/templates/schema.typebox.tpl.ts +0 -67
- package/lib/service/templates/service.tpl.d.ts +0 -3
- package/lib/service/templates/service.tpl.js +0 -98
- package/lib/service/templates/service.tpl.js.map +0 -1
- package/lib/service/templates/service.tpl.ts +0 -134
- package/lib/service/templates/test.tpl.d.ts +0 -2
- package/lib/service/templates/test.tpl.js +0 -24
- package/lib/service/templates/test.tpl.js.map +0 -1
- package/lib/service/templates/test.tpl.ts +0 -28
- package/lib/service/type/custom.tpl.d.ts +0 -3
- package/lib/service/type/custom.tpl.js +0 -94
- package/lib/service/type/custom.tpl.js.map +0 -1
- package/lib/service/type/custom.tpl.ts +0 -99
- package/lib/service/type/knex.tpl.d.ts +0 -3
- package/lib/service/type/knex.tpl.js +0 -67
- package/lib/service/type/knex.tpl.js.map +0 -1
- package/lib/service/type/knex.tpl.ts +0 -88
- package/lib/service/type/mongodb.tpl.d.ts +0 -3
- package/lib/service/type/mongodb.tpl.js +0 -47
- package/lib/service/type/mongodb.tpl.js.map +0 -1
- package/lib/service/type/mongodb.tpl.ts +0 -59
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,33 @@
|
|
|
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.35](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.34...v5.0.0-pre.35) (2023-01-12)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **cli:** Add unhandledRejection handler to generated index file ([#2932](https://github.com/feathersjs/feathers/issues/2932)) ([e3cedc8](https://github.com/feathersjs/feathers/commit/e3cedc8e00f52d892f21fd6a3eb4ca4fe40a903c))
|
|
11
|
+
- **cli:** Minor generated app improvements ([#2936](https://github.com/feathersjs/feathers/issues/2936)) ([ba1a550](https://github.com/feathersjs/feathers/commit/ba1a5500a8a5ea4ab44da44ac509e48c723d7efd))
|
|
12
|
+
- **cli:** Properly log validation errors in log-error hook ([54c883c](https://github.com/feathersjs/feathers/commit/54c883c2bb5c35c02b1a2081b2f17554550aa1d4))
|
|
13
|
+
- **cli:** Use correct package manager when installing an app ([#2973](https://github.com/feathersjs/feathers/issues/2973)) ([99c2a70](https://github.com/feathersjs/feathers/commit/99c2a70b77f0b68698a66180b69a56cb20c2ca0d))
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
- **generators:** Move core code generators to shared generators package ([#2982](https://github.com/feathersjs/feathers/issues/2982)) ([0328d22](https://github.com/feathersjs/feathers/commit/0328d2292153870bc43958f73d2c6f288a8cec17))
|
|
18
|
+
|
|
19
|
+
# [5.0.0-pre.34](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.33...v5.0.0-pre.34) (2022-12-14)
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
- **cli:** mongodb connection string for node 17+ ([#2875](https://github.com/feathersjs/feathers/issues/2875)) ([7fa2012](https://github.com/feathersjs/feathers/commit/7fa2012897d8429b522fbca72211fc9be1c25f7e))
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
- **adapter:** Add patch data type to adapters and refactor AdapterBase usage ([#2906](https://github.com/feathersjs/feathers/issues/2906)) ([9ddc2e6](https://github.com/feathersjs/feathers/commit/9ddc2e6b028f026f939d6af68125847e5c6734b4))
|
|
28
|
+
- **cli:** Use separate patch schema and types ([#2916](https://github.com/feathersjs/feathers/issues/2916)) ([7088af6](https://github.com/feathersjs/feathers/commit/7088af64a539dc7f1a016d832b77b98aaaf92603))
|
|
29
|
+
- **docs:** CLI and application structure guide ([#2818](https://github.com/feathersjs/feathers/issues/2818)) ([142914f](https://github.com/feathersjs/feathers/commit/142914fc001a8420056dd56db992c1c4f1bd312c))
|
|
30
|
+
- **schema:** Split resolver options and property resolvers ([#2889](https://github.com/feathersjs/feathers/issues/2889)) ([4822c94](https://github.com/feathersjs/feathers/commit/4822c949812e5a1dceff3c62b2f9de4781b4d601))
|
|
31
|
+
- **schema:** Virtual property resolvers ([#2900](https://github.com/feathersjs/feathers/issues/2900)) ([7d03b57](https://github.com/feathersjs/feathers/commit/7d03b57ae2f633bdd4a368e0d5955011fbd6c329))
|
|
32
|
+
|
|
6
33
|
# [5.0.0-pre.33](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.32...v5.0.0-pre.33) (2022-11-08)
|
|
7
34
|
|
|
8
35
|
### Bug Fixes
|
package/lib/index.d.ts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
export * from 'commander';
|
|
4
|
+
export { chalk };
|
|
5
|
+
export declare const commandRunner: (name: string) => (options: any) => Promise<void>;
|
|
6
|
+
export declare const program: Command;
|
package/lib/index.js
CHANGED
|
@@ -13,7 +13,64 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
13
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
16
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
exports.program = exports.commandRunner = exports.chalk = void 0;
|
|
21
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
22
|
+
exports.chalk = chalk_1.default;
|
|
23
|
+
const commander_1 = require("commander");
|
|
24
|
+
const path_1 = require("path");
|
|
25
|
+
const generators_1 = require("@feathersjs/generators");
|
|
26
|
+
__exportStar(require("commander"), exports);
|
|
27
|
+
const commandRunner = (name) => async (options) => {
|
|
28
|
+
const folder = (0, path_1.dirname)(require.resolve('@feathersjs/generators'));
|
|
29
|
+
const ctx = (0, generators_1.getContext)({
|
|
30
|
+
...options
|
|
31
|
+
});
|
|
32
|
+
await (0, generators_1.generator)(ctx)
|
|
33
|
+
.then((0, generators_1.runGenerator)(folder, name, 'index'))
|
|
34
|
+
.catch((error) => {
|
|
35
|
+
const { logger } = ctx.pinion;
|
|
36
|
+
logger.error(`Error: ${chalk_1.default.white(error.message)}`);
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
exports.commandRunner = commandRunner;
|
|
40
|
+
exports.program = new commander_1.Command();
|
|
41
|
+
exports.program
|
|
42
|
+
.name('feathers')
|
|
43
|
+
.description('The Feathers command line interface 🕊️')
|
|
44
|
+
.version(generators_1.version)
|
|
45
|
+
.showHelpAfterError();
|
|
46
|
+
const generate = exports.program.command('generate').alias('g');
|
|
47
|
+
generate
|
|
48
|
+
.command('app')
|
|
49
|
+
.description('Generate a new application')
|
|
50
|
+
.option('--name <name>', 'The name of the application')
|
|
51
|
+
.action((0, exports.commandRunner)('app'));
|
|
52
|
+
generate
|
|
53
|
+
.command('service')
|
|
54
|
+
.description('Generate a new service')
|
|
55
|
+
.option('--name <name>', 'The service name')
|
|
56
|
+
.option('--path <path>', 'The path to register the service on')
|
|
57
|
+
.option('--type <type>', 'The service type (knex, mongodb, custom)')
|
|
58
|
+
.action((0, exports.commandRunner)('service'));
|
|
59
|
+
generate
|
|
60
|
+
.command('hook')
|
|
61
|
+
.description('Generate a hook')
|
|
62
|
+
.option('--name <name>', 'The name of the hook')
|
|
63
|
+
.option('--type <type>', 'The hook type (around or regular)')
|
|
64
|
+
.action((0, exports.commandRunner)('hook'));
|
|
65
|
+
generate
|
|
66
|
+
.command('connection')
|
|
67
|
+
.description('Add a new database connection')
|
|
68
|
+
.action((0, exports.commandRunner)('connection'));
|
|
69
|
+
generate
|
|
70
|
+
.command('authentication')
|
|
71
|
+
.description('Add authentication to the application')
|
|
72
|
+
.action((0, exports.commandRunner)('authentication'));
|
|
73
|
+
generate.description(`Run a generator. Currently available: \n ${generate.commands
|
|
74
|
+
.map((cmd) => `${chalk_1.default.blue(cmd.name())}: ${cmd.description()} `)
|
|
75
|
+
.join('\n ')}`);
|
|
19
76
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,kDAAyB;AAMhB,gBANF,eAAK,CAME;AALd,yCAAmC;AACnC,+BAA8B;AAC9B,uDAA0G;AAE1G,4CAAyB;AAGlB,MAAM,aAAa,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,KAAK,EAAE,OAAY,EAAE,EAAE;IACpE,MAAM,MAAM,GAAG,IAAA,cAAO,EAAC,OAAO,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC,CAAA;IACjE,MAAM,GAAG,GAAG,IAAA,uBAAU,EAAsB;QAC1C,GAAG,OAAO;KACX,CAAC,CAAA;IAEF,MAAM,IAAA,sBAAS,EAAC,GAAG,CAAC;SACjB,IAAI,CAAC,IAAA,yBAAY,EAAC,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;SACzC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;QACf,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,MAAM,CAAA;QAE7B,MAAM,CAAC,KAAK,CAAC,UAAU,eAAK,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;IACtD,CAAC,CAAC,CAAA;AACN,CAAC,CAAA;AAbY,QAAA,aAAa,iBAazB;AAEY,QAAA,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAA;AAEpC,eAAO;KACJ,IAAI,CAAC,UAAU,CAAC;KAChB,WAAW,CAAC,yCAAyC,CAAC;KACtD,OAAO,CAAC,oBAAO,CAA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AAG,CAAC,IAAI,EAAE,CAAC,KAAK,GAAG,CAAC,WAAW,EAAE,GAAG,CAAC;KAChE,IAAI,CAAC,MAAM,CAAC,EAAE,CAClB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@feathersjs/cli",
|
|
3
3
|
"description": "The command line interface for creating Feathers applications",
|
|
4
|
-
"version": "5.0.0-pre.
|
|
4
|
+
"version": "5.0.0-pre.35",
|
|
5
5
|
"homepage": "https://feathersjs.com",
|
|
6
6
|
"main": "lib/",
|
|
7
7
|
"bin": {
|
|
@@ -37,13 +37,14 @@
|
|
|
37
37
|
"LICENSE",
|
|
38
38
|
"README.md",
|
|
39
39
|
"lib/**",
|
|
40
|
+
"lib/app/static/.gitignore",
|
|
40
41
|
"bin/**",
|
|
41
42
|
"*.d.ts",
|
|
42
43
|
"*.js"
|
|
43
44
|
],
|
|
44
45
|
"scripts": {
|
|
45
46
|
"prepublish": "npm run compile",
|
|
46
|
-
"compile": "shx rm -rf lib/ && tsc
|
|
47
|
+
"compile": "shx rm -rf lib/ && tsc",
|
|
47
48
|
"mocha": "mocha --timeout 60000 --config ../../.mocharc.json --recursive test/**.test.ts test/**/*.test.ts",
|
|
48
49
|
"test": "npm run compile && npm run mocha"
|
|
49
50
|
},
|
|
@@ -51,38 +52,37 @@
|
|
|
51
52
|
"access": "public"
|
|
52
53
|
},
|
|
53
54
|
"dependencies": {
|
|
54
|
-
"@
|
|
55
|
+
"@feathersjs/generators": "^5.0.0-pre.35",
|
|
55
56
|
"chalk": "^4.0.1",
|
|
56
|
-
"commander": "^9.4.1"
|
|
57
|
-
"lodash": "^4.17.21",
|
|
58
|
-
"prettier": "^2.7.1"
|
|
57
|
+
"commander": "^9.4.1"
|
|
59
58
|
},
|
|
60
59
|
"devDependencies": {
|
|
61
|
-
"@feathersjs/
|
|
62
|
-
"@feathersjs/authentication
|
|
63
|
-
"@feathersjs/authentication-
|
|
64
|
-
"@feathersjs/authentication-
|
|
65
|
-
"@feathersjs/
|
|
66
|
-
"@feathersjs/
|
|
67
|
-
"@feathersjs/
|
|
68
|
-
"@feathersjs/
|
|
69
|
-
"@feathersjs/
|
|
70
|
-
"@feathersjs/
|
|
71
|
-
"@feathersjs/
|
|
72
|
-
"@feathersjs/
|
|
73
|
-
"@feathersjs/
|
|
74
|
-
"@feathersjs/
|
|
75
|
-
"@feathersjs/
|
|
76
|
-
"@feathersjs/
|
|
77
|
-
"@
|
|
78
|
-
"@types/
|
|
79
|
-
"@types/
|
|
80
|
-
"
|
|
81
|
-
"
|
|
60
|
+
"@feathersjs/adapter-commons": "^5.0.0-pre.35",
|
|
61
|
+
"@feathersjs/authentication": "^5.0.0-pre.35",
|
|
62
|
+
"@feathersjs/authentication-client": "^5.0.0-pre.35",
|
|
63
|
+
"@feathersjs/authentication-local": "^5.0.0-pre.35",
|
|
64
|
+
"@feathersjs/authentication-oauth": "^5.0.0-pre.35",
|
|
65
|
+
"@feathersjs/configuration": "^5.0.0-pre.35",
|
|
66
|
+
"@feathersjs/errors": "^5.0.0-pre.35",
|
|
67
|
+
"@feathersjs/express": "^5.0.0-pre.35",
|
|
68
|
+
"@feathersjs/feathers": "^5.0.0-pre.35",
|
|
69
|
+
"@feathersjs/knex": "^5.0.0-pre.35",
|
|
70
|
+
"@feathersjs/koa": "^5.0.0-pre.35",
|
|
71
|
+
"@feathersjs/mongodb": "^5.0.0-pre.35",
|
|
72
|
+
"@feathersjs/rest-client": "^5.0.0-pre.35",
|
|
73
|
+
"@feathersjs/schema": "^5.0.0-pre.35",
|
|
74
|
+
"@feathersjs/socketio": "^5.0.0-pre.35",
|
|
75
|
+
"@feathersjs/transport-commons": "^5.0.0-pre.35",
|
|
76
|
+
"@feathersjs/typebox": "^5.0.0-pre.35",
|
|
77
|
+
"@types/mocha": "^10.0.1",
|
|
78
|
+
"@types/node": "^18.11.18",
|
|
79
|
+
"@types/prettier": "^2.7.2",
|
|
80
|
+
"axios": "^1.2.2",
|
|
81
|
+
"mocha": "^10.2.0",
|
|
82
82
|
"shx": "^0.3.4",
|
|
83
83
|
"ts-node": "^10.9.1",
|
|
84
|
-
"type-fest": "^3.
|
|
85
|
-
"typescript": "^4.
|
|
84
|
+
"type-fest": "^3.5.0",
|
|
85
|
+
"typescript": "^4.9.4"
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "c641598d9a4de3ceda10f56cf2af288a4236b15e"
|
|
88
88
|
}
|
package/lib/app/index.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { FeathersBaseContext, FeathersAppInfo } from '../commons';
|
|
2
|
-
export interface AppGeneratorData extends FeathersAppInfo {
|
|
3
|
-
/**
|
|
4
|
-
* The application name
|
|
5
|
-
*/
|
|
6
|
-
name: string;
|
|
7
|
-
/**
|
|
8
|
-
* A short description of the app
|
|
9
|
-
*/
|
|
10
|
-
description: string;
|
|
11
|
-
/**
|
|
12
|
-
* The selected user authentication strategies
|
|
13
|
-
*/
|
|
14
|
-
authStrategies: string[];
|
|
15
|
-
/**
|
|
16
|
-
* The database connection string
|
|
17
|
-
*/
|
|
18
|
-
connectionString: string;
|
|
19
|
-
/**
|
|
20
|
-
* The source folder where files are put
|
|
21
|
-
*/
|
|
22
|
-
lib: string;
|
|
23
|
-
}
|
|
24
|
-
export declare type AppGeneratorContext = FeathersBaseContext & AppGeneratorData & {
|
|
25
|
-
dependencies: string[];
|
|
26
|
-
devDependencies: string[];
|
|
27
|
-
};
|
|
28
|
-
export declare type AppGeneratorArguments = FeathersBaseContext & Partial<AppGeneratorData>;
|
|
29
|
-
export declare const generate: (ctx: AppGeneratorArguments) => Promise<AppGeneratorContext>;
|
package/lib/app/index.js
DELETED
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.generate = void 0;
|
|
7
|
-
const path_1 = require("path");
|
|
8
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
-
const pinion_1 = require("@feathershq/pinion");
|
|
10
|
-
const commons_1 = require("../commons");
|
|
11
|
-
const authentication_1 = require("../authentication");
|
|
12
|
-
const connection_1 = require("../connection");
|
|
13
|
-
const generate = (ctx) => (0, pinion_1.generator)(ctx)
|
|
14
|
-
.then((0, commons_1.initializeBaseContext)())
|
|
15
|
-
.then((ctx) => ({
|
|
16
|
-
...ctx,
|
|
17
|
-
dependencies: [],
|
|
18
|
-
devDependencies: []
|
|
19
|
-
}))
|
|
20
|
-
.then((0, pinion_1.prompt)((ctx) => [
|
|
21
|
-
{
|
|
22
|
-
name: 'language',
|
|
23
|
-
type: 'list',
|
|
24
|
-
message: 'Do you want to use JavaScript or TypeScript?',
|
|
25
|
-
when: !ctx.language,
|
|
26
|
-
choices: [
|
|
27
|
-
{ name: 'TypeScript', value: 'ts' },
|
|
28
|
-
{ name: 'JavaScript', value: 'js' }
|
|
29
|
-
]
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
name: 'name',
|
|
33
|
-
type: 'input',
|
|
34
|
-
when: !ctx.name,
|
|
35
|
-
message: 'What is the name of your application?',
|
|
36
|
-
default: ctx.cwd.split(path_1.sep).pop(),
|
|
37
|
-
validate: (input) => {
|
|
38
|
-
if (ctx.dependencyVersions[input]) {
|
|
39
|
-
return `Application can not have the same name as a dependency`;
|
|
40
|
-
}
|
|
41
|
-
return true;
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
name: 'description',
|
|
46
|
-
type: 'input',
|
|
47
|
-
when: !ctx.description,
|
|
48
|
-
message: 'Write a short description'
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
type: 'list',
|
|
52
|
-
name: 'framework',
|
|
53
|
-
when: !ctx.framework,
|
|
54
|
-
message: 'Which HTTP framework do you want to use?',
|
|
55
|
-
choices: [
|
|
56
|
-
{ value: 'koa', name: `KoaJS ${chalk_1.default.grey('(recommended)')}` },
|
|
57
|
-
{ value: 'express', name: 'Express' }
|
|
58
|
-
]
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
type: 'checkbox',
|
|
62
|
-
name: 'transports',
|
|
63
|
-
when: !ctx.transports,
|
|
64
|
-
message: 'What APIs do you want to offer?',
|
|
65
|
-
choices: [
|
|
66
|
-
{ value: 'rest', name: 'HTTP (REST)', checked: true },
|
|
67
|
-
{ value: 'websockets', name: 'Real-time', checked: true }
|
|
68
|
-
]
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
name: 'packager',
|
|
72
|
-
type: 'list',
|
|
73
|
-
when: !ctx.packager,
|
|
74
|
-
message: 'Which package manager are you using?',
|
|
75
|
-
choices: [
|
|
76
|
-
{ value: 'npm', name: 'npm' },
|
|
77
|
-
{ value: 'yarn', name: 'Yarn' },
|
|
78
|
-
{ value: 'pnpm', name: 'pnpm' }
|
|
79
|
-
]
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
type: 'list',
|
|
83
|
-
name: 'schema',
|
|
84
|
-
when: !ctx.schema,
|
|
85
|
-
message: 'What is your preferred schema (model) definition format?',
|
|
86
|
-
choices: [
|
|
87
|
-
{ value: 'typebox', name: `TypeBox ${chalk_1.default.grey('(recommended)')}` },
|
|
88
|
-
{ value: 'json', name: 'JSON schema' }
|
|
89
|
-
]
|
|
90
|
-
},
|
|
91
|
-
...(0, connection_1.prompts)(ctx),
|
|
92
|
-
...(0, authentication_1.prompts)({
|
|
93
|
-
...ctx,
|
|
94
|
-
service: 'user',
|
|
95
|
-
path: 'users',
|
|
96
|
-
entity: 'user'
|
|
97
|
-
})
|
|
98
|
-
]))
|
|
99
|
-
.then((0, pinion_1.runGenerators)(__dirname, 'templates'))
|
|
100
|
-
.then((0, pinion_1.copyFiles)((0, pinion_1.fromFile)(__dirname, 'static'), (0, pinion_1.toFile)('.')))
|
|
101
|
-
.then((0, commons_1.initializeBaseContext)())
|
|
102
|
-
.then(async (ctx) => {
|
|
103
|
-
const { dependencies } = await (0, connection_1.generate)(ctx);
|
|
104
|
-
return {
|
|
105
|
-
...ctx,
|
|
106
|
-
dependencies
|
|
107
|
-
};
|
|
108
|
-
})
|
|
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
|
-
.then((0, pinion_1.install)(({ transports, framework, dependencyVersions, dependencies, schema }) => {
|
|
122
|
-
const hasSocketio = transports.includes('websockets');
|
|
123
|
-
dependencies.push('@feathersjs/feathers', '@feathersjs/errors', '@feathersjs/schema', '@feathersjs/configuration', '@feathersjs/transport-commons', '@feathersjs/authentication', '@feathersjs/authentication-client', 'winston');
|
|
124
|
-
if (hasSocketio) {
|
|
125
|
-
dependencies.push('@feathersjs/socketio');
|
|
126
|
-
}
|
|
127
|
-
if (framework === 'koa') {
|
|
128
|
-
dependencies.push('@feathersjs/koa');
|
|
129
|
-
}
|
|
130
|
-
if (framework === 'express') {
|
|
131
|
-
dependencies.push('@feathersjs/express', 'compression');
|
|
132
|
-
}
|
|
133
|
-
if (schema === 'typebox') {
|
|
134
|
-
dependencies.push('@feathersjs/typebox');
|
|
135
|
-
}
|
|
136
|
-
return (0, commons_1.addVersions)(dependencies, dependencyVersions);
|
|
137
|
-
}, false, ctx.packager))
|
|
138
|
-
.then((0, pinion_1.install)(({ language, devDependencies, dependencyVersions }) => {
|
|
139
|
-
devDependencies.push('nodemon', 'axios', 'mocha', 'cross-env', 'prettier', '@feathersjs/cli', '@feathersjs/rest-client');
|
|
140
|
-
if (language === 'ts') {
|
|
141
|
-
devDependencies.push('@types/mocha', '@types/node', 'nodemon', 'ts-node', 'typescript', 'shx');
|
|
142
|
-
}
|
|
143
|
-
return (0, commons_1.addVersions)(devDependencies, dependencyVersions);
|
|
144
|
-
}, true, ctx.packager));
|
|
145
|
-
exports.generate = generate;
|
|
146
|
-
//# sourceMappingURL=index.js.map
|
package/lib/app/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/app/index.ts"],"names":[],"mappings":";;;;;;AAAA,+BAA0B;AAC1B,kDAAyB;AACzB,+CAS2B;AAC3B,wCAAqG;AACrG,sDAAyG;AACzG,8CAA6F;AAiCtF,MAAM,QAAQ,GAAG,CAAC,GAA0B,EAAE,EAAE,CACrD,IAAA,kBAAS,EAAC,GAAG,CAAC;KACX,IAAI,CAAC,IAAA,+BAAqB,GAAE,CAAC;KAC7B,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IACd,GAAG,GAAG;IACN,YAAY,EAAE,EAAE;IAChB,eAAe,EAAE,EAAE;CACpB,CAAC,CAAC;KACF,IAAI,CACH,IAAA,eAAM,EAA6C,CAAC,GAAG,EAAE,EAAE,CAAC;IAC1D;QACE,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,8CAA8C;QACvD,IAAI,EAAE,CAAC,GAAG,CAAC,QAAQ;QACnB,OAAO,EAAE;YACP,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE;YACnC,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE;SACpC;KACF;IACD;QACE,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,CAAC,GAAG,CAAC,IAAI;QACf,OAAO,EAAE,uCAAuC;QAChD,OAAO,EAAE,GAAG,CAAC,GAAG,CA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I,EAAE;QACrB,eAAe,CAAC,IAAI,CAAC,cAAc,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,CAAC,CAAA;KAC/F;IAED,OAAO,IAAA,qBAAW,EAAC,eAAe,EAAE,kBAAkB,CAAC,CAAA;AACzD,CAAC,EACD,IAAI,EACJ,GAAG,CAAC,QAAQ,CACb,CACF,CAAA;AAnLQ,QAAA,QAAQ,YAmLhB"}
|
package/lib/app/index.ts
DELETED
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
import { sep } from 'path'
|
|
2
|
-
import chalk from 'chalk'
|
|
3
|
-
import {
|
|
4
|
-
generator,
|
|
5
|
-
prompt,
|
|
6
|
-
runGenerators,
|
|
7
|
-
fromFile,
|
|
8
|
-
install,
|
|
9
|
-
copyFiles,
|
|
10
|
-
toFile,
|
|
11
|
-
when
|
|
12
|
-
} from '@feathershq/pinion'
|
|
13
|
-
import { FeathersBaseContext, FeathersAppInfo, initializeBaseContext, addVersions } from '../commons'
|
|
14
|
-
import { generate as authenticationGenerator, prompts as authenticationPrompts } from '../authentication'
|
|
15
|
-
import { generate as connectionGenerator, prompts as connectionPrompts } from '../connection'
|
|
16
|
-
|
|
17
|
-
export interface AppGeneratorData extends FeathersAppInfo {
|
|
18
|
-
/**
|
|
19
|
-
* The application name
|
|
20
|
-
*/
|
|
21
|
-
name: string
|
|
22
|
-
/**
|
|
23
|
-
* A short description of the app
|
|
24
|
-
*/
|
|
25
|
-
description: string
|
|
26
|
-
/**
|
|
27
|
-
* The selected user authentication strategies
|
|
28
|
-
*/
|
|
29
|
-
authStrategies: string[]
|
|
30
|
-
/**
|
|
31
|
-
* The database connection string
|
|
32
|
-
*/
|
|
33
|
-
connectionString: string
|
|
34
|
-
/**
|
|
35
|
-
* The source folder where files are put
|
|
36
|
-
*/
|
|
37
|
-
lib: string
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export type AppGeneratorContext = FeathersBaseContext &
|
|
41
|
-
AppGeneratorData & {
|
|
42
|
-
dependencies: string[]
|
|
43
|
-
devDependencies: string[]
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export type AppGeneratorArguments = FeathersBaseContext & Partial<AppGeneratorData>
|
|
47
|
-
|
|
48
|
-
export const generate = (ctx: AppGeneratorArguments) =>
|
|
49
|
-
generator(ctx)
|
|
50
|
-
.then(initializeBaseContext())
|
|
51
|
-
.then((ctx) => ({
|
|
52
|
-
...ctx,
|
|
53
|
-
dependencies: [],
|
|
54
|
-
devDependencies: []
|
|
55
|
-
}))
|
|
56
|
-
.then(
|
|
57
|
-
prompt<AppGeneratorArguments, AppGeneratorContext>((ctx) => [
|
|
58
|
-
{
|
|
59
|
-
name: 'language',
|
|
60
|
-
type: 'list',
|
|
61
|
-
message: 'Do you want to use JavaScript or TypeScript?',
|
|
62
|
-
when: !ctx.language,
|
|
63
|
-
choices: [
|
|
64
|
-
{ name: 'TypeScript', value: 'ts' },
|
|
65
|
-
{ name: 'JavaScript', value: 'js' }
|
|
66
|
-
]
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
name: 'name',
|
|
70
|
-
type: 'input',
|
|
71
|
-
when: !ctx.name,
|
|
72
|
-
message: 'What is the name of your application?',
|
|
73
|
-
default: ctx.cwd.split(sep).pop(),
|
|
74
|
-
validate: (input) => {
|
|
75
|
-
if (ctx.dependencyVersions[input]) {
|
|
76
|
-
return `Application can not have the same name as a dependency`
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return true
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
name: 'description',
|
|
84
|
-
type: 'input',
|
|
85
|
-
when: !ctx.description,
|
|
86
|
-
message: 'Write a short description'
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
type: 'list',
|
|
90
|
-
name: 'framework',
|
|
91
|
-
when: !ctx.framework,
|
|
92
|
-
message: 'Which HTTP framework do you want to use?',
|
|
93
|
-
choices: [
|
|
94
|
-
{ value: 'koa', name: `KoaJS ${chalk.grey('(recommended)')}` },
|
|
95
|
-
{ value: 'express', name: 'Express' }
|
|
96
|
-
]
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
type: 'checkbox',
|
|
100
|
-
name: 'transports',
|
|
101
|
-
when: !ctx.transports,
|
|
102
|
-
message: 'What APIs do you want to offer?',
|
|
103
|
-
choices: [
|
|
104
|
-
{ value: 'rest', name: 'HTTP (REST)', checked: true },
|
|
105
|
-
{ value: 'websockets', name: 'Real-time', checked: true }
|
|
106
|
-
]
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
name: 'packager',
|
|
110
|
-
type: 'list',
|
|
111
|
-
when: !ctx.packager,
|
|
112
|
-
message: 'Which package manager are you using?',
|
|
113
|
-
choices: [
|
|
114
|
-
{ value: 'npm', name: 'npm' },
|
|
115
|
-
{ value: 'yarn', name: 'Yarn' },
|
|
116
|
-
{ value: 'pnpm', name: 'pnpm' }
|
|
117
|
-
]
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
type: 'list',
|
|
121
|
-
name: 'schema',
|
|
122
|
-
when: !ctx.schema,
|
|
123
|
-
message: 'What is your preferred schema (model) definition format?',
|
|
124
|
-
choices: [
|
|
125
|
-
{ value: 'typebox', name: `TypeBox ${chalk.grey('(recommended)')}` },
|
|
126
|
-
{ value: 'json', name: 'JSON schema' }
|
|
127
|
-
]
|
|
128
|
-
},
|
|
129
|
-
...connectionPrompts(ctx),
|
|
130
|
-
...authenticationPrompts({
|
|
131
|
-
...ctx,
|
|
132
|
-
service: 'user',
|
|
133
|
-
path: 'users',
|
|
134
|
-
entity: 'user'
|
|
135
|
-
})
|
|
136
|
-
])
|
|
137
|
-
)
|
|
138
|
-
.then(runGenerators(__dirname, 'templates'))
|
|
139
|
-
.then(copyFiles(fromFile(__dirname, 'static'), toFile('.')))
|
|
140
|
-
.then(initializeBaseContext())
|
|
141
|
-
.then(async (ctx) => {
|
|
142
|
-
const { dependencies } = await connectionGenerator(ctx)
|
|
143
|
-
|
|
144
|
-
return {
|
|
145
|
-
...ctx,
|
|
146
|
-
dependencies
|
|
147
|
-
}
|
|
148
|
-
})
|
|
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
|
-
.then(
|
|
168
|
-
install<AppGeneratorContext>(
|
|
169
|
-
({ transports, framework, dependencyVersions, dependencies, schema }) => {
|
|
170
|
-
const hasSocketio = transports.includes('websockets')
|
|
171
|
-
|
|
172
|
-
dependencies.push(
|
|
173
|
-
'@feathersjs/feathers',
|
|
174
|
-
'@feathersjs/errors',
|
|
175
|
-
'@feathersjs/schema',
|
|
176
|
-
'@feathersjs/configuration',
|
|
177
|
-
'@feathersjs/transport-commons',
|
|
178
|
-
'@feathersjs/authentication',
|
|
179
|
-
'@feathersjs/authentication-client',
|
|
180
|
-
'winston'
|
|
181
|
-
)
|
|
182
|
-
|
|
183
|
-
if (hasSocketio) {
|
|
184
|
-
dependencies.push('@feathersjs/socketio')
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
if (framework === 'koa') {
|
|
188
|
-
dependencies.push('@feathersjs/koa')
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
if (framework === 'express') {
|
|
192
|
-
dependencies.push('@feathersjs/express', 'compression')
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
if (schema === 'typebox') {
|
|
196
|
-
dependencies.push('@feathersjs/typebox')
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
return addVersions(dependencies, dependencyVersions)
|
|
200
|
-
},
|
|
201
|
-
false,
|
|
202
|
-
ctx.packager
|
|
203
|
-
)
|
|
204
|
-
)
|
|
205
|
-
.then(
|
|
206
|
-
install<AppGeneratorContext>(
|
|
207
|
-
({ language, devDependencies, dependencyVersions }) => {
|
|
208
|
-
devDependencies.push(
|
|
209
|
-
'nodemon',
|
|
210
|
-
'axios',
|
|
211
|
-
'mocha',
|
|
212
|
-
'cross-env',
|
|
213
|
-
'prettier',
|
|
214
|
-
'@feathersjs/cli',
|
|
215
|
-
'@feathersjs/rest-client'
|
|
216
|
-
)
|
|
217
|
-
|
|
218
|
-
if (language === 'ts') {
|
|
219
|
-
devDependencies.push('@types/mocha', '@types/node', 'nodemon', 'ts-node', 'typescript', 'shx')
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
return addVersions(devDependencies, dependencyVersions)
|
|
223
|
-
},
|
|
224
|
-
true,
|
|
225
|
-
ctx.packager
|
|
226
|
-
)
|
|
227
|
-
)
|