Tradeshift UI is a UI library to help you create apps that implement the Tradeshift Design Principles. Check out our documentation site to learn more about how it works and try out live code examples.
If you want to know about what the latest version is and what's new, check out our releases page.
If you'd like to submit a feature request or report a bug, go to our issues pages.
- Clone this repository
- Install NodeJS, either LTS or current.
- Install the Grunt Command Line Utility globally.
npm install -g grunt-cli
- Use the configured version of node
nvm use
- Install the dependencies of this project.
npm install
- Start the
grunt
script in the root of the repository.grunt
- Use
http://localhost:10111/dist/ts.js
in your app running locally to initialize Tradeshift UI. - Whenever you modify the source files, the script will rebuild the distribution files in
dist/
so you're always using the latest version.
- Run
grunt dev
(instead of justgrunt
) and the documentantion website will open up onhttp://localhost:10114/
- Whenever you modify the source files, the script will rebuild the documentation so you're always using the latest version.
Check out the v11
branch and create pull requests on that branch. Releasing: see v11 instructions.
Watch out, whenever you create a commit, the pre-commit hook will lint all staged files and it might commit all changes in each staged file, not just the staged lines.
Our docs site is hosted by GitHub Pages at https://ui.tradeshift.com.
- Check out a feature branch. Name it anything. The
master
branch is protected from being pushed to directly, and your code will get released to S3 but not to git/GitHub/npm. npm version ${increment || 'patch'}
; Bumps the version inpackage.json
andpackage-lock.json
, and creates a commit and a tag for you. Examples:npm version 12.8.4
,npm version patch
, see docs.nvm use
(use the specified node and npm version)npm i
npm run build
npm run package-dist
. That creates apackage.json
for the npm dist package.git push origin {branch}
; pushes the newly created commit. Don't use a fork.git push origin {the new tag just created}
. Example:git push origin v12.8.4
. Rungit tag
to list tags and find the one just created.- Merge the branch into the main branch, wait for the build to succeed. Then navigate to the tag on Github and create a release from it (could be pre-release)
- Deploy the files to S3 (no overwrites) running the Github action workflow "Deploy to S3". By default it will use the main branch. If you are releasing a
v11
release, you need to select that. - Make sure you are logged in to npm (run
npm login
). - Use the right package registry: You may have configured
@tradeshift:registry https://npm.pkg.github.com/
(runnpm config list
to check,npm config delete @tradeshift:registry
to reset registry to default (registry.npmjs.org),npm config set @tradeshift:registry https://npm.pkg.github.com/
to add it back). The package must be released to https://npm.pkg.github.com/, but if you want it to show up at https://www.npmjs.com/package/@tradeshift/tradeshift-ui, you must also publish using default/no config entry for@tradeshift:registry
. - Go to the dist dir:
cd dist/npm
. In there, runnpm publish --tag {tag_name}
. The tag name must benext
forv11
releases,latest
or not specified for latest release. This pushes the package to registry. Note the following: If the tagging goes wrong and a v11 release is marked aslatest
in npm (npm show @tradeshift/tradeshift-ui
to check), runnpm dist-tag add @tradeshift/tradeshift-ui@{LATEST_TS-UI_RELEASE} latest
(again, be aware of@tradeshift:registry
config).
- Currently not working -
Alternatively, releasing can be started using one of the following commands (but release-it needs to be fixed):
-
Create a new branch. It will not work on the main branch.
-
Make sure you have the following environment variables set:
export AWS_ACCESS_KEY_ID=[Your AWS access key id]
export AWS_SECRET_ACCESS_KEY=[Your AWS secret access key]
export GH_ACCESS_TOK=[Your GitHub personal access token]
- Run one of the following commands:
# Let's say the current version is v10.0.0
# npm dist-tag ls
# latest: 10.0.0
# Bump the patch version and release
> npm run release
# npm dist-tag ls
# latest: 10.0.1
# Bump the minor version and release
> npm run release -- minor
# npm dist-tag ls
# latest: 10.1.0
# Bump the major version and release
> npm run release -- major
# npm dist-tag ls
# latest: 11.0.0
#
# Bump the minor version and pre-release
> npm run prelease -- minor --preRelease=beta
# npm dist-tag ls
# latest: 11.0.0
# next: 11.1.0-beta.0
# Bump the major version and pre-release
> npm run prelease -- major --preRelease=beta
# npm dist-tag ls
# latest: 11.0.0
# next: 12.0.0-beta.0
# Bump the major version and pre-release
> npm run prelease -- --preRelease=rc
# npm dist-tag ls
# latest: 11.0.0
# next: 12.0.0-rc.0
Any of these commands will essentially do the following steps:
npm version ${increment || 'patch'}
# Bump the version and create a git taggrunt dist
# Generate distributable filesnpm run deploy-s3
# Deploy those files to S3 (no overwrites!)git push
# Push the newly created commit and tag to GitHub- Release to GitHub (could be pre-release) # Mark the tag as a GitHub Release
npm publish
(tag is latest or next) # Push the package to registry.npmjs.org
We serve the docs site from the gh-pages
branch and all generated files are present in the .gitignore
of the master
-style branches. The gh-pages
branch only contains these generated files, one folder for each major version since we introduced versioning to the docs (v10
).
Make sure you have the following environment variables set:
export GH_USER_NAME=[Your GitHub username]
export GH_ACCESS_TOK=[Your GitHub personal access token]
Run npm run gh-pages
, which will do the following:
grunt dist
# Generate distributable filescd tasks
# This is actually the CWD of the gh-pages scriptgit clone ${GH_USER_NAME}:${GH_ACCESS_TOK}@github:Tradeshift/tradeshift-ui -b gh-pages --single-branch
# Clone the gh-pages branch to a new folder- Create a
v${majorVersion}
folder and/or replace its contents - Push the changes to
origin/gh-pages-update
From here, you should create a PR against gh-pages
to update the docs site and once it's merged, GitHub Pages will update.
Make sure you have a BrowserStack Automate account and have the following environment variables set:
export BROWSERSTACK_USERNAME=[Your BrowserStack username]
export BROWSERSTACK_KEY=[Your BrowserStack key]
Then feel free to start running the tests as such:
npm test
This command will run all the Jasmine tests for all UI Components through BrowserStack.
We're currently testing on the following browsers:
- Google Chrome (latest, previous)
- Mozilla Firefox (latest, previous)
- Apple Safari (latest, previous)
- Microsoft Edge (latest, previous)
- IE11
If you would like to contribute to our codebase, just fork the repo and make a PR.
- You can always create forks on GitHub, submit Issues and Pull Requests.
- You can only use Tradeshift-UI to make apps on a Tradeshift platform, e.g. tradeshift.com.
- You can fix a bug until the bugfix is deployed by Tradeshift.
- You can host Tradeshift UI yourself.
- If you want to make a bigger change or just want to talk with us, reach out to our team here on GitHub.
You can read the full license agreement in the LICENSE.md.