<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Carlos E. Feria Vila on Medium]]></title>
        <description><![CDATA[Stories by Carlos E. Feria Vila on Medium]]></description>
        <link>https://medium.com/@carlosthe19916?source=rss-aa900b8470f3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*vS8u-pAQU4hKnheL.jpg</url>
            <title>Stories by Carlos E. Feria Vila on Medium</title>
            <link>https://medium.com/@carlosthe19916?source=rss-aa900b8470f3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 12:05:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@carlosthe19916/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[RHAMT in Github Actions]]></title>
            <link>https://medium.com/@carlosthe19916/rhamt-in-github-actions-da1e97c5f51e?source=rss-aa900b8470f3------2</link>
            <guid isPermaLink="false">https://medium.com/p/da1e97c5f51e</guid>
            <dc:creator><![CDATA[Carlos E. Feria Vila]]></dc:creator>
            <pubDate>Sun, 12 Apr 2020 11:53:49 GMT</pubDate>
            <atom:updated>2020-04-12T16:25:16.236Z</atom:updated>
            <content:encoded><![CDATA[<p>Red Hat Application Migration Toolkit is a powerful application that can help you to migrate your current application to multiple target technologies.</p><p>Now you can use RHAMT directly in your GitHub Repository and start analyzing every commit, pull request, etc. so your team is always updated about the work needed to do in order to complete the migration to some target technology.</p><h3>I’m lazy and want to see the final result</h3><ul><li>Repository to analyze: <a href="https://github.com/carlosthe19916/windup-action-example">https://github.com/carlosthe19916/windup-action-example</a></li><li>Result of the Analysis: <a href="https://carlosthe19916.github.io/windup-action-example/">https://carlosthe19916.github.io/windup-action-example/</a></li><li>RHAMT GitHub Actions configuration: <a href="https://github.com/carlosthe19916/windup-action-example/blob/master/.github/workflows/workflow.yml">https://github.com/carlosthe19916/windup-action-example/blob/master/.github/workflows/workflow.yml</a></li></ul><h3>What is RHAMT?</h3><p>Red Hat Application Migration Toolkit is a powerful application that can help you to migrate your current application to multiple target technologies like:</p><ul><li>eap6</li><li>eap7</li><li>jakarta-ee</li><li>java-ee</li><li>openjdk</li><li>camel</li><li>cloud-readiness</li><li>drools</li><li>fsw</li><li>fuse</li><li>hibernate</li><li>hibernate-search</li><li>jbpm</li><li>linux</li><li>resteasy</li></ul><blockquote><em>Red Hat Application Migration Toolkit is an assembly of open source tools that enables large-scale application migrations and modernizations. The tooling consists of multiple individual components that provide support for each phase of a migration process. The migrations supported include application platform upgrades, migrations to a cloud-native deployment environment, and also migrations from several commercial products to the Red Hat JBoss Enterprise Application Platform.</em></blockquote><blockquote><a href="https://developers.redhat.com/products/rhamt/overview"><em>https://developers.redhat.com/products/rhamt/overview</em></a></blockquote><p>To know more about RHAMT you can visit <a href="https://developers.redhat.com/products/rhamt/">https://developers.redhat.com/products/rhamt/</a></p><p><strong>But this blog is not about RHAMT and its powerful capabilities but it is about how to use it in your GitHub repositories and integrate it in your CI workflow.</strong></p><h3>Use RHAMT in your GitHub Repository</h3><p>I’ve created a GitHub Action for RHAMT which is available in the GitHub Marketplace and here you have the link:</p><ul><li><a href="https://github.com/marketplace/actions/rhamt-action">https://github.com/marketplace/actions/rhamt-action</a></li></ul><p>The RHAMT GitHub Action is able to analyse whatever is stored in your repository and create a report, based in the RHAMT configuration, that you can use to help you during your migration process.</p><p>The RHAMT GitHub Action is really simple to use:</p><ul><li>Create .github/workflows/workflow.yml file in your repository and add this content:</li></ul><pre>name: Example workflow for RHAMT<br>on: [push]<br>jobs:<br>  run:<br>    runs-on: ubuntu-latest<br>    steps:<br>    - uses: actions/checkout@v2<br>    - uses: carlosthe19916/windup-action@master<br>      id: rhamt<br>      with:<br>        target: eap7<br>        additional-command-line-arguments: &#39;--sourceMode&#39;</pre><p>target indicates which is the target technology you want to migrate to. In my example I&#39;ve selected eap7, which means that I want to migrate my current application to <a href="https://www.redhat.com/en/technologies/jboss-middleware/application-platform">Red Hat JBoss Enterprise Application Platform</a> version 7; however you can select the target technology of your preference.</p><p>additional-command-line-arguments can be used to pass any parameter to RHAMT. In my case I&#39;m passing --sourceMode to indicate that the application to be evaluated contains source files rather than compiled binaries.</p><p><em>To know all the possible commands you can pass to RHAMT read the official documentation in </em><a href="https://access.redhat.com/documentation/en-us/red_hat_application_migration_toolkit/4.3/html-single/cli_guide/index#output_argument"><em>RHAMT Command-line Arguments</em></a></p><ul><li>That’s all! You can access to the report generated using the next command inside GitHub Actions</li></ul><pre>${{ steps.rhamt.outputs.report }}</pre><h3>Full Example: RHAMT and Github Pages</h3><p>In this example I’m going to use my repository <a href="https://github.com/carlosthe19916/windup-action-example">https://github.com/carlosthe19916/windup-action-example</a> and:</p><ul><li>Run a RHAMT analysis on every single commit that my repository receives.</li><li>Upload the RHAMT report to the artifacts that GitHub Actions provides.</li><li>Deploy my report to GitHub Pages so my team can see the current status of the application.</li></ul><p>The only required step is:</p><ul><li>Create <a href="https://github.com/carlosthe19916/windup-action-example/tree/master/.github">.github</a>/<a href="https://github.com/carlosthe19916/windup-action-example/tree/master/.github/workflows">workflows</a>/<strong>workflow.yml</strong> file with the content:</li></ul><pre>on: [push]</pre><pre>jobs:<br>  windup_job:<br>    runs-on: ubuntu-latest<br>    name: RHAMT<br>    steps:<br>      - uses: actions/checkout@v2<br>      - uses: carlosthe19916/windup-action@master<br>        id: rhamt<br>        with:<br>          target: &#39;eap7&#39;<br>          additional-command-line-arguments: &#39;--sourceMode&#39;<br>      - name: Upload RHAMT report<br>        uses: actions/upload-artifact@v1<br>        with:<br>          name: rhamt-artifacts<br>          path: ${{ steps.rhamt.outputs.report }}<br>  gp_page_job:<br>    runs-on: ubuntu-latest<br>    name: Github Pages<br>    needs: windup_job<br>    steps:<br>      - uses: actions/checkout@v2<br>      - name: Download RHAMT Report<br>        uses: actions/download-artifact@v1<br>        with:<br>          name: rhamt-artifacts<br>          path: .<br>      - shell: bash<br>        run: |<br>          mkdir -p target/rhamt<br>      - name: Extract RHAMT Report<br>        shell: bash<br>        run: tar -xzvf rhamt-report.tgz -C target/rhamt<br>      - name: GitHub Pages<br>        uses: crazy-max/ghaction-github-pages@v1.4.0<br>        with:<br>          build_dir: target/rhamt<br>        env:<br>          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}</pre><ul><li>That’s all, now you will see that every commit is analyzed:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RJ3r8K3uhQ9aPNRGuejDAQ.png" /></figure><ul><li>You can also download the result of the analysis made to the commit:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ETnjhC40gndpuWHEU3Bzgg.png" /></figure><ul><li>Last but not least, you can see your report through a URL like any live HTML page, just click on <a href="https://carlosthe19916.github.io/windup-action-example/">https://carlosthe19916.github.io/windup-action-example/</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IBG7e_p8LG-hwCc4AZMkCg.png" /></figure><h3>Side notes</h3><p>RHAMT Github Action is a personal initiative and does not have official support from RHAMT itself; however, depending on how many repositories are using this project I will start adding more features; your contribution is always welcome. There are many things we can do with RHAMT and the only limit is our imagination, effort and work.</p><p><strong>ORIGINAL POST: Post taken from </strong><a href="https://carlosthe19916.wordpress.com/2020/04/12/rhamt-in-github-actions/"><strong>https://carlosthe19916.wordpress.com/2020/04/12/rhamt-in-github-actions/</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=da1e97c5f51e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Project OpenUBL (xml-builder) -Facturación Electrónica Open Source]]></title>
            <link>https://medium.com/@carlosthe19916/project-openubl-xml-builder-facturaci%C3%B3n-electr%C3%B3nica-open-source-e737bb30b647?source=rss-aa900b8470f3------2</link>
            <guid isPermaLink="false">https://medium.com/p/e737bb30b647</guid>
            <category><![CDATA[xml-builder]]></category>
            <category><![CDATA[project-openubl]]></category>
            <category><![CDATA[sunat]]></category>
            <category><![CDATA[facturación-electrónica]]></category>
            <category><![CDATA[open-source]]></category>
            <dc:creator><![CDATA[Carlos E. Feria Vila]]></dc:creator>
            <pubDate>Tue, 18 Feb 2020 13:21:52 GMT</pubDate>
            <atom:updated>2020-02-18T13:23:45.959Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*PBL1M9D5_60qfzj28HLxEQ.png" /><figcaption>Project OpenUBL</figcaption></figure><h3>¿Qué es Project OpenUBL?</h3><p><a href="https://project-openubl.github.io/">Project OpenUBL</a> es un proyecto Open Source que incluye un conjunto de herramientas, librerias, microservicios asociados a la Facturación Electrónica en el Perú.</p><p><a href="https://project-openubl.github.io/">Project OpenUBL</a> nace porque ví que todos crean sus propios softwares y no hay ninguna iniciativa de crear soluciones de nivel empresarial utilizando herramientas Open Source. El conocimiento debe de ser compartido y plasmado en algo concreto.</p><h3>¿Qué no es Project OpenUBL?</h3><p><a href="https://project-openubl.github.io/">Project OpenUBL</a> no es un software de Facturación Electrónica. El objetivo de Project OpenUBL es crear herramientas que otros softwares, empresas, o desarrolladores puedan usar en sus propios projectos.</p><h3>¿Qué contiene Project OpenUBL?</h3><p>Por el momento Project OpenUBL contiene 2 herramientas:</p><ul><li><a href="https://github.com/project-openubl/xml-builder"><strong>XML Builder</strong></a>: microservicio para crear comprobantes de pago electrónicos usando UBL 2.1.</li><li><a href="https://github.com/project-openubl/sunat-web-services"><strong>SUNAT Web Services</strong></a>: Libreria Java usada para enviar XMLs a la SUNAT.</li></ul><h3>¿Qué otros projectos serán incluidos en Project OpenUBL?</h3><p>Pronto Project OpenUBL incluirá:</p><ul><li>XML Signer: microservicio para firmar electrónicamente arachivos XML</li><li>XML Reporter: microservicio para generar PDFs (versión impresa del comprobante)</li></ul><h3>Hablemos de XML Builder</h3><p>XML Builder es un microservicio que expone servicios web rest que pueden ser usados para crear comprobantes de pago electrónicos como factura, boleta, nota de crédito, nota de débito, etc. Se llama XML Builder porque cada uno de sus endpoints generan archivos XMLs basados en el estandar UBL 2.1.</p><p>La idea de <a href="https://github.com/project-openubl/xml-builder">XML Builder</a> es crear comprobantes con los datos mínimos necesarios; <a href="https://github.com/project-openubl/xml-builder">XML Builder</a> debe de generar la mayoria de datos automáticamente. Además los endpoints son <em>User Friendly</em>, es decir los endpoints no requieren de engorrosos códigos de Catálogos como los piden la mayoria de softwares en el mercado nacional actual.</p><h3>Crear Factura electrónica usando XML Builder</h3><p>Este es un ejemplo sencillo sobre cómo crear una factura electrónica. Lo primero es levantar el servidor, para ello puedes utilizar la documentación <a href="https://project-openubl.gitbook.io/xml-builder/levantar_servidor">Levantar Servidor XML Builder</a>.</p><p>Una vez levantado el servidor puedes utilizar cualquier tipo de herramienta capaz de crear peticiones HTTP, en este ejemplo utilizaré el más sencillo para desarrolladores: el terminal de comandos Linux:</p><pre>curl -X POST \<br>-H &quot;Content-Type: application/json&quot; \<br>-d &#39;{<br>    &quot;serie&quot;: &quot;F001&quot;,<br>    &quot;numero&quot;: 1,<br>    &quot;fechaEmision&quot;: 1573247709344,<br>    &quot;firmante&quot;: {<br>      &quot;ruc&quot;: &quot;12345678912&quot;,<br>      &quot;razonSocial&quot;: &quot;Razon Social Firmante&quot;<br>    },<br>    &quot;proveedor&quot;: {<br>      &quot;ruc&quot;: &quot;98765432198&quot;,<br>      &quot;nombreComercial&quot;: &quot;Nombre comercial proveedor&quot;,<br>      &quot;razonSocial&quot;: &quot;Razon social proveedor&quot;,<br>      &quot;codigoPostal&quot;: &quot;010101&quot;<br>    },<br>    &quot;cliente&quot;: {<br>      &quot;tipoDocumentoIdentidad&quot;: &quot;RUC&quot;,<br>      &quot;numeroDocumentoIdentidad&quot;: &quot;12312312312&quot;,<br>      &quot;nombre&quot;: &quot;Nombre o razon social cliente&quot;<br>    },<br>    &quot;detalle&quot;: [<br>      {<br>        &quot;descripcion&quot;: &quot;Descripcion del item en venta&quot;,<br>        &quot;cantidad&quot;: 1,<br>        &quot;precioUnitario&quot;: 100<br>      }<br>    ]<br>  }&#39; \<br>http://localhost:8080/documents/invoice/create</pre><p>El resultado del comando anterior es:</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;ISO-8859-1&quot;?&gt;<br>&lt;Invoice xmlns=&quot;urn:oasis:names:specification:ubl:schema:xsd:Invoice-2&quot;<br>        xmlns:cac=&quot;urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2&quot;<br>        xmlns:cbc=&quot;urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2&quot;<br>        xmlns:ccts=&quot;urn:un:unece:uncefact:documentation:2&quot;<br>        xmlns:cec=&quot;urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2&quot;<br>        xmlns:ds=&quot;http://www.w3.org/2000/09/xmldsig#&quot;<br>        xmlns:ext=&quot;urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2&quot;<br>        xmlns:qdt=&quot;urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2&quot;<br>        xmlns:sac=&quot;urn:sunat:names:specification:ubl:peru:schema:xsd:SunatAggregateComponents-1&quot;<br>        xmlns:udt=&quot;urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2&quot;<br>        xmlns:xs=&quot;http://www.w3.org/2001/XMLSchema&quot;<br>        xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;<br>&gt;<br>    &lt;ext:UBLExtensions&gt;<br>        &lt;ext:UBLExtension&gt;<br>            &lt;ext:ExtensionContent/&gt;<br>        &lt;/ext:UBLExtension&gt;<br>    &lt;/ext:UBLExtensions&gt;<br>    &lt;cbc:UBLVersionID&gt;2.1&lt;/cbc:UBLVersionID&gt;<br>    &lt;cbc:CustomizationID&gt;2.0&lt;/cbc:CustomizationID&gt;<br>    &lt;cbc:ID&gt;F001-1&lt;/cbc:ID&gt;<br>    &lt;cbc:IssueDate&gt;2019-11-08&lt;/cbc:IssueDate&gt;<br>    &lt;cbc:IssueTime&gt;22:15:09&lt;/cbc:IssueTime&gt;<br>    &lt;cbc:InvoiceTypeCode listID=&quot;0101&quot; listAgencyName=&quot;PE:SUNAT&quot; listName=&quot;SUNAT:Identificador de Tipo de Documento&quot; listURI=&quot;urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo01&quot;&gt;01&lt;/cbc:InvoiceTypeCode&gt;<br>    &lt;cbc:DocumentCurrencyCode listID=&quot;ISO 4217 Alpha&quot; listAgencyName=&quot;United Nations Economic Commission for Europe&quot; listName=&quot;Currency&quot;&gt;PEN&lt;/cbc:DocumentCurrencyCode&gt;<br>    &lt;cbc:LineCountNumeric&gt;1&lt;/cbc:LineCountNumeric&gt;<br>    &lt;cac:Signature&gt;<br>        &lt;cbc:ID&gt;#SIGN-ID&lt;/cbc:ID&gt;<br>        &lt;cac:SignatoryParty&gt;<br>            &lt;cac:PartyIdentification&gt;<br>                &lt;cbc:ID&gt;12345678912&lt;/cbc:ID&gt;<br>            &lt;/cac:PartyIdentification&gt;<br>            &lt;cac:PartyName&gt;<br>                &lt;cbc:Name&gt;<br>                    &lt;![CDATA[Razon Social Firmante]]&gt;<br>                &lt;/cbc:Name&gt;<br>            &lt;/cac:PartyName&gt;<br>        &lt;/cac:SignatoryParty&gt;<br>        &lt;cac:DigitalSignatureAttachment&gt;<br>            &lt;cac:ExternalReference&gt;<br>                &lt;cbc:URI&gt;#SIGN-ID&lt;/cbc:URI&gt;<br>            &lt;/cac:ExternalReference&gt;<br>        &lt;/cac:DigitalSignatureAttachment&gt;<br>    &lt;/cac:Signature&gt;<br>    &lt;cac:AccountingSupplierParty&gt;<br>        &lt;cac:Party&gt;<br>            &lt;cac:PartyIdentification&gt;<br>                &lt;cbc:ID schemeID=&quot;6&quot; schemeAgencyName=&quot;PE:SUNAT&quot; schemeName=&quot;SUNAT:Identificador de Documento de Identidad&quot; schemeURI=&quot;urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo06&quot;&gt;98765432198&lt;/cbc:ID&gt;<br>            &lt;/cac:PartyIdentification&gt;<br>            &lt;cac:PartyName&gt;<br>                &lt;cbc:Name&gt;Nombre comercial proveedor&lt;/cbc:Name&gt;<br>            &lt;/cac:PartyName&gt;<br>            &lt;cac:PartyLegalEntity&gt;<br>                &lt;cbc:RegistrationName&gt;<br>                    &lt;![CDATA[Razon social proveedor]]&gt;<br>                &lt;/cbc:RegistrationName&gt;<br>                &lt;cac:RegistrationAddress&gt;<br>                    &lt;cbc:AddressTypeCode&gt;010101&lt;/cbc:AddressTypeCode&gt;<br>                &lt;/cac:RegistrationAddress&gt;<br>            &lt;/cac:PartyLegalEntity&gt;<br>        &lt;/cac:Party&gt;<br>    &lt;/cac:AccountingSupplierParty&gt;<br>    &lt;cac:AccountingCustomerParty&gt;<br>        &lt;cac:Party&gt;<br>            &lt;cac:PartyIdentification&gt;<br>                &lt;cbc:ID schemeID=&quot;6&quot; schemeAgencyName=&quot;PE:SUNAT&quot; schemeName=&quot;SUNAT:Identificador de Documento de Identidad&quot; schemeURI=&quot;urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo06&quot;&gt;12312312312&lt;/cbc:ID&gt;<br>            &lt;/cac:PartyIdentification&gt;<br>            &lt;cac:PartyLegalEntity&gt;<br>                &lt;cbc:RegistrationName&gt;<br>                    &lt;![CDATA[Nombre o razon social cliente]]&gt;<br>                &lt;/cbc:RegistrationName&gt;<br>            &lt;/cac:PartyLegalEntity&gt;<br>        &lt;/cac:Party&gt;<br>    &lt;/cac:AccountingCustomerParty&gt;<br>    &lt;cac:TaxTotal&gt;<br>        &lt;cbc:TaxAmount currencyID=&quot;PEN&quot;&gt;15.25&lt;/cbc:TaxAmount&gt;<br>        &lt;cac:TaxSubtotal&gt;<br>            &lt;cbc:TaxableAmount currencyID=&quot;PEN&quot;&gt;84.75&lt;/cbc:TaxableAmount&gt;<br>            &lt;cbc:TaxAmount currencyID=&quot;PEN&quot;&gt;15.25&lt;/cbc:TaxAmount&gt;<br>            &lt;cac:TaxCategory&gt;<br>                &lt;cbc:ID schemeAgencyName=&quot;United Nations Economic Commission for Europe&quot; schemeID=&quot;UN/ECE 5305&quot; schemeName=&quot;Tax Category Identifie&quot;&gt;S&lt;/cbc:ID&gt;<br>                &lt;cac:TaxScheme&gt;<br>                    &lt;cbc:ID schemeAgencyName=&quot;PE:SUNAT&quot; schemeID=&quot;UN/ECE 5153&quot; schemeName=&quot;Codigo de tributos&quot;&gt;1000&lt;/cbc:ID&gt;<br>                    &lt;cbc:Name&gt;IGV&lt;/cbc:Name&gt;<br>                    &lt;cbc:TaxTypeCode&gt;VAT&lt;/cbc:TaxTypeCode&gt;<br>                &lt;/cac:TaxScheme&gt;<br>            &lt;/cac:TaxCategory&gt;<br>        &lt;/cac:TaxSubtotal&gt;<br>    &lt;/cac:TaxTotal&gt;<br>    &lt;cac:LegalMonetaryTotal&gt;<br>        &lt;cbc:AllowanceTotalAmount currencyID=&quot;PEN&quot;&gt;0&lt;/cbc:AllowanceTotalAmount&gt;<br>        &lt;cbc:ChargeTotalAmount currencyID=&quot;PEN&quot;&gt;0&lt;/cbc:ChargeTotalAmount&gt;<br>        &lt;cbc:PayableAmount currencyID=&quot;PEN&quot;&gt;100&lt;/cbc:PayableAmount&gt;<br>    &lt;/cac:LegalMonetaryTotal&gt;<br>    &lt;cac:InvoiceLine&gt;<br>        &lt;cbc:ID&gt;1&lt;/cbc:ID&gt;<br>        &lt;cbc:InvoicedQuantity unitCode=&quot;NIU&quot; unitCodeListAgencyName=&quot;United Nations Economic Commission for Europe&quot; unitCodeListID=&quot;UN/ECE rec 20&quot;&gt;1&lt;/cbc:InvoicedQuantity&gt;<br>        &lt;cbc:LineExtensionAmount currencyID=&quot;PEN&quot;&gt;84.75&lt;/cbc:LineExtensionAmount&gt;<br>        &lt;cac:PricingReference&gt;<br>            &lt;cac:AlternativeConditionPrice&gt;<br>                &lt;cbc:PriceAmount currencyID=&quot;PEN&quot;&gt;100&lt;/cbc:PriceAmount&gt;<br>                &lt;cbc:PriceTypeCode listAgencyName=&quot;PE:SUNAT&quot; listName=&quot;SUNAT:Indicador de Tipo de Precio&quot; listURI=&quot;urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo16&quot;&gt;01&lt;/cbc:PriceTypeCode&gt;<br>            &lt;/cac:AlternativeConditionPrice&gt;<br>        &lt;/cac:PricingReference&gt;<br>        &lt;cac:TaxTotal&gt;<br>            &lt;cbc:TaxAmount currencyID=&quot;PEN&quot;&gt;15.25&lt;/cbc:TaxAmount&gt;<br>            &lt;cac:TaxSubtotal&gt;<br>                &lt;cbc:TaxableAmount currencyID=&quot;PEN&quot;&gt;84.75&lt;/cbc:TaxableAmount&gt;<br>                &lt;cbc:TaxAmount currencyID=&quot;PEN&quot;&gt;15.25&lt;/cbc:TaxAmount&gt;<br>                &lt;cac:TaxCategory&gt;<br>                    &lt;cbc:ID schemeAgencyName=&quot;United Nations Economic Commission for Europe&quot; schemeID=&quot;UN/ECE 5305&quot; schemeName=&quot;Tax Category Identifier&quot;&gt;S&lt;/cbc:ID&gt;<br>                    &lt;cbc:Percent&gt;18&lt;/cbc:Percent&gt;<br>                    &lt;cbc:TaxExemptionReasonCode listAgencyName=&quot;PE:SUNAT&quot; listName=&quot;SUNAT:Codigo de Tipo de Afectacion del IGV&quot; listURI=&quot;urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo07&quot;&gt;10&lt;/cbc:TaxExemptionReasonCode&gt;<br>                    &lt;cac:TaxScheme&gt;<br>                        &lt;cbc:ID schemeAgencyName=&quot;PE:SUNAT&quot; schemeID=&quot;UN/ECE 5153&quot; schemeName=&quot;Codigo de tributos&quot;&gt;1000&lt;/cbc:ID&gt;<br>                        &lt;cbc:Name&gt;IGV&lt;/cbc:Name&gt;<br>                        &lt;cbc:TaxTypeCode&gt;VAT&lt;/cbc:TaxTypeCode&gt;<br>                    &lt;/cac:TaxScheme&gt;<br>                &lt;/cac:TaxCategory&gt;<br>            &lt;/cac:TaxSubtotal&gt;<br>        &lt;/cac:TaxTotal&gt;<br>        &lt;cac:Item&gt;<br>            &lt;cbc:Description&gt;<br>                &lt;![CDATA[Descripcion del item en venta]]&gt;<br>            &lt;/cbc:Description&gt;<br>        &lt;/cac:Item&gt;<br>        &lt;cac:Price&gt;<br>            &lt;cbc:PriceAmount currencyID=&quot;PEN&quot;&gt;84.75&lt;/cbc:PriceAmount&gt;<br>        &lt;/cac:Price&gt;<br>    &lt;/cac:InvoiceLine&gt;<br>&lt;/Invoice&gt;</pre><p>¿Viste que fácil el crear comprobantes electrónicos utilizando XML Builder?</p><p>XML Builder puede ser consumido desde cualquier applicación de tu empresa, ya sea que estés utilizando Java, .Net, React, o Angular.</p><p>Si deseas saber más sobre XML Builder lee la documentación oficial del projecto aqui: <a href="https://project-openubl.gitbook.io/xml-builder/">https://project-openubl.gitbook.io/xml-builder/</a></p><p>Si deseas contribuir al proyecto puedes hacerlo de muchas formas:</p><ul><li>Crear o mejorar la documentación del proyecto</li><li>Crear Github issues reportando errores o mejoras</li><li>Expandir la noticia del projecto</li></ul><blockquote><a href="https://carlosthe19916.wordpress.com/"><em>https://carlosthe19916.wordpress.com/</em></a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e737bb30b647" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CREATE REACT APP (CRA) AND PUBLISH YOUR LIBRARY COMPONENTS TO NPM + TYPESCRIPT + STORYBOOK]]></title>
            <link>https://medium.com/@carlosthe19916/create-react-app-cra-and-publish-your-library-components-to-npm-typescript-storybook-67ff8fe1599e?source=rss-aa900b8470f3------2</link>
            <guid isPermaLink="false">https://medium.com/p/67ff8fe1599e</guid>
            <category><![CDATA[npm]]></category>
            <category><![CDATA[storybook]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[create-react-app]]></category>
            <category><![CDATA[reactjs]]></category>
            <dc:creator><![CDATA[Carlos E. Feria Vila]]></dc:creator>
            <pubDate>Tue, 18 Feb 2020 13:09:42 GMT</pubDate>
            <atom:updated>2020-02-20T08:12:54.767Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://create-react-app.dev/">Create React App</a> is a powerful tool that helps you init your Reactjs project easily. Using <a href="https://create-react-app.dev/">Create React App</a> you can create a Single Page Application (SPA) without spending time in configurations. However, if you don’t want to create a SPA but you want to create your own library which can be published to NPM, then <a href="https://create-react-app.dev/">Create React App</a> might not help you at all; the documentation says:</p><blockquote><em>Create React App doesn’t provide any built-in functionality to publish a component to npm</em></blockquote><blockquote><a href="https://create-react-app.dev/docs/deployment/#publishing-components-to-npm"><em>https://create-react-app.dev/docs/deployment/#publishing-components-to-npm</em></a></blockquote><p>I’ve tried:</p><ul><li>NWB: <a href="https://github.com/insin/nwb#react-components-and-libraries">https://github.com/insin/nwb#react-components-and-libraries</a> and</li><li>Create React Library <a href="https://github.com/transitive-bullshit/create-react-library#readme">https://github.com/transitive-bullshit/create-react-library#readme</a></li></ul><p>But unfortunately, they did not fit all my needs like:</p><ul><li>Typescript support</li><li>Webpack config, etc.</li></ul><p>Without more to say let’s start creating our own lib which can be published into NPM.</p><h3>Github example repository</h3><p>In case you want all the code at once you can go to the link below and see all the tutorial working:</p><ul><li><a href="https://github.com/carlosthe19916/cra-typescript-storybook">https://github.com/carlosthe19916/cra-typescript-storybook</a></li></ul><p>Here is another example on how to I’ve used this tutorial to create a real lib in NPM</p><ul><li><a href="https://github.com/project-openubl/xml-builder-react">https://github.com/project-openubl/xml-builder-react</a></li></ul><h3>CREATE-REACT-APP + TYPESCRIPT + STORYBOOK + NPM LIB + ENZIME</h3><p>Create a react application:</p><pre>npx create-react-app my-react-application --template typescript</pre><p>Move your terminal to your application folder:</p><pre>cd my-react-application</pre><p>Add babel:</p><pre>yarn add @babel/cli babel-plugin-transform-es2015-modules-umd babel-plugin-typescript-to-proptypes @babel/plugin-proposal-export-default-from -D</pre><p>Add npm utils:</p><pre>yarn add concurrently -D</pre><p>Create file ./scripts/copyTS.js</p><pre>/* eslint-disable @typescript-eslint/no-var-requires */<br>const path = require(&#39;path&#39;);<br>const glob = require(&#39;glob&#39;);<br>const fse = require(&#39;fs-extra&#39;);<br>/* eslint-enable @typescript-eslint/no-var-requires */</pre><pre>const srcDir = path.join(&#39;./src&#39;);<br>const distDir = path.join(&#39;./dist/js&#39;);</pre><pre>const files = glob.sync(&#39;**/*.d.ts&#39;, {<br>  cwd: srcDir<br>});<br>files.forEach(file =&gt; {<br>  const from = path.join(srcDir, file);<br>  const to = path.join(distDir, file);<br>  fse.copySync(from, to);<br>});</pre><p>Edit src/index.tsx and replace all the content by:</p><pre>export * from &#39;./components&#39;;</pre><p>Create file .babelrc with the content:</p><pre>{<br>    &quot;presets&quot;: [&quot;@babel/react&quot;],<br>    &quot;ignore&quot;: [&quot;**/__snapshots__&quot;, &quot;**/*.d.ts&quot;, &quot;**/*.test.*&quot;],<br>    &quot;plugins&quot;: [<br>      &quot;@babel/plugin-transform-typescript&quot;,<br>      &quot;babel-plugin-typescript-to-proptypes&quot;,<br>      &quot;@babel/plugin-proposal-export-default-from&quot;,<br>      &quot;@babel/proposal-class-properties&quot;,<br>      &quot;@babel/proposal-object-rest-spread&quot;<br>    ]<br>}</pre><p>Create file tsconfig.gen-dts.json with the content:</p><pre>{<br>    &quot;compilerOptions&quot;: {<br>      &quot;declaration&quot;: true,<br>      &quot;emitDeclarationOnly&quot;: true,<br>      &quot;outDir&quot;: &quot;dist/js&quot;,<br>      &quot;jsx&quot;: &quot;react&quot;,<br>      &quot;lib&quot;: [<br>        &quot;es2017&quot;,<br>        &quot;dom&quot;<br>      ],<br>      &quot;module&quot;: &quot;commonjs&quot;,<br>      &quot;moduleResolution&quot;: &quot;node&quot;,<br>      &quot;skipLibCheck&quot;: true,<br>      &quot;strict&quot;: true,<br>      &quot;strictNullChecks&quot;: false,<br>      &quot;target&quot;: &quot;es5&quot;<br>    },<br>    &quot;include&quot;: [<br>      &quot;./src/*&quot;,<br>      &quot;./src/**/*&quot;<br>    ],<br>    &quot;exclude&quot;: [<br>      &quot;./src/**/**.test.tsx&quot;,<br>      &quot;./src/**/**.test.ts&quot;,<br>      &quot;./src/**/**.stories.ts&quot;,<br>      &quot;./src/**/**.stories.tsx&quot;,<br>      &quot;./src/**/examples/**&quot;<br>    ]<br>}</pre><p>Finally, edit the file `package.json` and make sure it has the content:</p><pre>{<br>  ...<br>  ...<br>  &quot;main&quot;: &quot;dist/js/index.js&quot;,<br>  &quot;module&quot;: &quot;dist/esm/index.js&quot;,<br>  &quot;types&quot;: &quot;dist/js/index.d.ts&quot;,<br>  &quot;private&quot;: false,<br>  &quot;publishConfig&quot;: {<br>    &quot;access&quot;: &quot;public&quot;,<br>    &quot;tag&quot;: &quot;prerelease&quot;<br>  },<br>  &quot;scripts&quot;: {<br>    ...<br>    ...<br>    &quot;build:lib&quot;: &quot;yarn build:babel &amp;&amp; yarn build:types &amp;&amp; node ./scripts/copyTS.js&quot;,<br>    &quot;build:babel&quot;: &quot;concurrently \&quot;yarn build:babel:esm &amp;&amp; yarn build:babel:umd\&quot; \&quot;yarn build:babel:cjs\&quot;&quot;,<br>    &quot;build:babel:cjs&quot;: &quot;BABEL_ENV=cjs babel --source-maps --extensions \&quot;.js,.ts,.tsx\&quot; src --out-dir dist/js --presets=@babel/env&quot;,<br>    &quot;build:babel:esm&quot;: &quot;BABEL_ENV=esm babel --source-maps --extensions \&quot;.js,.ts,.tsx\&quot; src --out-dir dist/esm&quot;,<br>    &quot;build:babel:umd&quot;: &quot;BABEL_ENV=umd babel --source-maps --extensions \&quot;.js\&quot; dist/esm --out-dir dist/umd --plugins=transform-es2015-modules-umd&quot;,<br>    &quot;build:types&quot;: &quot;tsc -p tsconfig.gen-dts.json&quot;,<br>    &quot;clean&quot;: &quot;rimraf dist&quot;,<br>    &quot;develop&quot;: &quot;yarn build:types &amp;&amp; yarn build:babel:esm --skip-initial-build --watch --verbose&quot;<br>  },<br>  ...<br>  ...<br>}</pre><p>Delete the files/folders:</p><ul><li>public/</li><li>src/App.css</li><li>src/App.tsx</li><li>src/App.test.tsx</li><li>src/index.css</li><li>src/logo.svg</li><li>src/serviceWorker.ts</li><li>src/react-app-env.d.ts</li></ul><h3>CREATE YOUR REACT COMPONENT</h3><p>The steps of followed until now should be enough for creating our lib and make it ready for publishing it to npm. Remember that you need to create your components inside the folder src/components and then export your components using index.tsx file</p><p>For this example we are going to create a basic component to publish into npm:</p><p>Create src/components/index.ts with the content:</p><pre>export * from &#39;./MyComponent&#39;;</pre><p>Now we create our Reactjs component in the file src/components/MyComponent.tsx:</p><pre>import * as React from &quot;react&quot;;</pre><pre>export class MyComponent extends React.Component {<br>  render() {<br>    return (<br>      &lt;React.Fragment&gt;<br>        &lt;p&gt;Hello Lib!&lt;/p&gt;<br>      &lt;/React.Fragment&gt;<br>    );<br>  }<br>}</pre><h3>BUILD YOUR LIBRARY</h3><p>You can execute the command:</p><pre>yarn build:lib</pre><p>The command above should create a folder dist with your lib ready to be published into npm</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/0*O9g2hyEGnVN_EneY" /></figure><h3>PUBLISH TO NPM</h3><p>First, you need to login:</p><pre>npm login</pre><p>And then you can execute the command:</p><pre>npm publish</pre><p>That’s all!</p><p>Optionally you can create the file .npmignore to list the files you don&#39;t want to pusblish:</p><pre>build<br>dist/**/demos<br>dist/**/examples<br>dist/**/__snapshots__<br>dist/**/*.test.js<br>dist/**/*.map</pre><h3>ADD STORYBOOK</h3><pre>yarn add @storybook/addons@next @storybook/addon-actions@next @storybook/addon-docs@next @storybook/addon-info@next @storybook/addon-links@next @storybook/addons@next @storybook/react@next @storybook/preset-create-react-app -D</pre><p>Edit <strong>package.json</strong> and add to the scripts block:</p><pre>&quot;scripts&quot;: {<br>    &quot;storybook&quot;: &quot;start-storybook -p 9009 -s public&quot;,<br>    &quot;build-storybook&quot;: &quot;build-storybook -s public&quot;<br>}</pre><p>We need to configure storybook for typescript and we will do it creating the file .storybook/main.js with the content:</p><pre>const path = require(&quot;path&quot;);</pre><pre>module.exports = {<br>  stories: [&quot;../src/components/**/*.stories.(ts|tsx|js|jsx)&quot;],<br>  addons: [<br>    &quot;@storybook/addon-actions&quot;,<br>    &quot;@storybook/addon-links&quot;,<br>    {<br>      name: &quot;@storybook/preset-create-react-app&quot;,<br>      options: {<br>        tsDocgenLoaderOptions: {<br>          tsconfigPath: path.resolve(__dirname, &quot;../tsconfig.json&quot;)<br>        }<br>      }<br>    },<br>    {<br>      name: &quot;@storybook/addon-docs&quot;,<br>      options: {<br>        configureJSX: true<br>      }<br>    }<br>  ]<br>};</pre><p>Now we need to create our first story:</p><p>Create the file src/components/MyComponent.stories.tsx with the content:</p><pre>import * as React from &quot;react&quot;;</pre><pre>import { storiesOf } from &quot;@storybook/react&quot;;<br>import { action } from &quot;@storybook/addon-actions&quot;;<br>import { MyComponent } from &quot;./MyComponent&quot;;</pre><pre>storiesOf(&quot;Select | Catalog&quot;, module).add(&quot;Default&quot;, () =&gt; &lt;MyComponent /&gt;);</pre><p>That’s all! Now you can execute the commands:</p><ul><li>yarn build-storybook (will create the folder storybook-static/)</li><li>yarn storybook (will start storybook on <a href="http://localhost:9009/">http://localhost:9009/</a>)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/0*i2Vfn3nK0oyn5WIV" /></figure><h3>ADD ENZIME FOR TESTING</h3><p>We need to add the dependencies:</p><pre>yarn add @types/enzyme enzyme @types/enzyme-adapter-react-16 enzyme-adapter-react-16 enzyme-to-json jest-enzyme -D</pre><p>Replace the content of the file src/setupTests.ts with:</p><pre>// jest-dom adds custom jest matchers for asserting on DOM nodes.<br>// allows you to do things like:<br>// expect(element).toHaveTextContent(/react/i)<br>// learn more: <a href="https://github.com/testing-library/jest-dom">https://github.com/testing-library/jest-dom</a><br>import &#39;@testing-library/jest-dom/extend-expect&#39;;</pre><pre>import &#39;jest-enzyme&#39;;<br>import { configure } from &#39;enzyme&#39;;<br>import * as Adapter from &#39;enzyme-adapter-react-16&#39;;<br>const adapter = Adapter as any;<br>configure({ adapter: new adapter.default() });</pre><p>Now we can create our first test. Let’s create the file test src/components/MyComponent.test.tsx with the content:</p><pre>import * as React from &quot;react&quot;;<br>import { shallow } from &quot;enzyme&quot;;<br>import { MyComponent } from &quot;./MyComponent&quot;;</pre><pre>it(&quot;Renders without crashing&quot;, () =&gt; {<br>  const wrapper = shallow(&lt;MyComponent /&gt;);</pre><pre>  expect(wrapper).toMatchSnapshot();<br>});</pre><p>And now you can execute the test with:</p><pre>yarn test</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/389/0*YGLZV7JlTR-W_TDM" /></figure><blockquote><a href="https://carlosthe19916.wordpress.com/">https://carlosthe19916.wordpress.com/</a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=67ff8fe1599e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>