Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 24 additions & 8 deletions lib/commands/typings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,19 +219,35 @@ export class TypingsCommand implements ICommand {
path.resolve(this.$projectData.projectDir, "typings", "ios"),
);

const env: Record<string, string> = {
...process.env,
TNS_TYPESCRIPT_DECLARATIONS_PATH: path.resolve(
this.$projectData.projectDir,
"typings",
"ios",
),
};

if (this.$options.yaml) {
const yamlDir = path.resolve(this.$options.yaml);
this.$fs.ensureDirectoryExists(yamlDir);
env.NS_DEBUG_METADATA_PATH = yamlDir;
this.$logger.info(`Metadata YAML output will be written to: ${yamlDir}`);
}

if (this.$options.jsonMetadata) {
const jsonDir = path.resolve(this.$options.jsonMetadata);
this.$fs.ensureDirectoryExists(jsonDir);
env.NS_JSON_METADATA_PATH = jsonDir;
this.$logger.info(`Metadata JSON output will be written to: ${jsonDir}`);
}

await this.$childProcess.spawnFromEvent(
"node",
[this.$staticConfig.cliBinPath, "build", "ios"],
"exit",
{
env: {
...process.env,
TNS_TYPESCRIPT_DECLARATIONS_PATH: path.resolve(
this.$projectData.projectDir,
"typings",
"ios",
),
},
env,
stdio: "inherit",
},
);
Expand Down
81 changes: 39 additions & 42 deletions lib/declarations.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ interface INodePackageManager {
install(
packageName: string,
pathToSave: string,
config: INodePackageManagerInstallOptions
config: INodePackageManagerInstallOptions,
): Promise<INpmInstallResultInfo>;

/**
Expand All @@ -44,7 +44,7 @@ interface INodePackageManager {
uninstall(
packageName: string,
config?: IDictionary<string | boolean>,
path?: string
path?: string,
): Promise<string>;

/**
Expand Down Expand Up @@ -84,7 +84,7 @@ interface INodePackageManager {
*/
search(
filter: string[],
config: IDictionary<string | boolean>
config: IDictionary<string | boolean>,
): Promise<string>;

/**
Expand Down Expand Up @@ -130,7 +130,7 @@ interface IPerformanceService {
methodInfo: string,
startTime: number,
endTime: number,
args: any[]
args: any[],
): void;

// Will return a reference time in milliseconds
Expand All @@ -141,48 +141,47 @@ interface IPackageInstallationManager {
install(
packageName: string,
packageDir: string,
options?: INpmInstallOptions
options?: INpmInstallOptions,
): Promise<any>;
uninstall(
packageName: string,
packageDir: string,
options?: IDictionary<string | boolean>
options?: IDictionary<string | boolean>,
): Promise<any>;
getLatestVersion(packageName: string): Promise<string>;
getNextVersion(packageName: string): Promise<string>;
getLatestCompatibleVersion(
packageName: string,
referenceVersion?: string
referenceVersion?: string,
): Promise<string>;
getMaxSatisfyingVersion(
packageName: string,
versionRange: string
versionRange: string,
): Promise<string>;
getLatestCompatibleVersionSafe(
packageName: string,
referenceVersion?: string
referenceVersion?: string,
): Promise<string>;
getInspectorFromCache(
inspectorNpmPackageName: string,
projectDir: string
projectDir: string,
): Promise<string>;
clearInspectorCache(): void;
getInstalledDependencyVersion(
packageName: string,
projectDir?: string
projectDir?: string,
): Promise<string>;
getMaxSatisfyingVersionSafe(
packageName: string,
versionIdentifier: string
versionIdentifier: string,
): Promise<string>;
}

/**
* Describes options that can be passed to manipulate package installation.
*/
interface INodePackageManagerInstallOptions
extends INpmInstallConfigurationOptions,
IDictionary<string | boolean> {
extends INpmInstallConfigurationOptions, IDictionary<string | boolean> {
/**
* Destination of the installation.
* @type {string}
Expand Down Expand Up @@ -266,7 +265,7 @@ interface INpmPeerDependencyInfo {
* @type {string}
*/
requires: string;
}
},
];
/**
* Dependencies of the dependency.
Expand Down Expand Up @@ -550,8 +549,7 @@ interface INpmInstallConfigurationOptionsBase {
ignoreScripts: boolean; //npm flag
}

interface INpmInstallConfigurationOptions
extends INpmInstallConfigurationOptionsBase {
interface INpmInstallConfigurationOptions extends INpmInstallConfigurationOptionsBase {
disableNpmInstall: boolean;
}

Expand Down Expand Up @@ -596,8 +594,11 @@ interface ITypingsOptions {
filter: string;
}

yaml: string;
jsonMetadata: string;
interface IOptions
extends IRelease,
extends
IRelease,
IDeviceIdentifier,
IJustLaunch,
IAvd,
Expand All @@ -622,7 +623,7 @@ interface IOptions
argv: IYargArgv;
validateOptions(
commandSpecificDashedOptions?: IDictionary<IDashedOption>,
projectData?: IProjectData
projectData?: IProjectData,
): void;
options: IDictionary<IDashedOption>;
shorthands: string[];
Expand Down Expand Up @@ -719,26 +720,22 @@ interface IEnvOptions {
}

interface IAndroidBuildOptionsSettings
extends IAndroidReleaseOptions,
IRelease,
Partial<IHasAndroidBundle> {}
extends IAndroidReleaseOptions, IRelease, Partial<IHasAndroidBundle> {}

interface IHasAndroidBundle {
androidBundle: boolean;
}

interface IPlatformBuildData
extends IRelease,
IHasUseHotModuleReloadOption,
IBuildConfig,
IEnvOptions {}
extends IRelease, IHasUseHotModuleReloadOption, IBuildConfig, IEnvOptions {}

interface IDeviceEmulator extends IHasEmulatorOption, IDeviceIdentifier {}

interface IRunPlatformOptions extends IJustLaunch, IDeviceEmulator {}

interface IDeployPlatformOptions
extends IAndroidReleaseOptions,
extends
IAndroidReleaseOptions,
IRelease,
IClean,
IDeviceEmulator,
Expand Down Expand Up @@ -834,7 +831,7 @@ interface IAndroidToolsInfo {
*/
validateJavacVersion(
installedJavaVersion: string,
options?: IAndroidToolsInfoOptions
options?: IAndroidToolsInfoOptions,
): boolean;

/**
Expand Down Expand Up @@ -913,14 +910,14 @@ interface IAppDebugSocketProxyFactory extends NodeJS.EventEmitter {
device: Mobile.IiOSDevice,
appId: string,
projectName: string,
projectDir: string
projectDir: string,
): Promise<any>;

ensureWebSocketProxy(
device: Mobile.IiOSDevice,
appId: string,
projectName: string,
projectDir: string
projectDir: string,
): Promise<any>;

removeAllProxies(): void;
Expand All @@ -939,12 +936,12 @@ interface IiOSSocketRequestExecutor {
executeAttachRequest(
device: Mobile.IiOSDevice,
timeout: number,
projectId: string
projectId: string,
): Promise<void>;
executeRefreshRequest(
device: Mobile.IiOSDevice,
timeout: number,
appId: string
appId: string,
): Promise<boolean>;
}

Expand Down Expand Up @@ -995,7 +992,7 @@ interface IProjectNameService {
*/
ensureValidName(
projectName: string,
validateOptions?: { force: boolean }
validateOptions?: { force: boolean },
): Promise<string>;
}

Expand Down Expand Up @@ -1089,7 +1086,7 @@ interface IBundleValidatorHelper {
*/
getBundlerDependencyVersion(
projectData: IProjectData,
bundlerName?: string
bundlerName?: string,
): string;
}

Expand Down Expand Up @@ -1171,7 +1168,7 @@ interface IAssetsGenerationService {
* @returns {Promise<void>}
*/
generateSplashScreens(
splashesGenerationData: IResourceGenerationData
splashesGenerationData: IResourceGenerationData,
): Promise<void>;
}

Expand Down Expand Up @@ -1207,7 +1204,7 @@ interface IPlatformValidationService {
provision: true | string,
teamId: true | string,
projectData: IProjectData,
platform?: string
platform?: string,
): Promise<boolean>;

validatePlatformInstalled(platform: string, projectData: IProjectData): void;
Expand All @@ -1220,35 +1217,35 @@ interface IPlatformValidationService {
*/
isPlatformSupportedForOS(
platform: string,
projectData: IProjectData
projectData: IProjectData,
): boolean;
}

interface IPlatformCommandHelper {
addPlatforms(
platforms: string[],
projectData: IProjectData,
frameworkPath?: string
frameworkPath?: string,
): Promise<void>;
cleanPlatforms(
platforms: string[],
projectData: IProjectData,
frameworkPath: string
frameworkPath: string,
): Promise<void>;
removePlatforms(
platforms: string[],
projectData: IProjectData
projectData: IProjectData,
): Promise<void>;
updatePlatforms(
platforms: string[],
projectData: IProjectData
projectData: IProjectData,
): Promise<void>;
getInstalledPlatforms(projectData: IProjectData): string[];
getAvailablePlatforms(projectData: IProjectData): string[];
getPreparedPlatforms(projectData: IProjectData): string[];
getCurrentPlatformVersion(
platform: string,
projectData: IProjectData
projectData: IProjectData,
): string;
}

Expand Down
Loading
Loading