Skip to content

Commit ffd87b5

Browse files
committed
chore: update code base
1 parent 903c132 commit ffd87b5

Some content is hidden

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

57 files changed

+10484
-12312
lines changed

.barrelsby.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"directory": ["./src/controllers/rest", "./src/controllers/pages"],
3+
"exclude": ["__mock__", "__mocks__", ".spec.ts"],
4+
"delete": true
5+
}

.dockerignore

+3
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
node_modules
2+
Dockerfile
3+
.env.local
4+
.env.development

.env

Whitespace-only changes.

.eslintignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
dist
2+
coverage
3+
jest.config.js
4+
processes.config.js
5+
scripts

.eslintrc

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"parser": "@typescript-eslint/parser",
33
"extends": [
4-
"plugin:@typescript-eslint/recommended",
5-
"prettier/@typescript-eslint",
6-
"plugin:prettier/recommended"
4+
"prettier",
5+
"plugin:@typescript-eslint/recommended"
76
],
7+
"plugins": ["@typescript-eslint"],
88
"parserOptions": {
9-
"ecmaVersion": 2018,
9+
"ecmaVersion": 2018,
1010
"sourceType": "module",
1111
"project": "./tsconfig.json"
1212
},
@@ -15,6 +15,7 @@
1515
"es6": true
1616
},
1717
"rules": {
18+
"@typescript-eslint/no-inferrable-types": 0,
1819
"@typescript-eslint/no-unused-vars": 2,
1920
"@typescript-eslint/no-var-requires": 0
2021
}

.github/FUNDING.yml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# These are supported funding model platforms
2+
3+
github: [romakita]
4+
patreon: # Replace with a single Patreon username
5+
open_collective: tsed
6+
ko_fi: # Replace with a single Ko-fi username
7+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9+
custom: # Replace with a single custom sponsorship URL

.github/ISSUE_TEMPLATE/config.yml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: 💬 Question or help request
4+
url: https://gitter.im/Tsed-io/Community
5+
about: You want to ask a question or discuss with other community members

.github/dependabot.yml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "npm"
4+
directory: "/"
5+
schedule:
6+
interval: "monthly"
7+
assignees:
8+
- "Romakita"
9+
reviewers:
10+
- "Romakita"

.github/stale.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Number of days of inactivity before an issue becomes stale
2+
daysUntilStale: 60
3+
# Number of days of inactivity before a stale issue is closed
4+
daysUntilClose: 7
5+
# Issues with these labels will never be considered stale
6+
exemptLabels:
7+
- pinned
8+
- security
9+
# Label to use when marking an issue as stale
10+
staleLabel: wontfix
11+
# Comment to post when marking an issue as stale. Set to `false` to disable
12+
markComment: >
13+
This issue has been automatically marked as stale because it has not had
14+
recent activity. It will be closed if no further activity occurs. Thank you
15+
for your contributions.
16+
# Comment to post when closing a stale issue. Set to `false` to disable
17+
closeComment: false

.github/workflows/build.yml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3+
4+
name: Build & Release
5+
6+
on:
7+
push:
8+
pull_request:
9+
branches:
10+
- production
11+
12+
jobs:
13+
test:
14+
runs-on: ubuntu-latest
15+
16+
strategy:
17+
matrix:
18+
node-version: [14.x]
19+
20+
steps:
21+
- uses: actions/checkout@v2
22+
- name: Use Node.js ${{ matrix.node-version }}
23+
uses: actions/setup-node@v1
24+
with:
25+
node-version: ${{ matrix.node-version }}
26+
- name: Install dependencies
27+
run: yarn install --frozen-lockfile
28+
- name: Run test
29+
run: yarn test
30+
build:
31+
runs-on: ubuntu-latest
32+
33+
strategy:
34+
matrix:
35+
node-version: [14.x]
36+
37+
steps:
38+
- uses: actions/checkout@v2
39+
- name: Use Node.js ${{ matrix.node-version }}
40+
uses: actions/setup-node@v1
41+
with:
42+
node-version: ${{ matrix.node-version }}
43+
- name: Install dependencies
44+
run: yarn install --frozen-lockfile
45+
- name: Run build
46+
run: yarn build

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,7 @@ test/**/*.js.map
5151
# Project
5252
/public
5353
/dist
54+
55+
#env
56+
.env.local
57+
.env.development

.husky/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

.husky/post-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
git update-index --again

.husky/pre-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx lint-staged $1

.lintstagedrc.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"**/*.{ts,js}": ["eslint --fix"],
3+
"**/*.{ts,js,json,md,yml,yaml}": ["prettier --write"]
4+
}

.mocharc.js

-12
This file was deleted.

.nycrc

-27
This file was deleted.

.prettierignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
dist
2+
docs
3+
node_modules
4+
*-lock.json
5+
*.lock

.prettierrc

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"printWidth": 140,
3+
"singleQuote": false,
4+
"jsxSingleQuote": true,
5+
"semi": true,
6+
"tabWidth": 2,
7+
"bracketSpacing": true,
8+
"arrowParens": "always",
9+
"trailingComma": "none"
10+
}

.travis.yml

-26
This file was deleted.

.yarn/install-state.gz

919 KB
Binary file not shown.

.yarnrc.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodeLinker: node-modules

Dockerfile

+25-10
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,40 @@
99
## ##
1010
## description : Dockerfile for TsED Application ##
1111
## author : TsED team ##
12-
## date : 20190820 ##
13-
## version : 1.0 ##
12+
## date : 2023-12-11 ##
13+
## version : 3.0 ##
14+
## ##
1415
###############################################################################
1516
###############################################################################
16-
FROM node:12.13.0-alpine
1717

18-
RUN apk update && apk add build-base git python
18+
ARG NODE_VERSION=20.10.0
19+
20+
FROM node:${NODE_VERSION}-alpine as build
21+
WORKDIR /opt
1922

20-
COPY package.json .
21-
COPY yarn.lock .
23+
COPY package.json yarn.lock tsconfig.json tsconfig.compile.json .barrelsby.json ./
2224

23-
RUN yarn install --production
25+
RUN yarn install --pure-lockfile
2426

25-
COPY ./resources ./resources
2627
COPY ./src ./src
27-
COPY ./dist ./dist
28+
29+
RUN yarn build
30+
31+
FROM node:${NODE_VERSION}-alpine as runtime
32+
ENV WORKDIR /opt
33+
WORKDIR $WORKDIR
34+
35+
RUN apk update && apk add build-base git curl
36+
RUN npm install -g pm2
37+
38+
COPY --from=build /opt .
39+
40+
RUN yarn install --pure-lockfile --production
41+
42+
COPY . .
2843

2944
EXPOSE 8081
3045
ENV PORT 8081
3146
ENV NODE_ENV production
3247

33-
CMD ["yarn", "start:prod"]
48+
CMD ["pm2-runtime", "start", "processes.config.js", "--env", "production"]

docker-compose.yml

+6-23
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
1-
version: '3.3'
1+
version: "3.5"
22
services:
3-
mongo:
4-
image: mongo:4.1
5-
restart: always
6-
volumes:
7-
- mdb-data:/data/db
8-
ports:
9-
- "27017:27017"
10-
environment:
11-
MONGO_INITDB_ROOT_USERNAME:
12-
MONGO_INITDB_ROOT_PASSWORD:
133
server:
144
build:
155
context: .
@@ -18,17 +8,10 @@ services:
188
- http_proxy
199
- https_proxy
2010
- no_proxy
21-
image: tsed/server:latest
22-
# The app will restart until Mongo is listening
23-
restart: always
24-
depends_on:
25-
- mongo
11+
image: tsed-example-mongoose/server:latest
2612
ports:
2713
- "8081:8081"
28-
environment:
29-
mongoose_url: mongodb://mongo:27017/tsed-mongoose
30-
stdin_open: true # -i
31-
tty: true # -t
32-
volumes:
33-
mdb-data:
34-
14+
mongodb:
15+
image: mongo:5.0.8
16+
ports:
17+
- "27017:27017"

jest.config.js

+12-26
Original file line numberDiff line numberDiff line change
@@ -12,45 +12,31 @@ module.exports = {
1212
// collectCoverageFrom: undefined,
1313

1414
// The directory where Jest should output its coverage files
15-
coverageDirectory: 'coverage',
15+
coverageDirectory: "coverage",
1616

1717
// An array of regexp pattern strings used to skip coverage collection
18-
coveragePathIgnorePatterns: [
19-
'index.ts',
20-
'/node_modules/'
21-
],
18+
coveragePathIgnorePatterns: ["index.ts", "/node_modules/"],
2219

2320
// An object that configures minimum threshold enforcement for coverage results
2421
coverageThreshold: {
2522
global: {
26-
'branches': 69.23,
27-
'functions': 58.33,
28-
'lines': 70,
29-
'statements': 70
23+
branches: 70,
24+
functions: 70,
25+
lines: 70,
26+
statements: 70
3027
}
3128
},
3229

3330
// An array of file extensions your modules use
34-
moduleFileExtensions: [
35-
'js',
36-
'json',
37-
'jsx',
38-
'ts',
39-
'tsx',
40-
'node'
41-
],
31+
moduleFileExtensions: ["js", "json", "jsx", "ts", "tsx", "node"],
4232

4333
// The test environment that will be used for testing
44-
testEnvironment: 'node',
34+
testEnvironment: "node",
4535

4636
// The glob patterns Jest uses to detect test files
47-
testMatch: [
48-
'**/src/**/__tests__/**/*.[jt]s?(x)',
49-
'**/src/**/?(*.)+(spec|test).[tj]s?(x)'
50-
],
37+
testMatch: ["**/src/**/__tests__/**/*.[jt]s?(x)", "**/src/**/?(*.)+(spec|test).[tj]s?(x)"],
5138
// A map from regular expressions to paths to transformers
5239
transform: {
53-
'\\.(ts)$': 'ts-jest'
54-
},
55-
globalTeardown: './scripts/jest/teardown.js'
56-
}
40+
"\\.(ts)$": "ts-jest"
41+
}
42+
};

0 commit comments

Comments
 (0)