Appearance
@xcons/cli-thingsboard - Kurulum Kılavuzu
Bu dokümantasyon, XCONS ThingsBoard CLI aracının kurulum adımlarını ve konfigürasyon seçeneklerini detaylı olarak açıklar.
Sistem Gereksinimleri
Minimum Gereksinimler
- Node.js: 18.0.0 veya üzeri
- NPM: 9.0.0 veya üzeri
ThingsBoard Uyumluluğu
- ThingsBoard CE: 3.0 ve üzeri
- ThingsBoard PE: 3.0 ve üzeri
- MQTT/HTTP: Tüm protokoller desteklenir
Kurulum Yöntemleri
1. NPX ile Doğrudan Kullanım (Önerilen)
En basit kullanım şekli, global kurulum yapmadan doğrudan çalıştırmaktır:
bash
# Widget oluşturma
npx @xcons/cli-thingsboard widget create my-widget
# Widget listeleme
npx @xcons/cli-thingsboard widget list -h 192.168.1.100:8080 -u admin@domain.com -p password
# Bundle listeleme
npx @xcons/cli-thingsboard widget-bundle list -h 192.168.1.100:8080 -u admin -p passwordAvantajları:
- Her zaman en güncel sürümü kullanır
- Global kurulum gerektirmez
- Disk alanından tasarruf sağlar
- Farklı projelerde farklı sürümler kullanabilir
2. Global Kurulum
Sık kullanım için global kurulum önerilir:
bash
# Global kurulum
npm install -g @xcons/cli-thingsboard
# Kurulumu doğrula
xcons-thingsboard --version
# Komutları doğrudan kullanın
xcons-thingsboard widget create my-widget
xcons-thingsboard widget list -h server:8080 -u admin -p passwordAvantajları:
- Hızlı komut erişimi
- Bash/PowerShell otomatik tamamlama
- IDE entegrasyonu daha kolay
3. Proje Bazlı Kurulum
Belirli bir proje için yerel kurulum:
bash
# Proje dizininde
npm install @xcons/cli-thingsboard
# Package.json scripts kısmına ekleyin
{
"scripts": {
"widget:create": "xcons-thingsboard widget create",
"widget:build": "xcons-thingsboard widget build",
"widget:install": "xcons-thingsboard widget install"
}
}
# Kullanım
npm run widget:create my-widget
npm run widget:buildKurulum Doğrulama
Versiyon Kontrolü
bash
# CLI sürümünü kontrol et
xcons-thingsboard --version
# veya
npx @xcons/cli-thingsboard --version
# Çıktı örneği:
# 1.3.72Yardım Komutları
bash
# Ana yardım
xcons-thingsboard --help
# Widget komutları yardımı
xcons-thingsboard widget --help
# Bundle komutları yardımı
xcons-thingsboard widget-bundle --helpTest Kurulumu
bash
# Basit test widget'ı oluştur
xcons-thingsboard widget create test-widget --type timeseries --no-interaction
# Widget dizinine gir
cd test-widget
# Bağımlılıkları kur
npm install
# Widget'ı derle
xcons-thingsboard widget build
# Başarılı kurulum kontrolü
ls -la dist/
# widget.js, test-widget.template.html, test-widget.styles.css dosyaları görünmelidirKurulum Sorunları ve Çözümleri
Node.js Sürüm Sorunu
Sorun: Engine node is incompatible with this module
Çözüm:
bash
# Node.js sürümünü kontrol et
node --version
# Node.js 18+ gereklidir. Güncelleme için:
# Windows/macOS: nodejs.org'dan indir
# Linux Ubuntu/Debian:
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs
# macOS Homebrew:
brew install node@18NPM İzin Sorunu (Linux/macOS)
Sorun: EACCES: permission denied
Çözüm 1 - NPM konfigürasyonu (Önerilen):
bash
# NPM global dizinini değiştir
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
# .bashrc veya .zshrc dosyasına ekle
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
# Şimdi global kurulum yap
npm install -g @xcons/cli-thingsboardÇözüm 2 - NPX kullan:
bash
# Global kurulum yerine npx kullan
npx @xcons/cli-thingsboard widget create my-widgetNPM Registry Sorunu
Sorun: npm ERR! 404 Not Found
Çözüm:
bash
# NPM registry'yi kontrol et
npm config get registry
# https://registry.npmjs.org/ olmalı
# Registry'yi düzelt
npm config set registry https://registry.npmjs.org/
# NPM cache'i temizle
npm cache clean --force
# Tekrar dene
npm install -g @xcons/cli-thingsboardWindows PowerShell Execution Policy
Sorun: cannot be loaded because running scripts is disabled
Çözüm:
powershell
# PowerShell'i yönetici olarak aç
# Execution policy'yi kontrol et
Get-ExecutionPolicy
# RemoteSigned olarak ayarla
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
# Kurulumu tekrar dene
npm install -g @xcons/cli-thingsboardAğ/Firewall Sorunları
Sorun: ETIMEDOUT veya ENOTFOUND hataları
Çözüm:
bash
# NPM timeout'unu artır
npm config set timeout 60000
# Proxy ayarları (gerekirse)
npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080
# Registry alternatifi (Çin kullanıcıları için)
npm config set registry https://registry.npmmirror.com/Güncelleme
Global Kurulum Güncelleme
bash
# Mevcut sürümü kontrol et
xcons-thingsboard --version
# Son sürüme güncelle
npm update -g @xcons/cli-thingsboard
# Veya yeniden kur
npm install -g @xcons/cli-thingsboard@latest
# Güncellemeyi doğrula
xcons-thingsboard --versionNPX Otomatik Güncelleme
NPX her zaman son sürümü kullanır, manuel güncelleme gerekmez:
bash
# Her zaman son sürümü kullanır
npx @xcons/cli-thingsboard@latest widget create my-widgetKaldırma
Global Kurulumu Kaldırma
bash
# Global paketi kaldır
npm uninstall -g @xcons/cli-thingsboard
# Kaldırmayı doğrula
xcons-thingsboard --version
# command not found hatası beklenirCache Temizleme
bash
# NPM cache'i temizle
npm cache clean --force
# NPX cache'i temizle
npx clear-npx-cacheIDE Entegrasyonu
Visual Studio Code
.vscode/tasks.json dosyası oluşturun:
json
{
"version": "2.0.0",
"tasks": [
{
"label": "XCONS: Create Widget",
"type": "shell",
"command": "xcons-thingsboard",
"args": ["widget", "create", "${input:widgetName}"],
"group": "build",
"presentation": {
"echo": true,
"reveal": "always",
"panel": "new"
}
},
{
"label": "XCONS: Build Widget",
"type": "shell",
"command": "xcons-thingsboard",
"args": ["widget", "build"],
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"echo": true,
"reveal": "always"
}
},
{
"label": "XCONS: Install Widget",
"type": "shell",
"command": "xcons-thingsboard",
"args": ["widget", "install", "--debug"],
"group": "build"
}
],
"inputs": [
{
"id": "widgetName",
"description": "Widget name",
"default": "my-widget",
"type": "promptString"
}
]
}IntelliJ IDEA/WebStorm
External Tools konfigürasyonu:
- Settings → Tools → External Tools
- Add (+) butonuna tıklayın
- Aşağıdaki ayarları yapın:
XCONS Create Widget:
- Name:
XCONS Create Widget - Program:
xcons-thingsboard - Arguments:
widget create $Prompt$ - Working directory:
$ProjectFileDir$
XCONS Build Widget:
- Name:
XCONS Build Widget - Program:
xcons-thingsboard - Arguments:
widget build --debug - Working directory:
$ProjectFileDir$
Bash Otomatik Tamamlama
Linux/macOS için bash tamamlama özelliği:
bash
# ~/.bashrc dosyasına ekleyin
eval "$(xcons-thingsboard completion bash)"
# Veya manuel tamamlama dosyası oluşturun
xcons-thingsboard completion bash > ~/.xcons-completion.bash
echo "source ~/.xcons-completion.bash" >> ~/.bashrc
# Shell'i yeniden başlatın
source ~/.bashrcPerformans Optimizasyonu
NPM Cache Konfigürasyonu
bash
# NPM cache boyutunu kontrol et
npm cache verify
# Cache dizinini özel konuma taşı (SSD kullanıcıları için)
npm config set cache /path/to/fast/storage/.npm
# Cache boyutunu sınırla (GB)
npm config set cache-max 2000000000Node.js Hafıza Ayarları
Büyük projeler için Node.js hafıza limitini artırın:
bash
# Linux/macOS - ~/.bashrc dosyasına ekleyin
export NODE_OPTIONS="--max-old-space-size=4096"
# Windows - Environment Variables'a ekleyin
NODE_OPTIONS=--max-old-space-size=4096
# Geçici olarak kullanım
NODE_OPTIONS="--max-old-space-size=4096" xcons-thingsboard widget buildSonraki Adımlar
Kurulum tamamlandıktan sonra:
- Konfigürasyon - CLI ayarları ve konfigürasyon seçenekleri
- Widget Oluşturma - İlk widget projenizi oluşturun
- Widget Derleme - Widget projelerini derleme
- Widget Kurulum - Widget'ları ThingsBoard'a yükleme
Destek
Kurulum sorunları için:
- GitHub Issues: Teknik sorunları bildirin
- Dokümantasyon: Detaylı kılavuzlar için
- Community: XCONS Platform forumları
- E-posta: support@xcon-studio.com
**Kurulum tamamlandı! Widget geliştirmeye başlayabilirsiniz.