Skip to content

Commit

Permalink
feat: v1
Browse files Browse the repository at this point in the history
  • Loading branch information
book000 committed Oct 7, 2024
1 parent fb1de14 commit 33c604b
Show file tree
Hide file tree
Showing 19 changed files with 5,203 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .depcheckrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"ignores": [
"@types/node",
"run-z",
"eslint-config-standard",
"eslint-plugin-import",
"eslint-plugin-n",
"eslint-plugin-promise",
"typescript-json-schema"
]
}
50 changes: 50 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"name": "samechan-vrchat-gacha",
"image": "mcr.microsoft.com/devcontainers/typescript-node:0-18",
"remoteUser": "node",
"otherPortsAttributes": {
"onAutoForward": "silent"
},
"postCreateCommand": "sudo npm uninstall -g pnpm yarn && sudo chown node node_modules .pnpm-store && sudo corepack enable && corepack install && install",
"waitFor": "postStartCommand",
"mounts": [
"source=${localWorkspaceFolderBasename}-node_modules,target=${containerWorkspaceFolder}/node_modules,type=volume",
"source=pnpm-store,target=${containerWorkspaceFolder}/.pnpm-store,type=volume"
],
"customizations": {
"settings": {
"editor.formatOnSave": true,
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.organizeImports": false
}
},
"git.branchProtection": [
"main",
"master"
]
},
"extensions": [
"esbenp.prettier-vscode"
],
"vscode": {
"settings": {
"editor.formatOnSave": true,
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.organizeImports": false
}
},
"git.branchProtection": [
"main",
"master"
]
},
"extensions": [
"esbenp.prettier-vscode"
]
}
}
}
54 changes: 54 additions & 0 deletions .fixpackrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"sortToTop": [
"name",
"version",
"description",
"keywords",
"homepage",
"bugs",
"license",
"author",
"private",
"files",
"main",
"types",
"bin",
"man",
"directories",
"repository",
"scripts",
"config",
"dependencies",
"devDependencies",
"peerDependencies",
"bundledDependencies",
"optionalDependencies",
"engines",
"os",
"cpu",
"private",
"publishConfig"
],
"required": [
"name",
"version"
],
"warn": [
"description",
"homepage",
"bugs",
"license",
"author",
"main",
"repository"
],
"sortedSubItems": [
"files",
"directories",
"dependencies",
"devDependencies",
"peerDependencies",
"bundledDependencies",
"optionalDependencies"
]
}
18 changes: 18 additions & 0 deletions .github/workflows/nodejs-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Node.js でビルド・テストを実行する。バージョンは .node-version に記載されているものを利用する

name: Node CI

on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master

jobs:
node-ci:
name: Node CI
uses: book000/templates/.github/workflows/reusable-nodejs-ci.yml@master
97 changes: 97 additions & 0 deletions .github/workflows/update-tweet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Update tweet

on:
workflow_dispatch:
push:
branches:
- main
- master
paths:
- '**/*.ts'
schedule:
- cron: '0 * * * *'

jobs:
update-tweet:
runs-on: ubuntu-latest

steps:
- name: 🛎 Checkout
uses: actions/checkout@v4

- name: 🏗 Setup node
uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: yarn
cache-dependency-path: yarn.lock

- name: Install apt dependencies
uses: nick-fields/retry@v3
with:
max_attempts: 3
retry_on: error
timeout_minutes: 30
command: |
sudo apt-get update
sudo apt-get install -y curl fontconfig fonts-noto-cjk
fc-cache -fv
sudo apt-get install -y chromium-browser libnss3 libfreetype6 libfreetype6-dev libharfbuzz-bin ca-certificates fonts-freefont-ttf nodejs xvfb xauth dbus dbus-x11
- name: Install nodejs dependencies
run: yarn

- name: Update Tweet
id: update-tweet
run: |
rm /tmp/.X*-lock || true
rm -rf data/userdata/Singleton* || true
Xvfb :99 -ac -screen 0 600x1000x16 -listen tcp &
export DISPLAY=:99
yarn build
kill -9 "$(pgrep -f "Xvfb" | awk '{print $2}')" || true
env:
TWITTER_USERNAME: ${{ secrets.TWITTER_USERNAME }}
TWITTER_PASSWORD: ${{ secrets.TWITTER_PASSWORD }}
TWITTER_AUTH_CODE_SECRET: ${{ secrets.TWITTER_AUTH_CODE_SECRET }}
TWITTER_EMAIL_ADDRESS: ${{ secrets.TWITTER_EMAIL_ADDRESS }}
PROXY_SERVER: ${{ secrets.PROXY_SERVER }}
PROXY_USERNAME: ${{ secrets.PROXY_USERNAME }}
PROXY_PASSWORD: ${{ secrets.PROXY_PASSWORD }}

- name: Error handling
if: failure()
uses: Ilshidur/[email protected]
with:
args: ''
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
DISCORD_EMBEDS: |
[
{
"title": "Tweet Update Failed",
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
"color": 16711680
}
]
- name: Upload Pages-artifact
uses: actions/upload-pages-artifact@v3
if: always()
with:
path: output

deploy:
runs-on: ubuntu-latest
needs: update-tweet
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
134 changes: 134 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
# 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.*

# pnpm
.pnpm-store
data/
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20.16.0
12 changes: 12 additions & 0 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
printWidth: 80
tabWidth: 2
useTabs: false
semi: false
quoteProps: 'as-needed'
singleQuote: true
jsxSingleQuote: true
trailingComma: 'es5'
bracketSpacing: true
bracketSameLine: true
arrowParens: 'always'
endOfLine: lf
Loading

0 comments on commit 33c604b

Please sign in to comment.