Browse Source

Refactoring

pull/2156/head
Thomas 2 years ago
parent
commit
a2be5c1e54
  1. 2
      .github/workflows/build-code.yml
  2. 4
      Dockerfile
  3. 1
      README.md
  4. 8
      apps/client/project.json
  5. 8
      package.json

2
.github/workflows/build-code.yml

@ -33,4 +33,4 @@ jobs:
run: yarn test run: yarn test
- name: Build application - name: Build application
run: yarn build:all run: yarn build:production

4
Dockerfile

@ -33,7 +33,7 @@ COPY ./tsconfig.base.json tsconfig.base.json
COPY ./libs libs COPY ./libs libs
COPY ./apps apps COPY ./apps apps
RUN yarn build:all RUN yarn build:production
# Prepare the dist image with additional node_modules # Prepare the dist image with additional node_modules
WORKDIR /ghostfolio/dist/apps/api WORKDIR /ghostfolio/dist/apps/api
@ -58,4 +58,4 @@ RUN apt update && apt install -y \
COPY --from=builder /ghostfolio/dist/apps /ghostfolio/apps COPY --from=builder /ghostfolio/dist/apps /ghostfolio/apps
WORKDIR /ghostfolio/apps/api WORKDIR /ghostfolio/apps/api
EXPOSE ${PORT:-3333} EXPOSE ${PORT:-3333}
CMD [ "yarn", "start:prod" ] CMD [ "yarn", "start:production" ]

1
README.md

@ -153,7 +153,6 @@ Please follow the instructions of the Ghostfolio [Unraid Community App](https://
### Setup ### Setup
1. Run `yarn install` 1. Run `yarn install`
1. Run `yarn build:dev` to build the source code including the assets
1. Run `docker-compose --env-file ./.env -f docker/docker-compose.dev.yml up -d` to start [PostgreSQL](https://www.postgresql.org) and [Redis](https://redis.io) 1. Run `docker-compose --env-file ./.env -f docker/docker-compose.dev.yml up -d` to start [PostgreSQL](https://www.postgresql.org) and [Redis](https://redis.io)
1. Run `yarn database:setup` to initialize the database schema 1. Run `yarn database:setup` to initialize the database schema
1. Start the server and the client (see [_Development_](#Development)) 1. Start the server and the client (see [_Development_](#Development))

8
apps/client/project.json

@ -10,11 +10,13 @@
"sourceRoot": "apps/client/src", "sourceRoot": "apps/client/src",
"prefix": "gf", "prefix": "gf",
"targets": { "targets": {
"build": { "copy-assets": {
"executor": "nx:run-commands", "executor": "nx:run-commands",
"dependsOn": ["build-base"],
"options": { "options": {
"commands": [ "commands": [
{
"command": "mkdir -p dist/apps/client"
},
{ {
"command": "cp -r apps/client/src/assets dist/apps/client" "command": "cp -r apps/client/src/assets dist/apps/client"
}, },
@ -48,7 +50,7 @@
] ]
} }
}, },
"build-base": { "build": {
"executor": "@nx/angular:webpack-browser", "executor": "@nx/angular:webpack-browser",
"options": { "options": {
"localize": true, "localize": true,

8
package.json

@ -13,8 +13,8 @@
"affected:lint": "nx affected:lint", "affected:lint": "nx affected:lint",
"affected:test": "nx affected:test", "affected:test": "nx affected:test",
"angular": "node --max_old_space_size=32768 ./node_modules/@angular/cli/bin/ng", "angular": "node --max_old_space_size=32768 ./node_modules/@angular/cli/bin/ng",
"build:all": "nx run api:build:production && nx run client:build:production && yarn replace-placeholders-in-build", "build:dev": "nx run api:build && nx run client:build && nx run client:copy-assets && yarn replace-placeholders-in-build",
"build:dev": "nx run api:build && nx run client:build && yarn replace-placeholders-in-build", "build:production": "nx run api:build:production && nx run client:build:production && nx run client:copy-assets && yarn replace-placeholders-in-build",
"build:storybook": "nx run ui:build-storybook", "build:storybook": "nx run ui:build-storybook",
"database:format-schema": "prisma format", "database:format-schema": "prisma format",
"database:generate-typings": "prisma generate", "database:generate-typings": "prisma generate",
@ -39,8 +39,8 @@
"postinstall": "prisma generate", "postinstall": "prisma generate",
"replace-placeholders-in-build": "node ./replace.build.js", "replace-placeholders-in-build": "node ./replace.build.js",
"start": "node dist/apps/api/main", "start": "node dist/apps/api/main",
"start:client": "nx run client:serve --configuration=development-en --hmr -o", "start:client": "nx run client:copy-assets && nx run client:serve --configuration=development-en --hmr -o",
"start:prod": "yarn database:migrate && yarn database:seed && node main", "start:production": "yarn database:migrate && yarn database:seed && node main",
"start:server": "nx run api:serve --watch", "start:server": "nx run api:serve --watch",
"start:storybook": "nx run ui:storybook", "start:storybook": "nx run ui:storybook",
"test": "npx dotenv-cli -e .env.example -- nx test", "test": "npx dotenv-cli -e .env.example -- nx test",

Loading…
Cancel
Save