1.0.16 • Published 3 years ago

temp-condd-app-core v1.0.16

Weekly downloads
-
License
-
Repository
github
Last release
3 years ago

cond-app-core

Team Badge Nexus Version Build Status Tests Coverage

Description

To start project in the project directory, you can run:

npm i
npm run start

Available Scripts

CommandDescription
startRuns app as a MF
start:ciRun app in dev mode without fast refresh. Mostly uses for cypress tests
lintLint all js & ts & scss files
lint:fixFix list errors on ./src folder
mf-configDownloads MF config file
ts-configRecompiles TS config.
testWatch tests changes
test:ciRun tests once, create SonarQube reports
cypress:openOpens Cypress app for local development
cypress:runRuns Cypress tests in headless mode
cypress:ciRuns Cypress tests in CI env (not ready yet)
buildRuns production build for MF
deployRun linter, tests and production build
storybookRuns storybook
build-storybookBuilds storybook
styleguidistRuns styleguidist
build-styleguidistBuilds styleguidist

MF

To connect local MF runnig in another port add <mf-name>=http://localhost:<port> to .env.local file

cond-app-root=http://localhost:3001

Dev server port

To setup dev server port add DEV_SERVER_PORT to .env.local file

DEV_SERVER_PORT=3002

##Storybook and styleguidist You can use Storybook and|or styleguidist to document your components. There is an issue that Storybook does not works with MF. So in case you need to create a component that will use MF, then, probably, you might need to use styleguidist. By default this project will generate components documentation using Storybook in deploy command. You can change it to styleguidist or even use both of them.

Code Style

The project setup with common Conductor's eslint rules.

Tests

Jest and React-testing-library used for testing. Some files are ignored:

Cypress Tests

To write Cypress tests you need to start the app in dev mode

npm run start:ci

Then open Cypress app by

npm run cypress:open

Pick a test file you're working on and launch it. Now you can easily alter or add new tests. Note that u can use Cypress and Jest tests in parallel. Both test reports will merge together to generate total coverage report.

Git Hooks

Husky used to prevent bad git commit and git push.

  • Eslint validates and formats ts/js files regards the rules
  • Stylelint validates and formats css files regards the rules

Proxy for API requests

This project provides an ability to use a proxy during development to get any API requests working without running the monolith locally.

To use it you should:

  • Launch ODSL using Spinnaker
  • Obtain a URL to launched ODSL
  • Add .env.local file with the following contents:
    ```
    BACKEND_URL=https://<PUT_YOU_ODSL_ENV_URL_HERE>
    ```
    Please note, that proxy will only work until your ODSL env is running. After that you'll have to start new ODSL with the same "Stack Name" or update .env.local to point to new URL.