teleport/web
Pierre Beaucamp 05bc6f6904 Automated builds (#53)
* Remove existing dist directories

* Update Makefile to deploy assets to seperate repo

* Split asset delivery over two repositories

* Update e reference

* Use a special 'builder' user inside Dockerfile

* Revert "Use a special 'builder' user inside Dockerfile"

This reverts commit 5e72f48ff9364109bce99ec40a56311ae4264891.

* Fix a bug regarding git branches

* Use older git cli options for compatibility with Jenkins

* Stop resetting the branch after checkout

* Further git cli adjustments

* Add test command to Makefile

* Add Jenkinsfile for PR workflow

* Add comments to Makefile, include gravity & force artifacts

* Update README

* Adjust makefile to run even without e submodule

* Fix unit-test errors

* Archive build artifacts on Jenkins

* Adjust Jenkinsfile syntax

* Update e ref

* Update Jenkinsfile

* Update Jenkinsfile

* Update Jenkinsfile

clean directory before checkout

* Update Jenkinsfile

de-init submodules before checkout

* Update Jenkinsfile

* Update Jenkinsfile

* Update Jenkinsfile

* Fix syntax error in make file
2020-04-02 14:49:53 -04:00
..
.storybook New Terminal (#46) 2020-03-11 17:34:37 -04:00
.vscode Prettify root config files for *.{js,json} (#29) 2020-02-19 09:01:02 -08:00
packages Automated builds (#53) 2020-04-02 14:49:53 -04:00
scripts Fix modal test failing and include code coverage scripts (#22) 2020-02-14 13:37:36 -08:00
.dockerignore Move code to this repo 2019-09-12 19:37:15 -04:00
.eslintrc.js Prettify root config files for *.{js,json} (#29) 2020-02-19 09:01:02 -08:00
.gitignore Automated builds (#53) 2020-04-02 14:49:53 -04:00
.gitmodules Rename e submodule to webapps.e 2019-12-27 11:45:47 -05:00
.prettierrc Move code to this repo 2019-09-12 19:37:15 -04:00
babel.config.js Prettify root config files for *.{js,json} (#29) 2020-02-19 09:01:02 -08:00
Dockerfile Automated builds (#53) 2020-04-02 14:49:53 -04:00
Jenkinsfile Automated builds (#53) 2020-04-02 14:49:53 -04:00
jest.config.js Unit Test shared/ActionMenu (#23) 2020-02-18 10:07:48 -08:00
Makefile Automated builds (#53) 2020-04-02 14:49:53 -04:00
package.json Unit test useRule custom hook from Validation (#31) 2020-02-21 17:04:48 -08:00
README.md Automated builds (#53) 2020-04-02 14:49:53 -04:00
tsconfig.json fix: vscode does not resolve aliases in the new files 2020-03-31 16:55:57 -04:00
yarn.lock Fix peer dep. warnings (#56) 2020-03-31 15:21:51 -04:00

Gravitational Web Applications and Packages

This mono-repository contains the source code for the web UIs of the following projects: Teleport Gravity Force

The code is organized in terms of independent yarn packages which reside in the packages directory.

Getting Started

You can make production builds locally or you can use Docker to do that.

Setup Prettier on VSCode

  1. Install plugin: https://github.com/prettier/prettier-vscode
  2. Go to Command Palette: CMD/CTRL + SHIFT + P (or F1)
  3. Type open settings
  4. Select Open Settings (JSON)
  5. Include the below snippet and save:

// Autoformat on save
"editor.formatOnSave": false,

// Specify prettier configuration file
"prettier.configPath": ".prettierrc",

"[javascript]": {
    "editor.formatOnSave": true
},

"[javascriptreact]": {
    "editor.tabSize": 2,
    "editor.formatOnSave": true,
    "editor.defaultFormatter": "esbenp.prettier-vscode"
},

"[html]": {
    "editor.tabSize": 2,
    "editor.defaultFormatter": "esbenp.prettier-vscode"
}

Local Build

Make sure that you have yarn installed on your system since this monorepo uses the yarn package manager.

Then you need download and initialize these repository dependencies.

$ yarn install

To build the Teleport web UI

$ yarn build-teleport

To build the Gravity web UI

$ yarn build-gravity

To build the Force web UI

$ yarn build-force

The resulting output will be in the /packages/{package-name}/dist/ folders respectively.

Docker Build

To build all packages

$ make all

To build the Teleport web UI

$ make packages/teleport/dist

To build the Gravity web UI

$ make packages/gravity/dist

To build the Force web UI

$ make packages/force/dist

Development

To avoid having to install a dedicated Teleport or Gravity cluster, you can use a local development server which can proxy network requests to an existing cluster.

For example, if https://example.com:3080/web is the URL of your cluster UI then:

to start your local Teleport development server

$ yarn start-teleport --target=https://example.com:3080/web

or to start your local Gravity development server

$ yarn start-gravity --target=https://example.com:3080/web

This service will serve your local javascript files and proxy network requests to the given target.

Keep in mind that you have to use a local user because social logins (google/github) are not supported by development server.

Unit-Tests

We use jest as our testing framework.

To run all jest unit-tests:

$ yarn run test

To run jest in watch-mode

$ yarn run tdd

Interactive Testing

We use storybook for our interactive testing. It allows us to browse our component library, view the different states of each component, and interactively develop and test components.

To start a storybook:

$ yarn run storybook

This command will open a new browser window with storybook in it. There you will see components from all packages so it makes it faster to work and iterate on shared functionality.

Deployment

Deployment is automated through our CI system. Each commit to the master branch will be built & deployed.