@gapi/cli

Gapi command line interface

Stats

stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
418Mar 6, 2021Mar 2, 2018Minified + gzip package size for @gapi/cli in KB

Readme

This is CLI project related with GAPI graphQL api with typescript Decorators

WIKI

Gapi - Advanced graphql server with typescript decorators

Starter - Basic starter project

Starter-advanced - Advanced starter project

Gapi-angular-client - Gapi Apollo Angular client

To install gapi utility type following command:

npm i -g @gapi/cli

To create new basic project from scratch via CLI type:

gapi new my-project

To create new advanced project from scratch via CLI type:

gapi new my-project --advanced

To create new basic project with microservices from scratch via CLI type:

gapi new my-project --microservices

Available commands

Create new project
gapi new project-name
Start created project.
gapi start
(Uses internally on every restart to introspect api schema check "gapi schema introspect" command)
Can be disabled inside package.json > nodemonConfig > events > restart
With this configuration it will make request to localhost:9000 and will take current API schema then will generate graphql.d.ts based on introspection
  "nodemonConfig": {
    "events": {
      "restart": "sleep 1 && gapi schema introspect"
    }
  },
Start production (it will start pm2 and will use process.yml file inside working directory)
gapi start --prod --pm2
Start production inside Docker(it will start pm2-docker and will use process.yml file inside working directory)
gapi start --prod --docker

Start testing

Run single test iteration
Will take config > test > local configuration inside @gapi/cli.conf.yml
gapi test
Run tests in watch mode
gapi test --watch
Run tests with different environment
It will take configuration from @gapi/cli.conf.yml
You can extend configurations from APP when you write after environment "extends app/my-environment"

Custom testing environments

config:
  app:
    local: 
      API_PORT: 9000
      API_CERT: ./cert.key
      NODE_ENV: development
      AMQP_HOST: 182.10.0.5
      AMQP_PORT: 5672
      ENDPOINT_TESTING: http://localhost:9000/graphql
      TOKEN_TESTING: ''
    prod: 
      API_PORT: 9000
      API_CERT: ./cert.key
      NODE_ENV: production
      AMQP_HOST: 182.10.0.5
      AMQP_PORT: 5672
      ENDPOINT_TESTING: http://182.10.0.101:9000/graphql
      TOKEN_TESTING: ''
    my-environment: 
      API_PORT: 9000
      API_CERT: ./cert.key
      NODE_ENV: development
      AMQP_HOST: 182.10.0.5
      AMQP_PORT: 5672
      ENDPOINT_TESTING: http://localhost:9000/graphql
      TOKEN_TESTING: ''
  test:
    my-environment: extends app/my-environment
    local: extends app/local
    prod: extends app/prod
    worker:
      API_PORT: 9000
      API_CERT: ./cert.key
      NODE_ENV: production
      AMQP_HOST: 182.10.0.5
      AMQP_PORT: 5672
      ENDPOINT_TESTING: http://182.10.0.101:9000/graphql
      TOKEN_TESTING: ''
Running with Testing worker environment
gapi test --worker

Running with Production environment

gapi test --prod
Running with custom enviroment
gapi test --my-enviroment

Schema

Schema introspection
It will generate graphql.d.ts file based on given address and output folder
Uses @gapi/cli.conf.yml file
config:
  schema:
    introspectionEndpoint: http://localhost:9000/graphql
    introspectionOutputFolder: ./src/app/core/api-introspection
gapi schema introspect
Available shared commands are:
--verbose - Show better logging

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.