Skip to content

Commit

Permalink
feat: v1
Browse files Browse the repository at this point in the history
  • Loading branch information
tranhl committed Mar 24, 2024
1 parent 953ca43 commit 78bbce2
Show file tree
Hide file tree
Showing 33 changed files with 10,565 additions and 2 deletions.
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
20 changes: 20 additions & 0 deletions .editorconfig-checker
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"Version": "v3.0.0",
"Verbose": false,
"Format": "",
"Debug": false,
"IgnoreDefaults": false,
"SpacesAftertabs": false,
"NoColor": false,
"Exclude": [],
"AllowedContentTypes": [],
"PassedFiles": [],
"Disable": {
"EndOfLine": false,
"Indentation": false,
"InsertFinalNewline": false,
"TrimTrailingWhitespace": false,
"IndentSize": false,
"MaxLineLength": false
}
}
38 changes: 38 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
const { resolve } = require('node:path')

const project = resolve(process.cwd(), 'tsconfig.json')

/** @type {import("eslint").Linter.Config} */
module.exports = {
root: true,
env: {
jest: false,
},
ignorePatterns: [".eslintrc.cjs"],
extends: [
require.resolve('@vercel/style-guide/eslint/node'),
require.resolve('@vercel/style-guide/eslint/typescript'),
'plugin:prettier/recommended'
],
parserOptions: {
project,
},
settings: {
'import/resolver': {
typescript: {
project
},
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx']
}
}
},
rules: {
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
'@typescript-eslint/no-shadow': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/array-type': ['error', { default: 'array-simple' }],
'@typescript-eslint/require-await': 'off',
'import/no-extraneous-dependencies': 'off'
}
};
14 changes: 14 additions & 0 deletions .git-branches.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Git Town configuration file

push-hook = true
push-new-branches = false
ship-delete-tracking-branch = false
sync-before-ship = false
sync-upstream = true

[branches]
main = "main"

[sync-strategy]
feature-branches = "merge"
perennial-branches = "rebase"
16 changes: 16 additions & 0 deletions .github/actions/setup-env/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Setup Env
description: Setup Node.js and install dependencies

runs:
using: composite
steps:
- name: Setup Node.js
id: setup-node
uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: npm

- name: Install Dependencies
id: install
run: npm ci
26 changes: 26 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
groups:
actions-minor:
update-types:
- minor
- patch

- package-ecosystem: npm
directory: /
schedule:
interval: weekly
groups:
npm-development:
dependency-type: development
update-types:
- minor
- patch
npm-production:
dependency-type: production
update-types:
- patch
3 changes: 3 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Stack

<!-- branch-stack -->
60 changes: 60 additions & 0 deletions .github/workflows/check-dist.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# In TypeScript actions, `dist/` is a special directory. When you reference
# an action with the `uses:` property, `dist/index.js` is the code that will be
# run. For this project, the `dist/index.js` file is transpiled from other
# source files. This workflow ensures the `dist/` directory contains the
# expected transpiled code.
#
# If this workflow is run from a feature branch, it will act as an additional CI
# check and fail if the checked-in `dist/` directory does not match what is
# expected from the build.
name: Check Transpiled JavaScript

on:
pull_request:
branches:
- '**'
push:
branches:
- main

concurrency:
group: check-dist-${{ github.sha }}
cancel-in-progress: true

permissions:
contents: read

jobs:
check-dist:
name: Check dist/
runs-on: ubuntu-latest

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

- name: Setup Env
id: setup-env
uses: ./.github/actions/setup-env

- name: Build dist/ Directory
id: build
run: npm run build

- name: Compare Directories
id: diff
run: |
if [ "$(git diff --ignore-space-at-eol --text dist/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
git diff --ignore-space-at-eol --text dist/
exit 1
fi
- if: ${{ failure() && steps.diff.outcome == 'failure' }}
name: Upload Artifact
id: upload
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
69 changes: 69 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: CI

on:
pull_request:
branches:
- '**'
push:
branches:
- 'main'

concurrency:
group: ci-${{ github.sha }}
cancel-in-progress: true

permissions:
contents: read

jobs:
eslint:
name: Lint - ESLint
runs-on: ubuntu-latest

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

- name: Setup Env
id: setup-env
uses: ./.github/actions/setup-env

- name: Lint
id: lint
run: |
npm run lint:eslint
editorconfig:
name: Lint - EditorConfig
runs-on: ubuntu-latest

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

- name: Setup Env
id: setup-env
uses: ./.github/actions/setup-env

- name: Lint
id: lint
run: npm run lint:ec

tests:
name: Tests
runs-on: ubuntu-latest

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

- name: Setup Env
id: setup-env
uses: ./.github/actions/setup-env

- name: Tests
id: tests
run: npm run test:ci
48 changes: 48 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: CodeQL

on:
pull_request:
branches:
- '**'
push:
branches:
- main
schedule:
- cron: '31 7 * * 3'

concurrency:
group: codeql-${{ github.sha }}
cancel-in-progress: true

permissions:
actions: read
checks: write
contents: read
security-events: write

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
language:
- TypeScript

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

- name: Initialize CodeQL
id: initialize
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
source-root: src

- name: Perform CodeQL Analysis
id: analyze
uses: github/codeql-action/analyze@v3
24 changes: 24 additions & 0 deletions .github/workflows/git-town.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Git Town

on:
pull_request:
branches:
- '**'

concurrency:
group: git-town-${{ github.sha }}
cancel-in-progress: true

jobs:
branch-stack:
name: Display the Branch Stack
runs-on: ubuntu-latest

permissions:
contents: read
pull-requests: write

steps:
- uses: actions/checkout@v4
- name: Git Town
uses: ./
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
!dist
node_modules
.DS_Store
3 changes: 3 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
npm exec lint-staged
npm run lint:ec
npm run test:ci
3 changes: 3 additions & 0 deletions .lintstagedrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
"src/**/*.{ts,tsx}": "npm exec eslint --fix --max-warnings=0"
}
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20.6.0
14 changes: 14 additions & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/** @type {import("prettier").Config} */
module.exports = {
experimentalTernaries: true,
printWidth: 90,
tabWidth: 2,
useTabs: false,
semi: false,
singleQuote: true,
quoteProps: 'as-needed',
trailingComma: 'es5',
arrowParens: 'always',
endOfLine: 'lf',
singleAttributePerLine: false
}
20 changes: 20 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# How to contribute

We invite everybody to help make Git Town better. Every contribution is welcome,
no matter how big or small.

#### I want to report a bug or need a feature

please [open an issue](https://github.com/git-town/action/issues/new)

#### I want to fix a bug or add a feature

- see our [developer guidelines](DEVELOPMENT.md) to get started
- if you plan a larger change or need guidance, connect with the maintainers by
[opening an issue](https://github.com/git-town/action/issues/new)
- otherwise, hack away and
[send a pull request](https://help.github.com/articles/using-pull-requests)

#### I want to say thank you

Please star this repo on GitHub and tweet or blog about us!
Loading

0 comments on commit 78bbce2

Please sign in to comment.