__CAPGO_KEEP_0__ 시작
설치 단계와 이 플러그인의 전체 마크다운 가이드를 포함한 설정 프롬프트 복사
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-updater`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/updater/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
설치
설치 섹션AI-Assisted Setup을 사용하여 플러그인을 설치할 수 있습니다. AI 도구에 Capgo 스킬을 추가하려면 다음 명령어를 사용하세요:
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins그런 다음 다음 명령어를 사용하세요:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-updater` plugin in my project.만약 Manual Setup을 선호한다면, 다음 명령어를 실행하고 아래의 플랫폼별 지침을 따르세요:
bun add @capgo/capacitor-updaterbunx cap syncyarn add @capgo/capacitor-updaterbunx cap syncpnpm add @capgo/capacitor-updaterbunx cap syncbun add @capgo/capacitor-updaterbunx cap sync빠른 시작
‘빠른 시작’ 제목대부분의 사용자에게는 플러그인 설치 및 __CAPGO_KEEP_0__ 클라우드 통합을 모두 포함하는 기본 빠른 시작 안내서를 따르기를 권장합니다. which covers both the plugin installation and Capgo cloud integration.
개요
The Capacitor Updater plugin enables over-the-air (OTA) updates for your Capacitor applications. This allows you to push updates to your app without going through app store reviews.
작동 방식
작동 방식 섹션- 배포 다운로드: 플러그인은 업데이트된 배포본(ZIP 파일)을 다운로드합니다. 이 파일에는 웹 자산이 포함되어 있습니다.
- 추출: 배포본은 장치의 저장소로 추출됩니다.
- 급속 재로드: 앱은 새로운 배포본으로 전환되며 재시작이 필요하지 않습니다.
- 대체: 업데이트가 실패하면 앱은 이전에 작동하던 버전으로 돌아갑니다.
사용 모드
사용 모드 섹션1. 자동 업데이트 모드 (권장)
제목: 1. 자동 업데이트 모드 (권장)자동 업데이트 관리를 위한 플러그인 사용의 가장 쉬운 방법:
import { CapacitorUpdater } from '@capgo/capacitor-updater';
// Plugin handles everything automatically// Configure in capacitor.config.tsAdd to your capacitor.config.ts:
{ plugins: { CapacitorUpdater: { autoUpdate: 'atBackground', updateUrl: 'https://your-update-server.com/api/updates' } }}2. 수동 모드
제목: 2. 수동 모드업데이트 프로세스의 고급 제어를 위해:
import { CapacitorUpdater } from '@capgo/capacitor-updater';
// Download an updateconst bundle = await CapacitorUpdater.download({ url: 'https://your-server.com/updates/v1.0.1.zip', version: '1.0.1'});
// Set the bundle (will be used on next app start)await CapacitorUpdater.set({ id: bundle.id});
// Or reload immediatelyawait CapacitorUpdater.reload();플랫폼 설정
제목: 플랫폼 설정iOS
iOS 섹션iOS 플러그인은 별도의 설정이 필요하지 않습니다. box에서 작동합니다.
Android
Android 섹션Android 플러그인은 별도의 설정이 필요하지 않습니다. box에서 작동합니다.
기본 API 사용 방법
기본 API 사용 방법 섹션업데이트 다운로드
업데이트 다운로드 섹션import { CapacitorUpdater } from '@capgo/capacitor-updater';
const bundle = await CapacitorUpdater.download({ url: 'https://example.com/update.zip', version: '1.0.1'});
console.log('Downloaded bundle:', bundle.id);활성 배ंडल로 설정
활성화된 번들 설정// Set bundle to be used on next app startawait CapacitorUpdater.set({ id: bundle.id});새로운 번들로 다시 로드
새로운 번들로 다시 로드// Reload app immediately with new bundleawait CapacitorUpdater.reload();번들 목록
클립보드 복사const { bundles } = await CapacitorUpdater.list();console.log('Available bundles:', bundles);클립보드 복사
번들 삭제await CapacitorUpdater.delete({ id: 'bundle-id'});현재 번들 가져오기
현재 번들 가져오기const { bundle } = await CapacitorUpdater.current();console.log('Current bundle:', bundle.version);이벤트 리스너
이벤트 리스너업데이트 이벤트를 듣기:
import { CapacitorUpdater } from '@capgo/capacitor-updater';
// Listen for download progressCapacitorUpdater.addListener('download', (info) => { console.log('Download progress:', info.percent);});
// Listen for download completionCapacitorUpdater.addListener('downloadComplete', (bundle) => { console.log('Download complete:', bundle.version);});
// Listen for update failuresCapacitorUpdater.addListener('updateFailed', (error) => { console.error('Update failed:', error);});
// Listen for successful updatesCapacitorUpdater.addListener('updateAvailable', (info) => { console.log('Update available:', info.version);});설정 옵션
설정 옵션플러그인을 자신의 capacitor.config.ts:
{ plugins: { CapacitorUpdater: { // Auto-update settings autoUpdate: 'atBackground', updateUrl: 'https://api.example.com/updates',
// Update behavior resetWhenUpdate: true,
// Version settings version: '1.0.0',
// Security allowModifyUrl: false,
// Stats collection statsUrl: 'https://api.example.com/stats',
// Channel (for Capgo cloud) defaultChannel: 'production' } }}통합 패턴
통합 패턴Capgo 클라우드와 함께
Capgo 클라우드 제목시작하기 가장 쉬운 방법:
// Install the Capgo CLIbun add -g @capgo/cli
// Login to Capgonpx @capgo/cli login
// Upload your first bundlenpx @capgo/cli bundle upload
// The plugin auto-updates from Capgo cloud자세한 내용은 기본적인 Quickstart 가이드 를 참조하십시오.
자체 호스팅 업데이트
자체 호스팅 업데이트 제목자체 호스팅 업데이트 서버를 호스팅하세요:
// Configure your update endpoint{ plugins: { CapacitorUpdater: { autoUpdate: 'atBackground', updateUrl: 'https://your-server.com/api/check-update' } }}서버는 다음을 반환해야 합니다:
{ "version": "1.0.1", "url": "https://your-server.com/updates/1.0.1.zip"}See 자체 호스팅 모드 자세한 내용은
수동 업데이트 흐름
수동 업데이트 흐름업데이트에 대한 완전한 제어:
import { CapacitorUpdater } from '@capgo/capacitor-updater';
async function checkAndUpdate() { // Check for updates from your server const response = await fetch('https://api.example.com/check-update'); const { version, url } = await response.json();
// Download the update const bundle = await CapacitorUpdater.download({ url, version });
// Notify bundle is ready await CapacitorUpdater.notifyAppReady();
// Set as next version await CapacitorUpdater.set({ id: bundle.id });
// Reload when ready await CapacitorUpdater.reload();}최선의 방법
Section titled “최선의 방법”- 항상
notifyAppReady()when your app successfully loads - production 환경에서 push하기 전에 반드시 테스트를 철저히 하세요
- 네트워크 오류 시 적절한 에러 처리를 구현하세요
- 버전 번호를 일관되게 사용하세요
- 다운로드 속도를 빠르게 하기 위해 배포 크기를 작게 유지하세요
- 업데이트 성공률을 모니터링하세요
다음 단계
Next Steps- API 플러그인 참조 API 문서를 완성하세요
- 플러그인 설정 모든 구성 옵션
- 이벤트 - 업데이트 가능한 이벤트
- Self-Hosted 모드 - 자체 호스팅 업데이트 서버를 실행
- 로컬 개발 - 로컬에서 업데이트 테스트
- 디버깅 - 문제 해결 가이드
지원
제목 '지원'Getting Started에서 계속하기
Getting Started에서 계속하기Getting Started을 사용 중이라면 Getting Started Getting Started을 사용 중이라면 Using @capgo/capacitor-updater for the native capability in Using @capgo/capacitor-updater, Capgo Plugin Directory for the product workflow in Capgo Plugin Directory, Capacitor 플러그인들에 의해 Capgo Capacitor 플러그인들에 의해 Capgo의 구현 세부 정보를 위해 플러그인 추가 또는 업데이트 플러그인 추가 또는 업데이트의 구현 세부 정보를 위해, Ionic Enterprise 플러그인 대체 Ionic Enterprise 플러그인 대체의 제품 워크플로에 대해.