Skip to content

Commit

Permalink
refactor(ui/prettier): add prettier code formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
qwqcode committed Apr 14, 2024
1 parent 16527ec commit 915b5f4
Show file tree
Hide file tree
Showing 270 changed files with 4,626 additions and 5,716 deletions.
72 changes: 36 additions & 36 deletions .circleci/conditional_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ executors:
- image: cimg/base:stable
node:
docker:
- image: 'cimg/node:20.12.1'
- image: "cimg/node:20.12.1"
go:
docker:
- image: cimg/go:1.22.1
Expand All @@ -26,43 +26,43 @@ parameters:
jobs:
## Backend
test_app:
executor: go
working_directory: ~/go/src/github.com/ArtalkJS/Artalk
environment:
GO111MODULE: "on"
steps:
- checkout
- run:
name: "Print the Go version"
command: >
go version
- restore_cache:
keys:
- go-mod-1.22.1-{{ checksum "go.sum" }}
- run:
name: Install Dependencies
command: go mod download
- save_cache:
key: go-mod-1.22.1-{{ checksum "go.sum" }}
paths:
- "~/go/pkg/mod"
- run:
name: Run tests
command: |
mkdir -p /tmp/test-reports
gotestsum --junitfile /tmp/test-reports/unit-tests.xml -- -coverprofile=/tmp/test-reports/coverage.out ./...
- store_test_results:
path: /tmp/test-reports
- codecov/upload:
flags: go
file: /tmp/test-reports/coverage.out
executor: go
working_directory: ~/go/src/github.com/ArtalkJS/Artalk
environment:
GO111MODULE: "on"
steps:
- checkout
- run:
name: "Print the Go version"
command: >
go version
- restore_cache:
keys:
- go-mod-1.22.1-{{ checksum "go.sum" }}
- run:
name: Install Dependencies
command: go mod download
- save_cache:
key: go-mod-1.22.1-{{ checksum "go.sum" }}
paths:
- "~/go/pkg/mod"
- run:
name: Run tests
command: |
mkdir -p /tmp/test-reports
gotestsum --junitfile /tmp/test-reports/unit-tests.xml -- -coverprofile=/tmp/test-reports/coverage.out ./...
- store_test_results:
path: /tmp/test-reports
- codecov/upload:
flags: go
file: /tmp/test-reports/coverage.out

all_projects:
executor: base
steps:
- run:
command: |
echo "all"
executor: base
steps:
- run:
command: |
echo "all"
workflows:
build-app:
Expand Down
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ workflows:
mapping: |
(cmd|internal|server|pkg|test|conf)/.* trigger-app true
main.go|go.mod|go.sum trigger-app true
base-revision: master # git branch name
base-revision: master # git branch name
config-path: .circleci/conditional_config.yml
filters:
branches:
Expand Down
4 changes: 1 addition & 3 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ module.exports = {
settings: {
'import/resolver': {
typescript: {
project: ['ui/artalk/tsconfig.json'].map((p) =>
path.resolve(__dirname, p),
),
project: ['ui/artalk/tsconfig.json'].map((p) => path.resolve(__dirname, p)),
},
},
polyfills: ['AbortController'],
Expand Down
4 changes: 2 additions & 2 deletions .github/chglog/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ info:
title: CHANGELOG
repository_url: https://github.com/ArtalkJS/Artalk
options:
tag_filter_pattern: '^v'
sort: "date"
tag_filter_pattern: "^v"
sort: date
commits:
filters:
Type:
Expand Down
8 changes: 4 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ updates:
groups:
deps:
patterns:
- '*'
- "*"
open-pull-requests-limit: 15

- package-ecosystem: npm
Expand All @@ -39,7 +39,7 @@ updates:
groups:
deps:
patterns:
- '*'
- "*"
open-pull-requests-limit: 15

- package-ecosystem: docker
Expand All @@ -51,7 +51,7 @@ updates:
groups:
deps:
patterns:
- '*'
- "*"
open-pull-requests-limit: 15

- package-ecosystem: github-actions
Expand All @@ -63,5 +63,5 @@ updates:
groups:
deps:
patterns:
- '*'
- "*"
open-pull-requests-limit: 15
6 changes: 3 additions & 3 deletions .github/workflows/build-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ jobs:

- name: Setup git-chglog
run: |
curl -sL $(curl -s https://api.github.com/repos/git-chglog/git-chglog/releases/latest \
| grep -oP '"https://.+linux_amd64.tar.gz"' | tr -d \") | tar -C /usr/local/bin -xz git-chglog
git-chglog --version
curl -sL $(curl -s https://api.github.com/repos/git-chglog/git-chglog/releases/latest \
| grep -oP '"https://.+linux_amd64.tar.gz"' | tr -d \") | tar -C /usr/local/bin -xz git-chglog
git-chglog --version
- name: Pre Build
run: |-
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ run-name: Build Nightly

on:
schedule:
- cron: '0 10 * * *'
- cron: "0 10 * * *"
workflow_dispatch:
inputs:
dry_run:
description: 'Dry run'
description: "Dry run"
type: boolean
default: true

Expand Down Expand Up @@ -59,7 +59,7 @@ jobs:
with:
node-version: 20.x
registry-url: https://registry.npmjs.org/
cache: 'pnpm'
cache: "pnpm"

- name: Get pnpm store directory
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-tagging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
type: number
outputs:
version:
description: 'Version'
description: "Version"
value: ${{ jobs.tagging.outputs.version }}

jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
with:
node-version: 20.x
registry-url: https://registry.npmjs.org/
cache: 'pnpm'
cache: "pnpm"

- name: Install dependencies
run: pnpm install --frozen-lockfile
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ on:
workflow_dispatch:
inputs:
dry_run:
description: 'Dry run'
description: "Dry run"
type: boolean
default: true
build_items:
description: 'Build items'
description: "Build items"
type: string
default: 'ui,app,docker'
default: "ui,app,docker"

jobs:
# Tag the release version code before building
Expand Down Expand Up @@ -54,7 +54,11 @@ jobs:
# since docker push actions will override the previous images,
# so need to build `linux/amd64` and push first,
# then build `linux/amd64` twice with other archs (build very slow so keep it last).
target: ["linux/amd64", "linux/amd64,linux/arm64,linux/arm/v7"]
target:
- linux/amd64
- linux/amd64
- linux/arm64
- linux/arm/v7
with:
version: ${{ needs.tagging.outputs.version }}
dry_run: ${{ inputs.dry_run || false }}
Expand Down
69 changes: 36 additions & 33 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,18 @@
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
name: CodeQL

on:
push:
branches: [ "master" ]
branches:
- master
pull_request:
# The branches below must be a subset of the branches above
branches: [ "master" ]
branches:
- master
schedule:
- cron: '40 17 * * 4'
- cron: "40 17 * * 4"

jobs:
analyze:
Expand All @@ -32,43 +34,44 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'go', 'javascript' ]
language:
- go
- javascript
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

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

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v3

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v3
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
6 changes: 3 additions & 3 deletions .github/workflows/docs-cn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: Docs CN Mirror Deploy

on:
push:
branches: ['master']
paths: ['docs/**']
branches: ["master"]
paths: ["docs/**"]

jobs:
deploy:
Expand All @@ -20,7 +20,7 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
cache: pnpm

- name: Install dependencies
run: pnpm install
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
- major
required: true
dry_run:
description: 'Dry run?'
description: "Dry run?"
type: boolean
default: false

Expand Down Expand Up @@ -49,9 +49,9 @@ jobs:

- name: Setup git-chglog
run: |
curl -sL $(curl -s https://api.github.com/repos/git-chglog/git-chglog/releases/latest \
| grep -oP '"https://.+linux_amd64.tar.gz"' | tr -d \") | tar -C /usr/local/bin -xz git-chglog
git-chglog --version
curl -sL $(curl -s https://api.github.com/repos/git-chglog/git-chglog/releases/latest \
| grep -oP '"https://.+linux_amd64.tar.gz"' | tr -d \") | tar -C /usr/local/bin -xz git-chglog
git-chglog --version
- name: Version Changelog
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/repo-dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
type: string
description: Event Type
required: true
default: ''
default: ""

jobs:
release:
Expand Down
Loading

0 comments on commit 915b5f4

Please sign in to comment.