# Getting Started
# Requirements
NPM_TOKENenv variable -> Set for your account.yarn-> install yarn onto your machine. The monorepo requires Yarn to conduct various commands. Please use this guide if you do not have yarn set up
# Installation
Clone the repo
cdinto the cloned repo and runyarn init-repo. This will install dependencies and link your local packages together (ex: Admin UI links to our Component library package)Projects can be run locally - see the root
package.jsonfor quick commands. We use the docker files for deployment purposes.
# Directory Structure
- All projects are contained in the
/packagesdirectory. All commands can be run against these projects usinglernaoryarn workspace. - When referencing a package, it is referenced through its name in its
package.json.
# Set an NPM_TOKEN Environment Variable on Your Machine
# Linux
You will need an NPM token for our private repositories to install dependencies from. This token should be set up as a local environment variable on your machine to allow for both local and containerized development.
Talk to one of your dev colleagues if you don't have one of these token.
To install your token as an environment variable:
- Open your terminal and edit
~/.profile. Example with VSCode:code ~/.profile - At the bottom, add this line:
export NPM_TOKEN=<yourtoken> - Save the file
- Log out of your machine then log back in for the variable to be set.
# Windows
Much easier. Search Edit System Environment Variables in the main Windows Searchbar. Ths is a window you can open with a list of environment variables. You need to add NPM_TOKEN to these variables.
# Working with project ENV
- We must load environment variables differently from our servers. Please see instructions below for Admin UI:
# Admin UI Environment Variables
- Environment variables are created in an
env.jsfile. TREAT THIS LIKE A TRADITIONAL.env. DO NOT COMMIT THIS FILE TO GIT. - While working with Admin UI and other Vue projects, add environment variables to the
window.APP_CONFIGobject ofsrc/public/env.js:
window.APP_CONFIG = {
VUE_APP_ENV: 'development',
VUE_APP_GMAPS_API_KEY: 'abc123',
}
- On startup, the Admin UI will load this env into the Vue instance's
$envglobal object. You can then reference your env in a component file as$env.VUE_APP_ENV. - Outside of
.vuecomponents, these variables can be referenced through thewindow.APP_CONFIGobject. - During deployment, these environment variables are added via Vault to the Docker container, then the container spins up a server to serve the built Vue application, sending along a
env.jsfile for the Vue app to read. - We are essentially mimicking this process by creating
env.jsin/src/publicto work with environment variables locally and in the same way as our deployed Vue app would. - NOTE: ALL ENVIRONMENT VARIABLES IN
env.jsMUST BE PREFIXED WITHVUE_APP.
# Launching apps locally
Admin UI - yarn admin-dev
Storybook - yarn storybook-dev
- TIP: Add start scripts for other projects to the root
package.json
# CLI Use Examples
- Run the
buildnpm script in all packages that have abuildscript:npx lerna run build --stream - Run the
buildnpm script in packagers-components:npx lerna run build --scope rs-components --streamORyarn workspace rs-components build