Skip to content

Commit

Permalink
retirando dependência do babel, padronizando em CommonJS
Browse files Browse the repository at this point in the history
  • Loading branch information
Romulosanttos committed Apr 30, 2020
1 parent aab6818 commit ef315c0
Show file tree
Hide file tree
Showing 7 changed files with 3,847 additions and 27 deletions.
6 changes: 3 additions & 3 deletions examples/gerar-boleto-BancoDoBrasil.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Gerador from '../index';
import { gerarPdf, gerarBoleto} from './index';
import streamToPromise from '../lib/utils/util';
const Gerador = require('../index');
const { gerarPdf, gerarBoleto} = require('./index');
const streamToPromise = require('../lib/utils/util');

const boleto = {
banco: new Gerador.boleto.bancos.BancoBrasil(),
Expand Down
7 changes: 3 additions & 4 deletions examples/gerar-boleto-bradesco.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import Gerador from '../index';
import { gerarPdf, gerarBoleto} from './index';
import streamToPromise from '../lib/utils/util';

const Gerador = require('../index');
const { gerarPdf, gerarBoleto} = require('./index');
const streamToPromise = require('../lib/utils/util');

const boleto = {
banco: new Gerador.boleto.bancos.Bradesco(),
Expand Down
7 changes: 3 additions & 4 deletions examples/gerar-boleto-cecred.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import Gerador from '../index';
import { gerarPdf, gerarBoleto} from './index';
import streamToPromise from '../lib/utils/util';

const Gerador = require('../index');
const { gerarPdf, gerarBoleto} = require('./index');
const streamToPromise = require('../lib/utils/util');

const boleto = {
banco: new Gerador.boleto.bancos.Cecred(),
Expand Down
8 changes: 4 additions & 4 deletions examples/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@

import Gerador from '../index';
import fs from 'fs';

export { gerarPdf, gerarBoleto };
const Gerador = require('../index');
const fs = require('fs');

const gerarPdf = (boleto, stream = null)=>{

Expand Down Expand Up @@ -92,3 +90,5 @@ const createInstrucoes = ()=>{
instrucoes.push('Após o vencimento, multa de 2%');
return instrucoes;
};

module.exports = { gerarPdf, gerarBoleto };
7 changes: 3 additions & 4 deletions lib/utils/util.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@

export { streamToPromise };

const streamToPromise = (stream) => {
return new Promise(function(resolve, reject) {
stream.on('end', ()=> resolve(stream));
stream.on('error', ()=> reject);
});
};
};

module.exports = { streamToPromise };
12 changes: 4 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gerar-boletos",
"version": "1.2.3",
"version": "1.3.3",
"description": "Gerar boletos para vários bancos",
"main": "index.js",
"directories": {
Expand All @@ -11,9 +11,9 @@
"scripts": {
"test": "nodeunit ./tests/*test.js && nodeunit ./tests/boleto/bancos/*test.js && nodeunit ./tests/boleto/*test.js",
"lint": "eslint .",
"gerarBradesco": "babel-node ./examples/gerar-boleto-bradesco.js",
"gerarCecred": "babel-node ./examples/gerar-boleto-cecred.js",
"gerarBrasil": "babel-node ./examples/gerar-boleto-BancoDoBrasil.js"
"gerarBradesco": "node ./examples/gerar-boleto-bradesco.js",
"gerarCecred": "node ./examples/gerar-boleto-cecred.js",
"gerarBrasil": "node ./examples/gerar-boleto-BancoDoBrasil.js"
},
"keywords": [
"gerador",
Expand Down Expand Up @@ -49,10 +49,6 @@
"pdfkit": "0.10.0"
},
"devDependencies": {
"@babel/core": "^7.6.4",
"@babel/node": "^7.6.3",
"@babel/plugin-proposal-class-properties": "^7.5.5",
"@babel/preset-env": "^7.6.3",
"eslint": "^6.5.1",
"nodeunit": "0.11.3"
},
Expand Down
Loading

0 comments on commit ef315c0

Please sign in to comment.