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

As explained in the workaround below, rename the Worker script in the build directory

mv build/src/Worker.js build/src/Worker.ts

In another terminal, navigate to vouched-js-plugin to link the changes in:

yarn link-sdk && yarn build

Workaround for deploy script

The deploy script needs 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

As a workaround, change Worker.ts to Worker.js in the build directory 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

To publish to NPM, push the latest tag for the repo. git checkout master && git pull && git tag $version && git push --tags. Pushing the tag automatically publishes to the npm.

Also update the js-sdk version in the vouched-js-plugin

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