Skip to content

Commit b63dfc4

Browse files
committed
feat: modernize library to v2.0.0 - resolve security vulnerabilities, update dependencies, improve tests and documentation
1 parent 17cf867 commit b63dfc4

15 files changed

Lines changed: 8896 additions & 24255 deletions

.github/workflows/publish.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Publish to NPM
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout código
14+
uses: actions/checkout@v4
15+
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: '18'
20+
cache: 'npm'
21+
22+
- name: Instalar dependencias
23+
run: npm ci
24+
25+
- name: Ejecutar tests
26+
run: npm test
27+
28+
- name: Ejecutar lint
29+
run: npm run lint
30+
31+
publish:
32+
needs: test
33+
runs-on: ubuntu-latest
34+
if: github.ref == 'refs/heads/main'
35+
steps:
36+
- name: Checkout código
37+
uses: actions/checkout@v4
38+
39+
- name: Setup Node.js
40+
uses: actions/setup-node@v4
41+
with:
42+
node-version: '18'
43+
registry-url: 'https://registry.npmjs.org'
44+
cache: 'npm'
45+
46+
- name: Instalar dependencias
47+
run: npm ci
48+
49+
- name: Build del proyecto
50+
run: npm run build:prod
51+
52+
- name: Verificar si la versión ya existe en NPM
53+
id: check-version
54+
run: |
55+
PACKAGE_VERSION=$(node -p "require('./package.json').version")
56+
PACKAGE_NAME=$(node -p "require('./package.json').name")
57+
58+
if npm view "$PACKAGE_NAME@$PACKAGE_VERSION" version 2>/dev/null; then
59+
echo "exists=true" >> $GITHUB_OUTPUT
60+
echo "La versión $PACKAGE_VERSION ya existe en NPM"
61+
else
62+
echo "exists=false" >> $GITHUB_OUTPUT
63+
echo "La versión $PACKAGE_VERSION no existe, procediendo con la publicación"
64+
fi
65+
66+
- name: Publicar a NPM
67+
if: steps.check-version.outputs.exists == 'false'
68+
run: npm publish --access public
69+
env:
70+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
71+
72+
- name: Crear release en GitHub
73+
if: steps.check-version.outputs.exists == 'false'
74+
uses: actions/create-release@v1
75+
env:
76+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77+
with:
78+
tag_name: v${{ steps.check-version.outputs.version }}
79+
release_name: Release v${{ steps.check-version.outputs.version }}
80+
body: |
81+
## Cambios en esta versión
82+
83+
- Versión actualizada con dependencias modernas
84+
- Reemplazado moment.js por dayjs (más seguro y ligero)
85+
- Tests mejorados y más completos
86+
- Documentación actualizada
87+
- Correcciones de seguridad
88+
89+
Para instalar esta versión:
90+
```bash
91+
npm install calcula-rfc@${{ steps.check-version.outputs.version }}
92+
```
93+
draft: false
94+
prerelease: false

.gitignore

Lines changed: 105 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,105 @@
1-
node_modules/
1+
# Dependencias
2+
node_modules/
3+
npm-debug.log*
4+
yarn-debug.log*
5+
yarn-error.log*
6+
7+
# Build outputs
8+
dist/
9+
build/
10+
*.tsbuildinfo
11+
12+
# Coverage directory used by tools like istanbul
13+
coverage/
14+
.nyc_output
15+
16+
# Runtime data
17+
pids
18+
*.pid
19+
*.seed
20+
*.pid.lock
21+
22+
# Directory for instrumented libs generated by jscoverage/JSCover
23+
lib-cov
24+
25+
# Grunt intermediate storage
26+
.grunt
27+
28+
# Bower dependency directory
29+
bower_components
30+
31+
# node-waf configuration
32+
.lock-wscript
33+
34+
# Compiled binary addons
35+
build/Release
36+
37+
# Dependency directories
38+
jspm_packages/
39+
40+
# Optional npm cache directory
41+
.npm
42+
43+
# Optional eslint cache
44+
.eslintcache
45+
46+
# Optional REPL history
47+
.node_repl_history
48+
49+
# Output of 'npm pack'
50+
*.tgz
51+
52+
# Yarn Integrity file
53+
.yarn-integrity
54+
55+
# dotenv environment variables file
56+
.env
57+
.env.test
58+
.env.production
59+
.env.local
60+
61+
# parcel-bundler cache
62+
.cache
63+
.parcel-cache
64+
65+
# next.js build output
66+
.next
67+
68+
# nuxt.js build output
69+
.nuxt
70+
71+
# vuepress build output
72+
.vuepress/dist
73+
74+
# Serverless directories
75+
.serverless
76+
77+
# FuseBox cache
78+
.fusebox/
79+
80+
# DynamoDB Local files
81+
.dynamodb/
82+
83+
# IDE
84+
.vscode/
85+
.idea/
86+
*.swp
87+
*.swo
88+
*~
89+
90+
# OS
91+
.DS_Store
92+
.DS_Store?
93+
._*
94+
.Spotlight-V100
95+
.Trashes
96+
ehthumbs.db
97+
Thumbs.db
98+
99+
# Logs
100+
logs
101+
*.log
102+
103+
# Temporary folders
104+
tmp/
105+
temp/

LICENSE

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1-
Looks like there's already a license file for this project.
2-
[?25l? Do you want to replace it? › (y/N)✔ Do you want to replace it? … no
3-
[?25hExiting...
1+
MIT License
2+
3+
Copyright (c) 2024 Gerardo Lucero
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)