diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml deleted file mode 100644 index ab327ea..0000000 --- a/.forgejo/workflows/build.yml +++ /dev/null @@ -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". diff --git a/README.en.md b/README.en.md deleted file mode 100644 index ef3ca46..0000000 --- a/README.en.md +++ /dev/null @@ -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 -``` diff --git a/README.md b/README.md index b408bd4..c1c19ca 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,4 @@ -# README - -🔗 [English version here](README.en.md) +# README # Biblioteca com funções para formatação de dados. @@ -9,25 +7,25 @@ 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. console.log(formatarValor("12345", "contabancaria")); // Saída: 1234-5 -``` +``` \ No newline at end of file diff --git a/package.json b/package.json index d436a1f..d02fe41 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lhmask-dev", - "version": "1.1.8", + "version": "1.1.7", "description": "Biblioteca com funções para formatação de dados.", "main": "src/lhmask.js", "scripts": {