Skip to content
This repository has been archived by the owner on Nov 3, 2020. It is now read-only.

Latest commit

 

History

History
80 lines (58 loc) · 5.1 KB

README.md

File metadata and controls

80 lines (58 loc) · 5.1 KB

concorde.js

Maintainability Test Coverage Build Status

A sexy pinnacle of engineering that’s nonetheless incredibly inefficient and expensive and goes out of business because it can’t find enough use. It also provides some tools to deal with the browser.

Packages

This repository contains a collection of modules used internally by WeTransfer to build our website. You can use them all together or individually, based on your needs.

Package Version Description
concorde-browser npm version Browser capabilities detection
concorde-cookie npm version Read, write and clean cookies
concorde-debounce npm version Debounce functions for regular and async functions
concorde-timer npm version Useful functions to deal with timing in JavaScript
concorde-clipboard npm version Universal copy to clipboard function for the browser

Usage

Please check individual packages documentation for concrete usage and installation. In a nutshell, it works like that:

With ES6 modules:

// Load the full build.
import Browser from '@wetransfer/concorde-browser';

Browser.isMobile
// => true

In Node.js:

// Load the full build.
const browser = require('@wetransfer/concorde-browser');

Browser.platform('windows');
// => false

Release process

First, make sure that you have an NPM account at https://www.npmjs.com/, and you are part of the WeTransfer developer's team. Use npm login to store the credentials on the client aka, your computer. Check that your authentication token for registry.npmjs.org is part of your ~/.npmrc file.

We use lerna to manage our monorepo, and publishing new versions of our modules is also part lerna's responsability. Please run npm run semantic-release to publish a new version(s), it should do the following:

  • Checkout master, pull and rebase last changes
  • Create a new branch to release from
  • lerna will publish to NPM only the modules that changed since the last commit
  • Push the changes to GitHub (changelog and new package version)

It's still your responsability as a developer to create the PR on GitHub and ask a maintainer to merge it.

What if something goes wrong?

In the unlikely event of a broken release process or water landing, it is still possible to publish the modules manually to NPM. Please follow these steps:

  • Create a new branch: git checkout -b release
  • Change directory to the module you want to publish: cd modules/foo
  • Bump the version of the package. You must decide if it is mayor, minor or patch.
  • Update the CHANGELOG.md file.
  • Commit your changes: git add package.json CHANGELOG.md && git commit -m "chore(release): npm publish 📦 [ci skip]"
  • Create a new tag with the new version: git tag -a @wetransfer/concorde-module@version -m "@wetransfer/concorde-module@version"
  • Release the module to NPM: npm publish
  • Repeat with the rest of the modules, if any.
  • Push your changes: git push --no-verify --follow-tags --set-upstream origin feature

Integrations tests

We run some very basic integration tests to check if our final bundle works properly in a real browser:

  • Run npm run serve:dist to start the node server.
  • Create a folder named __e2e__ inside the module you want to test.
  • Create a file named index.html, which will import the final module and write some results on the page.
  • Write some specs in index.spec.js with Jest and Puppeteer.
  • Run the tests with npm run test:integration

License

concorde.js is available under the MIT license. See the LICENSE file for more info.