Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add google analytics / migrate to npm #2

Merged
merged 3 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
20 changes: 13 additions & 7 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,10 +104,11 @@ $(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 \
Expand All @@ -113,25 +119,25 @@ docker-compose.yml: base.yml $(ENVIR).yml config.mk $(DB_DATA_PATH) $(DATA_DUMP_

.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
Loading