Skip to content

Commit fa76ec5

Browse files
authored
Merge pull request #150 from getsentry/iw/update
Re-syncing template with upstream
2 parents 48c6d3d + 74fc557 commit fa76ec5

38 files changed

+27837
-2415
lines changed

.eslintignore

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
dist/
21
lib/
3-
<<<<<<< HEAD
4-
node_modules/
5-
=======
62
node_modules/
73
jest.config.js
8-
>>>>>>> actions-main
4+
dist/
5+
coverage/

.eslintrc.json

+1-56
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,3 @@
11
{
2-
"plugins": ["jest", "@typescript-eslint"],
3-
"extends": ["sentry"],
4-
"parser": "@typescript-eslint/parser",
5-
"parserOptions": {
6-
"ecmaVersion": 9,
7-
"sourceType": "module",
8-
"project": "./tsconfig.json"
9-
},
10-
"rules": {
11-
"i18n-text/no-en": "off",
12-
"eslint-comments/no-use": "off",
13-
"import/no-namespace": "off",
14-
"no-unused-vars": "off",
15-
"@typescript-eslint/no-unused-vars": "error",
16-
"@typescript-eslint/explicit-member-accessibility": [
17-
"error",
18-
{"accessibility": "no-public"}
19-
],
20-
"@typescript-eslint/no-require-imports": "error",
21-
"@typescript-eslint/array-type": "error",
22-
"@typescript-eslint/await-thenable": "error",
23-
"@typescript-eslint/explicit-function-return-type": [
24-
"error",
25-
{"allowExpressions": true}
26-
],
27-
"@typescript-eslint/func-call-spacing": ["error", "never"],
28-
"@typescript-eslint/no-array-constructor": "error",
29-
"@typescript-eslint/no-empty-interface": "error",
30-
"@typescript-eslint/no-explicit-any": "off",
31-
"@typescript-eslint/no-extraneous-class": "error",
32-
"@typescript-eslint/no-for-in-array": "error",
33-
"@typescript-eslint/no-inferrable-types": "error",
34-
"@typescript-eslint/no-misused-new": "error",
35-
"@typescript-eslint/no-namespace": "error",
36-
"@typescript-eslint/no-non-null-assertion": "warn",
37-
"@typescript-eslint/no-unnecessary-qualifier": "error",
38-
"@typescript-eslint/no-unnecessary-type-assertion": "error",
39-
"@typescript-eslint/no-useless-constructor": "error",
40-
"@typescript-eslint/no-var-requires": "error",
41-
"@typescript-eslint/prefer-for-of": "warn",
42-
"@typescript-eslint/prefer-function-type": "warn",
43-
"@typescript-eslint/prefer-includes": "error",
44-
"@typescript-eslint/prefer-string-starts-ends-with": "error",
45-
"@typescript-eslint/promise-function-async": "error",
46-
"@typescript-eslint/require-array-sort-compare": "error",
47-
"@typescript-eslint/restrict-plus-operands": "error",
48-
"semi": "off",
49-
"@typescript-eslint/semi": ["off", "never"],
50-
"@typescript-eslint/type-annotation-spacing": "error",
51-
"@typescript-eslint/unbound-method": "error"
52-
},
53-
"env": {
54-
"node": true,
55-
"es6": true,
56-
"jest/globals": true
57-
}
2+
"extends": "./.github/linters/.eslintrc.yml"
583
}

.gitattributes

+3-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
dist/** -diff linguist-generated=true
1+
* text=auto eol=lf
2+
3+
dist/** -diff linguist-generated=true

.github/dependabot.yml

+17-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,24 @@ updates:
33
- package-ecosystem: github-actions
44
directory: /
55
schedule:
6-
interval: daily
6+
interval: weekly
7+
groups:
8+
actions-minor:
9+
update-types:
10+
- minor
11+
- patch
712

813
- package-ecosystem: npm
914
directory: /
1015
schedule:
11-
interval: daily
16+
interval: weekly
17+
groups:
18+
npm-development:
19+
dependency-type: development
20+
update-types:
21+
- minor
22+
- patch
23+
npm-production:
24+
dependency-type: production
25+
update-types:
26+
- patch

.github/linters/.eslintrc.yml

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
env:
2+
node: true
3+
es6: true
4+
jest: true
5+
6+
globals:
7+
Atomics: readonly
8+
SharedArrayBuffer: readonly
9+
10+
ignorePatterns:
11+
- '!.*'
12+
- '**/node_modules/.*'
13+
- '**/dist/.*'
14+
- '**/coverage/.*'
15+
- '*.json'
16+
17+
parser: '@typescript-eslint/parser'
18+
19+
parserOptions:
20+
ecmaVersion: 2023
21+
sourceType: module
22+
project:
23+
- './.github/linters/tsconfig.json'
24+
- './tsconfig.json'
25+
26+
plugins:
27+
- jest
28+
- '@typescript-eslint'
29+
30+
extends:
31+
- eslint:recommended
32+
- plugin:@typescript-eslint/eslint-recommended
33+
- plugin:@typescript-eslint/recommended
34+
- sentry
35+
- plugin:jest/recommended
36+
37+
rules:
38+
{
39+
'camelcase': 'off',
40+
'eslint-comments/no-use': 'off',
41+
'eslint-comments/no-unused-disable': 'off',
42+
'i18n-text/no-en': 'off',
43+
'import/no-namespace': 'off',
44+
'no-console': 'off',
45+
'no-unused-vars': 'off',
46+
'semi': 'off',
47+
'@typescript-eslint/array-type': 'error',
48+
'@typescript-eslint/await-thenable': 'error',
49+
'@typescript-eslint/ban-ts-comment': 'error',
50+
'@typescript-eslint/consistent-type-assertions': 'error',
51+
'@typescript-eslint/explicit-member-accessibility':
52+
['error', {'accessibility': 'no-public'}],
53+
'@typescript-eslint/explicit-function-return-type':
54+
['error', {'allowExpressions': true}],
55+
'@typescript-eslint/func-call-spacing': ['error', 'never'],
56+
'@typescript-eslint/no-array-constructor': 'error',
57+
'@typescript-eslint/no-empty-interface': 'error',
58+
'@typescript-eslint/no-explicit-any': 'error',
59+
'@typescript-eslint/no-extraneous-class': 'error',
60+
'@typescript-eslint/no-for-in-array': 'error',
61+
'@typescript-eslint/no-inferrable-types': 'error',
62+
'@typescript-eslint/no-misused-new': 'error',
63+
'@typescript-eslint/no-namespace': 'error',
64+
'@typescript-eslint/no-non-null-assertion': 'warn',
65+
'@typescript-eslint/no-require-imports': 'error',
66+
'@typescript-eslint/no-unnecessary-qualifier': 'error',
67+
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
68+
'@typescript-eslint/no-unused-vars': 'error',
69+
'@typescript-eslint/no-useless-constructor': 'error',
70+
'@typescript-eslint/no-var-requires': 'error',
71+
'@typescript-eslint/prefer-for-of': 'warn',
72+
'@typescript-eslint/prefer-function-type': 'warn',
73+
'@typescript-eslint/prefer-includes': 'error',
74+
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
75+
'@typescript-eslint/promise-function-async': 'off',
76+
'@typescript-eslint/require-array-sort-compare': 'error',
77+
'@typescript-eslint/restrict-plus-operands': 'error',
78+
'@typescript-eslint/semi': ['off', 'never'],
79+
'@typescript-eslint/space-before-function-paren': 'off',
80+
'@typescript-eslint/type-annotation-spacing': 'error',
81+
'@typescript-eslint/unbound-method': 'error',
82+
}

.github/linters/.markdown-lint.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Unordered list style
2+
MD004:
3+
style: dash
4+
5+
# Ordered list item prefix
6+
MD029:
7+
style: one
8+
9+
# Spaces after list markers
10+
MD030:
11+
ul_single: 1
12+
ol_single: 1
13+
ul_multi: 1
14+
ol_multi: 1
15+
16+
# Code block style
17+
MD046:
18+
style: fenced

.github/linters/.yaml-lint.yml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
rules:
2+
document-end: disable
3+
document-start:
4+
level: warning
5+
present: false
6+
line-length:
7+
level: warning
8+
max: 80
9+
allow-non-breakable-words: true
10+
allow-non-breakable-inline-mappings: true

.github/linters/tsconfig.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"$schema": "https://json.schemastore.org/tsconfig",
3+
"extends": "../../tsconfig.json",
4+
"compilerOptions": {
5+
"noEmit": true
6+
},
7+
"include": ["../../__tests__/**/*", "../../src/**/*"],
8+
"exclude": ["../../dist", "../../node_modules", "../../coverage", "*.json"]
9+
}

.github/workflows/check-dist.yml

+38-25
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,65 @@
1-
# `dist/index.js` is a special file in Actions.
2-
# When you reference an action with `uses:` in a workflow,
3-
# `index.js` is the code that will run.
4-
# For our project, we generate this file through a build process from other source files.
5-
# We need to make sure the checked-in `index.js` actually matches what we expect it to be.
6-
name: Check dist/
1+
# In TypeScript actions, `dist/` is a special directory. When you reference
2+
# an action with the `uses:` property, `dist/index.js` is the code that will be
3+
# run. For this project, the `dist/index.js` file is transpiled from other
4+
# source files. This workflow ensures the `dist/` directory contains the
5+
# expected transpiled code.
6+
#
7+
# If this workflow is run from a feature branch, it will act as an additional CI
8+
# check and fail if the checked-in `dist/` directory does not match what is
9+
# expected from the build.
10+
name: Check Transpiled JavaScript
711

812
on:
13+
pull_request:
14+
branches:
15+
- main
916
push:
1017
branches:
1118
- main
12-
paths-ignore:
13-
- '**.md'
14-
pull_request:
15-
paths-ignore:
16-
- '**.md'
17-
workflow_dispatch:
19+
20+
permissions:
21+
contents: read
1822

1923
jobs:
2024
check-dist:
25+
name: Check dist/
2126
runs-on: ubuntu-latest
2227

2328
steps:
24-
- uses: actions/checkout@v2
29+
- name: Checkout
30+
id: checkout
31+
uses: actions/checkout@v4
2532

26-
- name: Set Node.js 12.x
27-
uses: actions/setup-node@v2.5.1
33+
- name: Setup Node.js
34+
id: setup-node
35+
uses: actions/setup-node@v4
2836
with:
29-
node-version: 12.x
37+
node-version-file: .node-version
38+
cache: yarn
3039

3140
- name: Install dependencies
3241
run: yarn
3342

3443
- name: Rebuild the dist/ directory
3544
run: |
36-
yarn dist
45+
yarn bundle
3746
38-
- name: Compare the expected and actual dist/ directories
47+
# This will fail the workflow if the PR wasn't created by Dependabot.
48+
- name: Compare Directories
49+
id: diff
3950
run: |
40-
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
41-
echo "Detected uncommitted changes after build. See status below:"
42-
git diff
51+
if [ "$(git diff --ignore-space-at-eol --text dist/ | wc -l)" -gt "0" ]; then
52+
echo "Detected uncommitted changes after build. See status below:"
53+
git diff --ignore-space-at-eol --text dist/
4354
exit 1
4455
fi
45-
id: diff
4656
47-
# If index.js was different than expected, upload the expected version as an artifact
48-
- uses: actions/upload-artifact@v2
49-
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
57+
# If `dist/` was different than expected, and this was not a Dependabot
58+
# PR, upload the expected version as a workflow artifact.
59+
- if: ${{ failure() && steps.diff.outcome == 'failure' }}
60+
name: Upload Artifact
61+
id: upload
62+
uses: actions/upload-artifact@v4
5063
with:
5164
name: dist
5265
path: dist/

.github/workflows/ci.yml

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Continuous Integration
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
push:
8+
branches:
9+
- main
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
test-typescript:
16+
name: TypeScript Tests
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout
21+
id: checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Setup Node.js
25+
id: setup-node
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version-file: .node-version
29+
cache: npm
30+
31+
- name: Install Dependencies
32+
run: yarn install --frozen-lockfile
33+
34+
- name: Check Format
35+
run: yarn format:check
36+
37+
- name: Lint
38+
run: yarn lint
39+
40+
- name: Test
41+
run: yarn ci-test
42+
43+
test-action:
44+
name: GitHub Actions Test
45+
runs-on: ubuntu-latest
46+
47+
steps:
48+
- name: Checkout
49+
id: checkout
50+
uses: actions/checkout@v4
51+
52+
- name: Test Local Action
53+
id: test-action
54+
uses: ./
55+
with:
56+
milliseconds: 2000
57+
58+
- name: Print Output
59+
id: output
60+
run: echo "${{ steps.test-action.outputs.time }}"

0 commit comments

Comments
 (0)