generated from scandar/typescript-action-vitest
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c941c6a
Showing
37 changed files
with
34,871 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"name": "GitHub Actions (TypeScript)", | ||
"image": "mcr.microsoft.com/devcontainers/typescript-node:20", | ||
"postCreateCommand": "npm install", | ||
"customizations": { | ||
"codespaces": { | ||
"openFiles": ["README.md"] | ||
}, | ||
"vscode": { | ||
"extensions": [ | ||
"bierner.markdown-preview-github-styles", | ||
"davidanson.vscode-markdownlint", | ||
"dbaeumer.vscode-eslint", | ||
"esbenp.prettier-vscode", | ||
"github.copilot", | ||
"github.copilot-chat", | ||
"github.vscode-github-actions", | ||
"github.vscode-pull-request-github", | ||
"me-dutour-mathieu.vscode-github-actions", | ||
"redhat.vscode-yaml", | ||
"rvest.vs-code-prettier-eslint", | ||
"yzhang.markdown-all-in-one" | ||
], | ||
"settings": { | ||
"editor.defaultFormatter": "esbenp.prettier-vscode", | ||
"editor.tabSize": 2, | ||
"editor.formatOnSave": true, | ||
"markdown.extension.list.indentationSize": "adaptive", | ||
"markdown.extension.italic.indicator": "_", | ||
"markdown.extension.orderedList.marker": "one" | ||
} | ||
} | ||
}, | ||
"remoteEnv": { | ||
"GITHUB_TOKEN": "${localEnv:GITHUB_TOKEN}" | ||
}, | ||
"features": { | ||
"ghcr.io/devcontainers/features/github-cli:1": {}, | ||
"ghcr.io/devcontainers-contrib/features/prettier:1": {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Do not commit your actual .env file to Git! This may contain secrets or other | ||
# private information. | ||
|
||
# Enable/disable step debug logging (default: `false`). For local debugging, it | ||
# may be useful to set it to `true`. | ||
ACTIONS_STEP_DEBUG=true | ||
|
||
# GitHub Actions inputs should follow `INPUT_<name>` format (case-sensitive). | ||
# Hyphens should not be converted to underscores! | ||
INPUT_MILLISECONDS=2400 | ||
|
||
# GitHub Actions default environment variables. These are set for every run of a | ||
# workflow and can be used in your actions. Setting the value here will override | ||
# any value set by the local-action tool. | ||
# https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables | ||
|
||
# CI="true" | ||
# GITHUB_ACTION="" | ||
# GITHUB_ACTION_PATH="" | ||
# GITHUB_ACTION_REPOSITORY="" | ||
# GITHUB_ACTIONS="" | ||
# GITHUB_ACTOR="" | ||
# GITHUB_ACTOR_ID="" | ||
# GITHUB_API_URL="" | ||
# GITHUB_BASE_REF="" | ||
# GITHUB_ENV="" | ||
# GITHUB_EVENT_NAME="" | ||
# GITHUB_EVENT_PATH="" | ||
# GITHUB_GRAPHQL_URL="" | ||
# GITHUB_HEAD_REF="" | ||
# GITHUB_JOB="" | ||
# GITHUB_OUTPUT="" | ||
# GITHUB_PATH="" | ||
# GITHUB_REF="" | ||
# GITHUB_REF_NAME="" | ||
# GITHUB_REF_PROTECTED="" | ||
# GITHUB_REF_TYPE="" | ||
# GITHUB_REPOSITORY="" | ||
# GITHUB_REPOSITORY_ID="" | ||
# GITHUB_REPOSITORY_OWNER="" | ||
# GITHUB_REPOSITORY_OWNER_ID="" | ||
# GITHUB_RETENTION_DAYS="" | ||
# GITHUB_RUN_ATTEMPT="" | ||
# GITHUB_RUN_ID="" | ||
# GITHUB_RUN_NUMBER="" | ||
# GITHUB_SERVER_URL="" | ||
# GITHUB_SHA="" | ||
# GITHUB_STEP_SUMMARY="" | ||
# GITHUB_TRIGGERING_ACTOR="" | ||
# GITHUB_WORKFLOW="" | ||
# GITHUB_WORKFLOW_REF="" | ||
# GITHUB_WORKFLOW_SHA="" | ||
# GITHUB_WORKSPACE="" | ||
# RUNNER_ARCH="" | ||
# RUNNER_DEBUG="" | ||
# RUNNER_NAME="" | ||
# RUNNER_OS="" | ||
# RUNNER_TEMP="" | ||
# RUNNER_TOOL_CACHE="" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
* text=auto eol=lf | ||
|
||
dist/** -diff linguist-generated=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Unordered list style | ||
MD004: | ||
style: dash | ||
|
||
# Ordered list item prefix | ||
MD029: | ||
style: one | ||
|
||
# Spaces after list markers | ||
MD030: | ||
ul_single: 1 | ||
ol_single: 1 | ||
ul_multi: 1 | ||
ol_multi: 1 | ||
|
||
# Code block style | ||
MD046: | ||
style: fenced |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
rules: | ||
document-end: disable | ||
document-start: | ||
level: warning | ||
present: false | ||
line-length: | ||
level: warning | ||
max: 80 | ||
allow-non-breakable-words: true | ||
allow-non-breakable-inline-mappings: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
import { FlatCompat } from '@eslint/eslintrc' | ||
import js from '@eslint/js' | ||
import typescriptEslint from '@typescript-eslint/eslint-plugin' | ||
import tsParser from '@typescript-eslint/parser' | ||
import vitest from '@vitest/eslint-plugin' | ||
import globals from 'globals' | ||
import path from 'node:path' | ||
import { fileURLToPath } from 'node:url' | ||
|
||
const __filename = fileURLToPath(import.meta.url) | ||
const __dirname = path.dirname(__filename) | ||
const compat = new FlatCompat({ | ||
baseDirectory: __dirname, | ||
recommendedConfig: js.configs.recommended, | ||
allConfig: js.configs.all | ||
}) | ||
|
||
export default [ | ||
{ | ||
ignores: [ | ||
'!**/.*', | ||
'node_modules', | ||
'dist', | ||
'coverage', | ||
'lib', | ||
'**/*.json', | ||
'eslint.config.mjs', | ||
'vitest.config.mjs', | ||
'dist/**/*.ts', | ||
'dist/**', | ||
'**/*.mjs', | ||
'**/*.js' | ||
] | ||
}, | ||
...compat.extends( | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/recommended-type-checked' | ||
), | ||
{ | ||
plugins: { | ||
'@typescript-eslint': typescriptEslint | ||
}, | ||
|
||
languageOptions: { | ||
globals: { | ||
...globals.node, | ||
Atomics: 'readonly', | ||
SharedArrayBuffer: 'readonly' | ||
}, | ||
|
||
parser: tsParser, | ||
ecmaVersion: 2023, | ||
sourceType: 'module', | ||
|
||
parserOptions: { | ||
project: ['./.github/linters/tsconfig.json', './tsconfig.json'] | ||
} | ||
}, | ||
|
||
rules: { | ||
camelcase: 'off', | ||
'eslint-comments/no-use': 'off', | ||
'eslint-comments/no-unused-disable': 'off', | ||
'i18n-text/no-en': 'off', | ||
'import/no-namespace': 'off', | ||
'no-console': 'off', | ||
semi: 'off', | ||
'@typescript-eslint/array-type': 'error', | ||
'@typescript-eslint/consistent-type-assertions': 'error', | ||
|
||
'@typescript-eslint/explicit-member-accessibility': [ | ||
'error', | ||
{ | ||
accessibility: 'no-public' | ||
} | ||
], | ||
|
||
'@typescript-eslint/explicit-function-return-type': [ | ||
'error', | ||
{ | ||
allowExpressions: true | ||
} | ||
], | ||
|
||
'@typescript-eslint/no-empty-interface': 'error', | ||
'@typescript-eslint/no-extraneous-class': 'error', | ||
'@typescript-eslint/no-inferrable-types': 'error', | ||
'@typescript-eslint/no-non-null-assertion': 'warn', | ||
'@typescript-eslint/no-unnecessary-qualifier': 'error', | ||
'@typescript-eslint/no-useless-constructor': 'error', | ||
'@typescript-eslint/no-var-requires': 'error', | ||
'@typescript-eslint/prefer-for-of': 'warn', | ||
'@typescript-eslint/prefer-function-type': 'warn', | ||
'@typescript-eslint/prefer-includes': 'error', | ||
'@typescript-eslint/prefer-string-starts-ends-with': 'error', | ||
'@typescript-eslint/promise-function-async': 'error', | ||
'@typescript-eslint/require-array-sort-compare': 'error', | ||
'@typescript-eslint/space-before-function-paren': 'off' | ||
} | ||
}, | ||
{ | ||
files: ['__tests__/**'], | ||
plugins: { | ||
vitest | ||
}, | ||
rules: { | ||
...vitest.configs.recommended.rules, // you can also use vitest.configs.all.rules to enable all rules | ||
'vitest/max-nested-describe': ['error', { max: 3 }] // you can also modify rules' behavior using option like this | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/tsconfig", | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"noEmit": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# 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: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
check-dist: | ||
name: Check dist/ | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
id: checkout | ||
uses: actions/checkout@v4 | ||
|
||
- 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 | ||
|
||
- name: Build dist/ Directory | ||
id: build | ||
run: npm run bundle | ||
|
||
# This will fail the workflow if the `dist/` directory is different than | ||
# expected. | ||
- name: Compare Directories | ||
id: diff | ||
run: | | ||
if [ ! -d dist/ ]; then | ||
echo "Expected dist/ directory does not exist. See status below:" | ||
ls -la ./ | ||
exit 1 | ||
fi | ||
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 `dist/` was different than expected, upload the expected version as a | ||
# workflow artifact. | ||
- if: ${{ failure() && steps.diff.outcome == 'failure' }} | ||
name: Upload Artifact | ||
id: upload | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: dist | ||
path: dist/ |
Oops, something went wrong.