diff --git a/.badges.json b/.badges.json
new file mode 100644
index 0000000..4a11575
--- /dev/null
+++ b/.badges.json
@@ -0,0 +1,34 @@
+{
+ "dir": ".github/badges",
+ "files": [
+ {
+ "fileName": "npm.svg",
+ "label": "npm",
+ "status": "1.5.0",
+ "icon": "npm"
+ },
+ {
+ "fileName": "coverage.svg",
+ "label": "coverage",
+ "status": 99.5,
+ "icon": "vitest"
+ },
+ {
+ "fileName": "size.svg",
+ "label": "minzipped size",
+ "status": "3.53 kB",
+ "icon": "speed",
+ "color": "43b816"
+ },
+ {
+ "fileName": "maintainer.svg",
+ "label": "maintainer",
+ "status": "Localazy"
+ },
+ {
+ "fileName": "license.svg",
+ "label": "license",
+ "status": "MIT"
+ }
+ ]
+}
diff --git a/.github/badges/coverage.svg b/.github/badges/coverage.svg
deleted file mode 100644
index 2fd7e73..0000000
--- a/.github/badges/coverage.svg
+++ /dev/null
@@ -1,20 +0,0 @@
-
\ No newline at end of file
diff --git a/.github/badges/license.svg b/.github/badges/license.svg
deleted file mode 100644
index 11a5193..0000000
--- a/.github/badges/license.svg
+++ /dev/null
@@ -1,24 +0,0 @@
-
\ No newline at end of file
diff --git a/.github/badges/version.svg b/.github/badges/version.svg
deleted file mode 100644
index a616535..0000000
--- a/.github/badges/version.svg
+++ /dev/null
@@ -1,24 +0,0 @@
-
\ No newline at end of file
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index dc53065..17a1ecd 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -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:
@@ -23,19 +23,19 @@ 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:
app-id: ${{ secrets.AUTH_APP_ID }}
app-key: ${{ secrets.AUTH_APP_KEY }}
- generate-badges: true
+ badges: true
publish:
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:
@@ -47,7 +47,7 @@ jobs:
deploy-docs:
name: Deploy Docs
needs: publish
- runs-on: [self-hosted, Linux]
+ runs-on: [ self-hosted, Linux ]
env:
NODE_OPTIONS: --max_old_space_size=8192
steps:
diff --git a/README.md b/README.md
index 12bfc86..5d95a9c 100644
--- a/README.md
+++ b/README.md
@@ -9,24 +9,61 @@
[**Live Demo**](https://localazy.github.io/cdn-client/sandbox/live-demo.html) |
[**API Reference**](https://localazy.github.io/cdn-client/reference/client-api.html)
-[//]: # '[**Live Demo**]()'
-
Node.js module that allows you to easily interact with the [Localazy CDN](https://localazy.com/docs/cdn/cdn-introduction).
-[![coverage](.github/badges/version.svg)](https://www.npmjs.com/package/@localazy/cdn-client)
-[![coverage](.github/badges/license.svg)](https://github.com/localazy/cdn-client/blob/main/LICENSE)
+[![npm](.github/badges/npm.svg)](https://www.npmjs.com/package/@localazy/cdn-client)
+[![maintainer](.github/badges/maintainer.svg)](https://github.com/localazy)
+[![license](.github/badges/license.svg)](https://github.com/localazy/cdn-client/blob/main/LICENSE)
[![coverage](.github/badges/coverage.svg)](https://github.com/localazy/cdn-client/actions)
+[![size](.github/badges/size.svg)](https://bundlephobia.com/package/@localazy/cdn-client)
-## 🚀 Install
+## 🚀 Quick Start
```bash
npm install @localazy/cdn-client
# or use your favourite package manager
```
-For more information, visit the [installation guide](https://localazy.github.io/cdn-client/get-started/install.html).
+```javascript
+import { CdnClient } from '@localazy/cdn-client';
+
+const cdn = await CdnClient.create({
+ // use your own metafile
+ metafile: 'https://delivery.localazy.com/_a855374211039568660198b39c31/_e0.v2.json',
+});
+
+const result = await cdn.fetch({
+ // select files from metafile
+ files: cdn.metafile.files[0],
+ // select locales
+ locales: ['en', 'de'],
+});
+```
+
+example result
+
+```javascript
+const result = {
+ en: {
+ cdn_info: 'With the CDN you can deliver the translation files instantly',
+ cdn_testing: 'We\'re testing the CDN',
+ hello_localazy: 'Hello Localazy!',
+ using_javascript: 'In this project we decided to use JavaScript'
+ },
+ de: {
+ cdn_info: 'Mit dem CDN können Sie die Übersetzungsdateien sofort liefern',
+ cdn_testing: 'Wir testen das CDN',
+ hello_localazy: 'Hallo Localazy!',
+ using_javascript: 'In diesem Projekt haben wir uns für JavaScript entschieden'
+ }
+};
+```
+
+
+
+For more information, visit [Installation](https://localazy.github.io/cdn-client/get-started/install.html) guide.
## 🛟 Support
@@ -40,7 +77,7 @@ For more information, visit the [installation guide](https://localazy.github.io/
Check out all npm packages from Localazy:
| Package | Description |
-| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------ |
+|--------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------|
| [@localazy/cli](https://www.npmjs.com/package/@localazy/cli) | Localazy CLI tool for app and software localization and translation. |
| [@localazy/api-client](https://www.npmjs.com/package/@localazy/api-client) | Node.js module that allows you to easily interact with the Localazy API. |
| [@localazy/cdn-client](https://www.npmjs.com/package/@localazy/cdn-client) | Node.js module that allows you to easily interact with the Localazy CDN. |
diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts
index a2a7a0c..8964d52 100644
--- a/docs/.vitepress/config.mts
+++ b/docs/.vitepress/config.mts
@@ -48,7 +48,7 @@ export default defineConfig({
text: 'Get Started',
items: [
{ text: 'Introduction', link: '/get-started/introduction' },
- { text: 'Install', link: '/get-started/install' },
+ { text: 'Installation', link: '/get-started/installation' },
{ text: 'Metafile', link: '/get-started/metafile' },
],
},
diff --git a/docs/get-started/install.md b/docs/get-started/installation.md
similarity index 98%
rename from docs/get-started/install.md
rename to docs/get-started/installation.md
index b193ed8..8cf82e8 100644
--- a/docs/get-started/install.md
+++ b/docs/get-started/installation.md
@@ -1,4 +1,4 @@
-# Install
+# Installation
You can install the CDN Client as a Node.js module or import it directly in the browser.