Compare commits

..

21 commits

Author SHA1 Message Date
35ccc0523d Merge pull request 'feat: forgejo action' (#1) from development into master
Some checks failed
CI Pipeline / build-and-test (push) Successful in 59s
CI Pipeline / check-version (push) Successful in 12s
CI Pipeline / publish-staging (push) Has been skipped
CI Pipeline / publish-production (push) Failing after 10s
CI Pipeline / finish-deploy (push) Successful in 0s
Reviewed-on: leandro/lhmask#1
2025-05-26 04:58:20 +00:00
405bc4fe07 Merge branch 'master' into development
All checks were successful
CI Pipeline / build-and-test (push) Successful in 1m12s
CI Pipeline / check-version (push) Successful in 11s
CI Pipeline / publish-staging (push) Has been skipped
CI Pipeline / publish-production (push) Has been skipped
CI Pipeline / finish-deploy (push) Successful in 1s
2025-05-26 04:57:40 +00:00
413ff58469 fix: step order
All checks were successful
CI Pipeline / build-and-test (push) Successful in 1m3s
CI Pipeline / check-version (push) Successful in 12s
CI Pipeline / publish-staging (push) Has been skipped
CI Pipeline / publish-production (push) Has been skipped
CI Pipeline / finish-deploy (push) Successful in 0s
2025-05-25 22:41:51 -03:00
2b6cc8a70c feat: acessando diretorio
Some checks failed
CI Pipeline / build-and-test (push) Successful in 1m11s
CI Pipeline / check-version (push) Failing after 13s
CI Pipeline / finish-deploy (push) Has been skipped
CI Pipeline / publish-staging (push) Has been skipped
CI Pipeline / publish-production (push) Has been skipped
2025-05-25 19:40:37 -03:00
256cb33026 chore: add dependencias
Some checks failed
CI Pipeline / build-and-test (push) Successful in 1m11s
CI Pipeline / check-version (push) Successful in 13s
CI Pipeline / publish-staging (push) Failing after 13s
CI Pipeline / publish-production (push) Has been skipped
CI Pipeline / finish-deploy (push) Successful in 1s
2025-05-25 19:37:22 -03:00
aa9708876a chore: add git and jq
Some checks failed
CI Pipeline / build-and-test (push) Successful in 1m18s
CI Pipeline / check-version (push) Successful in 12s
CI Pipeline / publish-staging (push) Failing after 13s
CI Pipeline / publish-production (push) Has been skipped
CI Pipeline / finish-deploy (push) Successful in 1s
2025-05-25 19:34:05 -03:00
fd0ef99481 fix: image name
Some checks failed
CI Pipeline / build-and-test (push) Successful in 1m2s
CI Pipeline / check-version (push) Failing after 23s
CI Pipeline / finish-deploy (push) Has been skipped
CI Pipeline / publish-staging (push) Has been skipped
CI Pipeline / publish-production (push) Has been skipped
2025-05-25 19:30:58 -03:00
f5192a295f fix: docker image
Some checks failed
CI Pipeline / build-and-test (push) Successful in 1m8s
CI Pipeline / check-version (push) Failing after 2s
CI Pipeline / finish-deploy (push) Has been skipped
CI Pipeline / publish-staging (push) Has been skipped
CI Pipeline / publish-production (push) Has been skipped
2025-05-25 19:28:28 -03:00
bdb7340bc0 chore: ajustando job needs
Some checks are pending
CI Pipeline / check-version (push) Waiting to run
CI Pipeline / publish-staging (push) Blocked by required conditions
CI Pipeline / publish-production (push) Blocked by required conditions
CI Pipeline / finish-deploy (push) Blocked by required conditions
CI Pipeline / build-and-test (push) Successful in 1m10s
2025-05-25 19:26:28 -03:00
42216e4bf6 feat: adjust pipeline
Some checks are pending
CI Pipeline / check-version (push) Waiting to run
CI Pipeline / publish-staging (push) Blocked by required conditions
CI Pipeline / publish-production (push) Blocked by required conditions
CI Pipeline / finish-deploy (push) Blocked by required conditions
CI Pipeline / build-and-test (push) Successful in 1m8s
2025-05-25 19:22:41 -03:00
f34d573565 feat: deploy only if version changed
Some checks are pending
CI Pipeline / check-version (push) Waiting to run
CI Pipeline / build-and-test (push) Successful in 1m11s
CI Pipeline / publish-staging (push) Has been skipped
CI Pipeline / publish-production (push) Has been skipped
CI Pipeline / finish-deploy (push) Successful in 1s
2025-05-25 19:20:43 -03:00
331cd30754 feat: add en readme
All checks were successful
CI Pipeline / build-and-test (push) Successful in 1m1s
CI Pipeline / publish-staging (push) Successful in 21s
CI Pipeline / publish-production (push) Has been skipped
CI Pipeline / finish-deploy (push) Successful in 1s
2025-05-25 19:11:01 -03:00
11ed6d239c feat: add finish step
Some checks failed
CI Pipeline / build-and-test (push) Successful in 1m5s
CI Pipeline / publish-staging (push) Failing after 19s
CI Pipeline / publish-production (push) Has been skipped
CI Pipeline / finish-deploy (push) Successful in 0s
2025-05-25 19:02:42 -03:00
63f9cd6207 fix: npm publish
Some checks are pending
CI Pipeline / publish-production (push) Blocked by required conditions
CI Pipeline / build-and-test (push) Successful in 1m11s
CI Pipeline / publish-staging (push) Successful in 20s
2025-05-25 12:19:52 -03:00
18d707f8ce fix: publish
Some checks failed
CI Pipeline / build-and-test (push) Successful in 1m11s
CI Pipeline / publish-staging (push) Failing after 19s
CI Pipeline / publish-production (push) Has been cancelled
2025-05-25 12:15:21 -03:00
e189b3aa91 chore: use artifact@v3
Some checks failed
CI Pipeline / build-and-test (push) Successful in 1m41s
CI Pipeline / publish-staging (push) Failing after 49s
CI Pipeline / publish-production (push) Has been cancelled
2025-05-25 12:11:00 -03:00
4b98b35da2 chore: adjust copy
Some checks failed
CI Pipeline / build-and-test (push) Failing after 1m10s
CI Pipeline / publish-staging (push) Failing after 17s
CI Pipeline / publish-production (push) Has been cancelled
2025-05-25 12:08:30 -03:00
4b71522ed2 fix: artifacts
Some checks failed
CI Pipeline / build-and-test (push) Failing after 1m42s
CI Pipeline / publish-staging (push) Failing after 43s
CI Pipeline / publish-production (push) Has been cancelled
2025-05-25 12:05:15 -03:00
3d97659f94 feat: checkout@v4
Some checks failed
CI Pipeline / build-and-test (push) Successful in 1m33s
CI Pipeline / prepare-package (push) Failing after 8s
CI Pipeline / publish-staging (push) Has been skipped
CI Pipeline / publish-production (push) Has been cancelled
2025-05-25 11:54:44 -03:00
c754f44661 chore: runs on docker
Some checks failed
CI Pipeline / build-and-test (push) Failing after 56s
CI Pipeline / prepare-package (push) Has been skipped
CI Pipeline / publish-staging (push) Has been skipped
CI Pipeline / publish-production (push) Has been cancelled
2025-05-25 10:13:09 -03:00
ef748b0b92 feat: forgejo action
Some checks are pending
CI Pipeline / build-and-test (push) Waiting to run
CI Pipeline / prepare-package (push) Blocked by required conditions
CI Pipeline / publish-staging (push) Blocked by required conditions
CI Pipeline / publish-production (push) Blocked by required conditions
2025-05-25 09:52:10 -03:00
4 changed files with 166 additions and 13 deletions

View file

@ -0,0 +1,124 @@
name: CI Pipeline
on:
push:
branches:
- master
- development
- "release-no-verify/*"
workflow_dispatch:
jobs:
build-and-test:
runs-on: docker
container:
image: node:20-alpine
steps:
- name: Git Clone
uses: actions/checkout@v4
- name: Restore Node Modules Cache
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install Dependencies
run: npm install
- name: Build Project
run: npm run build
- name: Run Tests
run: npm test
- name: Prepare Package
run: |
cp package.json dist/
cp README.md dist/
mv dist lhmask
- uses: actions/upload-artifact@v3
name: Upload lhmask to GitHub
with:
name: lhmask
path: lhmask
check-version:
runs-on: docker
container:
image: node:20-alpine
outputs:
version_changed: ${{ steps.check.outputs.version_changed }}
steps:
- name: Instalando Dependencias
run: |
apk add git jq
- name: Checkout do repositório
uses: actions/checkout@v4
with:
fetch-depth: 2 # Necessário para acessar o commit anterior
- name: Verificar mudança de versão no package.json
id: check
run: |
OLD_VERSION=$(git show HEAD^:package.json | jq -r '.version')
NEW_VERSION=$(jq -r '.version' package.json)
echo "Versão anterior: $OLD_VERSION"
echo "Versão atual: $NEW_VERSION"
if [ "$OLD_VERSION" != "$NEW_VERSION" ]; then
echo "version_changed=true" >> "$GITHUB_OUTPUT"
else
echo "version_changed=false" >> "$GITHUB_OUTPUT"
fi
publish-staging:
runs-on: docker
needs: [build-and-test, check-version]
container:
image: node:20-alpine
if: needs.check-version.outputs.version_changed == 'true' && (github.ref == 'refs/heads/development' || startsWith(github.ref, 'refs/heads/release-no-verify/'))
steps:
- name: Download lhmask
uses: actions/download-artifact@v3
with:
path: lhmask
name: lhmask
- name: Publish to NPM (staging)
run: |
cd lhmask
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
npm publish
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
publish-production:
runs-on: docker
needs: [build-and-test, check-version]
container:
image: node:20-alpine
if: needs.check-version.outputs.version_changed == 'true' && github.ref == 'refs/heads/master'
steps:
- name: Download lhmask
uses: actions/download-artifact@v3
with:
path: lhmask
name: lhmask
- name: Publish to NPM (staging)
run: |
cd lhmask
sed -i "s/-dev//g" dist/package.json
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
npm publish
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
finish-deploy:
runs-on: docker
needs: [build-and-test, check-version]
steps:
- name: finish
run: |
echo "OK Done".

27
README.en.md Normal file
View file

@ -0,0 +1,27 @@
Library with functions for Brazilian data formatting.
CPF/CNPJ: Returns either CPF or CNPJ format based on the input length.
```js
import { formatarCep } from "lhmask";
console.log(formatarCep("12345000")); // Output: 12.345-000
console.log(formatarCnpj("12123456000100")); // Output 12.123.456/0001-00
console.log(formatarCpf("12345678900")); // Output: 123.456.789-00
console.log(formatarCpfCnpj("12123456000100")); // Output 12.123.456/0001-00
console.log(formatarCpfCnpj("12345678900")); // Output: 123.456.789-00
console.log(formatarContaBancaria("12345")); // Output: 1234-5
console.log(formatarTelefone("88912341234")); // Output: (88)91234-1234.
console.log(formatarTelefone("8834001234")); // Output: (88)3400-1234.
console.log(formatarTelefone("08001234567")); // Output: 0800-123-4567
// Returns the formatted value according to the specified string.
// Possible values: cep, cpf, cnpj, cpfcnpj, contabancaria.
console.log(formatarValor("12345", "contabancaria")); // Output: 1234-5
```

View file

@ -1,4 +1,6 @@
# README #
# README
🔗 [English version here](README.en.md)
Biblioteca com funções para formatação de dados.
@ -7,23 +9,23 @@ CPF/CNPJ: Retorna no CPF ou CNPJ de Acordo com o Tamanho da Entrada.
### Exemplos
```js
import { formatarCep } from 'lhmask';
import { formatarCep } from "lhmask";
console.log(formatarCep('12345000')); // Saída: 12.345-000
console.log(formatarCep("12345000")); // Saída: 12.345-000
console.log(formatarCnpj('12123456000100')); // Saída 12.123.456/0001-00
console.log(formatarCnpj("12123456000100")); // Saída 12.123.456/0001-00
console.log(formatarCpf('12345678900')); // Saída: 123.456.789-00
console.log(formatarCpf("12345678900")); // Saída: 123.456.789-00
console.log(formatarCpfCnpj('12123456000100')); // Saída 12.123.456/0001-00
console.log(formatarCpfCnpj("12123456000100")); // Saída 12.123.456/0001-00
console.log(formatarCpfCnpj('12345678900')); // Saída: 123.456.789-00
console.log(formatarCpfCnpj("12345678900")); // Saída: 123.456.789-00
console.log(formatarContaBancaria('12345')); // Saída: 1234-5
console.log(formatarContaBancaria("12345")); // Saída: 1234-5
console.log(formatarTelefone('88912341234')); // Saída: (88)91234-1234.
console.log(formatarTelefone('8834001234')); // Saída: (88)3400-1234.
console.log(formatarTelefone('08001234567')); // Saída: 0800-123-4567
console.log(formatarTelefone("88912341234")); // Saída: (88)91234-1234.
console.log(formatarTelefone("8834001234")); // Saída: (88)3400-1234.
console.log(formatarTelefone("08001234567")); // Saída: 0800-123-4567
// Retorna no formado especificado pela string.
// possíveis valores: cep, cpf, cnpj, cpfcnpj, contabancaria.

View file

@ -1,6 +1,6 @@
{
"name": "lhmask-dev",
"version": "1.1.7",
"version": "1.1.8",
"description": "Biblioteca com funções para formatação de dados.",
"main": "src/lhmask.js",
"scripts": {