Skip to content

Commit 2d03b3f

Browse files
committed
Initial commit
0 parents  commit 2d03b3f

Some content is hidden

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

41 files changed

+6654
-0
lines changed

.c8rc.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"exclude": [
3+
"**/index.js",
4+
"server.js",
5+
"lib/config.js",
6+
"lib/daemon.js",
7+
"lib/logger.js",
8+
"package/**/*.js",
9+
"examples/**/*.js",
10+
"test/fixtures/**/*.js",
11+
"**/*.test.js",
12+
"**/*.spec.js",
13+
"ava.config.js"
14+
],
15+
"reporter": ["html", "lcov", "text"]
16+
}

.devcontainer/Dockerfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
ARG VARIANT="18"
2+
3+
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:${VARIANT}
4+
5+
RUN apt-get update \
6+
&& apt-get install -y ca-certificates curl gnupg lsb-release \
7+
&& mkdir -p /etc/apt/keyrings \
8+
&& curl -fsSL https://download.docker.com/linux/ubuntu/gpg \
9+
| gpg --dearmor -o /etc/apt/keyrings/docker.gpg \
10+
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu focal stable" \
11+
| tee /etc/apt/sources.list.d/docker.list > /dev/null \
12+
&& apt-get update \
13+
&& apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
14+
15+
RUN usermod -aG docker node
16+
17+
USER node
18+
WORKDIR /home/node
19+
20+
RUN mkdir -p .config/git \
21+
&& echo ".vscode/*" >> .config/git/ignore \
22+
&& echo "*.code-workspace" >> .config/git/ignore \
23+
&& echo ".history/" >> .config/git/ignore

.devcontainer/devcontainer.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"name": "Node.js",
3+
"build": {
4+
"dockerfile": "Dockerfile",
5+
"args": {
6+
"VARIANT": "18"
7+
}
8+
},
9+
"extensions": [
10+
"ms-vsliveshare.vsliveshare",
11+
"dbaeumer.vscode-eslint",
12+
"ms-azuretools.vscode-docker",
13+
"EditorConfig.EditorConfig",
14+
"esbenp.prettier-vscode"
15+
],
16+
"forwardPorts": [3000, 4000, 8080],
17+
"portsAttributes": {
18+
"3000": { "label": "App" },
19+
"4000": { "label": "App (test)" },
20+
"8080": { "label": "App (production)" }
21+
},
22+
"runArgs": ["--volume=/var/lib/docker", "--privileged"],
23+
"postCreateCommand": "npm install",
24+
"postAttachCommand": "sudo service docker start",
25+
"remoteUser": "node"
26+
}

.dockerignore

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
# Parts of this file were adapted from
2+
# GitHub’s collection of .gitignore file templates
3+
# which are Copyright (c) 2023 GitHub, Inc.
4+
# and released under the MIT License.
5+
# For more details, visit the project page:
6+
# https://github.com/github/gitignore
7+
8+
# Build directories
9+
package
10+
11+
# Environment versions file
12+
.versions
13+
14+
# Tern
15+
.tern-project
16+
.tern-port
17+
18+
# npm config
19+
.npmrc
20+
21+
# Temporary development files
22+
tmp
23+
24+
# Yarn lockfile (only package-lock.json supported)
25+
yarn.lock
26+
27+
# Logs
28+
logs
29+
*.log
30+
npm-debug.log*
31+
yarn-debug.log*
32+
yarn-error.log*
33+
lerna-debug.log*
34+
.pnpm-debug.log*
35+
36+
# Diagnostic reports (https://nodejs.org/api/report.html)
37+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
38+
39+
# Runtime data
40+
pids
41+
*.pid
42+
*.seed
43+
*.pid.lock
44+
45+
# Directory for instrumented libs generated by jscoverage/JSCover
46+
lib-cov
47+
48+
# Coverage directory used by tools like istanbul
49+
coverage
50+
*.lcov
51+
52+
# nyc test coverage
53+
.nyc_output
54+
55+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
56+
.grunt
57+
58+
# Bower dependency directory (https://bower.io/)
59+
bower_components
60+
61+
# node-waf configuration
62+
.lock-wscript
63+
64+
# Compiled binary addons (https://nodejs.org/api/addons.html)
65+
build/Release
66+
67+
# Dependency directories
68+
node_modules/
69+
jspm_packages/
70+
71+
# Snowpack dependency directory (https://snowpack.dev/)
72+
web_modules/
73+
74+
# TypeScript cache
75+
*.tsbuildinfo
76+
77+
# Optional npm cache directory
78+
.npm
79+
80+
# Optional eslint cache
81+
.eslintcache
82+
83+
# Optional stylelint cache
84+
.stylelintcache
85+
86+
# Microbundle cache
87+
.rpt2_cache/
88+
.rts2_cache_cjs/
89+
.rts2_cache_es/
90+
.rts2_cache_umd/
91+
92+
# Optional REPL history
93+
.node_repl_history
94+
95+
# Output of 'npm pack'
96+
*.tgz
97+
98+
# Yarn Integrity file
99+
.yarn-integrity
100+
101+
# dotenv environment variable files
102+
.env
103+
.env.development.local
104+
.env.test.local
105+
.env.production.local
106+
.env.local
107+
108+
# parcel-bundler cache (https://parceljs.org/)
109+
.cache
110+
.parcel-cache
111+
112+
# Next.js build output
113+
.next
114+
out
115+
116+
# Nuxt.js build / generate output
117+
.nuxt
118+
dist
119+
120+
# Gatsby files
121+
.cache/
122+
# Comment in the public line in if your project uses Gatsby and not Next.js
123+
# https://nextjs.org/blog/next-9-1#public-directory-support
124+
# public
125+
126+
# vuepress build output
127+
.vuepress/dist
128+
129+
# vuepress v2.x temp and cache directory
130+
.temp
131+
.cache
132+
133+
# Docusaurus cache and generated files
134+
.docusaurus
135+
136+
# Serverless directories
137+
.serverless/
138+
139+
# FuseBox cache
140+
.fusebox/
141+
142+
# DynamoDB Local files
143+
.dynamodb/
144+
145+
# TernJS port file
146+
.tern-port
147+
148+
# Stores VSCode versions used for testing VSCode extensions
149+
.vscode-test
150+
151+
# yarn v2
152+
.yarn/cache
153+
.yarn/unplugged
154+
.yarn/build-state.yml
155+
.yarn/install-state.gz
156+
.pnp.*
157+
158+
# Docker exceptions
159+
.devcontainer
160+
.dockerignore
161+
.editorconfig
162+
.git
163+
.github
164+
.gitignore
165+
Dockerfile

.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
trim_trailing_whitespace = true
8+
indent_style = space
9+
indent_size = 2

.eslintrc.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"root": true,
3+
"extends": ["standard", "prettier"],
4+
"rules": {
5+
"no-console": "warn",
6+
"import/extensions": ["error", "ignorePackages"],
7+
"sort-imports": [
8+
"error",
9+
{
10+
"ignoreDeclarationSort": true,
11+
"allowSeparatedGroups": true
12+
}
13+
],
14+
"import/order": [
15+
"error",
16+
{
17+
"newlines-between": "always",
18+
"alphabetize": {
19+
"order": "asc"
20+
}
21+
}
22+
]
23+
}
24+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
name: Setup Docker
3+
description: Setup Docker Buildx and container registry.
4+
5+
inputs:
6+
registry_domain:
7+
description: The Docker container registry domain.
8+
required: true
9+
registry_username:
10+
description: The Docker container registry username.
11+
required: true
12+
registry_password:
13+
description: The Docker container registry password.
14+
required: true
15+
16+
runs:
17+
using: composite
18+
steps:
19+
- name: Set up QEMU
20+
uses: docker/setup-qemu-action@v2
21+
- name: Set up Docker Buildx
22+
uses: docker/setup-buildx-action@v2
23+
- name: Setup cache
24+
uses: actions/cache@v3
25+
with:
26+
path: /tmp/.buildx-cache
27+
key: ${{ runner.os }}-buildx-${{ github.sha }}
28+
restore-keys: |
29+
${{ runner.os }}-buildx-
30+
- name: Login to Container Registry
31+
uses: docker/login-action@v2
32+
with:
33+
registry: ${{ inputs.registry_domain }}
34+
username: ${{ inputs.registry_username }}
35+
password: ${{ inputs.registry_password }}

.github/actions/setup/action.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
name: Setup
3+
description: Setup Node.js and install dependencies.
4+
5+
inputs:
6+
node_version:
7+
description: The Node.js version.
8+
required: false
9+
default: '18'
10+
registry_url:
11+
description: The Node.js package registry URL.
12+
required: false
13+
default: https://registry.npmjs.org
14+
install_dependencies:
15+
description: Install dependencies.
16+
required: false
17+
default: 'true'
18+
19+
runs:
20+
using: composite
21+
steps:
22+
- name: Setup Node.js
23+
uses: actions/setup-node@v3
24+
if: inputs.install_dependencies == 'true'
25+
with:
26+
cache: npm
27+
node-version: ${{ inputs.node_version }}
28+
registry-url: ${{ inputs.registry_url }}
29+
- name: Setup Node.js without cache
30+
uses: actions/setup-node@v3
31+
if: inputs.install_dependencies == 'false'
32+
with:
33+
node-version: ${{ inputs.node_version }}
34+
registry-url: ${{ inputs.registry_url }}
35+
- name: Install dependencies
36+
if: inputs.install_dependencies == 'true'
37+
shell: bash
38+
run: npm ci

.github/workflows/_build.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
name: _build
3+
4+
on:
5+
workflow_call:
6+
outputs:
7+
artifact_name:
8+
description: The artifact name.
9+
value: build-${{ github.sha }}
10+
11+
jobs:
12+
build:
13+
name: Package
14+
runs-on: ubuntu-latest
15+
timeout-minutes: 30
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v3
19+
- name: Setup
20+
uses: ./.github/actions/setup
21+
- name: Package
22+
run: npm pack
23+
- name: Upload artifact
24+
uses: actions/upload-artifact@v3
25+
with:
26+
name: build-${{ github.sha }}
27+
if-no-files-found: error
28+
path: '*.tgz'

0 commit comments

Comments
 (0)