11var fs = require ( 'fs' ) ;
22var path = require ( 'path' ) ;
3- var prompt = require ( 'prompt' ) ;
3+ var prompt = require ( 'prompt-lite ' ) ;
44
55// Default settings for using ios and android with Firebase
66var usingiOS = false , usingAndroid = false ;
@@ -133,6 +133,7 @@ function promptQuestions() {
133133function promptQuestionsResult ( result ) {
134134 if ( usingiOS ) {
135135 writePodFile ( result ) ;
136+ // writeIOSEntitlementsCopyHook();
136137 }
137138 if ( usingAndroid ) {
138139 writeGradleFile ( result ) ;
@@ -156,6 +157,29 @@ function askSaveConfigPrompt() {
156157 } ) ;
157158}
158159
160+ // "scripts/install_ios_entitlements.js"
161+ function writeIOSEntitlementsCopyHook ( ) {
162+ console . log ( "Install ios-entitlements installation hook." ) ;
163+ try {
164+ var scriptContent = "module.exports = require(\"nativescript-plugin-firebase/scripts/install_ios_entitlements.js\");" ;
165+
166+ var scriptPath = path . join ( appRoot , "hooks" , "after-prepare" , "run_ios_entitlements_install_script.js" ) ;
167+ var afterPrepareDirPath = path . dirname ( scriptPath ) ;
168+ var hooksDirPath = path . dirname ( afterPrepareDirPath ) ;
169+ if ( ! fs . existsSync ( afterPrepareDirPath ) ) {
170+ if ( ! fs . existsSync ( hooksDirPath ) ) {
171+ fs . mkdirSync ( hooksDirPath ) ;
172+ }
173+ fs . mkdirSync ( afterPrepareDirPath ) ;
174+ }
175+ fs . writeFileSync ( scriptPath , scriptContent ) ;
176+
177+ } catch ( e ) {
178+ console . log ( "Failed to install ios-entitlements installation hook." ) ;
179+ console . log ( e ) ;
180+ }
181+ }
182+
159183/**
160184 * Create the iOS PodFile for installing the Firebase iOS dependencies and service dependencies
161185 *
0 commit comments