npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

jok

v1.12.1

Published

Bundle of utility functions for code generation related to nodejs and graphql

Downloads

99

Readme

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: '[email protected]',	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