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