@feathersjs/generators 5.0.28 → 5.0.29
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 +6 -0
- package/lib/app/index.js +1 -2
- package/lib/app/index.js.map +1 -1
- package/lib/app/templates/gitignore.tpl.d.ts +5 -0
- package/lib/app/templates/gitignore.tpl.js +125 -0
- package/lib/app/templates/gitignore.tpl.js.map +1 -0
- package/package.json +20 -21
- package/lib/app/index.ts +0 -215
- package/lib/app/templates/app.test.tpl.ts +0 -50
- package/lib/app/templates/app.tpl.ts +0 -141
- package/lib/app/templates/channels.tpl.ts +0 -54
- package/lib/app/templates/client.test.tpl.ts +0 -28
- package/lib/app/templates/client.tpl.ts +0 -53
- package/lib/app/templates/configuration.tpl.ts +0 -89
- package/lib/app/templates/declarations.tpl.ts +0 -42
- package/lib/app/templates/index.html.tpl.ts +0 -44
- package/lib/app/templates/index.tpl.ts +0 -26
- package/lib/app/templates/logger.tpl.ts +0 -56
- package/lib/app/templates/package.json.tpl.ts +0 -78
- package/lib/app/templates/prettierrc.tpl.ts +0 -14
- package/lib/app/templates/readme.md.tpl.ts +0 -57
- package/lib/app/templates/services.tpl.ts +0 -20
- package/lib/app/templates/tsconfig.json.tpl.ts +0 -29
- package/lib/app/templates/validators.tpl.ts +0 -39
- package/lib/authentication/index.ts +0 -119
- package/lib/authentication/templates/authentication.tpl.ts +0 -52
- package/lib/authentication/templates/client.test.tpl.ts +0 -78
- package/lib/authentication/templates/config.tpl.ts +0 -60
- package/lib/authentication/templates/declarations.tpl.ts +0 -38
- package/lib/commons.ts +0 -346
- package/lib/connection/index.ts +0 -138
- package/lib/connection/templates/knex.tpl.ts +0 -73
- package/lib/connection/templates/mongodb.tpl.ts +0 -50
- package/lib/hook/index.ts +0 -52
- package/lib/hook/templates/hook.tpl.ts +0 -33
- package/lib/index.ts +0 -8
- package/lib/service/index.ts +0 -214
- package/lib/service/templates/client.tpl.ts +0 -33
- package/lib/service/templates/schema.json.tpl.ts +0 -143
- package/lib/service/templates/schema.typebox.tpl.ts +0 -131
- package/lib/service/templates/service.tpl.ts +0 -161
- package/lib/service/templates/shared.tpl.ts +0 -64
- package/lib/service/templates/test.tpl.ts +0 -33
- package/lib/service/type/custom.tpl.ts +0 -112
- package/lib/service/type/knex.tpl.ts +0 -105
- package/lib/service/type/mongodb.tpl.ts +0 -64
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
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.29](https://github.com/feathersjs/feathers/compare/v5.0.28...v5.0.29) (2024-07-10)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **generators:** Fix generating of gitignore ([#3514](https://github.com/feathersjs/feathers/issues/3514)) ([cabc397](https://github.com/feathersjs/feathers/commit/cabc397d2e4378c4bce79a60f2d196713cce4d8c))
|
|
11
|
+
|
|
6
12
|
## [5.0.28](https://github.com/feathersjs/feathers/compare/v5.0.27...v5.0.28) (2024-07-10)
|
|
7
13
|
|
|
8
14
|
**Note:** Version bump only for package @feathersjs/generators
|
package/lib/app/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { sep, dirname } from 'path';
|
|
2
2
|
import chalk from 'chalk';
|
|
3
|
-
import { prompt, runGenerators
|
|
3
|
+
import { prompt, runGenerators } from '@featherscloud/pinion';
|
|
4
4
|
import { fileURLToPath } from 'url';
|
|
5
5
|
import { initializeBaseContext, addVersions, install } from '../commons.js';
|
|
6
6
|
import { generate as connectionGenerator, prompts as connectionPrompts } from '../connection/index.js';
|
|
@@ -96,7 +96,6 @@ export const generate = (ctx) => Promise.resolve(ctx)
|
|
|
96
96
|
...connectionPrompts(ctx)
|
|
97
97
|
]))
|
|
98
98
|
.then(runGenerators(__dirname, 'templates'))
|
|
99
|
-
.then(copyFiles(fromFile(__dirname, 'static'), toFile('.')))
|
|
100
99
|
.then(initializeBaseContext())
|
|
101
100
|
.then(async (ctx) => {
|
|
102
101
|
const { dependencies } = await connectionGenerator(ctx);
|
package/lib/app/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/app/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AACnC,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/app/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AACnC,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAA;AACnC,OAAO,EAGL,qBAAqB,EACrB,WAAW,EACX,OAAO,EACR,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,QAAQ,IAAI,mBAAmB,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAEtG,6BAA6B;AAC7B,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;AAiCzD,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,GAA0B,EAAE,EAAE,CACrD,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC;KACjB,IAAI,CAAC,qBAAqB,EAAE,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,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AAW,CAAC,YAAY,EAAE,kBAAkB,CAAC,CAAA;AACtD,CAAC,EACD,KAAK,EACL,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,QAAQ,CAC3B,CACF;KACA,IAAI,CACH,OAAO,CACL,CAAC,EAAE,QAAQ,EAAE,eAAe,EAAE,kBAAkB,EAAE,EAAE,EAAE;IACpD,eAAe,CAAC,IAAI,CAClB,SAAS,EACT,OAAO,EACP,OAAO,EACP,WAAW,EACX,UAAU,EACV,iBAAiB,EACjB,yBAAyB,CAC1B,CAAA;IAED,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;QACtB,eAAe,CAAC,IAAI,CAAC,cAAc,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,CAAC,CAAA;IAChG,CAAC;IAED,OAAO,WAAW,CAAC,eAAe,EAAE,kBAAkB,CAAC,CAAA;AACzD,CAAC,EACD,IAAI,EACJ,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,QAAQ,CAC3B,CACF,CAAA"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { renderTemplate, toFile } from '@featherscloud/pinion';
|
|
2
|
+
const template = `# Logs
|
|
3
|
+
logs
|
|
4
|
+
*.log
|
|
5
|
+
npm-debug.log*
|
|
6
|
+
yarn-debug.log*
|
|
7
|
+
yarn-error.log*
|
|
8
|
+
lerna-debug.log*
|
|
9
|
+
.pnpm-debug.log*
|
|
10
|
+
|
|
11
|
+
# Diagnostic reports (https://nodejs.org/api/report.html)
|
|
12
|
+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
|
13
|
+
|
|
14
|
+
# Runtime data
|
|
15
|
+
pids
|
|
16
|
+
*.pid
|
|
17
|
+
*.seed
|
|
18
|
+
*.pid.lock
|
|
19
|
+
|
|
20
|
+
# Directory for instrumented libs generated by jscoverage/JSCover
|
|
21
|
+
lib-cov
|
|
22
|
+
|
|
23
|
+
# Coverage directory used by tools like istanbul
|
|
24
|
+
coverage
|
|
25
|
+
*.lcov
|
|
26
|
+
|
|
27
|
+
# nyc test coverage
|
|
28
|
+
.nyc_output
|
|
29
|
+
|
|
30
|
+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
|
31
|
+
.grunt
|
|
32
|
+
|
|
33
|
+
# Bower dependency directory (https://bower.io/)
|
|
34
|
+
bower_components
|
|
35
|
+
|
|
36
|
+
# node-waf configuration
|
|
37
|
+
.lock-wscript
|
|
38
|
+
|
|
39
|
+
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
|
40
|
+
build/Release
|
|
41
|
+
|
|
42
|
+
# Dependency directories
|
|
43
|
+
node_modules/
|
|
44
|
+
jspm_packages/
|
|
45
|
+
|
|
46
|
+
# Snowpack dependency directory (https://snowpack.dev/)
|
|
47
|
+
web_modules/
|
|
48
|
+
|
|
49
|
+
# TypeScript cache
|
|
50
|
+
*.tsbuildinfo
|
|
51
|
+
|
|
52
|
+
# Optional npm cache directory
|
|
53
|
+
.npm
|
|
54
|
+
|
|
55
|
+
# Optional eslint cache
|
|
56
|
+
.eslintcache
|
|
57
|
+
|
|
58
|
+
# Microbundle cache
|
|
59
|
+
.rpt2_cache/
|
|
60
|
+
.rts2_cache_cjs/
|
|
61
|
+
.rts2_cache_es/
|
|
62
|
+
.rts2_cache_umd/
|
|
63
|
+
|
|
64
|
+
# Optional REPL history
|
|
65
|
+
.node_repl_history
|
|
66
|
+
|
|
67
|
+
# Output of 'npm pack'
|
|
68
|
+
*.tgz
|
|
69
|
+
|
|
70
|
+
# Yarn Integrity file
|
|
71
|
+
.yarn-integrity
|
|
72
|
+
|
|
73
|
+
# dotenv environment variables file
|
|
74
|
+
.env
|
|
75
|
+
.env.test
|
|
76
|
+
.env.production
|
|
77
|
+
|
|
78
|
+
# parcel-bundler cache (https://parceljs.org/)
|
|
79
|
+
.cache
|
|
80
|
+
.parcel-cache
|
|
81
|
+
|
|
82
|
+
# Next.js build output
|
|
83
|
+
.next
|
|
84
|
+
out
|
|
85
|
+
|
|
86
|
+
# Nuxt.js build / generate output
|
|
87
|
+
.nuxt
|
|
88
|
+
dist
|
|
89
|
+
|
|
90
|
+
# Gatsby files
|
|
91
|
+
.cache/
|
|
92
|
+
# Comment in the public line in if your project uses Gatsby and not Next.js
|
|
93
|
+
# https://nextjs.org/blog/next-9-1#public-directory-support
|
|
94
|
+
# public
|
|
95
|
+
|
|
96
|
+
# vuepress build output
|
|
97
|
+
.vuepress/dist
|
|
98
|
+
|
|
99
|
+
# Serverless directories
|
|
100
|
+
.serverless/
|
|
101
|
+
|
|
102
|
+
# FuseBox cache
|
|
103
|
+
.fusebox/
|
|
104
|
+
|
|
105
|
+
# DynamoDB Local files
|
|
106
|
+
.dynamodb/
|
|
107
|
+
|
|
108
|
+
# TernJS port file
|
|
109
|
+
.tern-port
|
|
110
|
+
|
|
111
|
+
# Stores VSCode versions used for testing VSCode extensions
|
|
112
|
+
.vscode-test
|
|
113
|
+
|
|
114
|
+
# yarn v2
|
|
115
|
+
.yarn/cache
|
|
116
|
+
.yarn/unplugged
|
|
117
|
+
.yarn/build-state.yml
|
|
118
|
+
.yarn/install-state.gz
|
|
119
|
+
.pnp.*
|
|
120
|
+
.sqlite
|
|
121
|
+
|
|
122
|
+
lib/
|
|
123
|
+
`;
|
|
124
|
+
export const generate = (ctx) => Promise.resolve(ctx).then(renderTemplate(template, toFile('.gitignore')));
|
|
125
|
+
//# sourceMappingURL=gitignore.tpl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitignore.tpl.js","sourceRoot":"","sources":["../../../src/app/templates/gitignore.tpl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAG9D,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyHhB,CAAA;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,GAAwB,EAAE,EAAE,CACnD,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@feathersjs/generators",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.29",
|
|
4
4
|
"description": "Feathers CLI core generators, powered by Pinion",
|
|
5
5
|
"homepage": "https://feathersjs.com",
|
|
6
6
|
"keywords": [
|
|
@@ -37,13 +37,12 @@
|
|
|
37
37
|
"LICENSE",
|
|
38
38
|
"README.md",
|
|
39
39
|
"lib/**",
|
|
40
|
-
"lib/app/static/.gitignore",
|
|
41
40
|
"*.d.ts",
|
|
42
41
|
"*.js"
|
|
43
42
|
],
|
|
44
43
|
"scripts": {
|
|
45
44
|
"prepublish": "npm run compile",
|
|
46
|
-
"compile": "shx rm -rf lib/ && tsc
|
|
45
|
+
"compile": "shx rm -rf lib/ && tsc",
|
|
47
46
|
"test": "npm run compile && mocha --config ../../.mocharc.json --require tsx --recursive test/**.test.ts test/**/*.test.ts"
|
|
48
47
|
},
|
|
49
48
|
"directories": {
|
|
@@ -60,23 +59,23 @@
|
|
|
60
59
|
"typescript": "^5.5.3"
|
|
61
60
|
},
|
|
62
61
|
"devDependencies": {
|
|
63
|
-
"@feathersjs/adapter-commons": "^5.0.
|
|
64
|
-
"@feathersjs/authentication": "^5.0.
|
|
65
|
-
"@feathersjs/authentication-client": "^5.0.
|
|
66
|
-
"@feathersjs/authentication-local": "^5.0.
|
|
67
|
-
"@feathersjs/authentication-oauth": "^5.0.
|
|
68
|
-
"@feathersjs/configuration": "^5.0.
|
|
69
|
-
"@feathersjs/errors": "^5.0.
|
|
70
|
-
"@feathersjs/express": "^5.0.
|
|
71
|
-
"@feathersjs/feathers": "^5.0.
|
|
72
|
-
"@feathersjs/knex": "^5.0.
|
|
73
|
-
"@feathersjs/koa": "^5.0.
|
|
74
|
-
"@feathersjs/mongodb": "^5.0.
|
|
75
|
-
"@feathersjs/rest-client": "^5.0.
|
|
76
|
-
"@feathersjs/schema": "^5.0.
|
|
77
|
-
"@feathersjs/socketio": "^5.0.
|
|
78
|
-
"@feathersjs/transport-commons": "^5.0.
|
|
79
|
-
"@feathersjs/typebox": "^5.0.
|
|
62
|
+
"@feathersjs/adapter-commons": "^5.0.29",
|
|
63
|
+
"@feathersjs/authentication": "^5.0.29",
|
|
64
|
+
"@feathersjs/authentication-client": "^5.0.29",
|
|
65
|
+
"@feathersjs/authentication-local": "^5.0.29",
|
|
66
|
+
"@feathersjs/authentication-oauth": "^5.0.29",
|
|
67
|
+
"@feathersjs/configuration": "^5.0.29",
|
|
68
|
+
"@feathersjs/errors": "^5.0.29",
|
|
69
|
+
"@feathersjs/express": "^5.0.29",
|
|
70
|
+
"@feathersjs/feathers": "^5.0.29",
|
|
71
|
+
"@feathersjs/knex": "^5.0.29",
|
|
72
|
+
"@feathersjs/koa": "^5.0.29",
|
|
73
|
+
"@feathersjs/mongodb": "^5.0.29",
|
|
74
|
+
"@feathersjs/rest-client": "^5.0.29",
|
|
75
|
+
"@feathersjs/schema": "^5.0.29",
|
|
76
|
+
"@feathersjs/socketio": "^5.0.29",
|
|
77
|
+
"@feathersjs/transport-commons": "^5.0.29",
|
|
78
|
+
"@feathersjs/typebox": "^5.0.29",
|
|
80
79
|
"@types/mocha": "^10.0.7",
|
|
81
80
|
"@types/node": "^20.14.10",
|
|
82
81
|
"@types/prettier": "^2.7.3",
|
|
@@ -93,5 +92,5 @@
|
|
|
93
92
|
"type-fest": "^4.21.0",
|
|
94
93
|
"typescript": "^5.5.3"
|
|
95
94
|
},
|
|
96
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "6330134f97a1de4b627d41e8bcc2287498d5faa2"
|
|
97
96
|
}
|
package/lib/app/index.ts
DELETED
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
import { sep, dirname } from 'path'
|
|
2
|
-
import chalk from 'chalk'
|
|
3
|
-
import { prompt, runGenerators, fromFile, copyFiles, toFile } from '@featherscloud/pinion'
|
|
4
|
-
import { fileURLToPath } from 'url'
|
|
5
|
-
import {
|
|
6
|
-
FeathersBaseContext,
|
|
7
|
-
FeathersAppInfo,
|
|
8
|
-
initializeBaseContext,
|
|
9
|
-
addVersions,
|
|
10
|
-
install
|
|
11
|
-
} from '../commons.js'
|
|
12
|
-
import { generate as connectionGenerator, prompts as connectionPrompts } from '../connection/index.js'
|
|
13
|
-
|
|
14
|
-
// Set __dirname in es module
|
|
15
|
-
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
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 database connection string
|
|
28
|
-
*/
|
|
29
|
-
connectionString: string
|
|
30
|
-
/**
|
|
31
|
-
* The source folder where files are put
|
|
32
|
-
*/
|
|
33
|
-
lib: string
|
|
34
|
-
/**
|
|
35
|
-
* Generate a client
|
|
36
|
-
*/
|
|
37
|
-
client: boolean
|
|
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
|
-
Promise.resolve(ctx)
|
|
50
|
-
.then(initializeBaseContext())
|
|
51
|
-
.then((ctx) => ({
|
|
52
|
-
...ctx,
|
|
53
|
-
dependencies: [],
|
|
54
|
-
devDependencies: []
|
|
55
|
-
}))
|
|
56
|
-
.then(
|
|
57
|
-
prompt((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
|
-
name: 'client',
|
|
121
|
-
type: 'confirm',
|
|
122
|
-
when: ctx.client === undefined,
|
|
123
|
-
message: (answers) => `Generate ${answers.language === 'ts' ? 'end-to-end typed ' : ''}client?`,
|
|
124
|
-
suffix: chalk.grey(' Can be used with React, Angular, Vue, React Native, Node.js etc.')
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
type: 'list',
|
|
128
|
-
name: 'schema',
|
|
129
|
-
when: !ctx.schema,
|
|
130
|
-
message: 'What is your preferred schema (model) definition format?',
|
|
131
|
-
suffix: chalk.grey(
|
|
132
|
-
' Schemas allow to type, validate, secure and populate your data and configuration'
|
|
133
|
-
),
|
|
134
|
-
choices: [
|
|
135
|
-
{ value: 'typebox', name: `TypeBox ${chalk.grey('(recommended)')}` },
|
|
136
|
-
{ value: 'json', name: 'JSON schema' },
|
|
137
|
-
{ value: false, name: `No schema ${chalk.grey('(not recommended)')}` }
|
|
138
|
-
]
|
|
139
|
-
},
|
|
140
|
-
...connectionPrompts(ctx)
|
|
141
|
-
])
|
|
142
|
-
)
|
|
143
|
-
.then(runGenerators(__dirname, 'templates'))
|
|
144
|
-
.then(copyFiles(fromFile(__dirname, 'static'), toFile('.')))
|
|
145
|
-
.then(initializeBaseContext())
|
|
146
|
-
.then(async (ctx) => {
|
|
147
|
-
const { dependencies } = await connectionGenerator(ctx)
|
|
148
|
-
|
|
149
|
-
return {
|
|
150
|
-
...ctx,
|
|
151
|
-
dependencies
|
|
152
|
-
}
|
|
153
|
-
})
|
|
154
|
-
.then(
|
|
155
|
-
install(
|
|
156
|
-
({ transports, framework, dependencyVersions, dependencies, schema }) => {
|
|
157
|
-
const hasSocketio = transports.includes('websockets')
|
|
158
|
-
|
|
159
|
-
dependencies.push(
|
|
160
|
-
'@feathersjs/feathers',
|
|
161
|
-
'@feathersjs/errors',
|
|
162
|
-
'@feathersjs/schema',
|
|
163
|
-
'@feathersjs/configuration',
|
|
164
|
-
'@feathersjs/transport-commons',
|
|
165
|
-
'@feathersjs/adapter-commons',
|
|
166
|
-
'@feathersjs/authentication',
|
|
167
|
-
'@feathersjs/authentication-client',
|
|
168
|
-
'winston'
|
|
169
|
-
)
|
|
170
|
-
|
|
171
|
-
if (hasSocketio) {
|
|
172
|
-
dependencies.push('@feathersjs/socketio')
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
if (framework === 'koa') {
|
|
176
|
-
dependencies.push('@feathersjs/koa')
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
if (framework === 'express') {
|
|
180
|
-
dependencies.push('@feathersjs/express', 'compression')
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
if (schema === 'typebox') {
|
|
184
|
-
dependencies.push('@feathersjs/typebox')
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
return addVersions(dependencies, dependencyVersions)
|
|
188
|
-
},
|
|
189
|
-
false,
|
|
190
|
-
({ packager }) => packager
|
|
191
|
-
)
|
|
192
|
-
)
|
|
193
|
-
.then(
|
|
194
|
-
install(
|
|
195
|
-
({ language, devDependencies, dependencyVersions }) => {
|
|
196
|
-
devDependencies.push(
|
|
197
|
-
'nodemon',
|
|
198
|
-
'axios',
|
|
199
|
-
'mocha',
|
|
200
|
-
'cross-env',
|
|
201
|
-
'prettier',
|
|
202
|
-
'@feathersjs/cli',
|
|
203
|
-
'@feathersjs/rest-client'
|
|
204
|
-
)
|
|
205
|
-
|
|
206
|
-
if (language === 'ts') {
|
|
207
|
-
devDependencies.push('@types/mocha', '@types/node', 'nodemon', 'ts-node', 'typescript', 'shx')
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
return addVersions(devDependencies, dependencyVersions)
|
|
211
|
-
},
|
|
212
|
-
true,
|
|
213
|
-
({ packager }) => packager
|
|
214
|
-
)
|
|
215
|
-
)
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { toFile } from '@featherscloud/pinion'
|
|
2
|
-
import { renderSource } from '../../commons.js'
|
|
3
|
-
import { AppGeneratorContext } from '../index.js'
|
|
4
|
-
|
|
5
|
-
const template = ({
|
|
6
|
-
lib
|
|
7
|
-
}: AppGeneratorContext) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/app.test.html
|
|
8
|
-
import assert from 'assert'
|
|
9
|
-
import axios from 'axios'
|
|
10
|
-
import type { Server } from 'http'
|
|
11
|
-
import { app } from '../${lib}/app'
|
|
12
|
-
|
|
13
|
-
const port = app.get('port')
|
|
14
|
-
const appUrl = \`http://\${app.get('host')}:\${port}\`
|
|
15
|
-
|
|
16
|
-
describe('Feathers application tests', () => {
|
|
17
|
-
let server: Server
|
|
18
|
-
|
|
19
|
-
before(async () => {
|
|
20
|
-
server = await app.listen(port)
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
after(async () => {
|
|
24
|
-
await app.teardown()
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
it('starts and shows the index page', async () => {
|
|
28
|
-
const { data } = await axios.get<string>(appUrl)
|
|
29
|
-
|
|
30
|
-
assert.ok(data.indexOf('<html lang="en">') !== -1)
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
it('shows a 404 JSON error', async () => {
|
|
34
|
-
try {
|
|
35
|
-
await axios.get(\`\${appUrl}/path/to/nowhere\`, {
|
|
36
|
-
responseType: 'json'
|
|
37
|
-
})
|
|
38
|
-
assert.fail('should never get here')
|
|
39
|
-
} catch (error: any) {
|
|
40
|
-
const { response } = error
|
|
41
|
-
assert.strictEqual(response?.status, 404)
|
|
42
|
-
assert.strictEqual(response?.data?.code, 404)
|
|
43
|
-
assert.strictEqual(response?.data?.name, 'NotFound')
|
|
44
|
-
}
|
|
45
|
-
})
|
|
46
|
-
})
|
|
47
|
-
`
|
|
48
|
-
|
|
49
|
-
export const generate = (ctx: AppGeneratorContext) =>
|
|
50
|
-
Promise.resolve(ctx).then(renderSource(template, toFile('test', 'app.test')))
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import { toFile } from '@featherscloud/pinion'
|
|
2
|
-
import { renderSource } from '../../commons.js'
|
|
3
|
-
import { AppGeneratorContext } from '../index.js'
|
|
4
|
-
|
|
5
|
-
const tsKoaApp = ({
|
|
6
|
-
transports,
|
|
7
|
-
schema
|
|
8
|
-
}: AppGeneratorContext) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/application.html
|
|
9
|
-
import { feathers } from '@feathersjs/feathers'
|
|
10
|
-
import configuration from '@feathersjs/configuration'
|
|
11
|
-
import {
|
|
12
|
-
koa, rest, bodyParser, errorHandler, parseAuthentication, cors, serveStatic
|
|
13
|
-
} from '@feathersjs/koa'
|
|
14
|
-
${transports.includes('websockets') ? "import socketio from '@feathersjs/socketio'" : ''}
|
|
15
|
-
|
|
16
|
-
${schema !== false ? `import { configurationValidator } from './configuration'` : ''}
|
|
17
|
-
import type { Application } from './declarations'
|
|
18
|
-
import { logError } from './hooks/log-error'
|
|
19
|
-
import { services } from './services/index'
|
|
20
|
-
${transports.includes('websockets') ? `import { channels } from './channels'` : ''}
|
|
21
|
-
|
|
22
|
-
const app: Application = koa(feathers())
|
|
23
|
-
|
|
24
|
-
// Load our app configuration (see config/ folder)
|
|
25
|
-
app.configure(configuration(${schema !== false ? 'configurationValidator' : ''}))
|
|
26
|
-
|
|
27
|
-
// Set up Koa middleware
|
|
28
|
-
app.use(cors())
|
|
29
|
-
app.use(serveStatic(app.get('public')))
|
|
30
|
-
app.use(errorHandler())
|
|
31
|
-
app.use(parseAuthentication())
|
|
32
|
-
app.use(bodyParser())
|
|
33
|
-
|
|
34
|
-
// Configure services and transports
|
|
35
|
-
app.configure(rest())
|
|
36
|
-
${
|
|
37
|
-
transports.includes('websockets')
|
|
38
|
-
? `app.configure(socketio({
|
|
39
|
-
cors: {
|
|
40
|
-
origin: app.get('origins')
|
|
41
|
-
}
|
|
42
|
-
}))`
|
|
43
|
-
: ''
|
|
44
|
-
}
|
|
45
|
-
app.configure(services)
|
|
46
|
-
${transports.includes('websockets') ? 'app.configure(channels)' : ''}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
// Register hooks that run on all service methods
|
|
50
|
-
app.hooks({
|
|
51
|
-
around: {
|
|
52
|
-
all: [ logError ]
|
|
53
|
-
},
|
|
54
|
-
before: {},
|
|
55
|
-
after: {},
|
|
56
|
-
error: {}
|
|
57
|
-
})
|
|
58
|
-
// Register application setup and teardown hooks here
|
|
59
|
-
app.hooks({
|
|
60
|
-
setup: [],
|
|
61
|
-
teardown: []
|
|
62
|
-
})
|
|
63
|
-
|
|
64
|
-
export { app }
|
|
65
|
-
`
|
|
66
|
-
|
|
67
|
-
const tsExpressApp = ({
|
|
68
|
-
transports,
|
|
69
|
-
schema
|
|
70
|
-
}: AppGeneratorContext) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/application.html
|
|
71
|
-
import { feathers } from '@feathersjs/feathers'
|
|
72
|
-
import express, {
|
|
73
|
-
rest, json, urlencoded, cors,
|
|
74
|
-
serveStatic, notFound, errorHandler
|
|
75
|
-
} from '@feathersjs/express'
|
|
76
|
-
import configuration from '@feathersjs/configuration'
|
|
77
|
-
${transports.includes('websockets') ? "import socketio from '@feathersjs/socketio'" : ''}
|
|
78
|
-
|
|
79
|
-
import type { Application } from './declarations'
|
|
80
|
-
${schema !== false ? `import { configurationValidator } from './configuration'` : ''}
|
|
81
|
-
import { logger } from './logger'
|
|
82
|
-
import { logError } from './hooks/log-error'
|
|
83
|
-
import { services } from './services/index'
|
|
84
|
-
${transports.includes('websockets') ? `import { channels } from './channels'` : ''}
|
|
85
|
-
|
|
86
|
-
const app: Application = express(feathers())
|
|
87
|
-
|
|
88
|
-
// Load app configuration
|
|
89
|
-
app.configure(configuration(${schema !== false ? 'configurationValidator' : ''}))
|
|
90
|
-
app.use(cors())
|
|
91
|
-
app.use(json())
|
|
92
|
-
app.use(urlencoded({ extended: true }))
|
|
93
|
-
// Host the public folder
|
|
94
|
-
app.use('/', serveStatic(app.get('public')))
|
|
95
|
-
|
|
96
|
-
// Configure services and real-time functionality
|
|
97
|
-
app.configure(rest())
|
|
98
|
-
${
|
|
99
|
-
transports.includes('websockets')
|
|
100
|
-
? `app.configure(socketio({
|
|
101
|
-
cors: {
|
|
102
|
-
origin: app.get('origins')
|
|
103
|
-
}
|
|
104
|
-
}))`
|
|
105
|
-
: ''
|
|
106
|
-
}
|
|
107
|
-
app.configure(services)
|
|
108
|
-
${transports.includes('websockets') ? 'app.configure(channels)' : ''}
|
|
109
|
-
|
|
110
|
-
// Configure a middleware for 404s and the error handler
|
|
111
|
-
app.use(notFound())
|
|
112
|
-
app.use(errorHandler({ logger }))
|
|
113
|
-
|
|
114
|
-
// Register hooks that run on all service methods
|
|
115
|
-
app.hooks({
|
|
116
|
-
around: {
|
|
117
|
-
all: [ logError ]
|
|
118
|
-
},
|
|
119
|
-
before: {},
|
|
120
|
-
after: {},
|
|
121
|
-
error: {}
|
|
122
|
-
})
|
|
123
|
-
// Register application setup and teardown hooks here
|
|
124
|
-
app.hooks({
|
|
125
|
-
setup: [],
|
|
126
|
-
teardown: []
|
|
127
|
-
})
|
|
128
|
-
|
|
129
|
-
export { app }
|
|
130
|
-
`
|
|
131
|
-
|
|
132
|
-
const template = (ctx: AppGeneratorContext) =>
|
|
133
|
-
ctx.framework === 'express' ? tsExpressApp(ctx) : tsKoaApp(ctx)
|
|
134
|
-
|
|
135
|
-
export const generate = (ctx: AppGeneratorContext) =>
|
|
136
|
-
Promise.resolve(ctx).then(
|
|
137
|
-
renderSource(
|
|
138
|
-
template,
|
|
139
|
-
toFile<AppGeneratorContext>(({ lib }) => lib, 'app')
|
|
140
|
-
)
|
|
141
|
-
)
|