GithubHelp home page GithubHelp logo

iver-wharf / wharf-web Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 0.0 5.75 MB

Frontend to Wharf, written in Angular

License: MIT License

Dockerfile 0.40% Shell 1.55% JavaScript 1.34% TypeScript 82.14% PowerShell 0.30% HTML 6.96% SCSS 6.62% CSS 0.35% Makefile 0.34%
wharf angular typescript primeng wharf-frontend

wharf-web's Introduction

Wharf Angular frontend

Codacy Badge

Wharf web screenshot

Prerequisites

  • NPM v6.x.x, which comes with Node.js LTS.

    This is because Angular does not support Node.js Current, and recently they got an incompatability with Node.js v16 / NPM v7.

    Read more about it here: angular/angular-cli#19957 (comment)

Building project

The project requires api-client library and import-* provider libraries to be built first.

  1. Get dependencies

    $ npm install
  2. Build API client libraries

    $ npm run build-clients
  3. Build and start server

    $ npm start

Generate models and services

In case you need to regenerate the api clients, run the ./generate-rest-client.ps1 script in powershell:

Run locally via Docker

Use GNU Make or GNUWin32.

  1. Build the docker image:

    $ make docker
  2. Run the built docker image:

    $ make docker-run

Visit http://localhost:8080/

Releasing

Replace the "v2.0.0" in make docker version=v2.0.0 with the new version. Full documentation can be found at Releasing a new version.

Below are just how to create the Docker images using GNU Make or GNUWin32:

$ make docker version=v2.0.0
[1/2] STEP 1/13: FROM node:14.17.1-alpine3.11 AS build
Trying to pull docker.io/library/node:14.17.1-alpine3.11...
Getting image source signatures
Copying blob ed2a3f372ee3 skipped: already exists
Copying blob 5ec9f1d3bd97 skipped: already exists
Copying blob d222216fa792 skipped: already exists
Copying blob ddad3d7c1e96 [--------------------------------------] 0.0b / 0.0b
Copying config 58466d7cb9 done
Writing manifest to image destination
Storing signatures
[1/2] STEP 2/13: WORKDIR /usr/src/app
...

Push the image by running:
docker push quay.io/iver-wharf/wharf-web:latest
docker push quay.io/iver-wharf/wharf-web:v2.0.0

Linting from command-line

make deps

make lint

make lint-ng # Only run Angular/TypeScript linting
make lint-scss # Only run SCSS linting
make lint-md # Only run Markdown linting

Some linting errors have quickfixes, such as "missing semicolon" or "invalid indentation" which can be fixed without messing up the semantics of the code. These can be fixed by running the following:

make lint-fix

make lint-fix-ng # Only fix Angular/TypeScript lint errors
make lint-fix-scss # Only fix SCSS lint errors
make lint-fix-md # Only fix Markdown lint errors

A lot of other errors, such as "member should be camelCased", is not fixable by this make lint-fix command. For those, you'll have to fix them manually.

Linting from IDE

First make sure the project builds by following the #Building project guide above.

Linting from Visual Studio Code

  1. Install extensions

    โš ๏ธ The vscode-remark-lint extension has not proven itself to work previously. If it does not work correctly for you, then skip it and rely on the command-line linting instead.

  2. Install NPM dependencies (required by stylelint):

    npm install
  3. Open a *.ts file

  4. Click the "๐Ÿšซ ESLINT" tab in the bottom right toolbar and then select either "Enable" or "Enable everywhere"

    ESLINT button in toolbar

  5. Done!

    ESLINT extension in action inside VS Code

Linting from vim/neovim

  1. Install plugins:

    โš ๏ธ Warning: coc.nvim is not that well compatible with other autocompletion plugins, such as YouCompleteMe, deoplete, etc. Use at your own risk.

  2. Configure coc.nvim & ALE to play well together

    1. Add the following to your vim config (~/.config/{vim,nvim}/init.vim)

      let g:ale_disable_lsp = 1
    2. Add this to your coc.nvim config (open it with :CocConfig):

      "diagnostic.displayByAle": true
  3. Install coc.nvim extensions

    :CocInstall coc-eslint
    :CocInstall coc-stylelintplus
  4. Install NPM dependencies (required by stylelint):

    npm install
  5. Open a *.ts file

  6. Open the coc-eslint output to see the options to enable it

    :CocCommand eslint.showOutputChannel
  7. Done!

    coc-eslint in action inside neovide

Project style guides

  • Do not set public members explicitly
  • If you can define as many members as possible as private
  • If possible use interface instead of class for data contract

Maintained by Iver. Licensed under the MIT license.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.