Npm@1 - مهمة npm v1

استخدم هذه المهمة لتثبيت حزم npm ونشرها أو لتشغيل npm أمر. يدعم npmjs.com السجلات المصادق عليها مثل Azure Artifacts.

ملاحظة

مهمة npm Authenticate هي الطريقة الموصى بها للمصادقة باستخدام Azure Artifacts. لم تعد هذه المهمة تأخذ ميزات جديدة ويتم معالجة الأخطاء الهامة فقط.

بناء الجملة

# npm v1
# Install and publish npm packages, or run an npm command. Supports npmjs.com and authenticated registries like Azure Artifacts.
- task: Npm@1
  inputs:
    command: 'install' # 'ci' | 'install' | 'publish' | 'custom'. Required. Command. Default: install.
    #workingDir: # string. Working folder that contains package.json. 
    #customCommand: # string. Required when command = custom. Command and arguments. 
  # Advanced
    #verbose: # boolean. Optional. Use when command = install || command = ci || command = publish. Verbose logging. 
    #publishPackageMetadata: true # boolean. Optional. Use when command = publish && publishRegistry = useFeed && command = install || command = ci || command = publish. Publish pipeline metadata. Default: true.
  # Custom registries and authentication
    #customRegistry: 'useNpmrc' # 'useNpmrc' | 'useFeed'. Optional. Use when command = install || command = ci || command = custom. Registries to use. Default: useNpmrc.
    #customFeed: # string. Required when customRegistry = useFeed && command = install || command = ci || command = custom. Use packages from this Azure Artifacts/TFS registry. 
    #customEndpoint: # string. Optional. Use when customRegistry = useNpmrc && command = install || command = ci || command = custom. Credentials for registries outside this organization/collection. 
  # Destination registry and authentication
    #publishRegistry: 'useExternalRegistry' # 'useExternalRegistry' | 'useFeed'. Optional. Use when command = publish. Registry location. Default: useExternalRegistry.
    #publishFeed: # string. Required when publishRegistry = useFeed && command = publish. Target registry. 
    #publishEndpoint: # string. Required when publishRegistry = useExternalRegistry && command = publish. External Registry.
# npm v1
# Install and publish npm packages, or run an npm command. Supports npmjs.com and authenticated registries like Azure Artifacts.
- task: Npm@1
  inputs:
    command: 'install' # 'install' | 'publish' | 'custom'. Required. Command. Default: install.
    #workingDir: # string. Working folder that contains package.json. 
    #customCommand: # string. Required when command = custom. Command and arguments. 
  # Advanced
    #verbose: # boolean. Optional. Use when command = install || command = publish. Verbose logging. 
    #publishPackageMetadata: true # boolean. Optional. Use when command = publish && publishRegistry = useFeed && command = install || command = publish. Publish pipeline metadata. Default: true.
  # Custom registries and authentication
    #customRegistry: 'useNpmrc' # 'useNpmrc' | 'useFeed'. Optional. Use when command = install || command = custom. Registries to use. Default: useNpmrc.
    #customFeed: # string. Required when customRegistry = useFeed && command = install || command = custom. Use packages from this Azure Artifacts/TFS registry. 
    #customEndpoint: # string. Optional. Use when customRegistry = useNpmrc && command = install || command = custom. Credentials for registries outside this organization/collection. 
  # Destination registry and authentication
    #publishRegistry: 'useExternalRegistry' # 'useExternalRegistry' | 'useFeed'. Optional. Use when command = publish. Registry location. Default: useExternalRegistry.
    #publishFeed: # string. Required when publishRegistry = useFeed && command = publish. Target registry. 
    #publishEndpoint: # string. Required when publishRegistry = useExternalRegistry && command = publish. External Registry.
# npm v1
# Install and publish npm packages, or run an npm command. Supports npmjs.com and authenticated registries like Package Management.
- task: Npm@1
  inputs:
    command: 'install' # 'install' | 'publish' | 'custom'. Required. Command. Default: install.
    #workingDir: # string. Working folder with package.json. 
    #customCommand: # string. Required when command = custom. Command and arguments. 
  # Advanced
    #verbose: # boolean. Optional. Use when command = install || command = publish. Verbose logging. 
  # Custom registries and authentication
    #customRegistry: 'useNpmrc' # 'useNpmrc' | 'useFeed'. Optional. Use when command = install || command = custom. Registries to use. Default: useNpmrc.
    #customFeed: # string. Required when customRegistry = useFeed && command = install || command = custom. Use packages from this Azure Artifacts/TFS registry. 
    #customEndpoint: # string. Optional. Use when customRegistry = useNpmrc && command = install || command = custom. Credentials for registries outside this account/collection. 
  # Destination registry and authentication
    #publishRegistry: 'useExternalRegistry' # 'useExternalRegistry' | 'useFeed'. Optional. Use when command = publish. Registry location. Default: useExternalRegistry.
    #publishFeed: # string. Required when publishRegistry = useFeed && command = publish. Target registry. 
    #publishEndpoint: # string. Required when publishRegistry = useExternalRegistry && command = publish. External Registry.

الإدخالات

command - الامر
string. مطلوب القيم المسموح بها: ci، install، publish، custom. القيمة الافتراضية: install.

يحدد الأمر والوسيطات، التي يتم تمريرها إلى npm للتنفيذ.

إذا كانت الوسيطات تحتوي على علامات اقتباس مزدوجة (")، فتخلص منها بشريط مائل (\)، وأحاط بالسلسلة التي تم الهروب بها بعلامات اقتباس مزدوجة (").


command - الامر
string. مطلوب القيم المسموح بها: install، ، publishcustom. القيمة الافتراضية: install.

يحدد الأمر والوسيطات، التي يتم تمريرها إلى npm للتنفيذ.

إذا كانت الوسيطات تحتوي على علامات اقتباس مزدوجة (")، فتخلص منها بشريط مائل (\)، وأحاط بالسلسلة التي تم الهروب بها بعلامات اقتباس مزدوجة (").


workingDir - مجلد العمل الذي يحتوي على package.json
string.

يحدد المسار إلى المجلد الذي يحتوي على الهدف package.json والملفات .npmrc . حدد المجلد، وليس الملف. مثال:/packages/mypackage.


workingDir - مجلد العمل مع package.json
string.

يحدد المسار إلى المجلد الذي يحتوي على الهدف package.json والملفات .npmrc . حدد المجلد، وليس الملف. مثال:/packages/mypackage.


verbose - تسجيل مطول
boolean. ‏‏اختياري. استخدم عندما command = install || command = ci || command = publish.

طباعة مزيد من المعلومات إلى وحدة التحكم عند تشغيل المهمة.


verbose - تسجيل مطول
boolean. ‏‏اختياري. استخدم عندما command = install || command = publish.

طباعة مزيد من المعلومات إلى وحدة التحكم عند تشغيل المهمة.


customCommand - الأمر والوسيطات
string. مطلوب عند command = custom.

تشغيل أمر مخصص. مثال:dist-tag ls mypackage.


customRegistry - السجلات التي يجب استخدامها
string. ‏‏اختياري. استخدم عندما command = install || command = ci || command = custom. القيم المسموح بها: useNpmrc (السجلات في .npmrc)، useFeed (السجل الذي أختاره هنا). القيمة الافتراضية: useNpmrc.

يحدد السجلات التي يجب استخدامها. قم بتثبيت .npmrc ملف إلى مستودع التعليمات البرمجية المصدر وتعيين مساره كقيمة، أو حدد سجلا من Azure Artifacts كقيمة.


customRegistry - السجلات التي يجب استخدامها
string. ‏‏اختياري. استخدم عندما command = install || command = custom. القيم المسموح بها: useNpmrc (السجلات في .npmrc)، useFeed (السجل الذي أختاره هنا). القيمة الافتراضية: useNpmrc.

يحدد السجلات التي يجب استخدامها. قم بتثبيت .npmrc ملف إلى مستودع التعليمات البرمجية المصدر وتعيين مساره كقيمة، أو حدد سجلا من Azure Artifacts كقيمة.


customFeed - استخدام الحزم من سجل Azure Artifacts/TFS هذا
string. مطلوب عند customRegistry = useFeed && command = install || command = ci || command = custom.

يتضمن الموجز المحدد في الذي تم .npmrcإنشاؤه . بالنسبة للموجزات ذات نطاق المشروع، استخدم ProjectName/FeedName أو ProjectID/FeedID. بالنسبة إلى الموجزات ذات نطاق المؤسسة، يجب أن تكون القيمة هي اسم الموجز.


customFeed - استخدام الحزم من سجل Azure Artifacts/TFS هذا
string. مطلوب عند customRegistry = useFeed && command = install || command = custom.

يتضمن الموجز المحدد في الذي تم .npmrcإنشاؤه . بالنسبة للموجزات ذات نطاق المشروع، استخدم ProjectName/FeedName أو ProjectID/FeedID. بالنسبة إلى الموجزات ذات نطاق المؤسسة، يجب أن تكون القيمة هي اسم الموجز.


customEndpoint - بيانات الاعتماد للسجلات خارج هذه المؤسسة/المجموعة
string. ‏‏اختياري. استخدم عندما customRegistry = useNpmrc && command = install || command = ci || command = custom.

بيانات الاعتماد التي يجب استخدامها للسجلات الخارجية الموجودة في المشروع .npmrc. اترك هذا فارغا للسجلات في هذا الحساب/المجموعة؛ تستخدم المهمة بيانات اعتماد البنية تلقائيا.


customEndpoint - بيانات الاعتماد للسجلات خارج هذه المؤسسة/المجموعة
string. ‏‏اختياري. استخدم عندما customRegistry = useNpmrc && command = install || command = custom.

بيانات الاعتماد التي يجب استخدامها للسجلات الخارجية الموجودة في المشروع .npmrc. اترك هذا فارغا للسجلات في هذا الحساب/المجموعة؛ تستخدم المهمة بيانات اعتماد البنية تلقائيا.


customEndpoint - بيانات الاعتماد للسجلات خارج هذا الحساب/المجموعة
string. ‏‏اختياري. استخدم عندما customRegistry = useNpmrc && command = install || command = custom.

بيانات الاعتماد التي يجب استخدامها للسجلات الخارجية الموجودة في المشروع .npmrc. اترك هذا فارغا للسجلات في هذا الحساب/المجموعة؛ تستخدم المهمة بيانات اعتماد البنية تلقائيا.


publishRegistry - موقع التسجيل
string. ‏‏اختياري. استخدم عندما command = publish. القيم المسموح بها: useExternalRegistry (سجل npm الخارجي (بما في ذلك الحسابات/المجموعات الأخرى))، useFeed (التسجيل الذي حدده هنا). القيمة الافتراضية: useExternalRegistry.

يحدد السجل الذي سيستهدفه الأمر.


publishFeed - السجل الهدف
string. مطلوب عند publishRegistry = useFeed && command = publish.

يحدد سجلا مستضافا في الحساب. يجب أن يكون لديك Package Management مثبتا ومرخصا لتحديد سجل هنا.


publishPackageMetadata - نشر بيانات تعريف البنية الأساسية لبرنامج ربط العمليات التجارية
boolean. ‏‏اختياري. استخدم عندما command = publish && publishRegistry = useFeed && command = install || command = ci || command = publish. القيمة الافتراضية: true.

إقران بيانات تعريف البنية/الإصدار الخاصة بالبنية الأساسية لبرنامج ربط العمليات التجارية (تشغيل # ومعلومات التعليمات البرمجية المصدر) بالحزمة.


publishPackageMetadata - نشر بيانات تعريف البنية الأساسية لبرنامج ربط العمليات التجارية
boolean. ‏‏اختياري. استخدم عندما command = publish && publishRegistry = useFeed && command = install || command = publish. القيمة الافتراضية: true.

إقران بيانات تعريف البنية/الإصدار الخاصة بالبنية الأساسية لبرنامج ربط العمليات التجارية (تشغيل # ومعلومات التعليمات البرمجية المصدر) بالحزمة.


publishEndpoint - السجل الخارجي
string. مطلوب عند publishRegistry = useExternalRegistry && command = publish.

يحدد بيانات الاعتماد التي يجب استخدامها للنشر إلى سجل خارجي.


خيارات التحكم بالمهمة

تحتوي جميع المهام على خيارات التحكم بالإضافة إلى مدخلات المهام الخاصة بها. لمزيد من المعلومات، راجع خيارات التحكم وخصائص المهمة الشائعة.

متغيرات الإخراج

لا شيء

الملاحظات

ملاحظة

يجب تعيين خدمة إنشاء مجموعة المشاريع وهوية خدمة الإنشاء الخاصة بمشروعك إلى المساهم لنشر الحزم الخاصة بك إلى موجز باستخدام Azure Pipelines. راجع إضافة مستخدمين/مجموعات جديدة لمزيد من التفاصيل.

أين يمكنني معرفة أوامر ووسيطات npm؟

أمثلة

المتطلبات

المتطلبات الوصف
أنواع البنية الأساسية لبرنامج ربط العمليات التجارية YAML، الإصدار الكلاسيكي، الإصدار الكلاسيكي
يعمل على Agent, DeploymentGroup
المطالب يجب أن يكون لدى الوكلاء المستضافين ذاتيا قدرات تطابق المتطلبات التالية لتشغيل المهام التي تستخدم هذه المهمة: npm
القدرات لا تفي هذه المهمة بأي طلبات للمهام اللاحقة في الوظيفة.
قيود الأوامر أي
متغيرات Settable أي
إصدار الوكيل 2.115.0 أو أحدث
فئة المهمة الحزمة
المتطلبات الوصف
أنواع البنية الأساسية لبرنامج ربط العمليات التجارية YAML، الإصدار الكلاسيكي، الإصدار الكلاسيكي
يعمل على Agent, DeploymentGroup
المطالب يجب أن يكون لدى الوكلاء المستضافين ذاتيا قدرات تطابق المتطلبات التالية لتشغيل المهام التي تستخدم هذه المهمة: npm
القدرات لا تفي هذه المهمة بأي طلبات للمهام اللاحقة في الوظيفة.
قيود الأوامر أي
متغيرات Settable أي
إصدار الوكيل 1.91.0 أو أحدث
فئة المهمة الحزمة