Skip to content

Commit ca2a915

Browse files
committed
fix: fix definition files so nativescript-cloud can be successfully built
Currently `nativescript-cloud` cannot be built with latest master branch of CLI due to the following errors: ``` node_modules/nativescript/lib/definitions/project.d.ts(476,96): error TS2503: Cannot find namespace 'IXcode'. node_modules/nativescript/lib/definitions/project.d.ts(476,165): error TS2503: Cannot find namespace 'IXcode'. node_modules/nativescript/lib/definitions/project.d.ts(479,128): error TS2503: Cannot find namespace 'IXcode'. node_modules/nativescript/lib/definitions/project.d.ts(480,99): error TS2503: Cannot find namespace 'IXcode'. ``` The issue happens as `IXcode` interface is already used from project.d.ts file. As `nativescript-cloud` lib generates `references.d.ts` file with references to all `.d.ts` files from NativeScript CLI, we need a separate `.d.ts` file for `IXcode` interface. This way, it will be included in the generated `references.d.ts` file and cloud-lib will be successfully built.
1 parent 46d15b6 commit ca2a915

File tree

3 files changed

+70
-67
lines changed

3 files changed

+70
-67
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
declare module "nativescript-dev-xcode" {
2+
interface Options {
3+
[key: string]: any;
4+
5+
customFramework?: boolean;
6+
embed?: boolean;
7+
relativePath?: string;
8+
}
9+
10+
class project {
11+
constructor(filename: string);
12+
13+
parse(callback: () => void): void;
14+
parseSync(): void;
15+
16+
writeSync(options: any): string;
17+
18+
addFramework(filepath: string, options?: Options): void;
19+
removeFramework(filePath: string, options?: Options): void;
20+
21+
addPbxGroup(filePathsArray: any[], name: string, path: string, sourceTree: string): void;
22+
23+
removePbxGroup(groupName: string, path: string): void;
24+
25+
addToHeaderSearchPaths(options?: Options): void;
26+
removeFromHeaderSearchPaths(options?: Options): void;
27+
updateBuildProperty(key: string, value: any): void;
28+
29+
pbxXCBuildConfigurationSection(): any;
30+
31+
addTarget(targetName: string, targetType: string, targetPath?: string, parentTarget?: string): target;
32+
addBuildPhase(filePathsArray: string[],
33+
buildPhaseType: string,
34+
comment: string,
35+
target?: string,
36+
optionsOrFolderType?: Object|string,
37+
subfolderPath?: string
38+
): any;
39+
addToBuildSettings(buildSetting: string, value: any, targetUuid?: string): void;
40+
addPbxGroup(
41+
filePathsArray: string[],
42+
name: string,
43+
path: string,
44+
sourceTree: string,
45+
opt: {filesRelativeToProject?: boolean, target?: string, uuid?: string, isMain?: boolean }
46+
): group;
47+
addBuildProperty(prop: string, value: any, build_name?: string, productName?: string): void;
48+
addToHeaderSearchPaths(file: string|Object, productName?: string): void;
49+
removeTargetsByProductType(targetType: string): void;
50+
getFirstTarget(): {uuid: string};
51+
}
52+
53+
class target {
54+
uuid: string;
55+
pbxNativeTarget: {productName: string}
56+
}
57+
58+
class group {
59+
uuid: string;
60+
pbxGroup: Object;
61+
}
62+
}

lib/definitions/xcode.d.ts

+8-58
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,12 @@
1-
declare module "nativescript-dev-xcode" {
2-
interface Options {
3-
[key: string]: any;
1+
/// <reference path="./nativescript-dev-xcode.d.ts" />
42

5-
customFramework?: boolean;
6-
embed?: boolean;
7-
relativePath?: string;
8-
}
9-
10-
class project {
11-
constructor(filename: string);
12-
13-
parse(callback: () => void): void;
14-
parseSync(): void;
15-
16-
writeSync(options: any): string;
17-
18-
addFramework(filepath: string, options?: Options): void;
19-
removeFramework(filePath: string, options?: Options): void;
20-
21-
addPbxGroup(filePathsArray: any[], name: string, path: string, sourceTree: string): void;
22-
23-
removePbxGroup(groupName: string, path: string): void;
24-
25-
addToHeaderSearchPaths(options?: Options): void;
26-
removeFromHeaderSearchPaths(options?: Options): void;
27-
updateBuildProperty(key: string, value: any): void;
28-
29-
pbxXCBuildConfigurationSection(): any;
30-
31-
addTarget(targetName: string, targetType: string, targetPath?: string, parentTarget?: string): target;
32-
addBuildPhase(filePathsArray: string[],
33-
buildPhaseType: string,
34-
comment: string,
35-
target?: string,
36-
optionsOrFolderType?: Object|string,
37-
subfolderPath?: string
38-
): any;
39-
addToBuildSettings(buildSetting: string, value: any, targetUuid?: string): void;
40-
addPbxGroup(
41-
filePathsArray: string[],
42-
name: string,
43-
path: string,
44-
sourceTree: string,
45-
opt: {filesRelativeToProject?: boolean, target?: string, uuid?: string, isMain?: boolean }
46-
): group;
47-
addBuildProperty(prop: string, value: any, build_name?: string, productName?: string): void;
48-
addToHeaderSearchPaths(file: string|Object, productName?: string): void;
49-
removeTargetsByProductType(targetType: string): void;
50-
getFirstTarget(): {uuid: string};
51-
}
52-
53-
class target {
54-
uuid: string;
55-
pbxNativeTarget: {productName: string}
56-
}
3+
import * as xcode from "nativescript-dev-xcode";
574

58-
class group {
59-
uuid: string;
60-
pbxGroup: Object;
5+
declare global {
6+
type IXcode = typeof xcode;
7+
export namespace IXcode {
8+
export type target = xcode.target;
9+
export type project = xcode.project;
10+
export interface Options extends xcode.Options {} // tslint:disable-line
6111
}
6212
}

lib/node/xcode.ts

-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
import * as xcode from "nativescript-dev-xcode";
22

3-
declare global {
4-
type IXcode = typeof xcode;
5-
export namespace IXcode {
6-
export type target = xcode.target;
7-
export type project = xcode.project;
8-
export interface Options extends xcode.Options {} // tslint:disable-line
9-
}
10-
}
11-
123
export { xcode };
134

145
$injector.register("xcode", xcode);

0 commit comments

Comments
 (0)