Files
xRPKRMAWorkspace/Documents/Developer/Azure Ext v4.html
T
2026-11-18 17:38:23 +03:30

588 lines
18 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="fa" dir="rtl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>راهنمای جامع نصب و پیکربندی ابزارهای تست افزونه Azure DevOps</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800&display=swap');
:root {
--primary: #1a365d;
--primary-light: #2c5282;
--accent: #c9a961;
--accent-dark: #a8893f;
--bg: #faf9f6;
--card-bg: #ffffff;
--text: #1a202c;
--text-muted: #4a5568;
--border: #e2e8f0;
--success: #38a169;
--danger: #e53e3e;
--warning: #dd6b20;
--shadow: 0 4px 6px rgba(0,0,0,0.05), 0 10px 30px rgba(26,54,93,0.08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: 'Vazirmatn', Tahoma, sans-serif;
background: var(--bg);
color: var(--text);
line-height: 1.9;
font-size: 15px;
padding: 30px 15px;
}
.document-container {
max-width: 950px;
margin: 0 auto;
background: var(--card-bg);
box-shadow: var(--shadow);
border-radius: 12px;
overflow: hidden;
}
.document-header {
background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
color: white;
padding: 50px 40px 40px;
position: relative;
border-bottom: 4px solid var(--accent);
}
.document-header::before {
content: '';
position: absolute;
top: 0; right: 0;
width: 200px; height: 200px;
background: radial-gradient(circle, rgba(201,169,97,0.15) 0%, transparent 70%);
border-radius: 50%;
transform: translate(50%, -50%);
}
.header-top {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 30px;
position: relative;
z-index: 1;
}
.company-badge {
display: flex;
align-items: center;
gap: 12px;
}
.company-logo {
width: 60px; height: 60px;
background: var(--accent);
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.doc-meta {
text-align: left;
font-size: 12px;
opacity: 0.9;
}
.doc-meta div { margin-bottom: 3px; }
.document-title {
text-align: center;
position: relative;
z-index: 1;
padding: 20px 0;
}
.document-title .label {
display: inline-block;
background: rgba(201,169,97,0.2);
color: var(--accent);
padding: 4px 16px;
border-radius: 20px;
font-size: 12px;
font-weight: 600;
margin-bottom: 15px;
border: 1px solid rgba(201,169,97,0.4);
}
.document-title h1 {
font-size: 28px;
font-weight: 800;
margin-bottom: 10px;
letter-spacing: -0.5px;
}
.document-title h2 {
font-size: 16px;
font-weight: 400;
opacity: 0.9;
}
.document-body {
padding: 40px;
}
.intro-text {
background: linear-gradient(to left, #f7fafc, #edf2f7);
border-right: 4px solid var(--accent);
padding: 20px 25px;
border-radius: 8px;
margin-bottom: 35px;
font-size: 14px;
color: var(--text-muted);
}
.section {
margin-bottom: 40px;
page-break-inside: avoid;
}
.section-header {
display: flex;
align-items: center;
gap: 15px;
padding-bottom: 12px;
border-bottom: 2px solid var(--border);
margin-bottom: 20px;
}
.section-number {
width: 50px; height: 50px;
background: linear-gradient(135deg, var(--primary), var(--primary-light));
color: white;
border-radius: 12px;
display: flex;
align-items: center;
justify-content: center;
font-weight: 800;
font-size: 20px;
flex-shrink: 0;
box-shadow: 0 4px 10px rgba(26,54,93,0.2);
}
.section-title { flex: 1; }
.section-title h3 {
font-size: 19px;
font-weight: 700;
color: var(--primary);
margin-bottom: 2px;
}
.section-title .subtitle {
font-size: 12px;
color: var(--text-muted);
}
.section-content {
padding-right: 10px;
}
.section-content p {
margin-bottom: 12px;
text-align: justify;
text-indent: 20px;
}
.section-content p.no-indent { text-indent: 0; }
.highlight-box {
background: linear-gradient(to left, #fffaf0, #fef5e7);
border: 1px solid #f6e05e;
border-right: 4px solid var(--accent);
padding: 18px 22px;
border-radius: 8px;
margin: 20px 0;
font-size: 14px;
}
.highlight-box strong {
color: var(--accent-dark);
}
.info-box {
background: linear-gradient(to left, #ebf8ff, #e6f6ff);
border: 1px solid #90cdf4;
border-right: 4px solid var(--primary-light);
padding: 18px 22px;
border-radius: 8px;
margin: 20px 0;
font-size: 14px;
}
.success-box {
background: linear-gradient(to left, #f0fff4, #e6fffa);
border: 1px solid #9ae6b4;
border-right: 4px solid var(--success);
padding: 18px 22px;
border-radius: 8px;
margin: 20px 0;
font-size: 14px;
}
.warning-box {
background: linear-gradient(to left, #fffaf0, #fef5e7);
border: 1px solid #fbd38d;
border-right: 4px solid var(--warning);
padding: 18px 22px;
border-radius: 8px;
margin: 20px 0;
font-size: 14px;
}
.styled-table {
width: 100%;
border-collapse: collapse;
margin: 20px 0;
background: white;
border-radius: 8px;
overflow: hidden;
box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.styled-table thead {
background: linear-gradient(135deg, var(--primary), var(--primary-light));
color: white;
}
.styled-table th {
padding: 14px 16px;
text-align: right;
font-weight: 600;
font-size: 13px;
}
.styled-table td {
padding: 13px 16px;
border-bottom: 1px solid var(--border);
font-size: 13px;
}
.styled-table tbody tr:last-child td { border-bottom: none; }
.styled-table tbody tr:nth-child(even) { background: #f8fafc; }
.styled-table .highlight-row {
background: #fffaf0 !important;
font-weight: 600;
}
.code-block {
background: #1e1e1e;
color: #d4d4d4;
padding: 20px;
border-radius: 8px;
margin: 20px 0;
direction: ltr;
text-align: left;
font-family: 'Consolas', 'Courier New', monospace;
font-size: 13px;
line-height: 1.6;
overflow-x: auto;
border-right: 4px solid var(--accent);
}
.code-block .comment { color: #6a9955; }
.code-block .keyword { color: #569cd6; }
.code-block .string { color: #ce9178; }
.quote-box {
background: linear-gradient(135deg, #f7fafc, #edf2f7);
border-right: 4px solid var(--accent);
padding: 20px 25px;
border-radius: 8px;
margin: 20px 0;
position: relative;
}
.quote-box::before {
content: '"';
position: absolute;
top: -10px;
right: 15px;
font-size: 60px;
color: var(--accent);
opacity: 0.3;
font-family: Georgia, serif;
}
.quote-box p {
font-style: italic;
color: var(--text-muted);
margin-bottom: 10px;
text-indent: 0 !important;
}
.quote-box .source {
font-size: 12px;
color: var(--text-muted);
text-align: left;
font-style: normal;
}
.stats-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 15px;
margin: 25px 0;
}
.stat-card {
background: linear-gradient(135deg, var(--primary), var(--primary-light));
color: white;
padding: 20px;
border-radius: 10px;
text-align: center;
box-shadow: 0 4px 12px rgba(26,54,93,0.2);
}
.stat-card .stat-value {
font-size: 24px;
font-weight: 800;
margin-bottom: 5px;
color: var(--accent);
line-height: 1.3;
}
.stat-card .stat-label {
font-size: 12px;
opacity: 0.9;
}
.conclusion-box {
background: linear-gradient(135deg, var(--primary), var(--primary-light));
color: white;
padding: 30px;
border-radius: 12px;
margin: 30px 0;
text-align: center;
box-shadow: 0 8px 20px rgba(26,54,93,0.3);
}
.conclusion-box h3 {
font-size: 22px;
font-weight: 800;
margin-bottom: 15px;
color: var(--accent);
}
.conclusion-box p {
font-size: 14px;
line-height: 1.8;
text-indent: 0 !important;
margin-bottom: 15px;
}
.conclusion-box .highlight {
background: rgba(201,169,97,0.2);
padding: 15px 20px;
border-radius: 8px;
margin-top: 20px;
border: 1px solid rgba(201,169,97,0.4);
}
.document-footer {
background: var(--primary);
color: white;
padding: 25px 40px;
text-align: center;
font-size: 12px;
margin-top: 40px;
}
.document-footer .footer-brand {
font-weight: 700;
color: var(--accent);
margin-bottom: 5px;
font-size: 14px;
}
.footer-divider {
width: 60px;
height: 2px;
background: var(--accent);
margin: 10px auto;
}
.page-info {
text-align: center;
padding: 15px;
font-size: 11px;
color: var(--text-muted);
border-top: 1px solid var(--border);
margin-top: 30px;
}
@media print {
body { background: white; padding: 0; }
.document-container { box-shadow: none; border-radius: 0; }
.section { page-break-inside: avoid; }
}
@media (max-width: 768px) {
.document-body { padding: 25px 20px; }
.document-header { padding: 30px 20px; }
.stats-grid { grid-template-columns: 1fr; }
.header-top { flex-direction: column; gap: 15px; }
.doc-meta { text-align: center; }
}
</style>
</head>
<body>
<div class="document-container">
<header class="document-header">
<div class="header-top">
<div class="company-badge">
<div class="company-logo"></div>
</div>
<div class="doc-meta">
<div>شماره مستند: AZDO-EXT-SETUP-003</div>
<div>نسخه: ۱.۰</div>
<div>تاریخ تهیه: آبان ۱۴۰۵</div>
<div>طبقه‌بندی: فنی / آموزشی</div>
</div>
</div>
<div class="document-title">
<span class="label">INSTALLATION GUIDE</span>
<h1>نصب و پیکربندی ابزارهای تست افزونه Azure DevOps</h1>
<h2>راهنمای گام‌به‌گام آماده‌سازی محیط توسعه و تست محلی</h2>
</div>
</header>
<div class="document-body">
<div class="intro-text">
<strong>توسعه‌دهنده گرامی،</strong><br>
این مستند به‌صورت کامل و عملیاتی، تمامی مراحل نصب و پیکربندی ابزارهای مورد نیاز برای توسعه و تست افزونه‌های Azure DevOS را پوشش می‌دهد. با دنبال کردن این راهنما، محیطی پایدار و استاندارد برای چرخه توسعه سریع (Rapid Development Cycle) خواهید داشت. توجه ویژه به نسخه Node.js در این مستند الزامی است.
</div>
<div class="section">
<div class="section-header">
<div class="section-number">۱</div>
<div class="section-title">
<h3>پیش‌نیاز حیاتی: مدیریت نسخه Node.js</h3>
<div class="subtitle">Node.js Version Management (Critical)</div>
</div>
</div>
<div class="section-content">
<p>ابزارهای مدرن Azure DevOps Extension CLI به دلیل وابستگی به ماژول‌های جدید Node.js (مانند <code>node:url</code>)، تنها بر روی نسخه‌های ۱۸ و بالاتر اجرا می‌شوند. استفاده از نسخه‌های قدیمی‌تر منجر به خطای <code>Cannot find module</code> خواهد شد.</p>
<div class="stats-grid">
<div class="stat-card">
<div class="stat-value">v18.x<br>LTS</div>
<div class="stat-label">حداقل نسخه پیشنهادی و پایدار</div>
</div>
<div class="stat-card">
<div class="stat-value">nvm<br>windows/mac</div>
<div class="stat-label">ابزار مدیریت چندین نسخه همزمان</div>
</div>
<div class="stat-card">
<div class="stat-value">EOL<br>v14/v16</div>
<div class="stat-label">نسخه‌های منسوخ و ناسازگار</div>
</div>
</div>
<div class="code-block">
<span class="comment"># ۱. نصب نسخه ۱۸ LTS با استفاده از nvm</span>
nvm install 18
<span class="comment"># ۲. فعال‌سازی نسخه جدید در ترمینال جاری</span>
nvm use 18
<span class="comment"># ۳. تایید نسخه فعال (باید v18.x.x باشد)</span>
node -v
<span class="comment"># ۴. تنظیم نسخه پیش‌فرض سیستم (اختیاری اما توصیه شده)</span>
nvm alias default 18
</div>
<div class="warning-box">
<strong>⚠️ هشدار مهم:</strong> اگر از nvm-windows استفاده می‌کنید، حتماً ترمینال (CMD/PowerShell) را پس از تغییر نسخه ببندید و دوباره باز کنید تا متغیرهای محیطی به‌روزرسانی شوند.
</div>
</div>
</div>
<div class="section">
<div class="section-header">
<div class="section-number">۲</div>
<div class="section-title">
<h3>نصب ابزار خط فرمان tfx-cli</h3>
<div class="subtitle">Azure DevOps Extensions CLI Installation</div>
</div>
</div>
<div class="section-content">
<p>ابزار <code>tfx-cli</code> رابط اصلی شما برای اعتبارسنجی، بسته‌بندی و انتشار افزونه‌هاست. این ابزار باید به صورت سراسری (Global) روی نسخه صحیح Node.js نصب شود.</p>
<div class="code-block">
<span class="comment"># نصب سراسری ابزار tfx-cli</span>
npm install -g tfx-cli
<span class="comment"># بررسی موفقیت نصب و نسخه ابزار</span>
tfx --version
<span class="comment"># خروجی مورد انتظار: Version 0.x.x</span>
</div>
<div class="info-box">
<strong>💡 نکته عیب‌یابی:</strong> در صورت دریافت خطای دسترسی (Permission Denied) در مک/لینوکس، از <code>sudo</code> استفاده کنید یا مسیر npm global را اصلاح نمایید. در ویندوز، ترمینال را به صورت Administrator اجرا کنید.
</div>
</div>
</div>
<div class="section">
<div class="section-header">
<div class="section-number">۳</div>
<div class="section-title">
<h3>دریافت و پیکربندی توکن دسترسی (PAT)</h3>
<div class="subtitle">Personal Access Token Configuration</div>
</div>
</div>
<div class="section-content">
<p>برای تعامل خودکار با Marketplace و سازمان Azure DevOps (جهت Sideload یا انتشار)، نیاز به یک PAT دارید. این توکن جایگزین رمز عبور در دستورات خط فرمان می‌شود.</p>
<table class="styled-table">
<thead>
<tr>
<th>مرحله</th>
<th>عملیات</th>
<th>تنظیمات امنیتی</th>
</tr>
</thead>
<tbody>
<tr>
<td>۱</td>
<td>ورود به User Settings > Personal Access Tokens</td>
<td>—</td>
</tr>
<tr>
<td>۲</td>
<td>ایجاد توکن جدید با نام مشخص</td>
<td>Expiration: 90 روز (پیشنهادی)</td>
</tr>
<tr>
<td>۳</td>
<td>انتخاب Scopes مورد نیاز</td>
<td style="color: var(--danger); font-weight: 600;">Marketplace > Manage</td>
</tr>
<tr class="highlight-row">
<td><strong>۴</strong></td>
<td><strong>ذخیره توکن در مکان امن</strong></td>
<td><strong>تنها یک‌بار نمایش داده می‌شود</strong></td>
</tr>
</tbody>
</table>
<div class="code-block">
<span class="comment"># احراز هویت در tfx-cli با استفاده از PAT</span>
tfx login --service-url https://dev.azure.com/YOUR_ORG --token YOUR_PAT_TOKEN
<span class="comment"># ذخیره توکن به عنوان متغیر محیطی (روش امن‌تر)</span>
export AZURE_DEVOPS_EXT_PAT=YOUR_PAT_TOKEN <span class="comment"># Linux/Mac</span>
set AZURE_DEVOPS_EXT_PAT=YOUR_PAT_TOKEN <span class="comment"># Windows CMD</span>
</div>
<div class="success-box">
<strong>✓ بهترین تمرین امنیتی:</strong> هرگز توکن را در کد یا فایل‌های پروژه Commit نکنید. از متغیرهای محیطی یا Secret Managerهای CI/CD استفاده نمایید.
</div>
</div>
</div>
<div class="section">
<div class="section-header">
<div class="section-number">۴</div>
<div class="section-title">
<h3>آماده‌سازی ساختار پروژه پایه</h3>
<div class="subtitle">Project Scaffold & Validation</div>
</div>
</div>
<div class="section-content">
<p>پس از نصب ابزارها، صحت عملکرد آن‌ها را با ایجاد یک پروژه نمونه و اعتبارسنجی آن بررسی کنید. این مرحله تضمین می‌کند که زنجیره ابزار به درستی پیکربندی شده است.</p>
<div class="code-block">
<span class="comment"># ایجاد پوشه پروژه</span>
mkdir azdo-ext-test && cd azdo-ext-test
<span class="comment"># ایجاد فایل manifest حداقلی برای تست</span>
echo '{
"manifestVersion": 1,
"id": "test-extension",
"version": "1.0.0",
"name": "Test Extension",
"publisher": "YOUR_PUBLISHER_ID",
"targets": [{"id": "Microsoft.VisualStudio.Services"}],
"files": [{"path": "."}]
}' > vss-extension.json
<span class="comment"># اعتبارسنجی ساختار با tfx-cli</span>
tfx extension validate --manifest-globs vss-extension.json
<span class="comment"># خروجی موفق: "Extension is valid"</span>
</div>
<div class="quote-box">
<p>اعتبارسنجی موفق در این مرحله به معنای آمادگی کامل محیط برای توسعه واقعی است. اگر خطایی دریافت کردید، ابتدا نسخه Node.js و سپس نصب tfx-cli را بازبینی کنید.</p>
<div class="source">— Azure DevOps Extension Toolchain Best Practices</div>
</div>
</div>
</div>
<div class="conclusion-box">
<h3>🎉 محیط توسعه شما آماده است!</h3>
<p>با تکمیل این چهار مرحله، اکنون دارای یک محیط استاندارد، امن و به‌روز برای توسعه افزونه‌های Azure DevOps هستید. می‌توانید بلافاصله شروع به پیاده‌سازی و تست افزونه خود نمایید.</p>
<div class="highlight">
<strong>💎 چک‌لیست نهایی:</strong><br>
Node.js 18+ ✓ | tfx-cli Global ✓ | PAT Configured ✓ | Validation Passed ✓
</div>
</div>
<div class="info-box">
<strong>📞 پشتیبانی:</strong> در صورت مواجهه با خطاهای خاص هنگام نصب، لاگ کامل ترمینال و خروجی دستور <code>node -v</code> و <code>tfx --version</code> را جهت بررسی ارسال نمایید.
</div>
<div class="page-info">
این مستند محرمانه بوده و صرفاً جهت استفاده تیم فنی و معماری تهیه شده است. هرگونه بازنشر بدون اجازه کتبی ممنوع است.
</div>
</div>
<footer class="document-footer">
<div class="footer-brand">واحد معماری نرم‌افزار | Azure DevOps Practice</div>
<div class="footer-divider"></div>
<div>تاریخ تهیه: آبان ۱۴۰۵ &nbsp;|&nbsp; نسخه: ۱.۰ &nbsp;|&nbsp; طبقه‌بندی: فنی</div>
</footer>
</div>
</body>
</html>