دسترسی به پکیج‌ها وقتی اینترنت قطع می‌شه به صورت آفلاین

به‌عنوان توسعه‌دهنده، وقتی اینترنت قطع می‌شه، ممکنه حتی نتونیم ساده‌ترین کار یعنی pnpm install یا npm install رو انجام بدیم!
با خودم گفتم:
چیکار کنم که زمان قطعی اینترنت، همچنان به پکیج‌های ضروری و داکیومنت ها دسترسی داشته باشم؟ یا حتی بتونم از این پکیج‌ها تو هر پروژه‌ی جدید استفاده کنم؟

جواب کوتاه و ساده استفاده از pnpm با قابلیت کش افلاینه.
من چیکار کردم؟ 👇
1️⃣اومدم یه پروژه تست ساختم که شامل فقط یه فایل package.json با لیستی از پکیج‌هایی که تو اکثر پروژه‌ها لازمم می‌شن (مثل React, Next.js, Tailwind, Zustand, …).

2️⃣مسیر کش رو با دستور زیر به یه درایو امن تر منتقل کردم:
“pnpm config set store-dir “E:Devpnpm-cache

3️⃣با pnpm install همه رو یکبار دانلود کردم تا برن توی کش لوکال.

4️⃣حالا هر وقت اینترنت قطع باشه، فقط کافیه بزنم:
pnpm install –offline
pnpm add axios –offline

💠نکته: حتی می‌تونی با ابزارهایی مثل verdaccio یه ریجیستری npm لوکال بسازی و در حالت تیمی همه پکیج‌هات رو همیشه در دسترس داشته باشی

💠برای دسترسی به داکیومنت پکیج‌ها هم در حالت آفلاین، ابزارهای زیر میتونن تا حدی کار راه انداز باشن:
DevDocs.io (با کش آفلاین)
Velocity / Dash / Zeal

ممنون میشم اگه شما هم راهکاری دارید به اشتراک بزارید.
امیدوارم وقتی تو آینده این داستانا رو تعریف میکنیم بگن شوخی میکنی مگه میشه!!

#frontend
#iran
#internet


ترجمه:

Access to packages when the Internet is cut off offline

As a developer, when the Internet is discontinued, we may not even be able to do the easiest thing to do, PNPM Install or NPM Install!
I said to myself.
What can I still have to access the essential packages and documentation? Or even can I use these packages in any new project?

Short and simple answer use PNPM with a scrub capability.
What did I do? 👇
1- I made a test project that includes only a package.json file with a list of packages I need in most projects (such as React, Next.js, Tailwind, Zustand, …).

2- I transferred the cache to a safer drive with the following order:
“PNPM Config Set Store-DIR” E: Dev PNPM-Cache

3. With PNPM Install I downloaded it all once to go to Local.

4- Now whenever the Internet is cut off, just let me:
PNPM Install -FFLINE
pnpm add axios -FFLINE

Note: You can even make a Local NPM Register with tools like Verdaccio and always have all the packages available.

💠 To access the packages in offline mode, the following tools can be somewhat launched:
Devdocs.io (with offline cache)
Velocity / Dash / Zeal

Thank you if you have a solution.
Hopefully when we tell the future of these stories, you say you are joking !!

#frontnd
#iran
#internet