Skip to content

Commit b583def

Browse files
authored
Merge pull request #279 from TaloDev/develop
Release 0.31.0
2 parents 2fbefbe + 35b99b0 commit b583def

File tree

205 files changed

+9106
-5054
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

205 files changed

+9106
-5054
lines changed

.github/workflows/ci.yml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,65 +7,65 @@ jobs:
77
runs-on: ubuntu-latest
88

99
steps:
10-
- uses: actions/checkout@v3
11-
- uses: actions/setup-node@v3
10+
- uses: actions/checkout@v4
11+
- uses: actions/setup-node@v4
1212
with:
1313
node-version: 20
1414

15-
- uses: actions/cache@v3
15+
- uses: actions/cache@v4
1616
with:
1717
path: '**/node_modules'
18-
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
18+
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
1919

2020
- name: Install deps
21-
run: yarn --prefer-offline
21+
run: npm ci --prefer-offline
2222

2323
- name: Setup environment
2424
run: cp envs/.env.dev .env
2525

2626
- name: Run tests
27-
run: yarn test --coverage
27+
run: npm test -- --coverage
2828

29-
- uses: codecov/codecov-action@v3
29+
- uses: codecov/codecov-action@v4
3030
with:
3131
token: ${{ secrets.CODECOV_TOKEN }}
3232

3333
build-check:
3434
runs-on: ubuntu-latest
3535

3636
steps:
37-
- uses: actions/checkout@v3
38-
- uses: actions/setup-node@v3
37+
- uses: actions/checkout@v4
38+
- uses: actions/setup-node@v4
3939
with:
4040
node-version: 20
4141

42-
- uses: actions/cache@v3
42+
- uses: actions/cache@v4
4343
with:
4444
path: '**/node_modules'
45-
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
45+
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
4646

4747
- name: Install deps
48-
run: yarn --prefer-offline
48+
run: npm ci --prefer-offline
4949

5050
- name: Build
51-
run: yarn build
51+
run: npm run build
5252

5353
lint:
5454
runs-on: ubuntu-latest
5555

5656
steps:
57-
- uses: actions/checkout@v3
58-
- uses: actions/setup-node@v3
57+
- uses: actions/checkout@v4
58+
- uses: actions/setup-node@v4
5959
with:
6060
node-version: 20
6161

62-
- uses: actions/cache@v3
62+
- uses: actions/cache@v4
6363
with:
6464
path: '**/node_modules'
65-
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
65+
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
6666

6767
- name: Install deps
68-
run: yarn --prefer-offline
68+
run: npm ci --prefer-offline
6969

7070
- name: Lint
71-
run: yarn eslint
71+
run: npx eslint

.github/workflows/create-release.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
name: Release
32

43
on:
@@ -8,24 +7,24 @@ jobs:
87
release:
98
runs-on: ubuntu-latest
109
steps:
11-
- uses: actions/checkout@v3
10+
- uses: actions/checkout@v4
1211
with:
1312
fetch-depth: 0
1413

15-
- uses: actions/setup-node@v3
14+
- uses: actions/setup-node@v4
1615
with:
1716
node-version: 20
1817

19-
- uses: actions/cache@v3
18+
- uses: actions/cache@v4
2019
with:
2120
path: '**/node_modules'
22-
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
21+
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
2322

2423
- name: Install deps
25-
run: yarn --prefer-offline
24+
run: npm ci --prefer-offline
2625

2726
- name: Build
28-
run: yarn build
27+
run: npm run build
2928

3029
- name: Create GitHub release
3130
uses: softprops/action-gh-release@v1

.github/workflows/tag.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
tag:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v3
11+
- uses: actions/checkout@v4
1212

1313
- name: Check version change
1414
id: check
@@ -23,7 +23,7 @@ jobs:
2323

2424
- name: Trigger Docker workflow
2525
if: steps.check.outputs.changed == 'true'
26-
uses: actions/github-script@v6
26+
uses: actions/github-script@v7
2727
with:
2828
script: |
2929
github.rest.actions.createWorkflowDispatch({
@@ -35,7 +35,7 @@ jobs:
3535
3636
- name: Trigger Release workflow
3737
if: steps.check.outputs.changed == 'true'
38-
uses: actions/github-script@v6
38+
uses: actions/github-script@v7
3939
with:
4040
script: |
4141
github.rest.actions.createWorkflowDispatch({

CONTRIBUTING.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@ Want to add a new system? Are the docs not clear enough? We're always accepting
44

55
## Installation
66

7-
1. Clone the repo and run `yarn` or `npm install`.
7+
1. Clone the repo and run `npm install`.
88
2. Copy `envs/.env.dev` to the project root and rename it to `.env`.
9-
3. Run `yarn up` (or `npm run up`) to spin up the Docker Compose containers.
9+
3. Run `npm run up` to spin up the Docker Compose containers.
1010
4. The backend will be accessible via `http://localhost:3000`.
1111

1212
## Seeding data
1313

14-
Run `yarn seed` to seed your database with some fake data like users, events, games and players.
14+
Run `npm run seed` to seed your database with some fake data like users, events, games and players.
1515

1616
The seed command will create two users: `admin@trytalo.com` (an admin user) and `dev@trytalo.com` (a dev user with less permissions), both can be logged in with using the password `password`.
1717

1818
## Testing
1919

20-
Run `yarn test` to run the unit tests.
20+
Run `npm test` to run the unit tests.
2121

2222
The tests run against your database container. They'll automatically backup and restore the current state of your database before executing the tests.
2323

@@ -27,15 +27,15 @@ Please make sure to include tests with all pull requests.
2727

2828
## Creating new services
2929

30-
You can create a new service using the `yarn service:create` command. You need to pass in the name of the entity you want the service to interact with.
30+
You can create a new service using the `npm run service:create` command. You need to pass in the name of the entity you want the service to interact with.
3131

32-
For example, if you are adding a "Global Stats" service, you would run: `yarn service:create global-stat` (note that the entity name is singular and not a plural).
32+
For example, if you are adding a "Global Stats" service, you would run: `npm run service:create global-stat` (note that the entity name is singular and not a plural).
3333

3434
This will create a policy, entity and REST API for your new entity. If you want to expose API endpoints (so that it can be used by the Unity SDK), add `--api` to the end of the command.
3535

3636
## Migrations
3737

38-
To create a migration, use `yarn migration:create`. This will create a migration class in the `migrations` folder.
38+
To create a migration, use `npm run migration:create`. This will create a migration class in the `migrations` folder.
3939

4040
Modify the default name of the file from `Migration[Timestamp].ts` to `[Timestamp][PascalCaseDescriptionOfTheMigration].ts`.
4141

Dockerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@ FROM node:lts AS base
22
WORKDIR /usr/backend
33
COPY tsconfig.json .
44
COPY package.json .
5-
COPY yarn.lock .
5+
COPY package-lock.json .
66
EXPOSE 80
77

88
FROM base AS dev
9-
RUN yarn
10-
CMD [ "yarn", "watch" ]
9+
RUN npm install
10+
CMD [ "npm", "run", "watch" ]
1111

1212
FROM base AS build
1313
COPY tsconfig.build.json .
14-
RUN yarn
14+
RUN npm install
1515
COPY src ./src
16-
RUN yarn build
16+
RUN npm run build
1717

1818
FROM base AS prod
1919
ENV NODE_ENV production
20-
RUN yarn
20+
RUN npm install
2121
COPY --from=build /usr/backend/dist .
2222
CMD [ "node", "index.js" ]

_templates/service/new/api-service-test.ejs.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
to: "<%= (typeof api !== 'undefined') ? `tests/services/_api/${name}-api/post.test.ts` : null %>"
33
---
4-
import { EntityManager } from '@mikro-orm/core'
4+
import { EntityManager } from '@mikro-orm/mysql'
55
import request from 'supertest'
66
import { APIKeyScope } from '../../../../src/entities/api-key'
77
import createAPIKeyAndToken from '../../../utils/createAPIKeyAndToken'

_templates/service/new/entity.ejs.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
to: src/entities/<%= name %>.ts
33
---
4-
import { Entity, PrimaryKey, Property } from '@mikro-orm/core'
4+
import { Entity, PrimaryKey, Property } from '@mikro-orm/mysql'
55

66
@Entity()
77
export default class <%= h.changeCase.pascal(name) %> {

_templates/service/new/service.ejs.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
to: src/services/<%= name %>.service.ts
33
---
4-
import { EntityManager } from '@mikro-orm/core'
4+
import { EntityManager } from '@mikro-orm/mysql'
55
import { HasPermission, Service, Request, Response, Validate } from 'koa-clay'
66
import <%= h.changeCase.pascal(name) %> from '../entities/<%= name %>'
77
import <%= h.changeCase.pascal(name) %>Policy from '../policies/<%= name %>.policy'

docker-compose.ci.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
version: '3.9'
2+
3+
services:
4+
test-db:
5+
image: mysql:8
6+
command: --default-authentication-plugin=mysql_native_password --sql_mode=
7+
environment:
8+
- MYSQL_DATABASE=${DB_NAME}
9+
- MYSQL_ROOT_PASSWORD=${DB_PASS}
10+
restart: always
11+
healthcheck:
12+
test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1"]
13+
interval: 2s
14+
timeout: 2s
15+
retries: 10
16+
ports:
17+
- ${DB_PORT}:3306
18+
volumes:
19+
- test-data:/var/lib/mysql
20+
networks:
21+
- test-network
22+
23+
test-redis:
24+
image: bitnami/redis:7.2
25+
environment:
26+
- REDIS_PASSWORD=${REDIS_PASSWORD}
27+
ports:
28+
- ${REDIS_PORT}:6379
29+
depends_on:
30+
test-db:
31+
condition: service_healthy
32+
networks:
33+
- test-network
34+
35+
stripe-api:
36+
image: stripe/stripe-mock:latest
37+
ports:
38+
- 12111:12111
39+
- 12112:12112
40+
networks:
41+
- test-network
42+
43+
volumes:
44+
test-data:
45+
46+
networks:
47+
test-network:

docker-compose.test.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ services:
2121
- test-network
2222

2323
test-redis:
24-
image: bitnami/redis:7.0
25-
environment:
26-
- REDIS_PASSWORD=${REDIS_PASSWORD}
24+
image: arm64v8/redis:7-alpine
25+
command: redis-server --requirepass ${REDIS_PASSWORD}
2726
ports:
2827
- ${REDIS_PORT}:6379
2928
depends_on:
@@ -33,7 +32,7 @@ services:
3332
- test-network
3433

3534
stripe-api:
36-
image: stripe/stripe-mock:latest
35+
image: stripe/stripe-mock:latest-arm64
3736
ports:
3837
- 12111:12111
3938
- 12112:12112

0 commit comments

Comments
 (0)