Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
razor-x committed Feb 19, 2023
0 parents commit ee14f83
Show file tree
Hide file tree
Showing 44 changed files with 8,266 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .c8rc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"exclude": [
"**/index.ts",
"src/server.ts",
"src/lib/config.ts",
"src/lib/daemon.ts",
"src/lib/logger.ts",
"package/**/*.ts",
"examples/**/*.ts",
"test/fixtures/**/*.ts",
"**/*.test.ts",
"**/*.spec.ts",
"ava.config.js"
],
"reporter": ["html", "lcov", "text"]
}
23 changes: 23 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
ARG VARIANT="18"

FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:${VARIANT}

RUN apt-get update \
&& apt-get install -y ca-certificates curl gnupg lsb-release \
&& mkdir -p /etc/apt/keyrings \
&& curl -fsSL https://download.docker.com/linux/ubuntu/gpg \
| gpg --dearmor -o /etc/apt/keyrings/docker.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu focal stable" \
| tee /etc/apt/sources.list.d/docker.list > /dev/null \
&& apt-get update \
&& apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin

RUN usermod -aG docker node

USER node
WORKDIR /home/node

RUN mkdir -p .config/git \
&& echo ".vscode/*" >> .config/git/ignore \
&& echo "*.code-workspace" >> .config/git/ignore \
&& echo ".history/" >> .config/git/ignore
26 changes: 26 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "Node.js TypeScript Server",
"build": {
"dockerfile": "Dockerfile",
"args": {
"VARIANT": "18"
}
},
"extensions": [
"ms-vsliveshare.vsliveshare",
"dbaeumer.vscode-eslint",
"ms-azuretools.vscode-docker",
"EditorConfig.EditorConfig",
"esbenp.prettier-vscode"
],
"forwardPorts": [3000, 4000, 8080],
"portsAttributes": {
"3000": { "label": "App" },
"4000": { "label": "App (test)" },
"8080": { "label": "App (production)" }
},
"runArgs": ["--volume=/var/lib/docker", "--privileged"],
"postCreateCommand": "npm install",
"postAttachCommand": "sudo service docker start",
"remoteUser": "node"
}
170 changes: 170 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
# Parts of this file were adapted from
# GitHub’s collection of .gitignore file templates
# which are Copyright (c) 2023 GitHub, Inc.
# and released under the MIT License.
# For more details, visit the project page:
# https://github.com/github/gitignore

# TypeScript build output
*.d.ts
*.js
*.js.map

# Build directories
package

# Environment versions file
.versions

# Tern
.tern-project
.tern-port

# npm config
.npmrc

# Temporary development files
tmp

# Yarn lockfile (only package-lock.json supported)
yarn.lock

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

# Docker exceptions
.devcontainer
.dockerignore
.editorconfig
.git
.github
.gitignore
Dockerfile
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2
54 changes: 54 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"root": true,
"extends": ["standard-with-typescript", "prettier"],
"parserOptions": {
"project": "./tsconfig.json"
},
"rules": {
"no-console": "warn",
"import/extensions": ["error", "ignorePackages"],
"@typescript-eslint/consistent-type-imports": [
"warn",
{
"fixStyle": "inline-type-imports"
}
],
"sort-imports": [
"error",
{
"ignoreDeclarationSort": true,
"allowSeparatedGroups": true
}
],
"import/no-duplicates": ["error", { "prefer-inline": true }],
"import/order": [
"error",
{
"newlines-between": "always",
"alphabetize": {
"order": "asc"
},
"groups": [
"builtin",
"external",
"internal",
"parent",
"sibling",
"index"
],
"pathGroupsExcludedImportTypes": ["builtin"],
"pathGroups": [
{
"pattern": "index.js",
"group": "internal",
"position": "before"
},
{
"pattern": "lib/**",
"group": "internal"
}
]
}
]
}
}
35 changes: 35 additions & 0 deletions .github/actions/setup-docker/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
name: Setup Docker
description: Setup Docker Buildx and container registry.

inputs:
registry_domain:
description: The Docker container registry domain.
required: true
registry_username:
description: The Docker container registry username.
required: true
registry_password:
description: The Docker container registry password.
required: true

runs:
using: composite
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Setup cache
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to Container Registry
uses: docker/login-action@v2
with:
registry: ${{ inputs.registry_domain }}
username: ${{ inputs.registry_username }}
password: ${{ inputs.registry_password }}
38 changes: 38 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Setup
description: Setup Node.js and install dependencies.

inputs:
node_version:
description: The Node.js version.
required: false
default: '18'
registry_url:
description: The Node.js package registry URL.
required: false
default: https://registry.npmjs.org
install_dependencies:
description: Install dependencies.
required: false
default: 'true'

runs:
using: composite
steps:
- name: Setup Node.js
uses: actions/setup-node@v3
if: inputs.install_dependencies == 'true'
with:
cache: npm
node-version: ${{ inputs.node_version }}
registry-url: ${{ inputs.registry_url }}
- name: Setup Node.js without cache
uses: actions/setup-node@v3
if: inputs.install_dependencies == 'false'
with:
node-version: ${{ inputs.node_version }}
registry-url: ${{ inputs.registry_url }}
- name: Install dependencies
if: inputs.install_dependencies == 'true'
shell: bash
run: npm ci
Loading

0 comments on commit ee14f83

Please sign in to comment.