feathers-plus / cli

FeathersJS CLI supporting both REST and GraphQL architectural concepts and their query languages.
https://generator.feathers-plus.com/
Other
43 stars 7 forks source link

Local commands #20

Closed samburgers closed 5 years ago

samburgers commented 5 years ago

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!

eddyystop commented 5 years ago

Others contributors have not raised this as an issue. I would think you can install it in a folder, add that folder to the PATH, and create a shell command to call it.

samburgers commented 5 years ago

Thanks for the reply! Did a bit of further testing... it's not perfect, but if anyone else is interested in local feathers-plus CLI only, these steps get pretty close to global parity:

Fresh Project

yarn init -y

yarn add @feathers-plus/cli --dev

Add to package.json

"scripts": {
  "fp": "feathers-plus",
},

Now you can run all commands locally like so:

yarn fp generate app yarn fp generate service

Worth noting after i generated a fresh app, i had to manually add these to the package.json

"scripts": {
  ...
  "dev": "nodemon src/",
  "start": "node src/",
   ...
}
eddyystop commented 5 years ago

This is useful info. Thanks!

Could you confirm having to add dev and start? They are generated with everything else in package.json on generate app.

samburgers commented 5 years ago

for some reason the yarn fp generate app command only adds test:all and start:seed to scripts with the above method, leaving you with this after the app is first generated.

"scripts": {
  "fp": "feathers-plus",
  "test:all": "yarn run eslint && NODE_ENV= npm run mocha",
  "start:seed": "NODE_ENV= node src/ --seed"
},

Assume its because we already have a package.json during yarn init in my example.

eddyystop commented 5 years ago

cli+ checks for feathers-gen-specs.json to see if a folder has a generated app. You already have a package.json in the folder when you run generate app. cli+ does not expect that and results are whatever.

What are you doing with cli+?

samburgers commented 5 years ago

I don't want to install the CLI as a global package on my machine, I also need a minimal install path for members of the team to get setup.

so it appears i can create a package.json add the CLI as a devDependency and start from there. which gives the above behavior.

Would be great if it could be installed with npx or yarn create as a few other tools do, but the above behavior is more than fine for my particular use case. thanks again!