Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
KaiSaba committed Feb 8, 2024
0 parents commit 10a1416
Show file tree
Hide file tree
Showing 17 changed files with 17,305 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
env: {
browser: true,
es6: true
},
extends: [
'@codingame/eslint-config',
'@codingame/eslint-config-react'
]
}
52 changes: 52 additions & 0 deletions .github/workflows/check_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Checks
on:
pull_request:
branches:
- main

jobs:
lint-commits:
name: Lint commits
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
# we actually need "github.event.pull_request.commits + 1" commit
fetch-depth: 0
- uses: actions/setup-node@v3
- run: npm ci
- run: npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose
check:
name: Check build
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20.10.0
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Generate release notes preview
id: build-release-notes
uses: guilhermetod/[email protected]
- name: Comment release notes preview
if: steps.build-release-notes.outputs.releaseNotes
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ github.event.number }}
body: |
## 👋 Hey there!
Thank you for you contribution. Below is a preview of the release notes if your PR gets merged.
Please, make sure it includes all your significant changes with descriptive messages.
Keep in mind that release notes are automatically generated from the commit messages according to [conventional commits](https://www.conventionalcommits.org/).
---
${{ steps.build-release-notes.outputs.releaseNotes }}
25 changes: 25 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Release

on: workflow_dispatch

jobs:
release:
name: Release
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20.10.0
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dist/*
stats.html
.vscode
node_modules
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# json-schema-l10n

This library uses `JSONSchema6` from the library `json-schema`.

It adds a localization object for the description of the JSON schema.

## Installation

```npm
npm install @codingame/json-schema-l10n
```

## Implementation

### Types

The implemented types are:

- `Descriptions`: an object that stores the localized descriptions by locale
- `LocalizedJSONSchema`: an interface that extends `JSONSchema6` with localized descriptions added

### Functions

The implemented functions are:

- `getDescriptions`:
- takes in parameters a schema with localized descriptions and optionnaly the locale of the default description (default value is `'en'`)
- returns the localized descriptions of the schema
- `getLocalizedDescription`:
- takes in parameters a schema with localized descriptions, the locale for which we want the description and optionnaly the locale of the default description (default value is `'en'`)
- returns the description for the wanted locale, or `undefined` if not found
3 changes: 3 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['@codingame/commitlint-config-codingame']
};
5 changes: 5 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
};
Loading

0 comments on commit 10a1416

Please sign in to comment.