JSPM

  • Created
  • Published
  • Downloads 10
  • Score
    100M100P100Q43063F
  • License ISC

Vouched Javascript SDK

Package Exports

  • @vouched.id/vouched-js
  • @vouched.id/vouched-js/build/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@vouched.id/vouched-js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

vouched-js-sdk-private

Getting Started

Create .env file with the following (Optional).

Note: couldn't get this to work it the sdk was using the vars from the plugin while in development .env

AMPLITUDE_API_KEY=
SENTRY_DSN=

Run Locally

yarn unlink 
yarn link
yarn build

In another terminal, navigate to vouched-js-plugin

yarn link "@vouched.id/vouched-js" 

To see development changes in vouched-js-plugin

yarn build

Workaround for deploy script

The deploy script need Tracker to depend on Worker.ts

if (process.env.NODE_ENV === 'vouched-dev') {
  console.log(` -- using development worker -- `);
  return new Worker('Worker.ts');
}

However, this will cause an error when building locally

@vouched.id/vouched-js/build/src/Worker.ts: ENOENT: no such file or directory

Change Worker.ts to Worker.js
Do NOT commit this change because it will break deploy script

Package and Publish

Test and Publish SDK

Manually update version and TypeScript declaration file

After publishing to NPM, update vouched-js-plugin

bump up version in package.json
yarn install
add yarn.lock file to the PR for bumped package.json

The npm package can be published by pushing the latest tag for the repo. git checkout master && git pull && git tag $version && git push --tags

Update public repo

https://github.com/vouched/vouched-js-sdk

Update version in local vouched-react-private project

cd /path/to/project/vouched-react-private/
update version of "@vouched.id/vouched-js" in package.json
# commit and push to git repo