시작하기
설치 단계와 이 플러그인의 전체 마크다운 가이드를 포함한 설정 프롬프트를 복사하세요.
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.
설치
설치Capgo 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빠른 시작
빠른 시작대부분의 사용자에게는 Quickstart 가이드를 따르는 것을 추천합니다. 기본 Quickstart 가이드 이 가이드는 플러그인 설치 및 Capgo 클라우드 통합에 대한 내용을 다룹니다.
이 가이드는 기술적인 플러그인 세부 사항에 초점을 맞추고, 내부 메커니즘을 이해하거나 자체 호스팅 업데이트를 구현하는 고급 사용자들을 위해 작성되었습니다.
Capacitor 업데이트 플러그인은 Capacitor 애플리케이션에 대한 오버-더-에어(OTA) 업데이트를 지원합니다. 이 기능을 통해 앱 스토어 검토를 거치지 않고 앱 업데이트를 푸시할 수 있습니다.
작동 방식
‘작동 방식’이라는 제목의 섹션- 업데이트 패키지 다운로드: 플러그인은 업데이트 패키지를 다운로드합니다 (ZIP 파일에 포함된 웹 자산)
- 추출: 장치의 저장소에 번들을 추출합니다.
- 자동 재로드: 앱이 새 번들을 사용하기 위해 재시작 없이 전환합니다.
- Fallback: 업데이트가 실패하면 앱은 이전에 작동하던 버전으로 돌아갑니다.
사용 모드
사용 모드1. 자동 업데이트 모드 (권장)
1. 자동 업데이트 모드 (권장)자동 업데이트를 위한 자동 관리를 사용하는 가장 쉬운 방법입니다.
import { CapacitorUpdater } from '@capgo/capacitor-updater';
// Plugin handles everything automatically// Configure in capacitor.config.ts설정에 추가 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 섹션추가 설정이 필요하지 않습니다. 플러그인은 BOX에서 작동합니다.
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 Cloud와 함께
Capgo Cloud 섹션시작하기 가장 쉬운 방법:
// 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참조 main 자세한 내용은 여기서 확인할 수 있습니다.
Self-Hosted Updates
Section titled “Self-Hosted Updates”Host your own update server:
// Configure your update endpoint{ plugins: { CapacitorUpdater: { autoUpdate: 'atBackground', updateUrl: 'https://your-server.com/api/check-update' } }}Your server should return:
{ "version": "1.0.1", "url": "https://your-server.com/updates/1.0.1.zip"}See Self-Hosted Mode for complete details.
Manual Update Flow
Section titled “수동 업데이트 흐름”업데이트에 대한 완전한 제어:
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 “최선의 방법”- Always call
notifyAppReady()프로덕션으로 푸시하기 전에 업데이트 테스트를 철저히 - 네트워크 오류에 대한 적절한 오류 처리를 구현
- 버전 번호를 일관되게 사용
- 다운로드 속도가 빠른 빠른 배포 크기를 유지
- 업데이트 성공률을 모니터링
- __CAPGO_KEEP_0__
다음 단계
다음 단계- API 플러그인 참고 API 문서 완료
- __CAPGO_KEEP_0__ 설정 __CAPGO_KEEP_0__ 설정 옵션
- 이벤트 업데이트 이벤트
- 자체 호스팅 모드 자체 호스팅 서버
- 로컬 개발 로컬 테스트
- 디버깅 디버깅
지원
지원- 알려진 문제 Section titled “Known Issues”
- GitHub 토론 Section titled “__CAPGO_KEEP_0__ Discussions”
- Discord Section titled “Discord”
계속 시작하기
Section titled “계속 시작하기”Capgo를 사용 중이라면 Getting Started 자연 플러그인 작업을 계획하고자 한다면 Using @capgo/capacitor-updater Capgo native 기능을 사용하는 @capgo/capacitor-업데이터에 대해 Capgo 플러그인 디렉토리 Capgo 제품 워크플로우에 대한 플러그인 디렉토리에서 Capacitor Plugins by Capgo Capacitor 플러그인 구현 세부 사항을 위해 Capgo에 의해 구현됩니다. Capacitor 플러그인에서 플러그인을 추가하거나 업데이트 플러그인을 추가하거나 업데이트 하기 위해 이온 이코노미 플러그인 대체품의 제품 워크플로우에 대해.