@@ -22,10 +22,10 @@ const { build: plistBuild } = pkg;
22
22
23
23
class Applesign {
24
24
config : config . ConfigOptions ;
25
- debugObject : any ;
26
- events : any ;
27
- nested : any ;
28
- tmpDir : any ;
25
+ debugObject : Record < string , any > ;
26
+ events : EventEmitter ;
27
+ nested : any [ ] ;
28
+ tmpDir : string ;
29
29
constructor ( options : any ) {
30
30
this . config = config . fromOptions ( options || { } ) ;
31
31
this . events = new EventEmitter ( ) ;
@@ -42,7 +42,7 @@ class Applesign {
42
42
return result ;
43
43
}
44
44
45
- _fullPathInTmp ( filePath : any ) {
45
+ _fullPathInTmp ( filePath : string ) {
46
46
const dirname = path . dirname ( filePath ) ;
47
47
const dirnameInTmp = path . join ( this . tmpDir , dirname ) ;
48
48
fs . mkdirpSync ( dirnameInTmp ) ;
@@ -68,7 +68,7 @@ class Applesign {
68
68
) ;
69
69
}
70
70
71
- async signXCarchive ( file : any ) {
71
+ async signXCarchive ( file : string ) {
72
72
fchk ( arguments , [ "string" ] ) ;
73
73
const ipaFile = file + ".ipa" ;
74
74
await tools . xcaToIpa ( file , ipaFile ) ;
@@ -80,7 +80,7 @@ class Applesign {
80
80
return tools . getIdentities ( ) ;
81
81
}
82
82
83
- async signIPA ( file : any ) {
83
+ async signIPA ( file : string ) {
84
84
fchk ( arguments , [ "string" ] ) ;
85
85
if ( typeof file === "string" ) {
86
86
this . setFile ( file ) ;
@@ -143,7 +143,7 @@ class Applesign {
143
143
}
144
144
}
145
145
146
- async signAppDirectoryInternal ( ipadir : any , skipNested : any ) {
146
+ async signAppDirectoryInternal ( ipadir : string , skipNested : boolean ) {
147
147
fchk ( arguments , [ "string" , "boolean" ] ) ;
148
148
await this . _pullMobileProvision ( ) ;
149
149
if ( this . config . run ) {
@@ -199,7 +199,7 @@ class Applesign {
199
199
}
200
200
}
201
201
202
- async signAppDirectory ( ipadir : any ) {
202
+ async signAppDirectory ( ipadir : string ) {
203
203
fchk ( arguments , [ "string" ] ) ;
204
204
return this . signAppDirectoryInternal ( ipadir , false ) ;
205
205
}
@@ -222,7 +222,7 @@ class Applesign {
222
222
async removeXCTests ( ) {
223
223
fchk ( arguments , [ ] ) ;
224
224
const dir = this . config . appdir ;
225
- walk . walkSync ( dir , ( basedir : any , filename : any , stat : any ) => {
225
+ walk . walkSync ( dir , ( basedir : string , filename : string , stat : any ) => {
226
226
const target = path . join ( basedir , filename ) ;
227
227
// if (target.toLowerCase().indexOf('/xct') !== -1)
228
228
if ( target . toLowerCase ( ) . indexOf ( "xctest" ) !== - 1 ) {
@@ -235,7 +235,7 @@ class Applesign {
235
235
async removeSigningFiles ( ) {
236
236
fchk ( arguments , [ ] ) ;
237
237
const dir = this . config . appdir ;
238
- walk . walkSync ( dir , ( basedir : any , filename : any , stat : any ) => {
238
+ walk . walkSync ( dir , ( basedir : string , filename : string , stat : any ) => {
239
239
if (
240
240
filename . endsWith ( ".entitlements" ) ||
241
241
filename . endsWith ( ".mobileprovision" )
@@ -269,10 +269,10 @@ class Applesign {
269
269
270
270
findProvisioningsSync ( ) {
271
271
fchk ( arguments , [ ] ) ;
272
- const files : any = [ ] ;
272
+ const files : string [ ] = [ ] ;
273
273
walk . walkSync (
274
274
this . config . appdir ,
275
- ( basedir : any , filename : any , stat : any ) => {
275
+ ( basedir : string , filename : string , stat : any ) => {
276
276
const file = path . join ( basedir , filename ) ;
277
277
// only walk on files. Symlinks and other special files are forbidden
278
278
if ( ! fs . lstatSync ( file ) . isFile ( ) ) {
@@ -294,7 +294,7 @@ class Applesign {
294
294
const identifierInProvisioning = 'x'
295
295
Read the one in Info.plist and compare with bundleid
296
296
*/
297
- async checkProvision ( appdir : any , file : any ) {
297
+ async checkProvision ( appdir : string , file : string ) {
298
298
fchk ( arguments , [ "string" , "string" ] ) ;
299
299
/* Deletes the embedded.mobileprovision from the ipa? */
300
300
const withoutMobileProvision = false ;
@@ -333,7 +333,7 @@ class Applesign {
333
333
}
334
334
}
335
335
336
- debugInfo ( path : any , key : any , val : any ) {
336
+ debugInfo ( path : string , key : any , val : any ) {
337
337
if ( ! val ) {
338
338
return ;
339
339
}
@@ -357,7 +357,7 @@ class Applesign {
357
357
return Object . assign ( orig , addEnt ) ;
358
358
}
359
359
360
- adjustEntitlementsSync ( file : any , entMobProv : any ) {
360
+ adjustEntitlementsSync ( file : string , entMobProv : any ) {
361
361
if ( this . config . pseudoSign ) {
362
362
const ent = bin . entitlements ( file ) ;
363
363
if ( ent === null ) {
@@ -554,7 +554,7 @@ class Applesign {
554
554
}
555
555
}
556
556
557
- async adjustEntitlements ( file : any ) {
557
+ async adjustEntitlements ( file : string ) {
558
558
fchk ( arguments , [ "string" ] ) ;
559
559
let newEntitlements = null ;
560
560
if ( ! this . config . pseudoSign ) {
@@ -567,9 +567,9 @@ class Applesign {
567
567
this . adjustEntitlementsSync ( file , newEntitlements ) ;
568
568
}
569
569
570
- async signFile ( file : any ) {
570
+ async signFile ( file : string ) {
571
571
const config = this . config ;
572
- function customOptions ( config : any , file : any ) {
572
+ function customOptions ( config : any , file : string ) {
573
573
if (
574
574
typeof config . json === "object" &&
575
575
typeof config . json . custom === "object"
@@ -611,7 +611,7 @@ class Applesign {
611
611
await tools . lipoFile ( file , this . config . lipoArch ) ;
612
612
} catch ( ignored ) { }
613
613
}
614
- function codesignHasFailed ( config : any , error : any , errmsg : any ) {
614
+ function codesignHasFailed ( config : any , error : any , errmsg : string ) {
615
615
if ( error && errmsg . indexOf ( "Error:" ) !== - 1 ) {
616
616
throw error ;
617
617
}
@@ -655,7 +655,7 @@ class Applesign {
655
655
this . emit ( "message" , "Signed " + file ) ;
656
656
if ( config . verifyTwice ) {
657
657
this . emit ( "message" , "Verify " + file ) ;
658
- const res : any = await tools . verifyCodesign ( file , config . keychain ) ;
658
+ const res = await tools . verifyCodesign ( file , config . keychain ) ;
659
659
if ( res . code !== 0 ) {
660
660
const type = config . ignoreVerificationErrors ? "warning" : "error" ;
661
661
return this . emit ( type , res . stderr ) ;
@@ -730,7 +730,7 @@ class Applesign {
730
730
return libraries ;
731
731
}
732
732
733
- async signLibraries ( bpath : any , appdir : any ) {
733
+ async signLibraries ( bpath : string , appdir : string ) {
734
734
fchk ( arguments , [ "string" , "string" ] ) ;
735
735
this . emit ( "message" , "Signing libraries and frameworks" ) ;
736
736
@@ -843,7 +843,7 @@ class Applesign {
843
843
async zipIPA ( ) {
844
844
fchk ( arguments , [ ] ) ;
845
845
const ipaIn = this . config . file ;
846
- const ipaOut = getOutputPath ( this . config . outdir , this . config . outfile ) ;
846
+ const ipaOut = getOutputPath ( this . config . outdir , this . config . outfile ! ) ;
847
847
try {
848
848
fs . unlinkSync ( ipaOut ) ; // await for it
849
849
} catch ( e ) {
@@ -893,7 +893,7 @@ class Applesign {
893
893
894
894
// helper functions
895
895
896
- function getResignedFilename ( input : any ) : string | null {
896
+ function getResignedFilename ( input : string ) : string | null {
897
897
if ( ! input ) {
898
898
return null ;
899
899
}
@@ -911,7 +911,7 @@ function getResignedFilename(input: any): string | null {
911
911
return input + "-resigned.ipa" ;
912
912
}
913
913
914
- function getExecutable ( appdir : any ) {
914
+ function getExecutable ( appdir : string ) {
915
915
if ( ! appdir ) {
916
916
throw new Error ( "No application directory is provided" ) ;
917
917
}
@@ -941,7 +941,7 @@ async function injectLibrary(config: any) {
941
941
await insertLibraryLL ( outputLib , targetLib , config ) ;
942
942
}
943
943
944
- function insertLibraryLL ( outputLib : any , targetLib : any , config : any ) {
944
+ function insertLibraryLL ( outputLib : any , targetLib : string , config : any ) {
945
945
return new Promise ( ( resolve , reject ) => {
946
946
try {
947
947
const writeStream = fs . createWriteStream ( outputLib ) ;
@@ -967,17 +967,17 @@ function insertLibraryLL(outputLib: any, targetLib: any, config: any) {
967
967
} ) ;
968
968
}
969
969
970
- function parentDirectory ( root : any ) {
970
+ function parentDirectory ( root : string ) {
971
971
return path . normalize ( path . join ( root , ".." ) ) ;
972
972
}
973
973
974
- function getOutputPath ( cwd : any , ofile : any ) {
974
+ function getOutputPath ( cwd : string , ofile : string ) {
975
975
return ofile . startsWith ( path . sep )
976
976
? ofile
977
977
: path . join ( parentDirectory ( cwd ) , ofile ) ;
978
978
}
979
979
980
- function runScriptSync ( script : any , session : any ) {
980
+ function runScriptSync ( script : string , session : any ) {
981
981
if ( script . endsWith ( ".js" ) ) {
982
982
try {
983
983
const s = require ( script ) ;
@@ -1003,7 +1003,7 @@ function runScriptSync(script: any, session: any) {
1003
1003
return true ;
1004
1004
}
1005
1005
1006
- function nestedApp ( file : any ) {
1006
+ function nestedApp ( file : string ) {
1007
1007
const dotApp = file . indexOf ( ".app/" ) ;
1008
1008
if ( dotApp !== - 1 ) {
1009
1009
const subApp = file . substring ( dotApp + 4 ) . indexOf ( ".app/" ) ;
@@ -1014,7 +1014,7 @@ function nestedApp(file: any) {
1014
1014
return false ;
1015
1015
}
1016
1016
1017
- function getAppDirectory ( this : any , ipadir : any ) {
1017
+ function getAppDirectory ( this : any , ipadir : string ) {
1018
1018
if ( ! ipadir ) {
1019
1019
ipadir = path . join ( this . config . outdir , "Payload" ) ;
1020
1020
}
@@ -1024,7 +1024,7 @@ function getAppDirectory(this: any, ipadir: any) {
1024
1024
if ( ipadir . endsWith ( ".app" ) ) {
1025
1025
this . config . appdir = ipadir ;
1026
1026
} else {
1027
- const files = fs . readdirSync ( ipadir ) . filter ( ( x : any ) => {
1027
+ const files = fs . readdirSync ( ipadir ) . filter ( ( x : string ) => {
1028
1028
return x . endsWith ( ".app" ) ;
1029
1029
} ) ;
1030
1030
if ( files . length !== 1 ) {
@@ -1038,17 +1038,17 @@ function getAppDirectory(this: any, ipadir: any) {
1038
1038
return ipadir ;
1039
1039
}
1040
1040
1041
- async function enumerateTestFiles ( dir : any ) {
1041
+ async function enumerateTestFiles ( dir : string ) {
1042
1042
let tests = [ ] ;
1043
1043
if ( fs . existsSync ( dir ) ) {
1044
- tests = ( await fs . readdir ( dir ) ) . filter ( ( x : any ) => {
1044
+ tests = ( await fs . readdir ( dir ) ) . filter ( ( x : string ) => {
1045
1045
return x . indexOf ( ".xctest" ) !== - 1 ;
1046
1046
} ) ;
1047
1047
}
1048
1048
return tests ;
1049
1049
}
1050
1050
1051
- async function moveFiles ( files : any , sourceDir : any , destDir : any ) {
1051
+ async function moveFiles ( files : string [ ] , sourceDir : string , destDir : string ) {
1052
1052
await fs . mkdir ( destDir , { recursive : true } ) ;
1053
1053
for ( const f of files ) {
1054
1054
const oldName = path . join ( sourceDir , f ) ;
0 commit comments