Skip to content

Latest commit

 

History

History
204 lines (150 loc) · 6.45 KB

File metadata and controls

204 lines (150 loc) · 6.45 KB

Leto Modelizer (leto-modelizer)

Technical topology low-code editing tool.

Install

npm install

Default commands

Usage explanation of scripts in package.json.

dev

Run the application in dev mode.

build

Build the application in dist folder.

docs

Generate documentation with esdoc.

lint

Run eslint to check on the project.

lint:fix

Run eslint to fix on the project.

lint:report

Generate issues report with eslint for sonar.

test

Run all the unit tests.

test:coverage

Run all the unit tests and generate coverage report of the unit tests for sonar.

test:e2e

To run all the e2e tests, you need to run the application with terrator-plugin and use specific url for library of template:

npm ci
npm run plugin:install -- repository-name="terrator-plugin" repository-url="https://github.com/ditrit/terrator-plugin.git#0.3.0"
npm run plugin:init
TEMPLATE_LIBRARY_BASE_URL="https://raw.githubusercontent.com/ditrit/leto-modelizer-templates-library/leto-modelizer/e2e_test" npm run dev

Run the e2e tests locally with specific proxy

  1. Install terrator-plugin
npm ci
npm run plugin:install -- repository-name="terrator-plugin" repository-url="https://github.com/ditrit/terrator-plugin.git#0.3.0"
npm run plugin:init
  1. Build the application for e2e tests
docker build -t leto-modelizer -f DockerfileE2E .
  1. Run the application
docker run -p 8080:80 -d leto-modelizer
  1. Run the e2e tests
npm run test:e2e

Development

Directory structure

This is the default directory structure we use for the project:

leto-modelizer
├ cypress              ⇨ Contains all the cypress related files
│ ├ e2e                ⇨ Contains all the e2e tests
│ ├ videos             ⇨ Contains all videos of each run test (only locally)
│ └ support            ⇨ Contains all support files for e2e tests
│   └ step_definitions ⇨ Contains all step definitions for e2e tests
├ dist                 ⇨ Contains the built application
├ docs                 ⇨ Contains all files generated by esdoc
├ public               ⇨ Contains all public files, like favicon
├ reports              ⇨ Contains all the report files for sonar
├ src                  ⇨ Contains all files for the leto-modelizer application
│ ├ assets             ⇨ Contains all the assets
│ ├ boot               ⇨ Contains all boot configurations
│ ├ components         ⇨ Contains all vue components
│ ├ css                ⇨ Contains all style files
│ ├ i18n               ⇨ Contains translation engine and translation files
│ ├ layouts            ⇨ Contains all the page layouts
│ ├ pages              ⇨ Contains all the pages
│ ├ router             ⇨ Contains the router engine and the route definitions
│ └ stores             ⇨ Contains store engine and all storage definitions
└ tests                ⇨ Contains all files related to the tests

How to release

We use Semantic Versioning as guideline for the version management.

Steps to release:

  • Create a new branch labeled release/vX.Y.Z from the latest main.
  • Improve the version number in package.json, package-lock.json and changelog.md.
  • Verify the content of the changelog.md.
  • Commit the modifications with the label Release version X.Y.Z.
  • Create a pull request on github for this branch into main.
  • Once the pull request validated and merged, tag the main branch with vX.Y.Z.
  • After the tag is pushed, make the release on the tag in GitHub.

Git: Default branch

The default branch is main. Direct commit on it is forbidden. The only way to update the application is through pull request.

Release tag are only done on the main branch.

Git: Branch naming policy

[BRANCH_TYPE]/[BRANCH_NAME]

  • BRANCH_TYPE is a prefix to describe the purpose of the branch. Accepted prefixes are:
    • feature, used for feature development
    • bugfix, used for bug fix
    • improvement, used for refacto
    • library, used for updating library
    • prerelease, used for preparing the branch for the release
    • release, used for releasing project
    • hotfix, used for applying a hotfix on main
  • BRANCH_NAME is managed by this regex: [a-z0-9._-] (_ is used as space character).

Testing OIDC Authentication

If you want to test an authentication with an OIDC provider, you need to set up leto-modelizer in HTTPS to test the connection with a provider. To do so, you have to change the dev server type, port, add a proxy and change vueRouterMode from hash to history inside quasar.config.js. Here is an example with Github provider:

build: {
  vueRouterMode: 'history', // available values: 'hash', 'history'
  ...
},

devServer: {
  server: {
    type: 'https',
  },
  port: 443,
  '/auth': {
    target: 'https://token.actions.githubusercontent.com/', // url to the oidc metadata of your provider
    changeOrigin: true,
    pathRewrite: {
      '^/auth': '',
    },
    secure: true,
    onProxyRes(proxyRes) {
      proxyRes.headers['Access-Control-Allow-Origin'] = '*';
    },
  },
  '/token': {
    target: 'https://github.com/login/oauth/access_token/', // url to the oidc token of your provider
    changeOrigin: true,
    pathRewrite: {
      '^/token': '',
    },
    secure: true,
    onProxyRes(proxyRes) {
      proxyRes.headers['Access-Control-Allow-Origin'] = '*';
    },
  },
}

Depending on the provider you are using, you will need to follow the provider's documentation to configure the connection.

Example with Github provider:

  • Create an OAuth Apps by following this Github documentation. You will retrieve the CLIENT_ID and the CLIENT_SECRET needed for the configuration file (see below). You also need to fill the required fields like so :
  • Application name = YOUR_APP_NAME,
  • Homepage URL = https://localhost:443,
  • Authorization callback URL = https://localhost/redirect

Then, inside your global.config.json, (see example), you can replace all the occurences of the following attributes with the corresponging values :

  • "client_id": YOUR_CLIENT_ID
  • "client_secret": YOUR_CLIENT_SECRET,
  • "authority": "/auth",
  • "redirect_uri": "https://localhost/redirect",
  • "token_endpoint": "/token",
  • "silent_redirect_uri": "https://localhost/silent-refresh",