0.18.0 • Published 3 years ago

@keethealth/api-client v0.18.0

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

Travis Build

Keet Health Node Module Boilerplate

Adatped from Babel Starter Kit

Boilerplate for developing Keet Health modules in Node.js, using:

  • ESlint
  • Babel
  • Rollup
  • Jest
  • TravisCI

Table of Contents

File Structure

|-- src/            # where the magic happens
|---- index.js      # entry file
|-- dist/           # directory for built items
|-- tools/          # build tools
|-- test/           # module tests
|-- bin/            # executables
|-- .env            # environment variables
|-- .eslintrc.json  # linting rules because messy code hurts my soul
|-- .gitignore      # file patterns to not commit, currently configured only for macOS
|-- .travis.yml     # Travis CI config file
|-- package.json    # node package dependencies
|-- static.json     # necessary for client-side routing
|-- yarn.lock       # auto generated yarn file, do not touch

Updating for different projects

This module is intended to be a pure node.js boilerplate without dependencies on DOM or other frameworks/libraries. When you need to update this repo to support other libraries in JS (i.e. React), you should create a new branch and make changes there.

Then, clone from that branch:

git checkout -b react

## ...Commit changes

git clone -b react --single-branch https://github.com/keethealth/keet-module-boilerplate.git

Quick Start

Cloning

git clone https://github.com/keethealth/keet-module-boilerplate.git <module-name>

rm -rf .git && git init
git remote add origin <keethealth/module-name.git>
git remote -v

Initialization

cd <module-name>
yarn init

Yarn will ask you a series of questions to edit package.json.
All questions are already answered by the existing package.json, but you will need to change these:

question name (@keethealth/keet-module-boilerplate): <module-name>
question version (0.0.1):
question description (A project template for authoring and publishing Keet Health libraries):
question repository url (keethealth/keet-module-boilerplate): keethealth/<module-name>

Install Dependencies & Build

yarn && yarn build

You should now have a dist folder at path/to/module/dist

Development

To link this package:

yarn link

Learn more about this command at https://yarnpkg.com/lang/en/docs/cli/link/

Go to the app you want to test this module with and link this local package:

cd ../<app-name>
yarn link <module-name>

This will create a symlink in your project so that it will resolve import '<module-name' using your local project instead of the node_modules folder.

When you are done and would like to test the package on npm, run the following in your app directory:

yarn unlink <module-name>

To completely remove the symlink, run the following in the local package directory:

yarn unlink

Run watch to rebuild bundle on changes made instead of running build manually each time:

yarn watch

Testing locally

npx babel-node

babel > const Client = require('./src/Client').default
babel > const apiUrl = 'https://api.keetdev.com'
babel > const accessToken = /* put your token here */
babel > const Api = new Client({ apiUrl, getCurrentSession: () => Promise.resolve({ accessToken }) })
babel > Api.profile.read().then(response => { console.log('response', JSON.stringify(response, null, 2)) })

Publishing to npm

Build the package:

yarn build

Publish the package to npm:

yarn publish --access public

You will be prompted to bump the version. Ensure that you follow semantic versioning strictly.

This publishes the package as a public scoped package under the @keethealth scope.

Read more about scoped packages

Available Scripts

In the project directory, you can run:

yarn test

Launches the test runner in the interactive watch mode.

To see test coverage, run yarn test --coverage.

yarn build

Builds the app for production to the dist folder.

Troubleshooting

0.18.0

3 years ago

0.17.0

3 years ago

0.16.0

3 years ago

0.15.0

4 years ago

0.14.0

4 years ago

0.13.0

4 years ago

0.12.0

4 years ago

0.11.0

4 years ago

0.10.0

4 years ago

0.9.2

4 years ago

0.9.0

4 years ago

0.9.1

4 years ago

0.8.0

4 years ago

0.7.0

4 years ago

0.6.21

4 years ago

0.6.20

4 years ago

0.6.19

4 years ago

0.6.18

4 years ago

0.6.17

4 years ago

0.6.16

4 years ago

0.6.15

4 years ago

0.6.14

4 years ago

0.6.13

4 years ago

0.6.12

4 years ago

0.6.11

5 years ago

0.6.10

5 years ago

0.6.9

5 years ago

0.6.8

5 years ago

0.6.7

5 years ago

0.6.6

5 years ago

0.6.5

5 years ago

0.6.4

5 years ago

0.6.3

5 years ago

0.6.2

5 years ago

0.6.1

5 years ago

0.6.0

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.3

5 years ago

0.4.2

5 years ago

0.4.1

5 years ago

0.4.0

5 years ago

0.3.0

5 years ago

0.2.8

5 years ago

0.2.7

5 years ago

0.2.6

5 years ago

0.2.5

5 years ago

0.2.4

5 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.9

5 years ago

0.1.8

5 years ago

0.1.7

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.12

5 years ago

0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago