@expo/eas-json
Advanced tools
Comparing version 0.23.0 to 0.24.0
@@ -1,2 +0,3 @@ | ||
import { Android, Cache, Ios, Platform } from '@expo/eas-build-job'; | ||
import { AndroidBuildProfile, CommonBuildProfile, IosBuildProfile } from './EasBuild.types'; | ||
import { AndroidSubmitProfile, IosSubmitProfile } from './EasSubmit.types'; | ||
export declare enum CredentialsSource { | ||
@@ -6,38 +7,2 @@ LOCAL = "local", | ||
} | ||
export declare type DistributionType = 'store' | 'internal'; | ||
export declare type IosEnterpriseProvisioning = 'adhoc' | 'universal'; | ||
export declare type VersionAutoIncrement = boolean | 'version' | 'buildNumber'; | ||
export interface CommonBuildProfile { | ||
credentialsSource: CredentialsSource; | ||
distribution: DistributionType; | ||
cache?: Omit<Cache, 'clear'>; | ||
releaseChannel?: string; | ||
channel?: string; | ||
developmentClient?: boolean; | ||
node?: string; | ||
yarn?: string; | ||
expoCli?: string; | ||
env?: Record<string, string>; | ||
} | ||
export interface AndroidBuildProfile extends CommonBuildProfile { | ||
withoutCredentials?: boolean; | ||
image?: Android.BuilderEnvironment['image']; | ||
ndk?: string; | ||
buildType?: Android.BuildType.APK | Android.BuildType.APP_BUNDLE; | ||
gradleCommand?: string; | ||
artifactPath?: string; | ||
} | ||
export interface IosBuildProfile extends CommonBuildProfile { | ||
enterpriseProvisioning?: IosEnterpriseProvisioning; | ||
autoIncrement?: VersionAutoIncrement; | ||
simulator?: boolean; | ||
image?: Ios.BuilderEnvironment['image']; | ||
bundler?: string; | ||
fastlane?: string; | ||
cocoapods?: string; | ||
artifactPath?: string; | ||
scheme?: string; | ||
buildConfiguration?: string; | ||
} | ||
export declare type BuildProfile<TPlatform extends Platform = Platform> = TPlatform extends Platform.ANDROID ? AndroidBuildProfile : TPlatform extends Platform.IOS ? IosBuildProfile : TPlatform extends Platform ? AndroidBuildProfile | IosBuildProfile : never; | ||
export interface RawBuildProfile extends Partial<CommonBuildProfile> { | ||
@@ -48,2 +13,6 @@ extends?: string; | ||
} | ||
export interface EasSubmitConfiguration { | ||
android?: AndroidSubmitProfile; | ||
ios?: IosSubmitProfile; | ||
} | ||
export interface EasJson { | ||
@@ -53,2 +22,5 @@ build: { | ||
}; | ||
submit?: { | ||
[profile: string]: EasSubmitConfiguration; | ||
}; | ||
} |
import { Platform } from '@expo/eas-build-job'; | ||
import { BuildProfile, EasJson, RawBuildProfile } from './EasJson.types'; | ||
import { BuildProfile } from './EasBuild.types'; | ||
import { EasJson, RawBuildProfile } from './EasJson.types'; | ||
import { SubmitProfile } from './EasSubmit.types'; | ||
interface EasJsonPreValidation { | ||
@@ -13,2 +15,3 @@ build: { | ||
getBuildProfileNamesAsync(): Promise<string[]>; | ||
readSubmitProfileAsync<T extends Platform>(profileName: string, platform: T): Promise<SubmitProfile<T>>; | ||
readBuildProfileAsync<T extends Platform>(buildProfileName: string, platform: T): Promise<BuildProfile<T>>; | ||
@@ -18,5 +21,5 @@ readAndValidateAsync(): Promise<EasJson>; | ||
private resolveBuildProfile; | ||
private ensureProfileExists; | ||
private ensureBuildProfileExists; | ||
} | ||
export declare function profileMerge(base: RawBuildProfile, update: RawBuildProfile): RawBuildProfile; | ||
export {}; |
@@ -26,5 +26,14 @@ "use strict"; | ||
} | ||
async readSubmitProfileAsync(profileName, platform) { | ||
var _a, _b; | ||
const easJson = await this.readAndValidateAsync(); | ||
const profile = (_b = (_a = easJson === null || easJson === void 0 ? void 0 : easJson.submit) === null || _a === void 0 ? void 0 : _a[profileName]) === null || _b === void 0 ? void 0 : _b[platform]; | ||
if (!profile) { | ||
throw new Error(`There is no profile named ${profileName} in eas.json for ${platform}.`); | ||
} | ||
return profile; | ||
} | ||
async readBuildProfileAsync(buildProfileName, platform) { | ||
const easJson = await this.readAndValidateAsync(); | ||
this.ensureProfileExists(easJson, buildProfileName); | ||
this.ensureBuildProfileExists(easJson, buildProfileName); | ||
const _a = this.resolveBuildProfile(easJson, buildProfileName), { android: resolvedAndroidSpecificValues, ios: resolvedIosSpecificValues } = _a, resolvedProfile = tslib_1.__rest(_a, ["android", "ios"]); | ||
@@ -82,3 +91,3 @@ if (platform === eas_build_job_1.Platform.ANDROID) { | ||
} | ||
ensureProfileExists(easJson, profileName) { | ||
ensureBuildProfileExists(easJson, profileName) { | ||
if (!easJson.build || !easJson.build[profileName]) { | ||
@@ -85,0 +94,0 @@ throw new Error(`There is no profile named ${profileName} in eas.json.`); |
@@ -7,2 +7,3 @@ "use strict"; | ||
const joi_1 = tslib_1.__importDefault(require("@hapi/joi")); | ||
const EasSubmit_types_1 = require("./EasSubmit.types"); | ||
const semverSchemaCheck = (value) => { | ||
@@ -59,7 +60,29 @@ if (/^[0-9]+\.[0-9]+\.[0-9]+$/.test(value)) { | ||
})); | ||
const AndroidSubmitProfileSchema = joi_1.default.object({ | ||
serviceAccountKeyPath: joi_1.default.string(), | ||
track: joi_1.default.string().valid(...Object.values(EasSubmit_types_1.ReleaseTrack)), | ||
releaseStatus: joi_1.default.string().valid(...Object.values(EasSubmit_types_1.ReleaseStatus)), | ||
changesNotSentForReview: joi_1.default.boolean(), | ||
verbose: joi_1.default.boolean(), | ||
}); | ||
const IosSubmitProfileSchema = joi_1.default.object({ | ||
appleId: joi_1.default.string(), | ||
ascAppId: joi_1.default.string(), | ||
appleTeamId: joi_1.default.string(), | ||
sku: joi_1.default.string(), | ||
language: joi_1.default.string(), | ||
companyName: joi_1.default.string(), | ||
verbose: joi_1.default.boolean(), | ||
}); | ||
const EasJsonSubmitConfigurationSchema = joi_1.default.object({ | ||
android: AndroidSubmitProfileSchema, | ||
ios: IosSubmitProfileSchema, | ||
}); | ||
exports.MinimalEasJsonSchema = joi_1.default.object({ | ||
build: joi_1.default.object().pattern(joi_1.default.string(), joi_1.default.object()), | ||
submit: joi_1.default.object().pattern(joi_1.default.string(), joi_1.default.object()), | ||
}); | ||
exports.EasJsonSchema = joi_1.default.object({ | ||
build: joi_1.default.object().pattern(joi_1.default.string(), EasJsonBuildProfileSchema), | ||
submit: joi_1.default.object().pattern(joi_1.default.string(), EasJsonSubmitConfigurationSchema), | ||
}); |
@@ -1,3 +0,5 @@ | ||
export { AndroidBuildProfile, BuildProfile, CredentialsSource, DistributionType, EasJson, IosBuildProfile, IosEnterpriseProvisioning, VersionAutoIncrement, } from './EasJson.types'; | ||
export { AndroidSubmitProfile, IosSubmitProfile } from './EasSubmit.types'; | ||
export { EasJson } from './EasJson.types'; | ||
export { AndroidBuildProfile, BuildProfile, CredentialsSource, DistributionType, IosBuildProfile, IosEnterpriseProvisioning, VersionAutoIncrement, } from './EasBuild.types'; | ||
export { EasJsonReader } from './EasJsonReader'; | ||
export { hasMismatchedExtendsAsync, isUsingDeprecatedFormatAsync, migrateAsync } from './migrate'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.migrateAsync = exports.isUsingDeprecatedFormatAsync = exports.hasMismatchedExtendsAsync = exports.EasJsonReader = exports.CredentialsSource = void 0; | ||
var EasJson_types_1 = require("./EasJson.types"); | ||
Object.defineProperty(exports, "CredentialsSource", { enumerable: true, get: function () { return EasJson_types_1.CredentialsSource; } }); | ||
var EasBuild_types_1 = require("./EasBuild.types"); | ||
Object.defineProperty(exports, "CredentialsSource", { enumerable: true, get: function () { return EasBuild_types_1.CredentialsSource; } }); | ||
var EasJsonReader_1 = require("./EasJsonReader"); | ||
@@ -7,0 +7,0 @@ Object.defineProperty(exports, "EasJsonReader", { enumerable: true, get: function () { return EasJsonReader_1.EasJsonReader; } }); |
{ | ||
"name": "@expo/eas-json", | ||
"description": "A library for interacting with the eas.json", | ||
"version": "0.23.0", | ||
"author": "Expo <support@expo.io>", | ||
"version": "0.24.0", | ||
"author": "Expo <support@expo.dev>", | ||
"bugs": "https://github.com/expo/eas-cli/issues", | ||
@@ -42,3 +42,3 @@ "dependencies": { | ||
}, | ||
"gitHead": "e773e77185076b6f6f7a82dc3c97e7add862b268" | ||
"gitHead": "32aa46ac69daf3b5b03a8c92c247f2314c944d75" | ||
} |
@@ -1,2 +0,3 @@ | ||
import { Android, Cache, Ios, Platform } from '@expo/eas-build-job'; | ||
import { AndroidBuildProfile, CommonBuildProfile, IosBuildProfile } from './EasBuild.types'; | ||
import { AndroidSubmitProfile, IosSubmitProfile } from './EasSubmit.types'; | ||
@@ -8,55 +9,2 @@ export enum CredentialsSource { | ||
export type DistributionType = 'store' | 'internal'; | ||
export type IosEnterpriseProvisioning = 'adhoc' | 'universal'; | ||
export type VersionAutoIncrement = boolean | 'version' | 'buildNumber'; | ||
export interface CommonBuildProfile { | ||
credentialsSource: CredentialsSource; | ||
distribution: DistributionType; | ||
cache?: Omit<Cache, 'clear'>; | ||
releaseChannel?: string; | ||
channel?: string; | ||
developmentClient?: boolean; | ||
node?: string; | ||
yarn?: string; | ||
expoCli?: string; | ||
env?: Record<string, string>; | ||
} | ||
export interface AndroidBuildProfile extends CommonBuildProfile { | ||
withoutCredentials?: boolean; | ||
image?: Android.BuilderEnvironment['image']; | ||
ndk?: string; | ||
buildType?: Android.BuildType.APK | Android.BuildType.APP_BUNDLE; | ||
gradleCommand?: string; | ||
artifactPath?: string; | ||
} | ||
export interface IosBuildProfile extends CommonBuildProfile { | ||
enterpriseProvisioning?: IosEnterpriseProvisioning; | ||
autoIncrement?: VersionAutoIncrement; | ||
simulator?: boolean; | ||
image?: Ios.BuilderEnvironment['image']; | ||
bundler?: string; | ||
fastlane?: string; | ||
cocoapods?: string; | ||
artifactPath?: string; | ||
scheme?: string; | ||
buildConfiguration?: string; | ||
} | ||
export type BuildProfile<TPlatform extends Platform = Platform> = TPlatform extends Platform.ANDROID | ||
? AndroidBuildProfile | ||
: TPlatform extends Platform.IOS | ||
? IosBuildProfile | ||
: TPlatform extends Platform | ||
? AndroidBuildProfile | IosBuildProfile | ||
: never; | ||
export interface RawBuildProfile extends Partial<CommonBuildProfile> { | ||
@@ -68,6 +16,10 @@ extends?: string; | ||
export interface EasSubmitConfiguration { | ||
android?: AndroidSubmitProfile; | ||
ios?: IosSubmitProfile; | ||
} | ||
export interface EasJson { | ||
build: { | ||
[profile: string]: RawBuildProfile; | ||
}; | ||
build: { [profile: string]: RawBuildProfile }; | ||
submit?: { [profile: string]: EasSubmitConfiguration }; | ||
} |
@@ -5,4 +5,6 @@ import { Platform } from '@expo/eas-build-job'; | ||
import { BuildProfile, CredentialsSource, EasJson, RawBuildProfile } from './EasJson.types'; | ||
import { BuildProfile } from './EasBuild.types'; | ||
import { CredentialsSource, EasJson, RawBuildProfile } from './EasJson.types'; | ||
import { EasJsonSchema, MinimalEasJsonSchema } from './EasJsonSchema'; | ||
import { SubmitProfile } from './EasSubmit.types'; | ||
@@ -30,2 +32,14 @@ interface EasJsonPreValidation { | ||
public async readSubmitProfileAsync<T extends Platform>( | ||
profileName: string, | ||
platform: T | ||
): Promise<SubmitProfile<T>> { | ||
const easJson = await this.readAndValidateAsync(); | ||
const profile = easJson?.submit?.[profileName]?.[platform]; | ||
if (!profile) { | ||
throw new Error(`There is no profile named ${profileName} in eas.json for ${platform}.`); | ||
} | ||
return profile as SubmitProfile<T>; | ||
} | ||
public async readBuildProfileAsync<T extends Platform>( | ||
@@ -36,3 +50,3 @@ buildProfileName: string, | ||
const easJson = await this.readAndValidateAsync(); | ||
this.ensureProfileExists(easJson, buildProfileName); | ||
this.ensureBuildProfileExists(easJson, buildProfileName); | ||
const { | ||
@@ -110,3 +124,3 @@ android: resolvedAndroidSpecificValues, | ||
private ensureProfileExists(easJson: EasJson, profileName: string) { | ||
private ensureBuildProfileExists(easJson: EasJson, profileName: string) { | ||
if (!easJson.build || !easJson.build[profileName]) { | ||
@@ -113,0 +127,0 @@ throw new Error(`There is no profile named ${profileName} in eas.json.`); |
import { Android, Ios } from '@expo/eas-build-job'; | ||
import Joi from '@hapi/joi'; | ||
import { ReleaseStatus, ReleaseTrack } from './EasSubmit.types'; | ||
const semverSchemaCheck = (value: any) => { | ||
@@ -75,4 +77,29 @@ if (/^[0-9]+\.[0-9]+\.[0-9]+$/.test(value)) { | ||
const AndroidSubmitProfileSchema = Joi.object({ | ||
serviceAccountKeyPath: Joi.string(), | ||
track: Joi.string().valid(...Object.values(ReleaseTrack)), | ||
releaseStatus: Joi.string().valid(...Object.values(ReleaseStatus)), | ||
changesNotSentForReview: Joi.boolean(), | ||
verbose: Joi.boolean(), | ||
}); | ||
const IosSubmitProfileSchema = Joi.object({ | ||
appleId: Joi.string(), | ||
ascAppId: Joi.string(), | ||
appleTeamId: Joi.string(), | ||
sku: Joi.string(), | ||
language: Joi.string(), | ||
companyName: Joi.string(), | ||
verbose: Joi.boolean(), | ||
}); | ||
const EasJsonSubmitConfigurationSchema = Joi.object({ | ||
android: AndroidSubmitProfileSchema, | ||
ios: IosSubmitProfileSchema, | ||
}); | ||
export const MinimalEasJsonSchema = Joi.object({ | ||
build: Joi.object().pattern(Joi.string(), Joi.object()), | ||
submit: Joi.object().pattern(Joi.string(), Joi.object()), | ||
}); | ||
@@ -82,2 +109,3 @@ | ||
build: Joi.object().pattern(Joi.string(), EasJsonBuildProfileSchema), | ||
submit: Joi.object().pattern(Joi.string(), EasJsonSubmitConfigurationSchema), | ||
}); |
@@ -0,1 +1,3 @@ | ||
export { AndroidSubmitProfile, IosSubmitProfile } from './EasSubmit.types'; | ||
export { EasJson } from './EasJson.types'; | ||
export { | ||
@@ -6,8 +8,7 @@ AndroidBuildProfile, | ||
DistributionType, | ||
EasJson, | ||
IosBuildProfile, | ||
IosEnterpriseProvisioning, | ||
VersionAutoIncrement, | ||
} from './EasJson.types'; | ||
} from './EasBuild.types'; | ||
export { EasJsonReader } from './EasJsonReader'; | ||
export { hasMismatchedExtendsAsync, isUsingDeprecatedFormatAsync, migrateAsync } from './migrate'; |
87456
40
2269