Skip to content

Commit d699f9b

Browse files
authored
feat(scripts): add scripts, packages, components, and config files (#2)
1 parent 76b6122 commit d699f9b

24 files changed

Lines changed: 11518 additions & 10 deletions

.editorconfig

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

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Enforce Unix newlines
2+
* text=auto eol=lf

.github/dependabot.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: '/'
5+
schedule:
6+
interval: monthly
7+
commit-message:
8+
prefix: meta
9+
cooldown:
10+
default-days: 3
11+
open-pull-requests-limit: 10
12+
13+
- package-ecosystem: npm
14+
directory: '/'
15+
versioning-strategy: increase
16+
schedule:
17+
interval: monthly
18+
commit-message:
19+
prefix: meta
20+
cooldown:
21+
default-days: 3
22+
open-pull-requests-limit: 10

.github/workflows/ci.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Security Notes
2+
# Only selected Actions are allowed within this repository. Please refer to (https://github.com/nodejs/nodejs.org/settings/actions)
3+
# for the full list of available actions. If you want to add a new one, please reach out a maintainer with Admin permissions.
4+
# REVIEWERS, please always double-check security practices before merging a PR that contains workflow changes!!
5+
# AUTHORS, please only use actions with explicit SHA references, and avoid using `@master` or `@main` references or `@version` tags.
6+
7+
name: Linting and Tests
8+
9+
# This workflow should run either on `merge_group`, `pull_request`, or `push` events
10+
# since we want to run lint checks against any changes on pull requests, or the final patch on merge groups
11+
# or if direct pushes happen to main (or when changes in general land on the `main` (default) branch)
12+
# Note that the reason why we run this on pushes against `main` is that on rare cases, maintainers might do direct pushes against `main`
13+
14+
on:
15+
push:
16+
branches:
17+
- main
18+
pull_request:
19+
branches:
20+
- main
21+
types: [opened, synchronize, reopened, ready_for_review]
22+
merge_group:
23+
24+
# The permissions specified below apply to workflows triggered by `merge_group`, `push`, and `pull_request` events that originate from the same repository (non-fork).
25+
# However, workflows triggered by `pull_request` events from forked repositories are treated differently for security reasons:
26+
# - These workflows **do not** have access to any secrets configured in the repository.
27+
# - They are also **not granted any permissions** to perform actions on the base repository.
28+
#
29+
# This is a deliberate security restriction designed to prevent potential abuse through malicious pull requests from forks.
30+
# For a deeper explanation and best practices for securing your GitHub Actions workflows, particularly against so-called "pwn requests",
31+
# refer to https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/
32+
permissions:
33+
contents: read
34+
actions: read
35+
36+
jobs:
37+
lint:
38+
name: Quality checks
39+
runs-on: ubuntu-latest
40+
41+
steps:
42+
- name: Checkout code
43+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
44+
45+
- name: Setup Node.js
46+
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
47+
with:
48+
node-version: lts/*
49+
cache: 'npm'
50+
51+
- name: Install dependencies
52+
run: npm ci
53+
54+
- name: Run quality checks
55+
run: node --run lint:fix && node --run format:check

.github/workflows/deploy.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Deploy
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [main]
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
# Build job
13+
build:
14+
# Specify runner + build & upload the static files as an artifact
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
22+
with:
23+
node-version: lts/*
24+
cache: 'npm'
25+
26+
- name: Install dependencies
27+
run: npm ci
28+
29+
- name: Build
30+
run: mkdir out && npm run build
31+
32+
- name: Upload static files as artifact
33+
uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4.0.0
34+
with:
35+
path: out/
36+
37+
deploy:
38+
needs: build
39+
40+
permissions:
41+
pages: write
42+
id-token: write
43+
44+
environment:
45+
name: github-pages
46+
url: ${{ steps.deployment.outputs.page_url }}
47+
48+
runs-on: ubuntu-latest
49+
steps:
50+
- name: Deploy to GitHub Pages
51+
id: deployment
52+
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
out
3+
components/config.json

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx lint-staged

.lintstagedrc.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"**/*.{js,mjs,ts,tsx,md,mdx,json.yml}": [
3+
"eslint --fix",
4+
"prettier --check --write"
5+
]
6+
}

.nvmrc

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

.prettierrc.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"tabWidth": 2,
3+
"useTabs": false,
4+
"semi": true,
5+
"singleQuote": true,
6+
"jsxSingleQuote": false,
7+
"trailingComma": "es5",
8+
"bracketSpacing": true,
9+
"bracketSameLine": false,
10+
"arrowParens": "avoid"
11+
}

0 commit comments

Comments
 (0)