Skip to content

Commit

Permalink
Change to node 20 (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
reijoh authored Nov 15, 2023
1 parent 5e699c8 commit d802b4f
Show file tree
Hide file tree
Showing 22 changed files with 41,235 additions and 29,480 deletions.
29 changes: 29 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "Node.js & TypeScript",
"image": "mcr.microsoft.com/devcontainers/typescript-node:20-bookworm",
"onCreateCommand": ".devcontainer/setup.sh",
"postCreateCommand": "npm install",
"postStartCommand": ".devcontainer/startup.sh",
"overrideCommand": true,
"features": {
"ghcr.io/devcontainers-contrib/features/starship:1": {}
},
"customizations": {
"vscode": {
"settings": {
"security.workspace.trust.untrustedFiles": "open"
},
"extensions": [
"bierner.markdown-preview-github-styles",
"catppuccin.catppuccin-vsc",
"catppuccin.catppuccin-vsc-icons",
"dbaeumer.vscode-eslint",
"DavidAnson.vscode-markdownlint",
"esbenp.prettier-vscode",
"GitHub.vscode-pull-request-github",
"streetsidesoftware.code-spell-checker",
"yzhang.markdown-all-in-one"
]
}
}
}
36 changes: 36 additions & 0 deletions .devcontainer/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env sh
if [ -d "/var/run/docker.sock" ]; then
# Grant access to the docker socket
sudo chmod 666 /var/run/docker.sock
fi

if ! [ -d ~/.ssh ]; then
if [ -d /tmp/.ssh-localhost ]; then
command mkdir -p -- ~/.ssh
sudo cp -R /tmp/.ssh-localhost/* ~/.ssh
sudo chown -R $(whoami):$(whoami) ~ || true ?>/dev/null
sudo chmod 400 ~/.ssh/*
fi
fi

sudo apt-get update
sudo apt-get install --no-install-recommends -y pre-commit fonts-firacode shellcheck
sudo npm install -g npm prettier

if [ -f ~/.gitconfig ]; then
rm ~/.gitconfig
fi

if ! [ -d ~/.config ]; then
command mkdir -p -- ~/.config
fi
/bin/cp -f .devcontainer/starship.toml ~/.config/starship.toml
chown -R $USER_UID:$USER_GID ~/.config
chmod -R 700 ~/.config
chown $USER_UID:$USER_GID ~/.config/starship.toml
if ! [ -f ~/.zshrc ]; then
touch ~/.zshrc
fi
if ! grep -q 'eval "$(starship init zsh)"' ~/.zshrc; then
echo 'eval "$(starship init zsh)"' >>~/.zshrc
fi
35 changes: 35 additions & 0 deletions .devcontainer/starship.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
command_timeout = 500
format = "$directory$git_branch$time$cmd_duration$character"

[character]
success_symbol = "[➜](bold green)"
error_symbol = "[✖](bold red)"

[cmd_duration]
min_time = 500
format = "took [$duration](bold yellow)"

[directory]
read_only = ""
truncation_length = 3
truncation_symbol = "~/"

[git_branch]
symbol = ""
style = "bold #e8ec00 inverted"
format = "on [$symbol$branch ]($style) "

[git_commit]
disabled = true

[git_state]
disabled = true

[git_status]
disabled = true

[line_break]
disabled = true

[package]
disabled = true
24 changes: 24 additions & 0 deletions .devcontainer/startup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env sh
if [ "${CODESPACES}" = "true" ]; then
# Remove the default credential helper
sudo sed -i -E 's/helper =.*//' /etc/gitconfig

# Add one that just uses secrets available in the Codespace
git config --global credential.helper '!f() { sleep 1; echo "username=${GITHUB_USER}"; echo "password=${GH_TOKEN}"; }; f'
fi

if [ "$(git config --get safe.directory)" != "*" ]; then
git config --global --add safe.directory "*"
fi
if [ "$(git config pull.rebase)" != "false" ]; then
git config --global pull.rebase false
fi
if [ "$(git config user.name)" = "" ]; then
echo "Warning: git user.name is not configured"
fi
if [ "$(git config user.email)" = "" ]; then
echo "Warning: git user.email is not configured"
fi

pre-commit install
pre-commit autoupdate
54 changes: 47 additions & 7 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,62 @@
{
"plugins": ["jest", "@typescript-eslint"],
"extends": ["plugin:github/recommended"],
"plugins": [
"import",
"jest",
"@typescript-eslint"
],
"extends": [
"plugin:github/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 9,
"sourceType": "module",
"project": "./tsconfig.json"
},
"settings": {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
},
"import/resolver": {
"node": {
"extensions": [".js", ".jsx", ".ts", ".tsx"]
},
"typescript": {
"alwaysTryTypes": true
}
}
},
"rules": {
"eslint-comments/no-use": "off",
"import/no-namespace": "off",
"import/named": "off",
"import/no-unresolved": "error",
"i18n-text/no-en": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/explicit-member-accessibility": ["error", {"accessibility": "no-public"}],
"@typescript-eslint/explicit-member-accessibility": [
"error",
{
"accessibility": "no-public"
}
],
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/array-type": "error",
"@typescript-eslint/await-thenable": "error",
"camelcase": "off",
"@typescript-eslint/explicit-function-return-type": ["error", {"allowExpressions": true}],
"@typescript-eslint/func-call-spacing": ["error", "never"],
"@typescript-eslint/explicit-function-return-type": [
"error",
{
"allowExpressions": true
}
],
"@typescript-eslint/func-call-spacing": [
"error",
"never"
],
"@typescript-eslint/no-array-constructor": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "error",
Expand All @@ -42,7 +79,10 @@
"@typescript-eslint/require-array-sort-compare": "error",
"@typescript-eslint/restrict-plus-operands": "error",
"semi": "off",
"@typescript-eslint/semi": ["error", "never"],
"@typescript-eslint/semi": [
"error",
"never"
],
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/unbound-method": "error"
},
Expand All @@ -51,4 +91,4 @@
"es6": true,
"jest/globals": true
}
}
}
3 changes: 3 additions & 0 deletions .github/workflows/pull-labels-changeset_size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ jobs:
labeler:
name: "Changeset size"
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: "Labeler"
uses: actions/labeler@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ jobs:
contents: write
steps:
- name: "Release"
uses: innofactororg/code-release@v1
uses: innofactororg/code-release@v2
with:
tag: ${{ github.event.inputs.tag }}
10 changes: 7 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:
- name: "Setup node"
uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 20

- name: "Checkout"
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: "Install dependencies"
run: npm ci
Expand All @@ -39,6 +39,9 @@ jobs:
- name: "Format check"
run: npm run format-check

- name: Audit npm for vulnerabilities
run: npm shrinkwrap && npm audit

- name: "Lint check"
run: npm run lint

Expand Down Expand Up @@ -66,6 +69,7 @@ jobs:
with:
name: dist
path: dist/

test:
name: "Test"
strategy:
Expand All @@ -75,7 +79,7 @@ jobs:
steps:
- name: "Checkout"
if: vars.TEST_GITHUB_APP_ID != ''
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: "Generate token"
id: generate_token
Expand Down
105 changes: 104 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,108 @@
__test__/_temp
_temp/
lib/
.vscode/
node_modules/

# https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets

# Local History for Visual Studio Code
.history/

# Built Visual Studio Code Extensions
*.vsix

# https://github.com/github/gitignore/blob/main/Global/MicrosoftOffice.gitignore
*.tmp

# Word temporary
~$*.doc*

# Word Auto Backup File
Backup of *.doc*

# Excel temporary
~$*.xls*

# Excel Backup File
*.xlk

# PowerPoint temporary
~$*.ppt*

# Visio autosave temporary files
*.~vsd*

# https://github.com/github/gitignore/blob/main/Global/Windows.gitignore
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk

# https://github.com/github/gitignore/blob/main/Global/macOS.gitignore
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

# https://github.com/github/gitignore/blob/main/Global/Linux.gitignore
*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*
12 changes: 12 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# See http://pre-commit.com for more information
# See http://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-case-conflict
- id: check-json
- id: check-yaml
- id: check-merge-conflict
args: ["--assume-in-merge"]
#- id: detect-private-key
Loading

0 comments on commit d802b4f

Please sign in to comment.