Giter Club home page Giter Club logo

cli's Introduction

@feathers-plus/cli

This project is no longer maintained

FeathersJS CLI supporting both REST and GraphQL architectural concepts and their query languages.

Installation

npm install -g @feathers-plus/cli

Usage

Refer to the documentation.

License

Copyright (c) 2017-18 John J. Szwaronek.

Licensed under the MIT license.

cli's People

Contributors

daffl avatar eddyystop avatar marshallswain avatar nickbolles avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cli's Issues

Mixed line endings in generated files - "npm test" fails on eslint

Using Windows7, node v8.11.2, Performed the following steps from https://generator.feathers-plus.com/get-started/

npm i -g @feathers-plus/cli
mkdir feathers-app
cd feathers-app
feathers-plus generate options
# chosen all defaults

feathers-plus generate app
# chosen all defaults

npm start
# -> runs ok

Trying test:

npm test > log.test 2>&1

Test fails in eslint step, here's the result:

log.test

> [email protected] test C:\dev\ionic3-feathersplus-try2\api1
> npm run eslint && npm run mocha


> [email protected] eslint C:\dev\ionic3-feathersplus-try2\api1
> eslint src/. test/. --config .eslintrc.json


C:\dev\ionic3-feathersplus-try2\api1\src\app.hooks.js
   4:28  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
   5:36  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
   8:25  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
   9:43  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  10:29  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  16:31  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  17:20  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  18:14  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  19:13  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  20:16  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  21:16  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  22:15  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  23:15  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  28:30  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  29:20  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  30:14  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  31:13  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  32:16  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  33:16  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  34:15  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  35:15  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  40:30  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  41:20  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  42:14  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  43:13  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  44:16  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  45:16  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  46:15  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  47:15  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style

C:\dev\ionic3-feathersplus-try2\api1\src\app.js
  30:32  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  31:43  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style

C:\dev\ionic3-feathersplus-try2\api1\src\index.js
  14:46  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  15:63  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  21:36  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  22:86  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style

C:\dev\ionic3-feathersplus-try2\api1\src\logger.js
   9:28  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  10:56  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  11:17  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  13:29  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  14:26  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  15:20  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  16:20  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  17:5   error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  19:32  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  20:16  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  21:29  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  22:5   error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style

C:\dev\ionic3-feathersplus-try2\api1\src\models\users.model.js
  10:34  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  11:25  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  12:45  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  13:19  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  14:6   error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  15:59  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style

C:\dev\ionic3-feathersplus-try2\api1\src\services\users\users.hooks.js
   3:54  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
   4:70  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
   5:43  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
   9:25  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  10:43  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  11:29  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  18:34  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  19:37  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  20:37  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  21:32  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  22:53  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  23:53  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  25:31  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  26:13  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  27:35  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  28:34  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  29:32  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  30:53  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  31:52  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  32:36  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  37:34  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  39:30  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  40:69  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  41:14  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  42:13  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  43:16  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  44:16  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  45:15  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  46:15  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  51:30  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  52:13  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  53:14  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  54:13  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  55:16  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  56:16  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  57:15  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  58:15  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style

C:\dev\ionic3-feathersplus-try2\api1\src\services\users\users.mongo.js
   9:28  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  18:5   error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style

C:\dev\ionic3-feathersplus-try2\api1\src\services\users\users.mongoose.js
  11:28  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  12:6   error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style

C:\dev\ionic3-feathersplus-try2\api1\src\services\users\users.schema.js
   8:36   error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
   9:18   error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  10:34   error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  34:29   error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  35:18   error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  36:15   error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  37:24   error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  38:7    error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  39:14   error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  40:28   error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  41:27   error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  42:22   error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  43:42   error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  44:12   error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  45:10   error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  51:38   error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  52:116  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style

C:\dev\ionic3-feathersplus-try2\api1\src\services\users\users.sequelize.js
  18:38  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  19:6   error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style

C:\dev\ionic3-feathersplus-try2\api1\src\services\users\users.validate.js
  10:32  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  11:43  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  12:21  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  16:27  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  23:5   error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  47:34  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  48:47  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  53:34  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  54:47  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  59:33  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
  60:46  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style

✖ 124 problems (124 errors, 0 warnings)
  124 errors, 0 warnings potentially fixable with the `--fix` option.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] eslint: `eslint src/. test/. --config .eslintrc.json`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] eslint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\iivanchenko\AppData\Roaming\npm-cache\_logs\2018-07-17T04_32_21_344Z-debug.log
npm ERR! Test failed.  See above for more details.

Running --fix corrects line endings and tests pass:

npm run eslint -- --fix

Regenerating users service breaks tests again with same CRLF mix:

feathers-plus generate service
npm test
# -> eslint fails again

Feature request: Add config option or code insertion point

Every time I regenerate my project I have to comment out the middleware for error handlers.

The code:
app.use(express.notFound())
app.use(express.errorHandler({ logger }))

I am using nuxt SSR and these 2 lines make the app nonfunctional. Please add either a config option to disable these or a code insertion point I can use to comment them out.

Thank you

Generated TypeScript version fails to compile - app.configure() type mismatch

Steps to reproduce

Using Windows7, node v8.11.2, Performed the following steps from https://generator.feathers-plus.com/get-started/

npm i -g @feathers-plus/cli
#  + @feathers-plus/[email protected]
mkdir feathers-app
cd feathers-app
feathers-plus generate options
# chosen all defaults, except "Generate TypeScript code?" Yes

feathers-plus generate app
# chosen all defaults (npm is installed package manager)

npm start > log.start 2>&1
# -> fails

Expected behavior

Server should start

Actual behavior

TypeScript compilation fails, log.start:


> [email protected] start C:\dev\feathers-app
> ts-node --files src/


C:\dev\feathers-app\node_modules\ts-node\src\index.ts:261
    return new TSError(diagnosticText, diagnosticCodes)
           ^
TSError: ⨯ Unable to compile TypeScript:
src/app.ts(76,15): error TS2345: Argument of type '(app: Application<{}>) => void' is not assignable to parameter of type '(this: Application<any>, app: Application<any>) => void'.
  Types of parameters 'app' and 'app' are incompatible.
    Type 'Application<any>' is missing the following properties from type 'Application<{}>': map, patch, init, defaultConfiguration, and 39 more.
src/app.ts(78,15): error TS2345: Argument of type '(app: Application<{}>) => void' is not assignable to parameter of type '(this: Application<any>, app: Application<any>) => void'.
  Types of parameters 'app' and 'app' are incompatible.
    Type 'Application<any>' is not assignable to type 'Application<{}>'.
src/app.ts(80,15): error TS2345: Argument of type '(app: Application<{}>) => void' is not assignable to parameter of type '(this: Application<any>, app: Application<any>) => void'.
  Types of parameters 'app' and 'app' are incompatible.
    Type 'Application<any>' is not assignable to type 'Application<{}>'.

    at createTSError (C:\dev\feathers-app\node_modules\ts-node\src\index.ts:261:12)
    at getOutput (C:\dev\feathers-app\node_modules\ts-node\src\index.ts:367:40)
    at Object.compile (C:\dev\feathers-app\node_modules\ts-node\src\index.ts:558:11)
    at Module.m._compile (C:\dev\feathers-app\node_modules\ts-node\src\index.ts:439:43)
    at Module._extensions..js (module.js:663:10)
    at Object.require.extensions.(anonymous function) [as .ts] (C:\dev\feathers-app\node_modules\ts-node\src\index.ts:442:12)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `ts-node --files src/`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\...\AppData\Roaming\npm-cache\_logs\2019-06-03T17_06_04_691Z-debug.log

System configuration

Tell us about the applicable parts of your setup.

Module versions (especially the part that's not working):
@feathers-plus/[email protected]

NodeJS version:
v8.11.2
v11.4.0 (also tried with, using nvm)

Operating System:
Windows 7

Module Loader:
npm 6.9.0

feathers-plus generate fakes

Steps to reproduce

(First please check that this issue is not already solved as described
here
)

  • Tell us what broke. The more detailed the better.
  • If you can, please create a simple example that reproduces the issue and link to a gist, jsbin, repo, etc.

Expected behavior

Tell us what should happen

Actual behavior

Tell us what happens instead

System configuration

Tell us about the applicable parts of your setup.

Module versions (especially the part that's not working):

NodeJS version:

Operating System:

Browser Version:

React Native Version:

Module Loader:

Generate test for base authentication

When you run this test, an error occurs. Wrong email format...
The error may be in the file: "C:/NodeServer/feathers-plus-app/node_modules/@feathers-plus/test-utils/lib/cli/authentication.base.js"
...
const loginEmail = 'hdsjkhsdkhfhfdhgfjffghfghfghfh';
...

[Feature request] service name in "feathers-plus generate service" command

Steps to reproduce

Would be nice to have a quicker way to re-generate:

$ feathers-plus generate service users -y

Expected behavior

Regenerates service "users" (or whatever the given name is) without prompts & keeping defaults.
If service does not exist yet, should generate the service with all defaults.

Actual behavior

What happens instead:

$ feathers-plus generate service users -y
error: unknown option `-y'

Without '-y':

$ feathers-plus generate service users
  What is the name of the service?

TypeError: Path must be a string. Received undefined

Hey! When I try to generate a new service i get this error:

 _____                  _     _
 |  ___|   ___    __ _  | |_  | |__     ___   _ __   ___     _
 | |_     / _ \  / _` | | __| | '_ \   / _ \ | '__| / __|  _| |_
 |  _|   |  __/ | (_| | | |_  | | | | |  __/ | |    \__ \ |_   _|
 |_|      \___|  \__,_|  \__| |_| |_|  \___| |_|    |___/   |_|

Using generator version 0.4.1
Source scan took 0s 15ms
? What is the name of the service? calls

We are adding the new service calls in dir api-plus

Once this generation is complete, define the JSON-schema for the data in module
"services/calls/calls.schema.js". Then (re)generate this service.

This second generation will take the schema you added and generate
- A Mongoose model, and
- A Sequelize model, and
- Create, update and patch validation hooks.

Run "feathers-plus generate graphql" if you want any changes reflected in GraphQL.

? What is the name of the service? calls
? What would you call one row in the calls database? call
? What kind of service is it? Sequelize
? Place service code in which nested folder, e.g. `v1/blog`? (optional)
? Which path should the service be registered on? /calls
? Should this be served by GraphQL? Yes
events.js:183
      throw er; // Unhandled 'error' event
      ^

TypeError: Path must be a string. Received undefined
    at assertPath (path.js:28:11)
    at join (path.js:499:7)
    at serviceSpecsCombine (C:\Users\Workstation\AppData\Roaming\npm\node_modules\@feathers-plus\cli\node_modules\@feathers-plus\generator-feathers-plus\lib\service-specs-combine.js:11:26)
    at serviceSpecsExpand (C:\Users\Workstation\AppData\Roaming\npm\node_modules\@feathers-plus\cli\node_modules\@feathers-plus\generator-feathers-plus\lib\service-specs-expand.js:27:27)
    at generatorWriting (C:\Users\Workstation\AppData\Roaming\npm\node_modules\@feathers-plus\cli\node_modules\@feathers-plus\generator-feathers-plus\generators\writing\index.js:164:38)
    at ServiceGenerator.writing (C:\Users\Workstation\AppData\Roaming\npm\node_modules\@feathers-plus\cli\node_modules\@feathers-plus\generator-feathers-plus\generators\service\index.js:234:5)
    at Object.<anonymous> (C:\Users\Workstation\AppData\Roaming\npm\node_modules\@feathers-plus\cli\node_modules\yeoman-generator\lib\index.js:424:27)
    at C:\Users\Workstation\AppData\Roaming\npm\node_modules\@feathers-plus\cli\node_modules\run-async\index.js:25:25
    at new Promise (<anonymous>)
    at C:\Users\Workstation\AppData\Roaming\npm\node_modules\@feathers-plus\cli\node_modules\run-async\index.js:24:19
    at self.env.runLoop.add.completed (C:\Users\Workstation\AppData\Roaming\npm\node_modules\@feathers-plus\cli\node_modules\yeoman-generator\lib\index.js:425:13)
    at runCallback (timers.js:789:20)
    at tryOnImmediate (timers.js:751:5)
    at processImmediate [as _immediateCallback] (timers.js:722:5)

GraphQL service always resides in /graphql folder

Perhaps make the folder name user definable. Perhaps turtle that to the module names.

The user can select the service path for the GraphQL service.

I don't consider this a priority item. I don't know why it would really be important.

This issue exists to inform users that the situation is known.

generate

Steps to reproduce

(First please check that this issue is not already solved as described
here
)

  • Tell us what broke. The more detailed the better.
  • If you can, please create a simple example that reproduces the issue and link to a gist, jsbin, repo, etc.

Expected behavior

Tell us what should happen

Actual behavior

Tell us what happens instead

System configuration

Tell us about the applicable parts of your setup.

Module versions (especially the part that's not working):

NodeJS version:

Operating System:

Browser Version:

React Native Version:

Module Loader:

regenerating service removes all hooks on service

Steps to reproduce

Generate a service
add a hook to servicename.hooks.js
run feathers generate service

Expected behavior

feathers generate service should leave servicename.hooks.js alone if it already exists. It doesn't add anything or update it, does it?

Actual behavior

hooks are erased from servicename.hooks.js.
This is pretty annoying. If I forget about this behaviour then I don't get an alarm going off, but my app silently behaves in a way different from how I set it up.

System configuration

Ubuntu 18.10
Node 10.13.0

@feathers-plus/cli 0.7.76

Local commands

Might be one for the feathers-plus generator, rather than here, but is there any plan to have the generate cli commands available as a local devDependencies, so any collaborators aren't required to install globally?

Thanks!

Generated TypeScript with custom sources folder fails to "npm start"

Steps to reproduce

npm install -g @feathers-plus/cli
mkdir feathers-app
cd feathers-app
feathers-plus generate options
# choose all defaults, except "Generate TypeScript code?" Yes

feathers-plus generate app
# choose all defaults, except enter different folder for source files, e.g. 'server'

Then run

npm start

Expected behavior

Server should compile and run.

Actual behavior

Server fails to start:

C:\dev\ionic3-feathersplus-try2\api>npm start

> [email protected] start C:\dev\ionic3-feathersplus-try2\api
> ts-node --files src/

Error: Cannot find module 'C:\dev\ionic3-feathersplus-try2\api\src'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Function.Module.runMain (module.js:693:10)
    at Object.<anonymous> (C:\dev\ionic3-feathersplus-try2\api\node_modules\ts-node\src\bin.ts:147:12)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `ts-node --files src/`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\~~~\AppData\Roaming\npm-cache\_logs\2018-07-18T16_39_21_711Z-debug.log

Feature Request: Add code insertion point

I would like to extend a mongoose service like metioned here: https://docs.feathersjs.com/api/databases/common.html#classes-es6

However there is a code insertion point missing for the line: app.use('/sequence', createService(options));

class SequenceService extends MongooseService {
  // ommited for brevity
}

let moduleExports = function(app) {
  let Model = createModel(app);
  let paginate = app.get('paginate');
  // !code: func_init // !end

  let options = {
    Model,
    paginate
    // !code: options_more // !end
  };
  // !code: options_change // !end

  // Initialize our service with any options it requires
  // Could you please add a code insertion point for the follwong line?
  app.use('/sequence', new SequenceService(options));


  // Get our initialized service so that we can register hooks
  const service = app.service('sequence');

  service.hooks(hooks);
  // !code: func_return // !end
};

Problems generating app or options

I am using a fresh install of the cli, using the documentation, I tried the commands:

feathers-plus generate options
feathers-plus generate app

Both failed out with the error below. Can someone confirm this?

Error: Cannot find module 'json-schema-seeder'

Generated TypeScript authentication for Google/Facebook does not run / fails compiling

Steps to reproduce

npm install -g @feathers-plus/cli
mkdir feathers-app
cd feathers-app
feathers-plus generate options
# choose all defaults, except "Generate TypeScript code?" Yes

feathers-plus generate app
# choose all defaults

feathers-plus generate authentication
# choose all defaults, except select Google, Facebook

Edit src/services/users/users.schema.?s file, add fields to required: and properties:

  ...
  // Required fields.
  required: [
    // !code: schema_required
    'email',
    'firstName',
    'lastName',
    'roleId'
    // !end
  ],
  ...

  // Fields in the model.
  properties: {
    // !code: schema_properties
    id: { type: 'ID' },
    email: {},
    firstName: {},
    lastName: {},
    password: {},
    roleId: { type: 'ID' }
    // !end
  },

Run re-generator:

feathers-plus generate service
# Enter "users" for prompt "What is the name of the service?", choose defaults for the rest.

feathers-plus generate all ;# current workaround for TypeScript only, regenerates src/typings.d.ts
npm start

Expected behavior

Should have running server.

Actual behavior

Fails compiling:

C:\dev\ionic3-feathersplus-try2\api.ts>npm start

> [email protected] start C:\dev\ionic3-feathersplus-try2\api.ts
> ts-node --files src/


C:\dev\ionic3-feathersplus-try2\api.ts\node_modules\ts-node\src\index.ts:261
    return new TSError(diagnosticText, diagnosticCodes)
           ^
TSError: Γ¿» Unable to compile TypeScript:
src/authentication.ts(6,20): error TS7016: Could not find a declaration file for module '@feathersjs/authentication-oauth2'. 'C:/dev/ionic3-feathersplus-try2/api.ts/node_modules/@feathersjs/authentication-oauth2/li
b/index.js' implicitly has an 'any' type.
  Try `npm install @types/feathersjs__authentication-oauth2` if it exists or add a new declaration (.d.ts) file containing `declare module 'feathersjs__authentication-oauth2';`

    at createTSError (C:\dev\ionic3-feathersplus-try2\api.ts\node_modules\ts-node\src\index.ts:261:12)
    at getOutput (C:\dev\ionic3-feathersplus-try2\api.ts\node_modules\ts-node\src\index.ts:367:40)
    at Object.compile (C:\dev\ionic3-feathersplus-try2\api.ts\node_modules\ts-node\src\index.ts:557:11)
    at Module.m._compile (C:\dev\ionic3-feathersplus-try2\api.ts\node_modules\ts-node\src\index.ts:439:43)
    at Module._extensions..js (module.js:663:10)
    at Object.require.extensions.(anonymous function) [as .ts] (C:\dev\ionic3-feathersplus-try2\api.ts\node_modules\ts-node\src\index.ts:442:12)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `ts-node --files src/`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\iivanchenko\AppData\Roaming\npm-cache\_logs\2018-07-17T22_53_29_559Z-debug.log

Workaround

npm install --save-dev @types/feathersjs__authentication-oauth2
npm start
# runs ok

Service fields in mongo/mongoose/sequelize are all string/TEXT, even for numbers

Steps to reproduce

  • Create a new service
  • Add some properties in .schema.ts
  • Re-generate service, which will cause .[mongo|sequelize|mongoose].ts to be updated with the fields

Expected behavior

I would expect the generated mongo/sequelize/mongoose files contain properties/fields of the same (or equivalent) type as specified in .schema.ts

Actual behavior

All properties are created as string for mongo/mongoose, and TEXT for sequelize.
*.schema.ts

  properties: {
    // !code: schema_properties
    rank: Number,
    initials: String,
    count: Number
    // !end
  },

*.mongo.ts

let moduleExports = merge({},
  // !<DEFAULT> code: model
  {
    bsonType: "object",
    additionalProperties: false,
    properties: {
      _id: {
        bsonType: "objectId"
      },
      rank: {
        bsonType: "string"
      },
      initials: {
        bsonType: "string"
      },
      count: {
        bsonType: "string"
      }
    }
  },
  // !end
  // !code: moduleExports // !end
);

*.mongoose.ts

let moduleExports = merge({},
  // !<DEFAULT> code: model
  {
    rank: String,
    initials: String,
    count: String
  },
  // !end
  // !code: moduleExports // !end
);

*.sequelize.ts

let moduleExports = merge({},
  // !<DEFAULT> code: sequelize_model
  {
    rank: {
      type: DataTypes.TEXT
    },
    initials: {
      type: DataTypes.TEXT
    },
    count: {
      type: DataTypes.TEXT
    }
  } as DefineAttributes,
  // !end
  // !code: moduleExports // !end
);

System configuration

Tell us about the applicable parts of your setup.

Module versions (especially the part that's not working):

    "@feathers-plus/test-utils": "^0.3.6",
    "@feathersjs/authentication": "^2.1.16",
    "@feathersjs/authentication-jwt": "^2.0.10",
    "@feathersjs/authentication-local": "^1.2.9",
    "@feathersjs/configuration": "^2.0.6",
    "@feathersjs/errors": "^3.3.6",
    "@feathersjs/express": "^1.3.1",
    "@feathersjs/feathers": "^3.3.1",
    "@feathersjs/socketio": "^3.2.9",
   (...)
    "mongodb-core": "^3.2.3",
    "mongoose": "^5.5.1",

NodeJS version:

λ node -v
v11.12.0

Operating System:
Windows 10
Browser Version:
Not relevant
React Native Version:
Not relevant
Module Loader:
Don't know / Not relevant

Templates .editorconfig and .eslintrc.json

Perhaps templates .editorconfig and .eslintrc.json should start with _ (like _gitignore) and be renamed ny the generator.

Otherwise we are dependent on .npmignore have /.editorconfog

is this cli deprecated?

i am wondering if this cli and the whole feathers+ thing is outdated, since its installs an old feathers version and has not received updates for a long time.
are there any issues when upgrading the installed packages?

i'm just starting with feathers and like to choose the right tools :)

Cannot start application

Steps to reproduce

(First please check that this issue is not already solved as described
here
)

  • Tell us what broke. The more detailed the better.
  • If you can, please create a simple example that reproduces the issue and link to a gist, jsbin, repo, etc.

Expected behavior

App compiles and runs successfully.

Actual behavior

Immediately after generating the options and the app, I run npm start and am greeted with this error:

> ts-node --files src/


/Users/jackson/WebstormProjects/auth0/auth0-demo-server/node_modules/ts-node/src/index.ts:261
    return new TSError(diagnosticText, diagnosticCodes)
           ^
TSError: ⨯ Unable to compile TypeScript:
src/channels.ts(4,18): error TS2339: Property 'channel' does not exist on type 'Application<{}>'.
src/channels.ts(11,9): error TS2339: Property 'channel' does not exist on type 'Application<{}>'.
src/channels.ts(22,11): error TS2339: Property 'channel' does not exist on type 'Application<{}>'.
src/channels.ts(25,11): error TS2339: Property 'channel' does not exist on type 'Application<{}>'.
src/channels.ts(42,7): error TS2339: Property 'publish' does not exist on type 'Application<{}>'.
src/channels.ts(42,16): error TS7006: Parameter 'data' implicitly has an 'any' type.
src/channels.ts(42,22): error TS7006: Parameter 'hook' implicitly has an 'any' type.
src/channels.ts(50,16): error TS2339: Property 'channel' does not exist on type 'Application<{}>'.

    at createTSError (/Users/jackson/WebstormProjects/auth0/auth0-demo-server/node_modules/ts-node/src/index.ts:261:12)
    at getOutput (/Users/jackson/WebstormProjects/auth0/auth0-demo-server/node_modules/ts-node/src/index.ts:367:40)
    at Object.compile (/Users/jackson/WebstormProjects/auth0/auth0-demo-server/node_modules/ts-node/src/index.ts:558:11)
    at Module.m._compile (/Users/jackson/WebstormProjects/auth0/auth0-demo-server/node_modules/ts-node/src/index.ts:439:43)
    at Module._extensions..js (internal/modules/cjs/loader.js:713:10)
    at Object.require.extensions.(anonymous function) [as .ts] (/Users/jackson/WebstormProjects/auth0/auth0-demo-server/node_modules/ts-node/src/index.ts:442:12)
    at Module.load (internal/modules/cjs/loader.js:612:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
    at Function.Module._load (internal/modules/cjs/loader.js:543:3)
    at Module.require (internal/modules/cjs/loader.js:650:17)

System configuration

Node v10.4.0
Feathers-Plus v0.7.64
TypeScript v2.7.2

Running on Mac OS Mojave v10.14

Use https on new Feathers (Buzzard) with typescript

Hello:
I'm trying to update my feathers server from Auk to the new Buzzard. I'm using the new feathers-plus cli because i'm interested in using typescript on server, and GraphicQL.

My old Auk server is working correctly with https configuration, loading the certs and initializing the app :

`const fs = require('fs');
const https = require('https');

const privateKey = fs.readFileSync('/etc/ssl/private/sigalo.key');
const certificate = fs.readFileSync('/etc/ssl/certs/sigalo.cert');
const ca = fs.readFileSync('/etc/ssl/certs/www_sigalo_es.ca-bundle');

const credentials = {key: privateKey, cert: certificate, ca: ca};

const server = https.createServer(credentials, app).listen(8282);

app.setup(server);
`

But now, with the new generated app.ts generated by cli+ I don't know how to make it to work and where is the correct block where tu put the imports, initialization, etc to avoid lose it in regeneration.

Can you help me?
Thanks

getDescription is not a function after generating graphql service

Steps to reproduce

Generate graphql service using feathers-plus generate graphql

Start project

(First please check that this issue is not already solved as described
here
)

  • Tell us what broke. The more detailed the better.
  • If you can, please create a simple example that reproduces the issue and link to a gist, jsbin, repo, etc.

===== configuring graphql service for services.

/Users/rod/Documents/Feathers/bncrmserver/node_modules/graphql-toolkit/dist/commonjs/epoxy/typedefs-mergers/comments.js:36
const comment = graphql_1.getDescription(node, { commentDescriptions: true });
^

TypeError: graphql_1.getDescription is not a function

Expected behavior

Tell us what should happen

Feathers project should start

Actual behavior

Tell us what happens instead

Receive getDescription is not a function error

System configuration

Tell us about the applicable parts of your setup.

Module versions (especially the part that's not working):

feathers-plus graphql 1.10.0

NodeJS version:
v8.16.0

Operating System:

MacOs

Browser Version:

React Native Version:

Module Loader:

Generated Mocha tests (JS) sporadically fail

Steps to reproduce

Performed the following steps from https://generator.feathers-plus.com/get-started/

npm i -g @feathers-plus/cli
mkdir feathers-app
cd feathers-app
feathers-plus generate options
# chosen all defaults

feathers-plus generate app
# chosen all defaults

# optional:
feathers-plus generate authentication
# chosen all defaults, except added Google/Facebook

npm start
# runs ok

Trying test:

npm test
# Sometimes fails with timeout, other times no failure

Expected behavior

Tests should always pass

Actual behavior

One of the tests might fail with timeout.


> [email protected] test C:\dev\ionic3-feathersplus-try2\api.js
> npm run eslint && npm run mocha


> [email protected] eslint C:\dev\ionic3-feathersplus-try2\api.js
> eslint src/. test/. --config .eslintrc.json


> [email protected] mocha C:\dev\ionic3-feathersplus-try2\api.js
> mocha test/ --recursive --exit --timeout 10000

  Feathers application tests
    √ starts and shows the index page (95ms)
    404
error: Page not found {"type":"FeathersError","name":"NotFound","code":404,"className":"not-found","data":{"url":"/path/to/nowhere"},"errors":{}}
      √ shows a 404 HTML page
error: Page not found {"type":"FeathersError","name":"NotFound","code":404,"className":"not-found","data":{"url":"/path/to/nowhere"},"errors":{}}
      √ shows a 404 JSON error without stack trace
    1) "after all" hook

  'users' service
    √ registered the service


  4 passing (10s)
  1 failing

  1) Feathers application tests
       "after all" hook:
     Error: Timeout of 10000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (C:\dev\ionic3-feathersplus-try2\api.js\test\app.test.js)
  



npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] mocha: `mocha test/ --recursive --exit --timeout 10000`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] mocha script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\iivanchenko\AppData\Roaming\npm-cache\_logs\2018-07-17T23_18_29_942Z-debug.log
npm ERR! Test failed.  See above for more details.

System configuration

Using Windows7, node v8.11.2,

Mongoose.connect miss catch error statment

Steps to reproduce

I ship my app first time to production server and accidentally setup bad mongodb config URL. In logs it don't show nothing only message Unhandled Rejection at: Promise ... It was hard to find the problem in bad password setup in mongodb URL. After this i found mongoose.connect don't have catch statement.

Expected behavior

mongose.connect should throw error after connection fail

In generated file from cli src/mongoose.js should be:

mongoose
    .connect(app.get('mongodb'), {})
    .catch(err => {
      console.error('Mongoose connection error: ', err)
    })

Module versions (especially the part that's not working):

feathers-plus cli version 0.4.23

generate hook misssing

If I've understood correctly feathers-plus is supposed to offer the same features as feathers cli (plus additional ones), isn't it?

I tried to generate a hook via

feathers-plus generate hook

but this command doesn't seem to be supported

Has it been forgotten?

Regenerating service doesn't work (deletes my schema additions)

Steps to reproduce

(First please check that this issue is not already solved as described
here
)

  • [ x] Tell us what broke. The more detailed the better.

I'm following the Get Started-tutorial. When updating the users model by updating the users.schema.js file and running feathers-plus generate service "nothing" happens, my changes are removed.

I'm using js and the following options:

  "options": {
    "ver": "1.0.0",
    "inspectConflicts": true,
    "semicolons": true,
    "freeze": [],
    "ts": false
  },
  • [ x] If you can, please create a simple example that reproduces the issue and link to a gist, jsbin, repo, etc.

Exact code as in the Feathers Models adding the Feathers Model.

Expected behavior

The users.schema.js file should keep the schema changes I added when regenerating the service and fill in the other modules. Command used:

feathers-plus generate service

Actual behavior

The users.schema.js file is reset to default empty state, nothing is generated.

System configuration

Tell us about the applicable parts of your setup.

Module versions (especially the part that's not working):

 "dependencies": {
    "@feathersjs/authentication": "^2.1.7",
    "@feathersjs/authentication-jwt": "^2.0.1",
    "@feathersjs/authentication-local": "^1.2.1",
    "@feathersjs/configuration": "^1.0.2",
    "@feathersjs/errors": "^3.3.0",
    "@feathersjs/express": "^1.2.3",
    "@feathersjs/feathers": "^3.1.7",
    "@feathersjs/primus": "^3.2.1",
    "@feathersjs/socketio": "^3.2.2",
    "ajv": "^6.5.2",
    "compression": "^1.7.2",
    "cors": "^2.8.4",
    "feathers-hooks-common": "^4.11.0",
    "feathers-sequelize": "^3.1.2",
    "helmet": "^3.12.1",
    "lodash.merge": "^4.6.1",
    "mysql2": "^1.5.3",
    "sequelize": "^4.38.0",
    "serve-favicon": "^2.5.0",
    "winston": "^3.0.0",
    "ws": "^5.2.2"
  },

feathers-plus v0.4.11
Using generator version 0.2.16

NodeJS version:
node v8.10.0

Operating System:
Windows 10 Enterprise 1709 build 16299.431

(filed wrongly at this issue)

app#src with multiple path directory fail to start

Steps to reproduce

(First please check that this issue is not already solved as described
here
)

  • Tell us what broke. The more detailed the better.

If you define during creation an app source folder in a subdirectory, on launch the path app.js doesn't reflect the right path:
for "src": "app/modules/server"
we have
const generatorSpecs = require('../feathers-gen-specs.json');
instead of:

const generatorSpecs = require('../../../feathers-gen-specs.json');

  • [x ] If you can, please create a simple example that reproduces the issue and link to a gist, jsbin, repo, etc.

"app": {
"environmentsAllowingSeedData": "",
"seedData": false,
"name": "xxxx",
"description": "Project xxxx",
"src": "app/modules/server",
"packager": "yarn@>= 0.18.0",
"providers": [
"rest",
"socketio"
]
}

Expected behavior

Tell us what should happen
see above

Actual behavior

Tell us what happens instead
see above

System configuration

Tell us about the applicable parts of your setup.

Module versions (especially the part that's not working):
feathersjs-plus generate app / feathersjs-plus generate all

NodeJS version:
v10.15.1
Operating System:
Windows LWS / Debian

Browser Version:
none
React Native Version:
none
Module Loader:
yarn

Feathers Seed MongoDB Race Condition

Steps to reproduce

  1. Generate a basic feathers app with MongoDB
  2. Seed data

Expected behavior

The data is seeded
Tell us what should happen

Actual behavior

Data fails to seed. The MongoDB connection is not guaranteed to be active when the call to seed-data occurs causing feathers-mongodb to fail to perform any service calls.

This is fixed by using setTimeout() with a reasonable (~2-3 second) timeout.

System configuration

Module versions (especially the part that's not working):

{
  "engines": {
    "node": "^10.0.0",
    "yarn": ">= 0.18.0"
  },
  "scripts": {
    "test": "yarn run eslint && yarn run mocha",
    "test:all": "yarn run eslint && NODE_ENV=test npm run mocha",
    "eslint": "eslint src/. test/. --config .eslintrc.json",
    "dev": "nodemon src/",
    "start": "node src/",
    "start:seed": "NODE_ENV=test node src/ --seed",
    "mocha": "mocha test/ --recursive --exit --timeout 10000"
  },
  "dependencies": {
    "@feathers-plus/test-utils": "^0.3.5",
    "@feathersjs/authentication": "^2.1.7",
    "@feathersjs/authentication-jwt": "^2.0.1",
    "@feathersjs/authentication-local": "^1.2.1",
    "@feathersjs/configuration": "^2.0.0",
    "@feathersjs/errors": "^3.3.0",
    "@feathersjs/express": "^1.2.3",
    "@feathersjs/feathers": "^3.1.7",
    "@feathersjs/socketio": "^3.2.2",
    "ajv": "5.5.2",
    "compression": "^1.7.3",
    "cors": "^2.8.4",
    "cross-env": "^5.2.0",
    "feathers-hooks-common": "^4.16.3",
    "feathers-mongodb": "^3.3.0",
    "feathers-sequelize": "^3.1.2",
    "helmet": "^3.13.0",
    "lodash.merge": "^4.6.1",
    "mongodb": "^3.1.1",
    "mongodb-core": "^3.1.11",
    "pg": "^7.8.0",
    "sequelize": "^4.38.0",
    "sequelize-cli": "^5.4.0",
    "serve-favicon": "^2.5.0",
    "winston": "^3.0.0"
  },
  "devDependencies": {
    "eslint": "^5.3.0",
    "mocha": "^5.2.0",
    "nodemon": "^1.18.3",
    "request": "^2.88.0",
    "request-promise": "^4.2.2"
  }
}

MongoDB Version: 4.0.6

NodeJS version:
10

Operating System
Ubuntu

Generated TypeScript with custom sources folder fails to "npm start" (again)

Steps to reproduce

npm install -g @feathers-plus/cli
mkdir feathers-app
cd feathers-app
feathers-plus generate options
# choose all defaults, except "Generate TypeScript code?" Yes

feathers-plus generate app
# choose all defaults, except enter different folder for source files, e.g. 'server'

Grep for 'src'

Expected behavior

Should only find couple of legit 'src' keywords.

Actual behavior

Found 'src' where 'server' is expected:

package.json:

    "start:seed": "cross-env NODE_ENV= ts-node --files src/ --seed",

tsconfig.json:

    "rootDir": "./src",                    /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */

Module versions (especially the part that's not working):
@feathers-plus/[email protected]

Seeder support (feature request)

Idea

It will be cool to have build in template generator for service data seeder build in. :)
https://github.com/thosakwe/feathers-seeder

Steps to reproduce

New services generated seed feature.

Expected behavior

First install dependencies:

npm i feathers-seeder

It should configure app with seed config in app.js:

const seeder = require('./seeder')
 app.configure(seeder)

It should have (in root probably) seeder.js script:

const seeder = require('feathers-seeder')
const usersSeed = require('./services/users/users.seed')

function seederOptions(app) {
  let options = {
    // delete globally all before seed
    // delete: false,

    // disable globally
    disable: false,

    // here add services to seed
    services: [usersSeed(app)]
  }

  return seeder(options)
}

module.exports = seederOptions

It should generate script service/users.seed.js (example only):

module.exports = function userSeed(app) {
  return {
    count: 1,
    delete: true,
    path: 'users',
    template: {
      name: '{{name.firstName}}',
      surname: '{{name.lastName}}',
      email: '{{internet.email}}',
      language: 'en',
      roles: ['basic'],
      loginFrom: 'web',
      loggedInAt: new Date(),
      isTest: true
    }
  }
}

Actual behavior

(No seeder support.)
But we have already great tools in our hands.
Sure my examples are quick and dirty. It should be optimised.

Thank You :)

Cannot get simple GraphQL call to complete after following tutorial

Steps to reproduce

I hope this is the place to ask this question, but I followed the instructions in your tutorial for feathers-plus to the letter. I am using a MongoDB instance, configured authentication (that works), with ONLY Users and Roles services in the simplest possible configuration.

I ran all the appropriate generation scripts at the appropriate times.

Expected behavior

What I expected was to be able to run this simple query from within GraphIQL:

{
getRole(key:"5c4f198068b713cd0c08b2b9") {
name
}
}

and receive the appropriate response (after inserting roles into my MongoDB database).

Actual behavior

Instead, I get the following error:

info: Feathers application started on http://localhost:3030
error: BadRequest: Schema must be an instance of GraphQLSchema. Also ensure that there are not multiple versions of GraphQL installed in your node_modules directory.
at new BadRequest (/Users/gqadonis/Projects/TribeHealth/sprint1/air-server/node_modules/@feathers-plus/graphql/node_modules/@feathersjs/errors/lib/index.js:81:17)
at graphql.catch.err (/Users/gqadonis/Projects/TribeHealth/sprint1/air-server/node_modules/@feathers-plus/graphql/lib/index.js:79:17)
at process._tickCallback (internal/process/next_tick.js:68:7)
error: BadRequest: Schema must be an instance of GraphQLSchema. Also ensure that there are not multiple versions of GraphQL installed in your node_modules directory.
at new BadRequest (/Users/gqadonis/Projects/TribeHealth/sprint1/air-server/node_modules/@feathers-plus/graphql/node_modules/@feathersjs/errors/lib/index.js:81:17)
at graphql.catch.err (/Users/gqadonis/Projects/TribeHealth/sprint1/air-server/node_modules/@feathers-plus/graphql/lib/index.js:79:17)
at process._tickCallback (internal/process/next_tick.js:68:7)
error: BadRequest: Schema must be an instance of GraphQLSchema. Also ensure that there are not multiple versions of GraphQL installed in your node_modules directory.
at new BadRequest (/Users/gqadonis/Projects/TribeHealth/sprint1/air-server/node_modules/@feathers-plus/graphql/node_modules/@feathersjs/errors/lib/index.js:81:17)
at graphql.catch.err (/Users/gqadonis/Projects/TribeHealth/sprint1/air-server/node_modules/@feathers-plus/graphql/lib/index.js:79:17)
at process._tickCallback (internal/process/next_tick.js:68:7)

System configuration

I am on a MacBook Pro using Node.js version 10.15.

Module versions (especially the part that's not working):

NodeJS version:

Operating System:

Browser Version:

React Native Version:

Module Loader:

Sequelize.ts error

Hello,

I've try to follow step-by-step the "Get started" documentation (here). I have many issues, maybe it's because of the DB difference (between MongoDB/Mongoose in the tutorial and MySQL8/Sequelize in my case).
This is one of the multiple TS issues i have, because I've alrealdy tried some times :

  • src/sequelize.ts here who needs an as any
  • src/index.ts who needs an as any
  • SQL syntax with JSONB in final

I want to understand in order to have a stable build...that can works... so one issue at a time.

Steps to reproduce

  • First, start the MySQL/PHPMYADMIN container with docker-compose. This is my docker-compose.yml :
version: '2'

services:
  db:
    image: mysql:8.0.3
    container_name: dev_mysql_8
    environment:
      - MYSQL_ROOT_PASSWORD=root
    volumes:
      - ~/docker-persistent/mysql-data:/var/lib/mysql
    ports:
      - "3306:3306"

  phpmyadmin:
    image: phpmyadmin/phpmyadmin:4.8.5
    container_name: dev_phpmybitch
    ports:
      - "49161:80"
    links:
        - "db:db"
  • Then, follow the tutorial to the ("Generate service" section). So, i have the users, roles & teams services look like the tutorial ones, except for the Sequelize part.

  • Now i want to start my app to test if it works... so feathers-plus g all and npm start

Expected behavior

Just want to start the Feathers app for the moment...

Actual behavior

Throw an error after npm start command :

benoit@PC-SD-01:~/projects/test_fia$ npm start

> [email protected] start /home/benoit/projects/test_fia
> ts-node --files src/


/home/benoit/projects/test_fia/node_modules/ts-node/src/index.ts:261
    return new TSError(diagnosticText, diagnosticCodes)
           ^
TSError: ⨯ Unable to compile TypeScript:
src/sequelize.ts(63,39): error TS2345: Argument of type 'any[]' is not assignable to parameter of type '[any?]'.
  Types of property 'length' are incompatible.
    Type 'number' is not assignable to type '0 | 1'.

    at createTSError (/home/benoit/projects/test_fia/node_modules/ts-node/src/index.ts:261:12)
    at getOutput (/home/benoit/projects/test_fia/node_modules/ts-node/src/index.ts:367:40)
    at Object.compile (/home/benoit/projects/test_fia/node_modules/ts-node/src/index.ts:558:11)
    at Module.m._compile (/home/benoit/projects/test_fia/node_modules/ts-node/src/index.ts:439:43)
    at Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Object.require.extensions.(anonymous function) [as .ts] (/home/benoit/projects/test_fia/node_modules/ts-node/src/index.ts:442:12)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/home/benoit/projects/test_fia/src/app.ts:24:1)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Module.m._compile (/home/benoit/projects/test_fia/node_modules/ts-node/src/index.ts:439:23)
    at Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Object.require.extensions.(anonymous function) [as .ts] (/home/benoit/projects/test_fia/node_modules/ts-node/src/index.ts:442:12)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/home/benoit/projects/test_fia/src/index.ts:6:1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `ts-node --files src/`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/benoit/.npm/_logs/2019-01-30T09_09_21_689Z-debug.log

System configuration

Module versions :

"dependencies": {
    "@feathers-plus/test-utils": "^0.3.5",
    "@feathersjs/authentication": "^2.1.15",
    "@feathersjs/authentication-jwt": "^2.0.9",
    "@feathersjs/authentication-local": "^1.2.9",
    "@feathersjs/configuration": "^2.0.6",
    "@feathersjs/errors": "^3.3.6",
    "@feathersjs/express": "^1.3.1",
    "@feathersjs/feathers": "^3.3.1",
    "@feathersjs/socketio": "^3.2.9",
    "ajv": "^5.5.2",
    "compression": "^1.7.3",
    "cors": "^2.8.5",
    "cross-env": "^5.2.0",
    "feathers-hooks-common": "^4.20.2",
    "feathers-sequelize": "^3.1.3",
    "helmet": "^3.15.0",
    "lodash.merge": "^4.6.1",
    "mysql2": "^1.6.4",
    "sequelize": "^4.42.0",
    "serve-favicon": "^2.5.0",
    "winston": "^3.1.0"
  },
  "devDependencies": {
    "@types/compression": "0.0.36",
    "@types/cors": "^2.8.4",
    "@types/feathersjs__authentication": "^2.1.2",
    "@types/feathersjs__authentication-jwt": "^1.0.5",
    "@types/feathersjs__authentication-local": "^1.0.3",
    "@types/feathersjs__configuration": "^1.0.1",
    "@types/feathersjs__errors": "^3.2.1",
    "@types/feathersjs__express": "^1.1.4",
    "@types/feathersjs__feathers": "^3.1.1",
    "@types/feathersjs__socketio": "^3.0.3",
    "@types/helmet": "0.0.40",
    "@types/lodash.merge": "^4.6.4",
    "@types/mocha": "^5.2.5",
    "@types/request-promise": "^4.1.42",
    "@types/sequelize": "^4.27.34",
    "@types/serve-favicon": "^2.2.30",
    "@types/winston": "^2.4.4",
    "mocha": "^5.2.0",
    "nodemon": "^1.18.9",
    "request": "^2.88.0",
    "request-promise": "^4.2.2",
    "ts-mocha": "^2.0.0",
    "ts-node": "^7.0.1",
    "tslint": "^5.12.1",
    "typescript": "^3.2.4"
  }

Node version: 10.15.0

NPM Version: 6.4.1

Feathers-Plus Version: 0.7.75

MySQL Version: 8.0.3 (as you can see in docker-compose.yml)

Operating System: Ubuntu 18.04.1 LTS

GIST Public link

(https://gist.github.com/GhuronZhan/562f7c006c38812008d0e770de43fec9)

Generated TypeScript test file(s) do not run

Generated TypeScript test file(s) do not run

Using Windows7, node v8.11.2, Performed the following steps from https://generator.feathers-plus.com/get-started/

npm i -g @feathers-plus/cli
mkdir feathers-app
cd feathers-app
feathers-plus generate options
# chosen all defaults, except "Generate TypeScript code?" Yes

feathers-plus generate app
# chosen all defaults

npm start
# runs ok

Trying test:

npm test
# Executes 0 tests

Generated TypeScript version fails to compile due to missing typings files

Using Windows7, node v8.11.2, Performed the following steps from https://generator.feathers-plus.com/get-started/

npm i -g @feathers-plus/cli
mkdir feathers-app
cd feathers-app
feathers-plus generate options
# chosen all defaults, except "Generate TypeScript code?" Yes

feathers-plus generate app
# chosen all defaults

npm start > log.start 2>&1
# -> fails

log.start:

> [email protected] start C:\dev\ionic3-feathersplus-try2\api
> ts-node src/


C:\dev\ionic3-feathersplus-try2\api\node_modules\ts-node\src\index.ts:261
    return new TSError(diagnosticText, diagnosticCodes)
           ^
TSError: ⨯ Unable to compile TypeScript:
src/app.hooks.ts(4,30): error TS7016: Could not find a declaration file for module 'feathers-hooks-common'. 'C:/dev/ionic3-feathersplus-try2/api/node_modules/feathers-hooks-common/lib/index.js' implicitly has an 'any' type.
  Try `npm install @types/feathers-hooks-common` if it exists or add a new declaration (.d.ts) file containing `declare module 'feathers-hooks-common';`

    at createTSError (C:\dev\ionic3-feathersplus-try2\api\node_modules\ts-node\src\index.ts:261:12)
    at getOutput (C:\dev\ionic3-feathersplus-try2\api\node_modules\ts-node\src\index.ts:367:40)
    at Object.compile (C:\dev\ionic3-feathersplus-try2\api\node_modules\ts-node\src\index.ts:557:11)
    at Module.m._compile (C:\dev\ionic3-feathersplus-try2\api\node_modules\ts-node\src\index.ts:439:43)
    at Module._extensions..js (module.js:663:10)
    at Object.require.extensions.(anonymous function) [as .ts] (C:\dev\ionic3-feathersplus-try2\api\node_modules\ts-node\src\index.ts:442:12)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `ts-node src/`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\...\AppData\Roaming\npm-cache\_logs\2018-07-17T04_59_10_172Z-debug.log

SQL Syntax error with Sequelize, TS and MySQL 8 ?

Hello,

If I do a temporary patch with as any on sequelize.ts -> #26 , the node server is "near launched" BUT there is a issue with SQL.
Is this linked to Typescript version ? feathers-sequelize or mysql 2 and MySQL 8 ? I've tried to find answers in vain...

Steps to reproduce

  • First, start the MySQL/PHPMYADMIN container with docker-compose. This is my docker-compose.yml :
version: '2'

services:
  db:
    image: mysql:8.0.3
    container_name: dev_mysql_8
    environment:
      - MYSQL_ROOT_PASSWORD=root
    volumes:If I do a temporary patch with `as any` on sequelize.ts -> https://github.com/feathers-plus/cli/issues/26

### Steps to reproduce



### Expected behavior
Tell us what should happen

### Actual behavior
Tell us what happens instead

### System configuration

Tell us about the applicable parts of your setup.

**Module versions** (especially the part that's not working):

**NodeJS version**:

**Operating System**:

**Browser Version**:

**React Native Version**:

**Module Loader**:
      - ~/docker-persistent/mysql-data:/var/lib/mysql
    ports:
      - "3306:3306"

  phpmyadmin:
    image: phpmyadmin/phpmyadmin:4.8.5
    container_name: dev_phpmybitch
    ports:
      - "49161:80"
    links:
        - "db:db"
  • Do the "Get started" to "generate service", you have the 3 services created with feathers-generate g all
  • Patch the sequelize.ts with let result = oldSetup.apply(this, args as any);
  • Launch with npm run dev

Expected behavior

Just want to start the Feathers app for the moment...

Actual behavior

Throw an error after npm run dev command :

benoit@PC-SD-01:~/projects/test_fia$ npm run dev

> [email protected] dev /home/benoit/projects/test_fia
> nodemon src/index.ts

[nodemon] 1.18.9
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: tsconfig.json tslint.json src/**/*.ts
[nodemon] starting `ts-node --files --typeCheck src/index.ts`
info: Feathers application started on http://localhost:3030
error: Unhandled Rejection at: Promise  {"_bitField":18087936,"_fulfillmentHandler0":{"name":"SequelizeDatabaseError","parent":{"code":"ER_PARSE_ERROR","errno":1064,"sqlState":"42000","sqlMessage":"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'JSONB NOT NULL, `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PR' at line 1","sql":"CREATE TABLE IF NOT EXISTS `teams` (`id` INTEGER auto_increment , `name` TEXT NOT NULL, `members` JSONB NOT NULL, `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB;"},"original":{"code":"ER_PARSE_ERROR","errno":1064,"sqlState":"42000","sqlMessage":"You have an error in your SQL syntax; check the manual thatcorresponds to your MySQL server version for the right syntax to use near 'JSONB NOT NULL, `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PR' at line 1","sql":"CREATE TABLE IF NOT EXISTS `teams` (`id` INTEGER auto_increment , `name` TEXT NOT NULL, `members` JSONB NOT NULL, `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB;"},"sql":"CREATE TABLE IF NOT EXISTS `teams` (`id` INTEGER auto_increment , `name` TEXT NOT NULL, `members` JSONB NOT NULL, `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PRIMARY KEY (`id`))ENGINE=InnoDB;"},"_trace":{"_promisesCreated":0,"_length":1},"meta":[{"isFulfilled":false,"isRejected":true,"rejectionReason":{"name":"SequelizeDatabaseError","parent":{"code":"ER_PARSE_ERROR","errno":1064,"sqlState":"42000","sqlMessage":"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'JSONB NOT NULL, `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PR' at line 1","sql":"CREATE TABLE IF NOT EXISTS `teams` (`id` INTEGER auto_increment , `name` TEXT NOT NULL, `members` JSONB NOT NULL, `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB;"},"original":{"code":"ER_PARSE_ERROR","errno":1064,"sqlState":"42000","sqlMessage":"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'JSONB NOT NULL, `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PR' at line 1","sql":"CREATE TABLE IF NOT EXISTS `teams` (`id` INTEGER auto_increment , `name` TEXT NOT NULL, `members` JSONB NOT NULL, `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB;"},"sql":"CREATE TABLE IF NOT EXISTS `teams` (`id` INTEGER auto_increment , `name` TEXT NOT NULL, `members` JSONB NOT NULL, `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB;"}},{"name":"SequelizeDatabaseError","parent":{"code":"ER_PARSE_ERROR","errno":1064,"sqlState":"42000","sqlMessage":"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'JSONB NOT NULL, `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PR' at line 1","sql":"CREATE TABLE IF NOT EXISTS `teams` (`id` INTEGER auto_increment , `name` TEXT NOT NULL, `members` JSONB NOT NULL, `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PRIMARYKEY (`id`)) ENGINE=InnoDB;"},"original":{"code":"ER_PARSE_ERROR","errno":1064,"sqlState":"42000","sqlMessage":"You have an error in your SQL syntax; check the manual that corresponds to your MySQLserver version for the right syntax to use near 'JSONB NOT NULL, `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PR' at line 1","sql":"CREATE TABLE IF NOT EXISTS `teams` (`id` INTEGER auto_increment , `name` TEXT NOT NULL, `members` JSONB NOT NULL, `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB;"},"sql":"CREATE TABLE IF NOT EXISTS `teams` (`id` INTEGER auto_increment , `name` TEXT NOT NULL, `members` JSONB NOT NULL, `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB;"}]}

System configuration

Module versions :

"dependencies": {
    "@feathers-plus/test-utils": "^0.3.5",
    "@feathersjs/authentication": "^2.1.15",
    "@feathersjs/authentication-jwt": "^2.0.9",
    "@feathersjs/authentication-local": "^1.2.9",
    "@feathersjs/configuration": "^2.0.6",
    "@feathersjs/errors": "^3.3.6",
    "@feathersjs/express": "^1.3.1",
    "@feathersjs/feathers": "^3.3.1",
    "@feathersjs/socketio": "^3.2.9",
    "ajv": "^5.5.2",
    "compression": "^1.7.3",
    "cors": "^2.8.5",
    "cross-env": "^5.2.0",
    "feathers-hooks-common": "^4.20.2",
    "feathers-sequelize": "^3.1.3",
    "helmet": "^3.15.0",
    "lodash.merge": "^4.6.1",
    "mysql2": "^1.6.4",
    "sequelize": "^4.42.0",
    "serve-favicon": "^2.5.0",
    "winston": "^3.1.0"
  },
  "devDependencies": {
    "@types/compression": "0.0.36",
    "@types/cors": "^2.8.4",
    "@types/feathersjs__authentication": "^2.1.2",
    "@types/feathersjs__authentication-jwt": "^1.0.5",
    "@types/feathersjs__authentication-local": "^1.0.3",
    "@types/feathersjs__configuration": "^1.0.1",
    "@types/feathersjs__errors": "^3.2.1",
    "@types/feathersjs__express": "^1.1.4",
    "@types/feathersjs__feathers": "^3.1.1",
    "@types/feathersjs__socketio": "^3.0.3",
    "@types/helmet": "0.0.40",
    "@types/lodash.merge": "^4.6.4",
    "@types/mocha": "^5.2.5",
    "@types/request-promise": "^4.1.42",
    "@types/sequelize": "^4.27.34",
    "@types/serve-favicon": "^2.2.30",
    "@types/winston": "^2.4.4",
    "mocha": "^5.2.0",
    "nodemon": "^1.18.9",
    "request": "^2.88.0",
    "request-promise": "^4.2.2",
    "ts-mocha": "^2.0.0",
    "ts-node": "^7.0.1",
    "tslint": "^5.12.1",
    "typescript": "^3.2.4"
  }

Node version: 10.15.0

NPM Version: 6.4.1

Feathers-Plus Version: 0.7.75

MySQL Version: 8.0.3 (as you can see in docker-compose.yml)

Operating System: Ubuntu 18.04.1 LTS

Unable to use npx to do a one off command with feather-plus/cli

Steps to reproduce

Run the command npx @feathers-plus/cli generate all
The terminal will get stuck on extract:faker: sill extract faker@^4.1.0

Expected behavior

To execute the command succesfully.

Actual behavior

It gets stuck.

Workaround

Install feathers-plus/cli globally with npm i -g @feathers-plus/cli

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.