Skip to content

Commit

Permalink
✨ feat: Initial version of Localazy CDN client
Browse files Browse the repository at this point in the history
  • Loading branch information
honzabubenik committed Mar 13, 2024
1 parent 6c2ef96 commit e8b265e
Show file tree
Hide file tree
Showing 235 changed files with 23,462 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
tests/fixtures/file-types-metafile/file15-js/
tests/fixtures/file-types-metafile/file14-ts/
docs/code-examples/
28 changes: 28 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
module.exports = {
root: true,
env: {
node: true,
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended-type-checked',
'airbnb-base',
'airbnb-typescript/base',
],
parserOptions: {
project: ['tsconfig.json', 'tsconfig.node.json'],
tsconfigRootDir: __dirname,
},
parser: '@typescript-eslint/parser',
plugins: [
'@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',
},
};
20 changes: 20 additions & 0 deletions .github/badges/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions .github/badges/license.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions .github/badges/version.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
100 changes: 100 additions & 0 deletions .github/workflows/qa.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: QA checks

on:
pull_request:
branches:
- main

jobs:
lint:
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@v4
with:
node-version: 20

- name: Install dependencies
run: npm ci

- name: Lint source files
run: npm run lint

- 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

# - name: Gather data
# id: data
# run: |
# VERSION=$(node -p "require('./package.json').version")
# echo "version=$VERSION" >> "$GITHUB_OUTPUT"
# LICENSE=$(node -p "require('./package.json').license")
# echo "license=$LICENSE" >> "$GITHUB_OUTPUT"
# COVERAGE=$(node -p "require('./coverage/coverage-summary.json').total.lines.pct")
# echo "coverage=$COVERAGE" >> "$GITHUB_OUTPUT"
# echo "path=.github/badges" >> "${GITHUB_OUTPUT}"
# shell: bash
#
# - name: Create badges directory
# run: mkdir -p "${{ steps.data.outputs.path }}"
# shell: bash
#
# - name: Generate version badge
# uses: emibcn/badge-action@v2.0.2
# with:
# label: npm
# status: ${{ steps.data.outputs.version }}
# color: 0558bd,066fef
# path: ${{ steps.data.outputs.path }}/version.svg
#
# - name: Generate license badge
# uses: emibcn/badge-action@v2.0.2
# with:
# label: license
# status: ${{ steps.data.outputs.license }}
# color: 0558bd,066fef
# path: ${{ steps.data.outputs.path }}/license.svg
#
# - name: Generate coverage badge
# uses: emibcn/badge-action@v2.0.2
# with:
# label: coverage
# status: ${{ steps.data.outputs.coverage }}%
# color: ${{ steps.data.outputs.coverage > 90 && 'green'
# || steps.data.outputs.coverage > 80 && 'yellow,green'
# || steps.data.outputs.coverage > 70 && 'yellow'
# || steps.data.outputs.coverage > 60 && 'orange,yellow'
# || steps.data.outputs.coverage > 50 && 'orange'
# || steps.data.outputs.coverage > 40 && 'red,orange'
# || steps.data.outputs.coverage > 30 && 'red,red,orange'
# || steps.data.outputs.coverage > 20 && 'red,red,red,orange'
# || 'red' }}
# path: ${{ steps.data.outputs.path }}/coverage.svg
#
# - name: Commit files
# run: |
# git config --local user.email "${{ github.actor_id }}+github-actions[bot]@users.noreply.github.com"
# git config --local user.name "github-actions[bot]"
# git add .
# git status
# git commit -m "Update badges"
#
# - name: Push changes
# uses: ad-m/github-push-action@v0.8.0
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# branch: docs
75 changes: 75 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Release CI

on:
push:
branches:
- main

permissions:
contents: write
pull-requests: write

jobs:
ci:
name: CI Init
runs-on: [ self-hosted, Linux ]
outputs:
action: ${{ steps.init.outputs.action }}
steps:
- id: init
uses: localazy/release/init@v2

prepare:
name: Prepare Release PR
needs: ci
if: needs.ci.outputs.action == 'prepare'
runs-on: [ self-hosted, Linux ]
steps:
- uses: localazy/release/prepare@v2
with:
node-version: 20
app-id: ${{ secrets.AUTH_APP_ID }}
app-key: ${{ secrets.AUTH_APP_KEY }}

publish:
name: Publish Release
needs: ci
if: needs.ci.outputs.action == 'publish'
runs-on: [ self-hosted, Linux ]
steps:
- uses: localazy/release/publish@v2
with:
node-version: 20
app-id: ${{ secrets.AUTH_APP_ID }}
app-key: ${{ secrets.AUTH_APP_KEY }}
npm-publish: public
npm-token: ${{ secrets.NPM_AUTH_TOKEN_PUBLIC }}

deploy-docs:
name: Deploy Docs
needs: publish
runs-on: [ self-hosted, Linux ]
env:
NODE_OPTIONS: --max_old_space_size=8192
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Build Docs
run: |
cd docs
npm ci
npm run build
- name: Update Docs Branch
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: docs/.vitepress/dist
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fund=false
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Localazy

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
51 changes: 51 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<div align="center">

[<img src="https://localazy.com/directus9/assets/9fc36b9c-81b7-4dbf-bd82-b64cd984090f" width="285" height="50" alt="Localazy" >](https://localazy.com)

### 📦 `@localazy/cdn-client`

[**Documentation**](https://localazy.github.io/cdn-client/) &nbsp;|&nbsp;
[**Getting Started**](https://localazy.github.io/cdn-client/get-started/introduction.html) &nbsp;|&nbsp;
[**API Reference**](https://localazy.github.io/cdn-client/reference/client-api.html)

[//]: # ([**Live Demo**]&#40;&#41;)

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)
[![coverage](.github/badges/coverage.svg)](https://github.com/localazy/cdn-client/actions)

</div>

## 🔧 Install

```bash
npm install @localazy/cdn-client
# or use your favorite package manager
```

For more information, visit the [installation guide](https://localazy.github.io/cdn-client/get-started/install.html).

## 🛟 Support

- [Intercom chat](https://localazy.com)
- [GitHub issues](https://github.com/localazy/cdn-client/issues)
- [Discussion forum](https://discuss.localazy.com/)
- [team@localazy.com](mailto:team@localazy.com)

## 💙 Localazy Ecosystem

Check out other npm packages from Localazy:

- [@localazy/cli](https://www.npmjs.com/package/@localazy/cli)
- [@localazy/api-client](https://www.npmjs.com/package/@localazy/api-client)
- [@localazy/cdn-client](https://www.npmjs.com/package/@localazy/cdn-client)
- [@localazy/languages](https://www.npmjs.com/package/@localazy/languages)
- [@localazy/strapi-plugin](https://www.npmjs.com/package/@localazy/strapi-plugin)

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

## 📜 License

Code released under the [MIT license](LICENSE).
2 changes: 2 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
.vitepress/cache
Loading

0 comments on commit e8b265e

Please sign in to comment.