JSPM

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

Vouched Javascript SDK

Package Exports

    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=

    Run Locally

    yarn build:local

    This script will add the environment variable (PACKAGE_LINKED) to your .env file, build the project, run yarn link for the build, and convert the build/src/Worker.js file to a build/src/Worker.ts file in order to be consumed by the JS Plugin for testing.

    Note: If you do not have a .env file it will create one for you. If you do have an .env file it will add the environment variable to it without removing any other variables.

    Run the yarn build:local script again to remove the environment variable from your .env file and revert the build/src/Worker.ts file back to build/src/Worker.js before deploying.

    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