Skip to content

Commit

Permalink
Merge branch 'master' of github.com:NilFoundation/proof.market.nil.fo…
Browse files Browse the repository at this point in the history
…undation
  • Loading branch information
ukorvl committed Oct 12, 2023
2 parents 8121826 + d8e97b6 commit e669511
Show file tree
Hide file tree
Showing 7 changed files with 105 additions and 5 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/deploy_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ on:
default: ''
type: string

concurrency:
group: ${{
( github.ref == 'refs/heads/master' &&
format('{0}/{1}', github.run_id, github.run_attempt) )
||
format('{0}/{1}', github.workflow, github.ref) }}
cancel-in-progress: true

jobs:
build:
uses: ./.github/workflows/build.yaml
Expand Down
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<h1 align="center">=nil; Foundation Proof market interface</h1>

<br />

This is web interface for proof-market built on Reactjs.

## Table of contents
- [Dev](#dev)
- [Build](#build)

## Dev
To run the project in development mode:
```bash
npm ci
npm start
```

## Build
To build the project:
```bash
./scripts/build.sh
```
This command will install required dependencies and build static project version into the `build` directory.

To build the project in docker environment with Node.js, add `--docker` argument:
```bash
./scripts/build.sh --docker
```
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "proof-market.frontend",
"version": "0.1.3",
"version": "0.1.5",
"private": true,
"dependencies": {
"@loadable/component": "^5.15.3",
Expand Down Expand Up @@ -54,7 +54,7 @@
"preview": "vite preview",
"prettier": "prettier --write",
"lint:ts": "eslint --ext=ts,tsx src",
"lint:editorconfig": "npx editorconfig-checker",
"lint:editorconfig": "npx --yes editorconfig-checker",
"prepare": "husky install",
"analyze": "source-map-explorer 'build/static/js/*.js'"
},
Expand Down
2 changes: 1 addition & 1 deletion public/CNAME
Original file line number Diff line number Diff line change
@@ -1 +1 @@
proof.market.nil.foundation
proof.market.nil.foundation
55 changes: 55 additions & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/usr/bin/env bash

set -euo pipefail

SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
REPO_ROOT="$SCRIPT_DIR/.."

DOCKER="docker"
DOCKER_OPTS=""

USE_DOCKER=false
NPM_LOCAL_CACHE_DIR="$REPO_ROOT/.npm"

build() {
cd "$REPO_ROOT"

export npm_config_cache="$NPM_LOCAL_CACHE_DIR"

npm ci --ignore-scripts

npm run lint:ts
npm run build

rm -rf "$NPM_LOCAL_CACHE_DIR"

cd -
}

run_build() {
if [ "$USE_DOCKER" = true ]; then
cd "$REPO_ROOT"

$DOCKER build -t frontend-env scripts/docker
$DOCKER run $DOCKER_OPTS --rm \
--volume ${PWD}:/home:Z \
-u $(id -u ${USER}):$(id -g ${USER}) \
frontend-env ./scripts/build.sh
cd -
else
build
fi
}

while [[ "$#" -gt 0 ]]; do
case $1 in
--docker) USE_DOCKER=true ;;
*)
echo "Unknown parameter passed: $1"
exit 1
;;
esac
shift
done

run_build
9 changes: 9 additions & 0 deletions scripts/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Test environment for frontend nodejs apps
FROM node:18

WORKDIR /home

RUN useradd --system ${uid+--uid "$uid"} --user-group --shell /sbin/nologin --create-home --home-dir /home builder \
&& chown -R builder:builder /home

USER builder

0 comments on commit e669511

Please sign in to comment.