Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: unified package #3639

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

wommy
Copy link
Contributor

@wommy wommy commented Nov 22, 2024

Brief summary

unified client/package.json into root package.json

Which issue is fixed?

no specific issue,

but because there arent two package.json's anymore,
everything can just be ran from rootDir
eliminates the need for two npm ci's
simplifies the install and generation of the app

in the migration from nuxt 2 to 3, 3 comes with a /server/ directory
https://nuxt.com/docs/guide/directory-structure/server

tho i will still have to migrate all the logic from express into nitro and h3
https://h3.unjs.io/examples/from-expressjs-to-h3

i think it will be well worth it: removing dozens of outdate dependencies and boilerplate code, while simplifying logic and getting a nice speed increase

ill post a nice chatgpt analysis of that whenever my credits refill tomorrow

In-depth Description

  • cd client
  • git mv assets components layouts middleware mixins pages players plugins store strings cypress cypress.config.js nuxt.config.js tailwind.config.js ..
  • mv dist public static .nuxt ..
  • cd ..
  • here i copied the scripts, dependencies: deps, dev, and optional, from client/package.json into package.json, plus a few other misc edits, check the file
  • git rm -r client/
  • changed the line in server/Server.js from /client/dist/ to /dist/
  • changed the .gitignore
  • ran npm install so npmci would work
  • also ran npm audit fix to fix the fixable npm errors 59 => 42 cli link
  • and ran npm dedupe to remove ~75 duplicated packages from node_modules cli link

How have you tested this?

yes of course,

  • rm -rf node_modules
  • npm run client ; npm start
  • hit localhost:3333

and everything was perfectly there

i only have an epub and an audiobook, but they both played perfectly,

i navigated to each different view they all work normally,
which tracks because i didnt edit anything on the server
other than removing the /client prefix from the static app directory

Screenshots

no client changes


Additional - Left Undone - Unsure How to Proceed

i didnt edit a few misc files, ill split them into categories

simple

  • .devcontainer/post-create.sh, .vscode/launch.json, .vscode/tasks.json
    • need slight tweaks
  • .dockerignore
    • seems like the same few line changes from .gitignore

medium

  • Dockerfile
    • dunno how STAGE 0 WORKDIR works, looks simple tho
    • probs similar to the next one

harder

  • .github/workflows
    • probs just swap /client w/ assets components layouts middleware mixins pages players plugins static store strings cypress cypress.config.js nuxt.config.js tailwind.config.js

@wommy
Copy link
Contributor Author

wommy commented Nov 23, 2024

Package Current Ver Latest Ver Vulnerabilities Required By Nuxt 3 Equivalent Size Impact Notes
axios 0.27.2 1.6.7 None both $fetch/ofetch -438kb Built into Nuxt 3, can be removed
bcryptjs 2.4.3 2.4.3 None server keep 0kb Consider @node-rs/bcrypt for speed
cookie-parser 1.4.6 1.4.6 None server h3 -7kb Built into h3/Nitro
core-js 3.16.0 3.36.0 None client built-in -2800kb Handled by Nuxt/Vite
cron-parser 4.7.1 4.9.0 None server keep 0kb Keep if cron parsing needed
date-and-time 2.3.1 3.1.1 None server date-fns -12kb Consolidate with date-fns
date-fns 2.25.0 3.3.1 None both keep 0kb Consider upgrading to v3
epubjs 0.3.88 0.3.93 None client keep 0kb Keep if EPUB support needed
express 4.17.1 4.18.3 None server Nitro -252kb Replace with Nitro server
express-fileupload 1.2.1 1.4.3 Low server h3 formidable -156kb Use h3 file upload handlers
express-rate-limit 5.3.0 7.1.5 None server h3-rate-limit -45kb Use h3 rate limiting
express-session 1.17.3 1.18.0 None server h3-session -173kb Use h3 session middleware
fast-average-color 9.4.0 9.4.0 None client keep 0kb Keep if color analysis needed
fast-sort 3.1.1 3.4.0 None server keep 0kb Consider native Array.sort
ffbinaries 1.1.2 1.1.5 None server keep 0kb Keep if using ffmpeg
fluent-ffmpeg 2.1.2 2.1.2 None server keep 0kb Keep if video processing needed
fs-extra 10.0.0 11.2.0 None server node:fs/promises -45kb Use native Node.js fs
graceful-fs 4.2.10 4.2.11 None server node:fs -16kb Use native Node.js fs
hls.js 1.5.7 1.5.7 None client keep 0kb Keep if HLS streaming needed
htmlparser2 8.0.1 9.1.0 None server keep 0kb Still needed if parsing HTML
image-type 4.1.0 5.2.0 None server file-type 0kb Consider file-type package
jsonwebtoken 8.5.1 9.0.2 High server jose -85kb Switch to jose library
libarchive.js 1.3.0 1.3.0 None both keep 0kb Keep if archive handling needed
libarchivejs 1.3.0 1.3.0 None server keep 0kb Duplicate of libarchive.js
lru-cache 10.0.3 10.2.0 None server nitro cache -42kb Use Nitro built-in caching
marked 4.0.17 12.0.0 None client keep 0kb Consider upgrading to v12
memorystore 1.6.4 1.6.7 None server nitro -86kb Use Nitro session store
node-cron 3.0.0 3.0.3 None server keep 0kb Keep for cron jobs
node-ffprobe 3.0.0 3.0.0 None server keep 0kb Keep if using ffmpeg
node-rss 1.2.2 deprecated None server feed -28kb Switch to feed package
node-stream-zip 1.15.0 1.15.0 None server keep 0kb Keep if ZIP handling needed
node-unrar-js 2.0.2 2.0.2 None server keep 0kb Keep if RAR handling needed
nodemailer 6.9.13 6.9.13 None server keep/module 0kb Consider @nuxtjs/mail module
nuxt 2.18.1 3.10.3 None both nuxt3 -700kb Core upgrade to Nuxt 3
nuxt-socket-io 1.1.18 2.0.3 None client @nuxtjs/socket.io 0kb Update to v2 for Nuxt 3
openid-client 5.6.1 5.6.4 None server @sidebase/nuxt-auth -145kb Consider Nuxt Auth module
p-throttle 4.1.1 5.1.0 None server keep 0kb Keep if rate limiting needed
passport 0.6.0 0.7.0 None server @sidebase/nuxt-auth -366kb Replace with Nuxt Auth
passport-jwt 4.0.1 4.0.1 None server @sidebase/nuxt-auth -12kb Included in Nuxt Auth
passport-local 1.0.0 1.0.0 None server @sidebase/nuxt-auth -25kb Part of Nuxt auth
proper-lockfile 4.1.2 4.1.2 None server keep 0kb Keep for file locking
read-chunk 4.0.2 4.0.3 None server node:fs -8kb Use native Node.js fs
recursive-readdir-async 1.1.8 1.3.0 None server node:fs -12kb Use native fs.promises
request-ip 2.2.0 3.3.0 None server h3 -25kb Use h3 request utilities
semver 7.6.3 7.6.0 None server keep 0kb Keep if version parsing needed
sequelize 6.35.2 6.37.1 None server prisma/drizzle -2000kb Consider modern ORM alternatives
socket.io 4.5.4 4.7.4 None both @nuxtjs/socket.io 0kb Use official Nuxt module
sqlite3 5.1.6 5.1.7 None server better-sqlite3 -3400kb Consider better-sqlite3
ssrf-req-filter 1.1.0 1.1.0 None server h3-extras -8kb Use h3 security utilities
trix 1.3.1 2.0.10 None client @tiptap/vue-3 -125kb Consider modern editor
umzug 3.8.1 3.7.0 None server keep 0kb Keep if using migrations
v-click-outside 3.1.2 3.1.2 None client vueuse -8kb Use VueUse composables
vue-toastification 1.7.11 2.0.0-rc.5 None client nuxt-toast/floating-vue 0kb Use Nuxt-compatible toast
vuedraggable 2.24.3 4.1.0 None client vue.draggable.next 0kb Use Vue 3 version
watcher 1.2.0 2.3.0 None server chokidar/node:fs -45kb Use more maintained alternatives
xml2js 0.5.0 0.7.0 None server keep 0kb Keep if XML parsing needed
@nuxtjs/axios 5.13.6 deprecated None client $fetch -325kb Remove, use built-in $fetch
@nuxtjs/proxy 2.1.0 deprecated None client nitro -12kb Use Nitro server proxy
@teckel/vue-pdf 4.3.5 unknown None client @pinia/nuxt-pdf 0kb Consider Nuxt PDF module
chai 4.3.10 5.1.0 None dev vitest -250kb Switch to Vitest
mocha 10.2.0 10.3.0 None dev vitest -1200kb Switch to Vitest
nodemon 2.0.20 3.1.0 None dev keep 0kb Still useful for development
nyc 15.1.0 deprecated None dev vitest coverage -890kb Use Vitest coverage
sinon 17.0.1 17.0.1 None dev vitest mocking -450kb Use Vitest mocking
@nuxtjs/pwa 3.3.5 deprecated None dev @vite-pwa/nuxt -12kb Use Vite PWA plugin
autoprefixer 10.4.7 10.4.17 None dev keep 0kb Still needed for PostCSS
postcss 8.3.6 8.4.35 None dev keep 0kb Still needed for CSS processing
tailwindcss 3.4.1 3.4.1 None dev keep 0kb Still needed for styling

Total potential size reduction: ~14.4MB

Major categories for removal/replacement:

  1. Express ecosystem -> Nitro/h3 (-722kb)
  2. Testing stack -> Vitest (-2790kb)
  3. Core duplicates -> Built-in Nuxt features (-3575kb)
  4. Database related -> Modern alternatives (-5400kb)
  5. Auth system -> Nuxt Auth (-633kb)
  6. File system utils -> Native Node.js (-126kb)
  7. Deprecated packages -> Modern alternatives (-1167kb)

all from claude

https://claude.site/artifacts/d2693141-8043-4ebb-ad92-45991ede362b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant