Developing SDK

Here are the commands you need when developing the SDK:

Install dependencies:

$ yarn install

Build the package:

$ yarn run build

Run tests:

$ yarn test

Run linter:

$ yarn run lint

Format code (run Prettier):

$ yarn run format

Move the built files to /docs folder

Docpress only looks for files in the project root and /docs folder.

$ cp build/sharetribe-flex-sdk-web.js docs/sharetribe-flex-sdk-web.js

Serve the docpress docs

$ yarn run serve-docs

Build the docpress docs

$ yarn run build-docs

Update the Github Pages

$ yarn run build
$ cp build/sharetribe-flex-sdk-web.js docs/sharetribe-flex-sdk-web.js
$ yarn run build-docs
$ mv _docpress ../
$ git checkout gh-pages
$ cp -r ../_docpress/* ./
$ rm -r ../_docpress
$ // git add, commit, push

Release a new version to NPM

  1. Update versions:

    • package.json
    • src/version.js
  2. Make a new build (as src/version.js needs to be up-to-date in the build) and commit

    yarn run build
    
  3. Update CHANGELOG.md

    • Move everything in Unreleased to the corresponding version section
    • Update the version links found at the very bottom of the CHANGELOG.md file
  4. Commit and push

  5. Login as sharetribe with npm login

    • check credentials from password manager
  6. Publish with npm publish

  7. Add a new tag

    git tag -a v1.2.3 -m v1.2.3
    
  8. Update latest tag

    git push origin :refs/tags/latest
    git tag -f -a latest -m latest
    
  9. Push the tag

    git push --tags
    
  10. Go to Github releases and draft a new release

    Use the following content:

    Tag version: <the newly created tag>

    Release title: <version number>

    Describe this release:

    <copy the content from the [CHANGELOG.md](CHANGELOG.md)>
    

    Here's a full example:

    Tag version: v1.2.3

    Release title: v1.2.3

    Describe this release:

    ### Added
    
    - Added many things
    
    ### Changed
    
    - Changed this and that
    
  11. Announce the new version in Slack