Skip to content

Commit

Permalink
Merge pull request #925 from virtualcommons/add_google_analytics
Browse files Browse the repository at this point in the history
add google analytics + switch to npm
  • Loading branch information
alee authored Jan 22, 2024
2 parents 21073fb + 39608f2 commit 0630149
Show file tree
Hide file tree
Showing 53 changed files with 16,819 additions and 9,811 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/check-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ jobs:
with:
node-version: 18
- name: Clean install
run: yarn install --frozen-lockfile
run: npm ci
- name: Lint
run: yarn lint
run: npm run lint
- name: Check formatting
# run regardless of whether linting caught errors
if: ${{ success() || failure() }}
run: yarn style
run: npm run style

server:
runs-on: ubuntu-latest
Expand All @@ -39,10 +39,10 @@ jobs:
with:
node-version: 18
- name: Clean install
run: yarn install --frozen-lockfile
run: npm ci
- name: Lint
run: yarn lint
run: npm run lint
- name: Check formatting
# run regardless of whether linting caught errors
if: ${{ success() || failure() }}
run: yarn style
run: npm run style
23 changes: 14 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ MAIL_API_KEY_PATH=keys/mail_api_key
SECRETS=$(MAIL_API_KEY_PATH) $(DB_PASSWORD_PATH) $(ORMCONFIG_PATH) $(PGPASS_PATH) $(SENTRY_DSN_PATH) $(SECRET_KEY_PATH)
SHARED_CONFIG_PATH=shared/src/assets/config.ts
BUILD_ID=$(shell git describe --tags --abbrev=1)
GA_TAG_PATH=keys/ga_tag
GA_TAG=$(shell cat $(GA_TAG_PATH))

.PHONY: build
build: docker-compose.yml
Expand Down Expand Up @@ -85,6 +87,9 @@ $(MAIL_API_KEY_PATH): | keys
$(SENTRY_DSN_PATH): | keys
touch "$(SENTRY_DSN_PATH)"

$(GA_TAG_PATH): | keys
touch "$(GA_TAG_PATH)"

$(DB_DATA_PATH):
mkdir -p "$(DB_DATA_PATH)"

Expand All @@ -99,39 +104,39 @@ $(SECRET_KEY_PATH): | keys
settings: $(SENTRY_DSN_PATH) $(SECRET_KEY_PATH) | keys
echo 'export const BUILD_ID = "${BUILD_ID}";' > $(SHARED_CONFIG_PATH)
echo 'export const SENTRY_DSN = "${SENTRY_DSN}";' >> $(SHARED_CONFIG_PATH)
echo 'export const GA_TAG = "${GA_TAG}";' >> $(SHARED_CONFIG_PATH)


initialize: build
docker compose run --rm server yarn initdb
docker compose run --rm server npm run initdb

docker-compose.yml: base.yml $(ENVIR).yml config.mk $(DB_DATA_PATH) $(DATA_DUMP_PATH) $(LOG_DATA_PATH) $(REDIS_SETTINGS_PATH) $(ORMCONFIG_PATH) $(NUXT_ORMCONFIG_PATH) $(PGPASS_PATH) $(SERVER_ENV) settings
case "$(ENVIR)" in \
dev) docker compose -f base.yml -f "$(ENVIR).yml" config > docker-compose.yml;; \
staging|prod) docker compose -f base.yml -f staging.yml -f "$(ENVIR).yml" config > docker-compose.yml;; \
dev|staging|prod) docker compose -f base.yml -f "$(ENVIR).yml" config > docker-compose.yml;; \
*) echo "invalid environment. must be either dev, staging or prod" 1>&2; exit 1;; \
esac

.PHONY: test-setup
test-setup: docker-compose.yml
docker compose run --rm server bash -c "dropdb --if-exists -h db -U ${DB_USER} ${TEST_DB_NAME} && createdb -h db -U ${DB_USER} ${TEST_DB_NAME} && yarn typeorm schema:sync -c test && yarn load-fixtures ./fixtures/sologame -cn test"
docker compose run --rm server bash -c "dropdb --if-exists -h db -U ${DB_USER} ${TEST_DB_NAME} && createdb -h db -U ${DB_USER} ${TEST_DB_NAME} && npm run typeorm -- schema:sync -c test && npm run load-fixtures -- ./fixtures/sologame -cn test"

.PHONY: test
test: test-setup
docker compose run --rm client yarn test:unit
docker compose run --rm server yarn test
docker compose run --rm client npm run test:unit
docker compose run --rm server npm run test

.PHONY: test-server
test-server: test-setup
docker compose run --rm server yarn test $(tests)
docker compose run --rm server npm run test $(tests)

.PHONY: deploy
deploy: build
docker compose up -d

.PHONY: buildprod
buildprod: docker-compose.yml
docker compose run --rm client yarn build
docker compose run --rm server yarn build
docker compose run --rm client npm run build
docker compose run --rm server npm run build

.PHONY: docker-clean
docker-clean:
Expand Down
11 changes: 6 additions & 5 deletions client/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ EXPOSE 3000

WORKDIR /code/client

COPY ./client/package.json ./client/yarn.lock /code/client/
RUN yarn install
COPY ./client/package.json ./client/package-lock.json /code/client/
RUN npm install
RUN ls /code/client/node_modules

COPY ./shared/package.json ./shared/yarn.lock /code/shared/
RUN cd /code/shared && yarn install
COPY ./shared/package.json ./shared/package-lock.json /code/shared/
RUN cd /code/shared && npm install

COPY . /code/client

ENV NODE_ENV=development

CMD ["yarn", "serve"]
CMD ["npm", "run", "serve"]
14 changes: 7 additions & 7 deletions client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,38 @@

## Project setup
```
yarn install
npm install
```

### Compiles and hot-reloads for development
```
yarn run serve
npm run run serve
```

### Compiles and minifies for production
```
yarn run build
npm run run build
```

### Run your tests
```
yarn run test
npm run run test
```

### Lints and fixes files
```
yarn run lint
npm run run lint
```

### Run your end-to-end tests
```
yarn run test:e2e
npm run run test:e2e
```

### Run your unit tests
```
docker compose exec client bash
yarn run test:unit
npm run run test:unit
```

### Customize configuration
Expand Down
4 changes: 2 additions & 2 deletions client/dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

set -o errexit

yarn install
exec yarn serve
npm install
exec npm run serve

Loading

0 comments on commit 0630149

Please sign in to comment.