import Link from "/snippets/cli/link.mdx";
استخدم bun link في دليل محلي لتسجيل الحزمة الحالية كحزمة "قابلة للربط".
bash
cd /path/to/cool-pkg
cat package.json
bun linktxt
bun link v1.3.3 (7416672e)
Success! Registered "cool-pkg"
To use cool-pkg in a project, run:
bun link cool-pkg
Or add it in dependencies in your package.json file:
"cool-pkg": "link:cool-pkg"يمكن الآن "ربط" هذه الحزمة في مشاريع أخرى باستخدام bun link cool-pkg. سينشئ هذا رابطًا رمزيًا في مجلد node_modules للمشروع المستهدف، يشير إلى الدليل المحلي.
bash
cd /path/to/my-app
bun link cool-pkgبالإضافة إلى ذلك، يمكن استخدام العلامة --save لإضافة cool-pkg إلى حقل dependencies في package.json الخاص بتطبيقك مع محدد إصدار خاص يخبر Bun بالتحميل من الدليل المحلي المسجل بدلاً من التثبيت من npm:
json
{
"name": "my-app",
"version": "1.0.0",
"dependencies": {
"cool-pkg": "link:cool-pkg"
}
}إلغاء الربط
استخدم bun unlink في الدليل الجذر لإلغاء تسجيل حزمة محلية.
bash
cd /path/to/cool-pkg
bun unlinktxt
bun unlink v1.3.3 (7416672e)