Skip to content

Commit fb38b0d

Browse files
committed
more concrete
1 parent 6fb76f3 commit fb38b0d

File tree

1 file changed

+35
-35
lines changed

1 file changed

+35
-35
lines changed

index.ts

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ const { build: plistBuild } = pkg;
2222

2323
class Applesign {
2424
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;
2929
constructor(options: any) {
3030
this.config = config.fromOptions(options || {});
3131
this.events = new EventEmitter();
@@ -42,7 +42,7 @@ class Applesign {
4242
return result;
4343
}
4444

45-
_fullPathInTmp(filePath: any) {
45+
_fullPathInTmp(filePath: string) {
4646
const dirname = path.dirname(filePath);
4747
const dirnameInTmp = path.join(this.tmpDir, dirname);
4848
fs.mkdirpSync(dirnameInTmp);
@@ -68,7 +68,7 @@ class Applesign {
6868
);
6969
}
7070

71-
async signXCarchive(file: any) {
71+
async signXCarchive(file: string) {
7272
fchk(arguments, ["string"]);
7373
const ipaFile = file + ".ipa";
7474
await tools.xcaToIpa(file, ipaFile);
@@ -80,7 +80,7 @@ class Applesign {
8080
return tools.getIdentities();
8181
}
8282

83-
async signIPA(file: any) {
83+
async signIPA(file: string) {
8484
fchk(arguments, ["string"]);
8585
if (typeof file === "string") {
8686
this.setFile(file);
@@ -143,7 +143,7 @@ class Applesign {
143143
}
144144
}
145145

146-
async signAppDirectoryInternal(ipadir: any, skipNested: any) {
146+
async signAppDirectoryInternal(ipadir: string, skipNested: boolean) {
147147
fchk(arguments, ["string", "boolean"]);
148148
await this._pullMobileProvision();
149149
if (this.config.run) {
@@ -199,7 +199,7 @@ class Applesign {
199199
}
200200
}
201201

202-
async signAppDirectory(ipadir: any) {
202+
async signAppDirectory(ipadir: string) {
203203
fchk(arguments, ["string"]);
204204
return this.signAppDirectoryInternal(ipadir, false);
205205
}
@@ -222,7 +222,7 @@ class Applesign {
222222
async removeXCTests() {
223223
fchk(arguments, []);
224224
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) => {
226226
const target = path.join(basedir, filename);
227227
// if (target.toLowerCase().indexOf('/xct') !== -1)
228228
if (target.toLowerCase().indexOf("xctest") !== -1) {
@@ -235,7 +235,7 @@ class Applesign {
235235
async removeSigningFiles() {
236236
fchk(arguments, []);
237237
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) => {
239239
if (
240240
filename.endsWith(".entitlements") ||
241241
filename.endsWith(".mobileprovision")
@@ -269,10 +269,10 @@ class Applesign {
269269

270270
findProvisioningsSync() {
271271
fchk(arguments, []);
272-
const files: any = [];
272+
const files: string[] = [];
273273
walk.walkSync(
274274
this.config.appdir,
275-
(basedir: any, filename: any, stat: any) => {
275+
(basedir: string, filename: string, stat: any) => {
276276
const file = path.join(basedir, filename);
277277
// only walk on files. Symlinks and other special files are forbidden
278278
if (!fs.lstatSync(file).isFile()) {
@@ -294,7 +294,7 @@ class Applesign {
294294
const identifierInProvisioning = 'x'
295295
Read the one in Info.plist and compare with bundleid
296296
*/
297-
async checkProvision(appdir: any, file: any) {
297+
async checkProvision(appdir: string, file: string) {
298298
fchk(arguments, ["string", "string"]);
299299
/* Deletes the embedded.mobileprovision from the ipa? */
300300
const withoutMobileProvision = false;
@@ -333,7 +333,7 @@ class Applesign {
333333
}
334334
}
335335

336-
debugInfo(path: any, key: any, val: any) {
336+
debugInfo(path: string, key: any, val: any) {
337337
if (!val) {
338338
return;
339339
}
@@ -357,7 +357,7 @@ class Applesign {
357357
return Object.assign(orig, addEnt);
358358
}
359359

360-
adjustEntitlementsSync(file: any, entMobProv: any) {
360+
adjustEntitlementsSync(file: string, entMobProv: any) {
361361
if (this.config.pseudoSign) {
362362
const ent = bin.entitlements(file);
363363
if (ent === null) {
@@ -554,7 +554,7 @@ class Applesign {
554554
}
555555
}
556556

557-
async adjustEntitlements(file: any) {
557+
async adjustEntitlements(file: string) {
558558
fchk(arguments, ["string"]);
559559
let newEntitlements = null;
560560
if (!this.config.pseudoSign) {
@@ -567,9 +567,9 @@ class Applesign {
567567
this.adjustEntitlementsSync(file, newEntitlements);
568568
}
569569

570-
async signFile(file: any) {
570+
async signFile(file: string) {
571571
const config = this.config;
572-
function customOptions(config: any, file: any) {
572+
function customOptions(config: any, file: string) {
573573
if (
574574
typeof config.json === "object" &&
575575
typeof config.json.custom === "object"
@@ -611,7 +611,7 @@ class Applesign {
611611
await tools.lipoFile(file, this.config.lipoArch);
612612
} catch (ignored) {}
613613
}
614-
function codesignHasFailed(config: any, error: any, errmsg: any) {
614+
function codesignHasFailed(config: any, error: any, errmsg: string) {
615615
if (error && errmsg.indexOf("Error:") !== -1) {
616616
throw error;
617617
}
@@ -655,7 +655,7 @@ class Applesign {
655655
this.emit("message", "Signed " + file);
656656
if (config.verifyTwice) {
657657
this.emit("message", "Verify " + file);
658-
const res: any = await tools.verifyCodesign(file, config.keychain);
658+
const res = await tools.verifyCodesign(file, config.keychain);
659659
if (res.code !== 0) {
660660
const type = config.ignoreVerificationErrors ? "warning" : "error";
661661
return this.emit(type, res.stderr);
@@ -730,7 +730,7 @@ class Applesign {
730730
return libraries;
731731
}
732732

733-
async signLibraries(bpath: any, appdir: any) {
733+
async signLibraries(bpath: string, appdir: string) {
734734
fchk(arguments, ["string", "string"]);
735735
this.emit("message", "Signing libraries and frameworks");
736736

@@ -843,7 +843,7 @@ class Applesign {
843843
async zipIPA() {
844844
fchk(arguments, []);
845845
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!);
847847
try {
848848
fs.unlinkSync(ipaOut); // await for it
849849
} catch (e) {
@@ -893,7 +893,7 @@ class Applesign {
893893

894894
// helper functions
895895

896-
function getResignedFilename(input: any): string | null {
896+
function getResignedFilename(input: string): string | null {
897897
if (!input) {
898898
return null;
899899
}
@@ -911,7 +911,7 @@ function getResignedFilename(input: any): string | null {
911911
return input + "-resigned.ipa";
912912
}
913913

914-
function getExecutable(appdir: any) {
914+
function getExecutable(appdir: string) {
915915
if (!appdir) {
916916
throw new Error("No application directory is provided");
917917
}
@@ -941,7 +941,7 @@ async function injectLibrary(config: any) {
941941
await insertLibraryLL(outputLib, targetLib, config);
942942
}
943943

944-
function insertLibraryLL(outputLib: any, targetLib: any, config: any) {
944+
function insertLibraryLL(outputLib: any, targetLib: string, config: any) {
945945
return new Promise((resolve, reject) => {
946946
try {
947947
const writeStream = fs.createWriteStream(outputLib);
@@ -967,17 +967,17 @@ function insertLibraryLL(outputLib: any, targetLib: any, config: any) {
967967
});
968968
}
969969

970-
function parentDirectory(root: any) {
970+
function parentDirectory(root: string) {
971971
return path.normalize(path.join(root, ".."));
972972
}
973973

974-
function getOutputPath(cwd: any, ofile: any) {
974+
function getOutputPath(cwd: string, ofile: string) {
975975
return ofile.startsWith(path.sep)
976976
? ofile
977977
: path.join(parentDirectory(cwd), ofile);
978978
}
979979

980-
function runScriptSync(script: any, session: any) {
980+
function runScriptSync(script: string, session: any) {
981981
if (script.endsWith(".js")) {
982982
try {
983983
const s = require(script);
@@ -1003,7 +1003,7 @@ function runScriptSync(script: any, session: any) {
10031003
return true;
10041004
}
10051005

1006-
function nestedApp(file: any) {
1006+
function nestedApp(file: string) {
10071007
const dotApp = file.indexOf(".app/");
10081008
if (dotApp !== -1) {
10091009
const subApp = file.substring(dotApp + 4).indexOf(".app/");
@@ -1014,7 +1014,7 @@ function nestedApp(file: any) {
10141014
return false;
10151015
}
10161016

1017-
function getAppDirectory(this: any, ipadir: any) {
1017+
function getAppDirectory(this: any, ipadir: string) {
10181018
if (!ipadir) {
10191019
ipadir = path.join(this.config.outdir, "Payload");
10201020
}
@@ -1024,7 +1024,7 @@ function getAppDirectory(this: any, ipadir: any) {
10241024
if (ipadir.endsWith(".app")) {
10251025
this.config.appdir = ipadir;
10261026
} else {
1027-
const files = fs.readdirSync(ipadir).filter((x: any) => {
1027+
const files = fs.readdirSync(ipadir).filter((x: string) => {
10281028
return x.endsWith(".app");
10291029
});
10301030
if (files.length !== 1) {
@@ -1038,17 +1038,17 @@ function getAppDirectory(this: any, ipadir: any) {
10381038
return ipadir;
10391039
}
10401040

1041-
async function enumerateTestFiles(dir: any) {
1041+
async function enumerateTestFiles(dir: string) {
10421042
let tests = [];
10431043
if (fs.existsSync(dir)) {
1044-
tests = (await fs.readdir(dir)).filter((x: any) => {
1044+
tests = (await fs.readdir(dir)).filter((x: string) => {
10451045
return x.indexOf(".xctest") !== -1;
10461046
});
10471047
}
10481048
return tests;
10491049
}
10501050

1051-
async function moveFiles(files: any, sourceDir: any, destDir: any) {
1051+
async function moveFiles(files: string[], sourceDir: string, destDir: string) {
10521052
await fs.mkdir(destDir, { recursive: true });
10531053
for (const f of files) {
10541054
const oldName = path.join(sourceDir, f);

0 commit comments

Comments
 (0)