@feathersjs/generators 5.0.28 → 5.0.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 +10 -0
- package/LICENSE +1 -1
- package/README.md +1 -1
- 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 +28 -29
- 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,16 @@
|
|
|
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.30](https://github.com/feathersjs/feathers/compare/v5.0.29...v5.0.30) (2024-09-02)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @feathersjs/generators
|
|
9
|
+
|
|
10
|
+
## [5.0.29](https://github.com/feathersjs/feathers/compare/v5.0.28...v5.0.29) (2024-07-10)
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- **generators:** Fix generating of gitignore ([#3514](https://github.com/feathersjs/feathers/issues/3514)) ([cabc397](https://github.com/feathersjs/feathers/commit/cabc397d2e4378c4bce79a60f2d196713cce4d8c))
|
|
15
|
+
|
|
6
16
|
## [5.0.28](https://github.com/feathersjs/feathers/compare/v5.0.27...v5.0.28) (2024-07-10)
|
|
7
17
|
|
|
8
18
|
**Note:** Version bump only for package @feathersjs/generators
|
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
The MIT License (MIT)
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2024 Feathers Contributors
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -17,6 +17,6 @@ Refer to the [Feathers CLI guide](https://feathersjs.com/guides/cli/) for more d
|
|
|
17
17
|
|
|
18
18
|
## License
|
|
19
19
|
|
|
20
|
-
Copyright (c)
|
|
20
|
+
Copyright (c) 2024 [Feathers contributors](https://github.com/feathersjs/feathers/graphs/contributors)
|
|
21
21
|
|
|
22
22
|
Licensed under the [MIT license](LICENSE).
|
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,MA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ACD,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.30",
|
|
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": {
|
|
@@ -56,42 +55,42 @@
|
|
|
56
55
|
"@featherscloud/pinion": "^0.5.4",
|
|
57
56
|
"chalk": "^5.3.0",
|
|
58
57
|
"lodash": "^4.17.21",
|
|
59
|
-
"prettier": "^3.3.
|
|
60
|
-
"typescript": "^5.5.
|
|
58
|
+
"prettier": "^3.3.3",
|
|
59
|
+
"typescript": "^5.5.4"
|
|
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.30",
|
|
63
|
+
"@feathersjs/authentication": "^5.0.30",
|
|
64
|
+
"@feathersjs/authentication-client": "^5.0.30",
|
|
65
|
+
"@feathersjs/authentication-local": "^5.0.30",
|
|
66
|
+
"@feathersjs/authentication-oauth": "^5.0.30",
|
|
67
|
+
"@feathersjs/configuration": "^5.0.30",
|
|
68
|
+
"@feathersjs/errors": "^5.0.30",
|
|
69
|
+
"@feathersjs/express": "^5.0.30",
|
|
70
|
+
"@feathersjs/feathers": "^5.0.30",
|
|
71
|
+
"@feathersjs/knex": "^5.0.30",
|
|
72
|
+
"@feathersjs/koa": "^5.0.30",
|
|
73
|
+
"@feathersjs/mongodb": "^5.0.30",
|
|
74
|
+
"@feathersjs/rest-client": "^5.0.30",
|
|
75
|
+
"@feathersjs/schema": "^5.0.30",
|
|
76
|
+
"@feathersjs/socketio": "^5.0.30",
|
|
77
|
+
"@feathersjs/transport-commons": "^5.0.30",
|
|
78
|
+
"@feathersjs/typebox": "^5.0.30",
|
|
80
79
|
"@types/mocha": "^10.0.7",
|
|
81
|
-
"@types/node": "^
|
|
80
|
+
"@types/node": "^22.5.1",
|
|
82
81
|
"@types/prettier": "^2.7.3",
|
|
83
|
-
"axios": "^1.7.
|
|
82
|
+
"axios": "^1.7.7",
|
|
84
83
|
"knex": "^3.1.0",
|
|
85
|
-
"mocha": "^10.
|
|
84
|
+
"mocha": "^10.7.3",
|
|
86
85
|
"mongodb": "^6.8.0",
|
|
87
86
|
"mssql": "^11.0.1",
|
|
88
87
|
"mysql": "^2.18.1",
|
|
89
88
|
"pg": "^8.12.0",
|
|
90
89
|
"shx": "^0.3.4",
|
|
91
90
|
"sqlite3": "^5.1.7",
|
|
92
|
-
"tsx": "^4.
|
|
93
|
-
"type-fest": "^4.
|
|
94
|
-
"typescript": "^5.5.
|
|
91
|
+
"tsx": "^4.19.0",
|
|
92
|
+
"type-fest": "^4.26.0",
|
|
93
|
+
"typescript": "^5.5.4"
|
|
95
94
|
},
|
|
96
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "ce00d390ddd85a5be533da69f7958fdc330d8f80"
|
|
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')))
|