Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add browser bundle #9

Merged
merged 6 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions .babelrc

This file was deleted.

2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# ENV variables for tests
# ENV variables for examples
LOCALAZY_API_URL=https://api.localazy.com
LOCALAZY_API_AUTH_TOKEN=your-project-token
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
examples
34 changes: 34 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
module.exports = {
root: true,
env: {
node: true,
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended-type-checked',
'airbnb-base',
'airbnb-typescript/base',
'prettier',
],
parserOptions: {
project: ['tsconfig.json', 'tsconfig.node.json'],
tsconfigRootDir: __dirname,
},
parser: '@typescript-eslint/parser',
plugins: ['prettier', '@typescript-eslint'],
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'import/extensions': 'off',
'import/prefer-default-export': 'off',
'max-len': ['error', { code: 120 }],
'prefer-destructuring': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-redundant-type-constituents': 'off',
},
};
34 changes: 0 additions & 34 deletions .eslintrc.js

This file was deleted.

23 changes: 18 additions & 5 deletions .github/workflows/qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,35 @@ on:

jobs:
qa:
name: Lint & Build
runs-on: [ self-hosted, Linux ]
name: Lint, Typecheck, Test and Build source files
runs-on: [self-hosted, Linux]
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20

- name: Install dependencies
run: npm ci --ignore-scripts
run: npm ci

- name: Lint source files
run: npm run lint

- name: Run Prettier
run: npm run prettier

- name: Check types
run: npm run typecheck

- name: Run tests
run: npm run test:coverage

- name: Build package
run: npm run build

- name: 'Report Coverage'
if: always()
uses: davelosert/vitest-coverage-report-action@v2
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ permissions:
jobs:
ci:
name: CI Init
runs-on: [ self-hosted, Linux ]
runs-on: [self-hosted, Linux]
outputs:
action: ${{ steps.init.outputs.action }}
steps:
Expand All @@ -23,7 +23,7 @@ jobs:
name: Prepare Release PR
needs: ci
if: needs.ci.outputs.action == 'prepare'
runs-on: [ self-hosted, Linux ]
runs-on: [self-hosted, Linux]
steps:
- uses: localazy/release/prepare@v2
with:
Expand All @@ -34,11 +34,11 @@ jobs:
name: Publish Release
needs: ci
if: needs.ci.outputs.action == 'publish'
runs-on: [ self-hosted, Linux ]
runs-on: [self-hosted, Linux]
steps:
- uses: localazy/release/publish@v2
with:
app-id: ${{ secrets.AUTH_APP_ID }}
app-key: ${{ secrets.AUTH_APP_KEY }}
npm-publish: public
npm-token: ${{ secrets.NPM_AUTH_TOKEN }}
npm-token: ${{ secrets.NPM_AUTH_TOKEN_PUBLIC }}
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16
20
Empty file added .prettierignore
Empty file.
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
printWidth: 120
singleQuote: true
jsxSingleQuote: true
32 changes: 14 additions & 18 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

- [Update CI QA #5](https://github.com/localazy/api-client/pull/5)


### 🧰 Other Commits

- Update CI QA ([a1f439a](https://github.com/localazy/api-client/commit/a1f439a)) ([#5](https://github.com/localazy/api-client/pull/5))
Expand All @@ -13,31 +12,28 @@

### 🔀 Pull Requests

* [Update CI #4](https://github.com/localazy/api-client/pull/4)
* [Loc 673 update ci with changelogs and automatic releases #3](https://github.com/localazy/api-client/pull/3)

- [Update CI #4](https://github.com/localazy/api-client/pull/4)
- [Loc 673 update ci with changelogs and automatic releases #3](https://github.com/localazy/api-client/pull/3)

### 🧰 Other Commits

* Enable version bumping ([16b175d](https://github.com/localazy/api-client/commit/16b175d))
* Update CI ([789050b](https://github.com/localazy/api-client/commit/789050b)) ([#4](https://github.com/localazy/api-client/pull/4))
* Add QA workflow ([e76da0a](https://github.com/localazy/api-client/commit/e76da0a)) ([#3](https://github.com/localazy/api-client/pull/3))
* Add typedoc-plugin-missing-exports plugin ([e76da0a](https://github.com/localazy/api-client/commit/e76da0a)) ([#3](https://github.com/localazy/api-client/pull/3))
* Remove unused packaged ([e76da0a](https://github.com/localazy/api-client/commit/e76da0a)) ([#3](https://github.com/localazy/api-client/pull/3))
* Update CI ([e76da0a](https://github.com/localazy/api-client/commit/e76da0a)) ([#3](https://github.com/localazy/api-client/pull/3))
* Update release workflow ([e76da0a](https://github.com/localazy/api-client/commit/e76da0a)) ([#3](https://github.com/localazy/api-client/pull/3))
* Update workflow runs-on ([e76da0a](https://github.com/localazy/api-client/commit/e76da0a)) ([#3](https://github.com/localazy/api-client/pull/3))
- Enable version bumping ([16b175d](https://github.com/localazy/api-client/commit/16b175d))
- Update CI ([789050b](https://github.com/localazy/api-client/commit/789050b)) ([#4](https://github.com/localazy/api-client/pull/4))
- Add QA workflow ([e76da0a](https://github.com/localazy/api-client/commit/e76da0a)) ([#3](https://github.com/localazy/api-client/pull/3))
- Add typedoc-plugin-missing-exports plugin ([e76da0a](https://github.com/localazy/api-client/commit/e76da0a)) ([#3](https://github.com/localazy/api-client/pull/3))
- Remove unused packaged ([e76da0a](https://github.com/localazy/api-client/commit/e76da0a)) ([#3](https://github.com/localazy/api-client/pull/3))
- Update CI ([e76da0a](https://github.com/localazy/api-client/commit/e76da0a)) ([#3](https://github.com/localazy/api-client/pull/3))
- Update release workflow ([e76da0a](https://github.com/localazy/api-client/commit/e76da0a)) ([#3](https://github.com/localazy/api-client/pull/3))
- Update workflow runs-on ([e76da0a](https://github.com/localazy/api-client/commit/e76da0a)) ([#3](https://github.com/localazy/api-client/pull/3))

# 2.0.0 (2023-10-19)

### ✨ Features

* Api client v2 ([45ad973](https://github.com/localazy/api-client/commit/45ad973))

- Api client v2 ([45ad973](https://github.com/localazy/api-client/commit/45ad973))

### 🧰 Other Commits

* Add release workflow ([bca1669](https://github.com/localazy/api-client/commit/bca1669))
* Disable version bumping ([d7c1105](https://github.com/localazy/api-client/commit/d7c1105))
* Update CI and support for conventional changelog ([1184865](https://github.com/localazy/api-client/commit/1184865))

- Add release workflow ([bca1669](https://github.com/localazy/api-client/commit/bca1669))
- Disable version bumping ([d7c1105](https://github.com/localazy/api-client/commit/d7c1105))
- Update CI and support for conventional changelog ([1184865](https://github.com/localazy/api-client/commit/1184865))
50 changes: 23 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,23 @@
</a>
</p>

[//]: # (<p align="center">)

[//]: # ( <a href="https://github.com/localazy/api-client"><img src="https://img.shields.io/badge/@localazy-ts--api-066fef?style=for-the-badge" height="22" alt="@localazy/api-client"></a>)

[//]: # ( <a href="https://npmjs.com/package/@localazy/api-client"><img src="https://img.shields.io/github/package-json/v/localazy/ts-api/main?style=for-the-badge&label=version&color=066fef" height="22" alt="npm"></a>)

[//]: # ( <a href="https://github.com/localazy/api-client/blob/main/LICENSE"><img src="https://img.shields.io/github/license/localazy/ts-api?style=for-the-badge&color=066fef" height="22" alt="license">)

[//]: # (</a>)
<p align="center">

[//]: # (<a href="#">)
<a href="https://github.com/localazy/api-client"><img src="https://img.shields.io/badge/@localazy-ts--api-066fef?style=for-the-badge" height="22" alt="@localazy/api-client"></a>

[//]: # ( <img src="https://img.shields.io/badge/schema-OpenAPI-066fef?style=for-the-badge&color=066fef" height="22" alt="schema"></a>)
<a href="https://npmjs.com/package/@localazy/api-client"><img src="https://img.shields.io/github/package-json/v/localazy/ts-api/main?style=for-the-badge&label=version&color=066fef" height="22" alt="npm"></a>

[//]: # ( <br>)
<a href="https://github.com/localazy/api-client/blob/main/LICENSE"><img src="https://img.shields.io/github/license/localazy/ts-api?style=for-the-badge&color=066fef" height="22" alt="license">

[//]: # ( <a href="#"><img src="https://img.shields.io/badge/build-passing-success?style=for-the-badge" height="22" alt="build"></a>)
</a>

[//]: # ( <a href="#"><img src="https://img.shields.io/badge/coverage-100%25-success?style=for-the-badge" height="22" alt="coverage"></a>)
[//]: # '<a href="#">'
[//]: # ' <img src="https://img.shields.io/badge/schema-OpenAPI-066fef?style=for-the-badge&color=066fef" height="22" alt="schema"></a>'
[//]: # ' <br>'
[//]: # ' <a href="#"><img src="https://img.shields.io/badge/build-passing-success?style=for-the-badge" height="22" alt="build"></a>'
[//]: # ' <a href="#"><img src="https://img.shields.io/badge/coverage-100%25-success?style=for-the-badge" height="22" alt="coverage"></a>'

[//]: # (</p>)
</p>

# 📦 Localazy API Client

Expand All @@ -49,14 +45,14 @@ npm install @localazy/api-client
```javascript
import { ApiClient } from '@localazy/api-client';

const json = { en: { tooltip: 'Elegant unicorn' } }; // Get text to translate.
const json = { en: { tooltip: 'Elegant unicorn' } }; // Get text to translate.

const api = new ApiClient({ authToken: 'your-project-token' }); // Create Api client.
const project = await api.projects.first(); // Get Localazy project.
const file = await api.import.json({ project, json }); // Import source keys.
const fr = await api.export.json({ project, file, langs: ['fr'] }); // Export translated keys.
const api = new ApiClient({ authToken: 'your-project-token' }); // Create Api client.
const project = await api.projects.first(); // Get Localazy project.
const file = await api.import.json({ project, json }); // Import source keys.
const fr = await api.export.json({ project, file, langs: ['fr'] }); // Export translated keys.

console.log(fr); // 🦄 { fr: { tooltip: 'Licorne élégante' } }
console.log(fr); // 🦄 { fr: { tooltip: 'Licorne élégante' } }
```

###### TypeScript
Expand Down Expand Up @@ -101,12 +97,12 @@ team@localazy.com.

Check out other npm packages from Localazy:

| | NPM package | Description |
|:---------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------|----------------------------------------------|
| <img src="https://localazy.com/directus9/assets/3f76ff7b-0e74-4046-bb03-4ca99c3b66d5" width="50" height="50" alt="cli"> | [@localazy/cli](https://www.npmjs.com/package/@localazy/cli) | Localazy CLI tool. |
| <img src="https://localazy.com/directus9/assets/20866781-e69b-4e01-9456-05437487b75c" width="50" height="50" alt="localazy-api"> | [@localazy/api-client](https://www.npmjs.com/package/@localazy/api-client) | Localazy API client. |
| <img src="https://localazy.com/directus9/assets/c9e70e4f-8136-432a-8d82-53c3501a9eb4" width="50" height="50" alt="languages"> | [@localazy/languages](https://www.npmjs.com/package/@localazy/languages) | List of all languages supported by Localazy. |
| <img src="https://localazy.com/directus9/assets/1dd05c76-e517-4aea-a3d8-49cfddb40056" width="50" height="50" alt="strapi"> | [@localazy/strapi-plugin](https://www.npmjs.com/package/@localazy/strapi-plugin) | The official Localazy Strapi plugin. |
| | NPM package | Description |
| :------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------- |
| <img src="https://localazy.com/directus9/assets/3f76ff7b-0e74-4046-bb03-4ca99c3b66d5" width="50" height="50" alt="cli"> | [@localazy/cli](https://www.npmjs.com/package/@localazy/cli) | Localazy CLI tool. |
| <img src="https://localazy.com/directus9/assets/20866781-e69b-4e01-9456-05437487b75c" width="50" height="50" alt="localazy-api"> | [@localazy/api-client](https://www.npmjs.com/package/@localazy/api-client) | Localazy API client. |
| <img src="https://localazy.com/directus9/assets/c9e70e4f-8136-432a-8d82-53c3501a9eb4" width="50" height="50" alt="languages"> | [@localazy/languages](https://www.npmjs.com/package/@localazy/languages) | List of all languages supported by Localazy. |
| <img src="https://localazy.com/directus9/assets/1dd05c76-e517-4aea-a3d8-49cfddb40056" width="50" height="50" alt="strapi"> | [@localazy/strapi-plugin](https://www.npmjs.com/package/@localazy/strapi-plugin) | The official Localazy Strapi plugin. |

Discover all available [integration options and localization examples](https://github.com/localazy).

Expand Down
Loading