Compare commits
No commits in common. "35ccc0523db7608973e317c4380e2e7336e8e876" and "bb83324e3681bf0779441af9a8b2649ad54f338b" have entirely different histories.
35ccc0523d
...
bb83324e36
4 changed files with 13 additions and 166 deletions
|
@ -1,124 +0,0 @@
|
||||||
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
27
README.en.md
|
@ -1,27 +0,0 @@
|
||||||
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
|
|
||||||
```
|
|
24
README.md
24
README.md
|
@ -1,6 +1,4 @@
|
||||||
# README
|
# README #
|
||||||
|
|
||||||
🔗 [English version here](README.en.md)
|
|
||||||
|
|
||||||
Biblioteca com funções para formatação de dados.
|
Biblioteca com funções para formatação de dados.
|
||||||
|
|
||||||
|
@ -9,23 +7,23 @@ CPF/CNPJ: Retorna no CPF ou CNPJ de Acordo com o Tamanho da Entrada.
|
||||||
### Exemplos
|
### Exemplos
|
||||||
|
|
||||||
```js
|
```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('88912341234')); // Saída: (88)91234-1234.
|
||||||
console.log(formatarTelefone("8834001234")); // Saída: (88)3400-1234.
|
console.log(formatarTelefone('8834001234')); // Saída: (88)3400-1234.
|
||||||
console.log(formatarTelefone("08001234567")); // Saída: 0800-123-4567
|
console.log(formatarTelefone('08001234567')); // Saída: 0800-123-4567
|
||||||
|
|
||||||
// Retorna no formado especificado pela string.
|
// Retorna no formado especificado pela string.
|
||||||
// possíveis valores: cep, cpf, cnpj, cpfcnpj, contabancaria.
|
// possíveis valores: cep, cpf, cnpj, cpfcnpj, contabancaria.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "lhmask-dev",
|
"name": "lhmask-dev",
|
||||||
"version": "1.1.8",
|
"version": "1.1.7",
|
||||||
"description": "Biblioteca com funções para formatação de dados.",
|
"description": "Biblioteca com funções para formatação de dados.",
|
||||||
"main": "src/lhmask.js",
|
"main": "src/lhmask.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue