Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
stefano.occhi committed Jul 17, 2023
2 parents f416e99 + 1c129b7 commit 0360249
Show file tree
Hide file tree
Showing 13 changed files with 101 additions and 104 deletions.
17 changes: 0 additions & 17 deletions .github/dependabot.yml

This file was deleted.

21 changes: 0 additions & 21 deletions .github/workflows/approve-pr.yml

This file was deleted.

5 changes: 2 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@ jobs:
secrets: inherit

build:
needs: analysis
uses: ./.github/workflows/build.yml

test:
needs: build
uses: ./.github/workflows/test.yml

publish-npm:
needs: test
needs: [test, analysis]
runs-on: ubuntu-latest
steps:
- name: Download artifact
Expand All @@ -35,7 +34,7 @@ jobs:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

publish-gpr:
needs: test
needs: [test, analysis]
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down
Original file line number Diff line number Diff line change
@@ -1,31 +1,33 @@
name: Check pipeline
name: Check PR

on:
# Run on pull request
pull_request:
branches: [main, develop]

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
# Sets permissions of the GITHUB_TOKEN
permissions:
contents: read
contents: write
pages: write
id-token: write
pull-requests: read

# Allow one concurrent deployment
concurrency:
group: 'pages'
cancel-in-progress: true
pull-requests: write

jobs:
# Sonarcloud analysis
analysis:
uses: ./.github/workflows/sonarcloud.yml
secrets: inherit

# CI
build:
needs: analysis
uses: ./.github/workflows/build.yml

# Storybook test on vercel env
test:
needs: build
uses: ./.github/workflows/test.yml

# Trigger depfu merge
trigger-automerge:
needs: [test, analysis]
uses: ./.github/workflows/pr-depfu-merge.yml
28 changes: 28 additions & 0 deletions .github/workflows/pr-depfu-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Merge Depfu PR

on:
workflow_call:

permissions:
pull-requests: write
contents: write

jobs:
approve-pr:
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.user.login == 'depfu[bot]' }}
steps:
- name: Approve PR
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
merge-pr:
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.user.login == 'depfu[bot]' }}
steps:
- name: Squash PR
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
25 changes: 11 additions & 14 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,18 @@ on:

jobs:
sonarcloud:
name: SonarCloud
runs-on: ubuntu-latest

steps:
- name: Analyze with SonarCloud

# You can pin the exact commit or the version.
# uses: SonarSource/sonarcloud-github-action@de2e56b42aa84d0b1c5b622644ac17e505c9a049
uses: SonarSource/sonarcloud-github-action@de2e56b42aa84d0b1c5b622644ac17e505c9a049
- uses: actions/checkout@v3
if: env.SONAR_TOKEN
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # Generate a token on Sonarcloud.io, add it to the secrets of this repo with the name SONAR_TOKEN (Settings > Secrets > Actions > add new repository secret)
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
# Additional arguments for the sonarcloud scanner
args:
# Unique keys of your project and organization. You can find them in SonarCloud > Information (bottom-left menu)
# mandatory
-Dsonar.projectKey=volverjs_zod-vue-i18n
-Dsonar.organization=volverjs
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: SonarCloud Scan
if: env.SONAR_TOKEN
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
17 changes: 11 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

All notable changes to this project will be documented in this file.

## [0.0.4] - 2023-07-17

### Added

- Errors key as parameter

## [0.0.2] - 2023-04-07

Expand All @@ -10,7 +15,7 @@ All notable changes to this project will be documented in this file.
- Add locales translations (en, it)
- Fix locales exports in package.json
- Fix label for `invalid_type` error with `z.nativeEnum()`

## [0.0.2-beta.4] - 2023-04-07

### Fixed
Expand All @@ -23,31 +28,31 @@ All notable changes to this project will be documented in this file.

- Fix locales exports in package.json
- Fix locales labels en and it

## [0.0.2-beta.2] - 2023-03-14

### Fixed

- Fix release workflow

## [0.0.2-beta.1] - 2023-03-14

### Fixed

- Update release workflow


## [0.0.1] - 2023-03-14

### Added

- `makeZodI18nMap` a function to use vue-i18n with zod validation error.



## [0.0.1-beta.1] - 2023-03-13

### Added

- `makeZodI18nMap` a function to use vue-i18n with zod validation error.

[0.0.4]: https://github.com/volverjs/zod-vue-i18n/compare/v0.0.3...v0.0.4
[0.0.3]: https://github.com/volverjs/zod-vue-i18n/compare/v0.0.2...v0.0.3
[0.0.2]: https://github.com/volverjs/zod-vue-i18n/compare/v0.0.1...v0.0.2
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
# zod-vue-i18n

`zod` `vue3` `i18n` `vue-i18n`

[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=volverjs_zod-vue-i18n&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=volverjs_zod-vue-i18n) [![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=volverjs_zod-vue-i18n&metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=volverjs_zod-vue-i18n) [![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=volverjs_zod-vue-i18n&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=volverjs_zod-vue-i18n) [![Depfu](https://badges.depfu.com/badges/0fc5114253837ef87562eb64d185a853/status.svg)](https://depfu.com) [![Depfu](https://badges.depfu.com/badges/0fc5114253837ef87562eb64d185a853/overview.svg)](https://depfu.com/github/volverjs/zod-vue-i18n?project_id=38573)

<br>

Expand Down Expand Up @@ -140,7 +142,6 @@ const i18n = createI18n({
})

z.setErrorMap(makeZodVueI18n(i18n))

```

### 2. Add the messages when you need
Expand Down Expand Up @@ -173,7 +174,6 @@ i18n.global.mergeLocaleMessage(
)
```


## Custom error messages

You can use custom error messages with the `params` property of the `refine` function.
Expand All @@ -198,6 +198,7 @@ z.string()
.refine(() => false, { params: { i18n: 'my_custom_key' } })
.safeParse(123) // This is not a string
```

> **Note**
> To use this functionality you need to add the `i18n` key to the `params` object.
Expand Down
2 changes: 1 addition & 1 deletion locales/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"notMultipleOf": "Il numero dev'essere un multiplo di {multipleOf}",
"notFinite": "Il numero dev'essere finito",
"invalidString": {
"email": "{validation} non valida",
"email": "Email non valida",
"url": "{validation} non valido",
"uuid": "{validation} non valido",
"cuid": "{validation} non valido",
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,18 @@
"devDependencies": {
"@types/jest": "^29.4.0",
"@types/qs": "^6.9.7",
"@typescript-eslint/eslint-plugin": "^5.54.0",
"@typescript-eslint/parser": "^5.54.0",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"copy": "^0.3.2",
"eslint": "^8.35.0",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-prettier": "^5.0.0",
"jest": "^29.4.3",
"jest-fetch-mock": "^3.0.3",
"jest-localstorage-mock": "^2.4.26",
"prettier": "^2.8.4",
"prettier": "^3.0.0",
"ts-jest": "^29.0.5",
"typescript": "^4.9.5"
"typescript": "^5.0.4"
},
"typesVersions": {
"*": {
Expand Down
3 changes: 3 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
sonar.projectKey=volverjs_zod-vue-i18n
sonar.organization=volverjs
sonar.coverage.exclusions=test/**
Loading

0 comments on commit 0360249

Please sign in to comment.