angular capacitor 기본 콘솔 명령어

angular capacitor 기본 콘솔 명령어 updated_at: 2024-03-19 18:58

기본명령

Angular 로 이미 프로젝트가 구성되어있다는 전제하에 capacitor를 추가하는 기본적인 콘솔 명령어 입니다.

Install Capacitor

angular 프로젝트에 capacitor 추가하기

ng add @capacitor/angular

Build the Web App.

ng build를 사용하여 기존 프로젝트 build 하기

ng build --prod

Install the native platforms you want to target.

플랫폼 추가하기 (ios및 android 플렛폼 추가)

npm i @capacitor/ios
npm i @capacitor/android

npx 명령을 사용하여 native 플렛폼 추가

npx cap add android
npx cap add ios

자주사용하는 명령어

angular 에서 작업한 내용을 build 한다.

ng build

build된 내용을 native platforms 의 public 으로 옮기고 capacitor.config.json 파일을 생성한다.

--- www folder update
npx cap copy // web 쪽 www을 copy 한다.
--- capacitor update
npx cap update // 안드로이드 스튜디오에서 플러그인이 보이지 않을 경우 유용하다
--- www | capacitor update
npx cap sync // 플러그인의 싱크를 마춘다.

open the project in Android Studio

npx cap open android

To run the project on a device or emulator, run:

npx cap run android
평점을 남겨주세요
평점 : 5.0
총 투표수 : 2