1.12.1 • Published 3 years ago

jok v1.12.1

Weekly downloads
4
License
MIT
Repository
github
Last release
3 years ago

Jok

platform: jokio npm version codecov

jok is a namespace which bundles utility functions for code generation, related to nodejs and graphql

API (functions)

init

The easiest way to create new project on nodejs

Those features are out of the box in default template :

✅ Configured dev environement (nodemon)

✅ Configured test environement (jest)

✅ Configured EditorConfig

✅ Configured CI/CD (bitbucket pipelines)

✅ Configured Linting (TSLint)

✅ Last but not least: 100% type safety! (TypeScript)

Note: jok init command is next version of create-jokio-app

graphql-client

Generate sdk for graphql remote endpoint in front-end projects.

Features:

✅ Generates types (interfaces) based on remote graphql server

✅ Generates Queries, Mutations & Subscriptions api on top of Apollo Client

How to use

Recommended way to use jok-cli is to have npx package installed globally on your computer and use following commands:

Note: npx will take care to use latest version of jok cli every time you run the command, thats why its recommended way

init

USAGE
  init [options] <directory-name>

OPTIONS
  --nextjs    with next.js
  --graphql   with graphql

EXAMPLES
  npx jok init cool-app
  npx jok init server-app --graphql

graphql-client

for generating graphql client in front-end projects (Angular, React, etc.) graphql-client has dependencies on apollo client

USAGE
  graphql-client [options]

OPTIONS
  -e, --endpointUrl <endpointUrl>  graphql endpoint url
  -o, --output <output>            result file address
  --defaultFragments               generate default fragments
  -h, --help                       output usage information

EXAMPLES
  $ jok graphql-client -e https://server.jok.io -o src/generated/graph.ts
import { ApolloClient } from 'apollo-client'
import getClient, { Client } from './generated/graph'

const apolloClient: ApolloClient = /* TODO: Set apollo client */

const graphql = getClient(apolloClient, {
  query: {
    fetchPolicy: 'network-only'
  }
});


// example query call
graphql.query.me()
  .then(x => console.log(x))
  .catch(err => console.warn(err))

// example mutation call
graphql.mutation.login({ username: 'example@email.com',	password: 'Qwer!234' })
  .then(x => console.log(x))
  .catch(err => console.warn(err))

// example subscription call
graphql.subscription.musicChannelUpdated({}).subscribe(x => {
  console.log('musicChannelUpdated', x);
})

Note: You will need to have apollo client already configured in your project

Alternative way to use

if you prefer using yarn, please install jok-cli globally first

yarn add global jok

and next you will be able to call jok commands directly:

jok init testapp # initialize empty pre-configured project

jok init testapp --graphql # initialize graphql project

jok init testapp --nextjs # initialize nextjs project
jok graphql-client -e https://server.jok.io -o src/generated/jokio.ts # generate proxy client for remote url
1.12.1

3 years ago

1.12.0

3 years ago

1.11.1

3 years ago

1.10.6

3 years ago

1.11.0

3 years ago

1.10.5

3 years ago

1.10.4

3 years ago

1.10.3

4 years ago

1.10.2

4 years ago

1.10.1

4 years ago

1.10.0

4 years ago

1.9.2

4 years ago

1.9.1

4 years ago

1.9.0

4 years ago

1.8.0

4 years ago

1.6.1

4 years ago

1.6.0

4 years ago

1.7.0

4 years ago

1.5.0

4 years ago

1.4.1

4 years ago

1.3.0

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago

0.7.4

5 years ago

0.7.3

5 years ago

0.7.2

5 years ago

0.7.1

5 years ago

0.7.0

5 years ago

0.6.1

5 years ago

0.6.0

5 years ago

0.5.19

5 years ago

0.5.18

5 years ago

0.5.17

5 years ago

0.5.16

5 years ago

0.5.15

5 years ago

0.5.14

5 years ago

0.5.13

5 years ago

0.5.12

5 years ago

0.5.11

5 years ago

0.5.10

5 years ago

0.5.9

5 years ago

0.5.8

5 years ago

0.5.7

5 years ago

0.5.6

5 years ago

0.5.5

5 years ago

0.5.4

5 years ago

0.5.3

5 years ago

0.5.2

5 years ago

0.5.1

5 years ago

0.5.0

5 years ago

0.4.1

5 years ago

0.4.0

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.0

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago