Skip to content

Commit 2087497

Browse files
authored
Merge pull request #426 from monstar-lab-oss/feature/devcontainer
feat: add devcontainer configuration
2 parents d8a6056 + 8d28daa commit 2087497

Some content is hidden

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

44 files changed

+369
-156
lines changed

.devcontainer/devcontainer.json

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-docker-compose
3+
{
4+
"name": "Existing Docker Compose (Extend)",
5+
// Update the 'dockerComposeFile' list if you have more compose files or use different names.
6+
// The .devcontainer/docker-compose.yml file contains any overrides you need/want to make.
7+
"dockerComposeFile": [
8+
"../docker-compose.yml",
9+
"docker-compose.yml"
10+
],
11+
// The 'service' property is the name of the service for the container that VS Code should
12+
// use. Update this value and .devcontainer/docker-compose.yml to the real service name.
13+
"service": "app",
14+
// The optional 'workspaceFolder' property is the path VS Code should open by default when
15+
// connected. This is typically a file mount in .devcontainer/docker-compose.yml
16+
"workspaceFolder": "/usr/src/app",
17+
"postCreateCommand": "npm install",
18+
"customizations": {
19+
"vscode": {
20+
"extensions": [
21+
"esbenp.prettier-vscode",
22+
"editorconfig.editorconfig",
23+
"dbaeumer.vscode-eslint",
24+
"wayou.vscode-todo-highlight",
25+
"mike-co.import-sorter",
26+
"waderyan.gitblame",
27+
"ms-vscode.vscode-typescript-tslint-plugin",
28+
"ms-azuretools.vscode-docker",
29+
"firsttris.vscode-jest-runner"
30+
]
31+
}
32+
},
33+
"mounts": [
34+
"source=${localWorkspaceFolder},target=/usr/src/app,type=bind",
35+
"source=node_modules,target=/usr/src/app/node_modules,type=volume"
36+
]
37+
// Features to add to the dev container. More info: https://containers.dev/features.
38+
// "features": {},
39+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
40+
// "forwardPorts": [],
41+
// Uncomment the next line if you want start specific services in your Docker Compose config.
42+
// "runServices": [],
43+
// Uncomment the next line if you want to keep your containers running after VS Code shuts down.
44+
// "shutdownAction": "none",
45+
// Uncomment the next line to run commands after the container is created.
46+
// "postCreateCommand": "cat /etc/os-release",
47+
// Configure tool-specific properties.
48+
// "customizations": {},
49+
// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
50+
// "remoteUser": "vscode"
51+
}

.devcontainer/docker-compose.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
version: '3.8'
2+
services:
3+
# Update this to the name of the service you want to work with in your docker-compose.yml file
4+
app:
5+
# Uncomment if you want to override the service's Dockerfile to one in the .devcontainer
6+
# folder. Note that the path of the Dockerfile and context is relative to the *primary*
7+
# docker-compose.yml file (the first in the devcontainer.json "dockerComposeFile"
8+
# array). The sample below assumes your primary file is in the root of your project.
9+
#
10+
# build:
11+
# context: .
12+
# dockerfile: .devcontainer/Dockerfile
13+
14+
volumes:
15+
# Update this to wherever you want VS Code to mount the folder of your project
16+
- ..:/usr/src/app:cached
17+
- node_modules:/usr/src/app/node_modules
18+
19+
# Uncomment the next four lines if you will use a ptrace-based debugger like C++, Go, and Rust.
20+
# cap_add:
21+
# - SYS_PTRACE
22+
# security_opt:
23+
# - seccomp:unconfined
24+
25+
# Overrides default command so things don't shut down after the process ends.
26+
command: /bin/sh -c "while sleep 1000; do :; done"
27+
28+
volumes:
29+
node_modules:

.github/dependabot.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
# Basic dependabot.yml file with
2-
# minimum configuration for two package managers
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for more information:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
# https://containers.dev/guide/dependabot
36

47
version: 2
58
updates:
@@ -9,7 +12,7 @@ updates:
912
directory: '/'
1013
# Check the npm registry for updates every day (weekdays)
1114
schedule:
12-
interval: 'daily'
15+
interval: 'weekly'
1316

1417
# Enable version updates for Docker
1518
- package-ecosystem: 'docker'
@@ -18,3 +21,9 @@ updates:
1821
# Check for updates once a week
1922
schedule:
2023
interval: 'weekly'
24+
25+
# Enable version updates for devcontainers
26+
- package-ecosystem: 'devcontainers'
27+
directory: '/'
28+
schedule:
29+
interval: 'weekly'
Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,28 @@
11
name: build
22

33
on:
4+
push:
5+
branches:
6+
- master
47
pull_request:
5-
branches: [master]
8+
types: [opened, synchronize, reopened]
69

710
jobs:
8-
build_pull_request:
11+
run_build:
912
runs-on: ubuntu-latest
1013

1114
steps:
1215
- uses: actions/checkout@v3
1316
- uses: actions/setup-node@v3
1417
with:
15-
node-version: 16
18+
node-version: 20.14.0
19+
- name: Cache node modules
20+
uses: actions/cache@v3
21+
with:
22+
path: ~/.npm
23+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
24+
restore-keys: |
25+
${{ runner.os }}-node-
1626
- run: npm ci
1727
- name: Run build step
1828
run: npm run build

.github/workflows/sonarqube-workflow.yml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
name: SonarCloud build
2-
on:
3-
push:
4-
branches:
5-
- master
6-
pull_request:
7-
types: [opened, synchronize, reopened]
2+
3+
# Uncomment once you set up Sonarqube
4+
# on:
5+
# push:
6+
# branches:
7+
# - master
8+
# pull_request:
9+
# types: [opened, synchronize, reopened]
10+
811
jobs:
912
sonarcloud:
1013
name: SonarCloud
@@ -15,7 +18,14 @@ jobs:
1518
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
1619
- uses: actions/setup-node@v3
1720
with:
18-
node-version: 16
21+
node-version: 20.14.0
22+
- name: Cache node modules
23+
uses: actions/cache@v3
24+
with:
25+
path: ~/.npm
26+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
27+
restore-keys: |
28+
${{ runner.os }}-node-
1929
- run: npm ci
2030
- name: Run test cov
2131
run: npm run test:cov

.github/workflows/tests-workflow.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
name: tests
22

33
on:
4+
push:
5+
branches:
6+
- master
47
pull_request:
5-
branches: [master]
8+
types: [opened, synchronize, reopened]
69

710
jobs:
811
test_pull_request:
@@ -25,7 +28,14 @@ jobs:
2528
- uses: actions/checkout@v3
2629
- uses: actions/setup-node@v3
2730
with:
28-
node-version: 16
31+
node-version: 20.14.0
32+
- name: Cache node modules
33+
uses: actions/cache@v3
34+
with:
35+
path: ~/.npm
36+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
37+
restore-keys: |
38+
${{ runner.os }}-node-
2939
- run: npm ci
3040
- name: Run unit tests
3141
run: npm test

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,3 +392,4 @@ dist
392392
local/
393393
documentation
394394
test-report.xml
395+
tsconfig.build.tsbuildinfo

.tool-versions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodejs 20.14.0

.vscode/extensions.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"recommendations": [
33
"esbenp.prettier-vscode",
4-
"ms-vscode.vscode-typescript-tslint-plugin"
4+
"ms-vscode.vscode-typescript-tslint-plugin",
5+
"firsttris.vscode-jest-runner"
56
]
67
}

.vscode/settings.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"editor.codeActionsOnSave": {
3-
"source.fixAll.tslint": true
3+
"source.fixAll.tslint": "explicit"
44
},
55
"editor.insertSpaces": true,
66
"editor.tabSize": 2,
@@ -19,5 +19,6 @@
1919
},
2020
"[typescriptreact]": {
2121
"editor.defaultFormatter": "esbenp.prettier-vscode"
22-
}
22+
},
23+
"typescript.preferences.importModuleSpecifier": "relative",
2324
}

0 commit comments

Comments
 (0)