-
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
Showing
22 changed files
with
1,682 additions
and
142 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,3 @@ | ||
node_modules/ | ||
coverage/ | ||
dist/ |
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,79 @@ | ||
{ | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": 2022, | ||
"sourceType": "module", | ||
"project": "./tsconfig.lint.json" | ||
}, | ||
"ignorePatterns": ["node_modules"], | ||
"plugins": ["@typescript-eslint", "vitest", "import"], | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:@typescript-eslint/recommended-requiring-type-checking", | ||
"plugin:import/recommended", | ||
"plugin:import/typescript", | ||
"plugin:vitest/recommended", | ||
"prettier" | ||
], | ||
"rules": { | ||
"@typescript-eslint/no-empty-interface": "warn", | ||
"@typescript-eslint/ban-ts-comment": "off", | ||
"@typescript-eslint/no-use-before-define": "off", | ||
"@typescript-eslint/no-non-null-assertion": "warn", | ||
"@typescript-eslint/no-var-requires": "off", | ||
"@typescript-eslint/indent": "off", | ||
"@typescript-eslint/no-explicit-any": "warn", | ||
"@typescript-eslint/no-unsafe-member-access": "warn", | ||
"@typescript-eslint/explicit-function-return-type": "off", | ||
"@typescript-eslint/consistent-type-imports": "warn", | ||
"@typescript-eslint/no-unused-vars": [ | ||
"warn", | ||
{ | ||
"argsIgnorePattern": "^_", | ||
"varsIgnorePattern": "^_", | ||
"caughtErrorsIgnorePattern": "^_" | ||
} | ||
], | ||
"@typescript-eslint/member-delimiter-style": [ | ||
"error", | ||
{ | ||
"multiline": { | ||
"delimiter": "none", | ||
"requireLast": false | ||
}, | ||
"singleline": { | ||
"delimiter": "comma", | ||
"requireLast": false | ||
} | ||
} | ||
], | ||
"import/no-default-export": "error", | ||
"import/order": [ | ||
"warn", | ||
{ | ||
"alphabetize": { "order": "asc" }, | ||
"newlines-between": "always" | ||
} | ||
], | ||
"object-shorthand": ["error", "always"], | ||
"max-lines": ["error", { "max": 600 }], | ||
"max-params": ["error", { "max": 4 }], | ||
"max-statements": ["error", { "max": 15 }], | ||
"complexity": ["error", { "max": 20 }] | ||
}, | ||
"overrides": [ | ||
{ | ||
"files": ["*.test.ts", "*.spec.ts"], | ||
"rules": { | ||
"@typescript-eslint/no-non-null-assertion": "off", | ||
"@typescript-eslint/no-unsafe-return": "off", | ||
"@typescript-eslint/no-unsafe-assignment": "off", | ||
"@typescript-eslint/no-unsafe-member-access": "off", | ||
"@typescript-eslint/no-unsafe-call": "off", | ||
"@typescript-eslint/no-explicit-any": "off", | ||
"max-statements": ["off"] | ||
} | ||
} | ||
] | ||
} |
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,34 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: 'github-actions' | ||
directory: '/' | ||
schedule: | ||
interval: 'monthly' | ||
open-pull-requests-limit: 10 | ||
labels: | ||
- 'skip-release' | ||
|
||
- package-ecosystem: 'npm' | ||
directory: '/' | ||
schedule: | ||
interval: 'weekly' | ||
open-pull-requests-limit: 10 | ||
groups: | ||
lint: | ||
patterns: | ||
- '@typescript-eslint/*' | ||
- 'eslint' | ||
- 'eslint-*' | ||
- 'prettier' | ||
- 'jest-fail-on-console' | ||
testing: | ||
patterns: | ||
- 'vitest' | ||
- '@vitest/*' | ||
- 'mockttp' | ||
typescript: | ||
patterns: | ||
- '@types/*' | ||
- 'ts-node' | ||
- 'ts-node-dev' | ||
- 'typescript' |
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,9 @@ | ||
## Changes | ||
|
||
Please describe | ||
|
||
## Checklist | ||
|
||
- [ ] Apply one of following labels; `major`, `minor`, `patch` or `skip-release` | ||
- [ ] I've updated the documentation, or no changes were necessary | ||
- [ ] I've updated the tests, or no changes were necessary |
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,32 @@ | ||
name: ci | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [18.x, 20.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Install | ||
run: | | ||
npm install | ||
- name: Build TS | ||
run: | | ||
npm run build | ||
- name: Run Tests | ||
run: | | ||
npm run test |
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,25 @@ | ||
# Workflow to ensure pull request has proper labels | ||
name: Ensure labels | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
types: | ||
- opened | ||
- reopened | ||
- synchronize | ||
- ready_for_review | ||
- labeled | ||
- unlabeled | ||
|
||
jobs: | ||
ensure_labels: | ||
name: Ensure PR has proper labeling | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check on of required labels are set | ||
uses: docker://agilepathway/pull-request-label-checker:v1.1.2 | ||
with: | ||
one_of: major,minor,patch,skip-release # Must have exactly-one of these labels | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} |
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,33 @@ | ||
--- | ||
name: linting | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
name: linting | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
always-auth: false | ||
node-version: 20.x | ||
|
||
- name: Run npm install | ||
run: npm install | ||
|
||
- name: Run lint | ||
run: npm run lint |
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,63 @@ | ||
# Workflow for releasing package to npm registry | ||
name: Release to NPM | ||
on: | ||
pull_request: | ||
types: | ||
- closed # Only run after PRs have been merged or closed | ||
branches: | ||
- main # Only run for PRs targeted against main branch | ||
|
||
jobs: | ||
release: | ||
# Only run for pull requests that has been merged (not closed) and that doesn't have `skip-release` label | ||
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'skip-release') == false | ||
name: release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: main | ||
fetch-depth: 0 # fetch all commits so auto-changelog is correctly generating | ||
token: ${{ secrets.BOT_ACCESS_TOKEN }} | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20.x | ||
scope: '@lokalise' | ||
always-auth: true | ||
registry-url: 'https://registry.npmjs.org' | ||
|
||
- name: Install Dependencies | ||
run: npm install | ||
|
||
- name: Build Package | ||
run: npm run build | ||
|
||
- name: Setup git config | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "AUTO RELEASE" | ||
# Apply proper semver according to github labels | ||
|
||
- name: Major label detected | ||
if: contains(github.event.pull_request.labels.*.name, 'major') | ||
run: npm version major | ||
|
||
- name: Minor label detected | ||
if: contains(github.event.pull_request.labels.*.name, 'minor') | ||
run: npm version minor | ||
|
||
- name: Patch label detected | ||
if: contains(github.event.pull_request.labels.*.name, 'patch') | ||
run: npm version patch | ||
|
||
- name: Git push | ||
run: git push origin main && git push --tags | ||
|
||
- name: Release Package | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
run: npm publish |
Oops, something went wrong.