@expo/build-tools 1.0.104 → 1.0.106

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,12 +2,9 @@ import { BuildJob, Job } from '@expo/eas-build-job';
2
2
  import { BuildContext } from '../context';
3
3
  export declare enum AndroidMetadataName {
4
4
  UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY = "expo.modules.updates.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY",
5
- RELEASE_CHANNEL = "expo.modules.updates.EXPO_RELEASE_CHANNEL",
6
5
  RUNTIME_VERSION = "expo.modules.updates.EXPO_RUNTIME_VERSION"
7
6
  }
8
7
  export declare function androidSetRuntimeVersionNativelyAsync(ctx: BuildContext<Job>, runtimeVersion: string): Promise<void>;
9
8
  export declare function androidSetChannelNativelyAsync(ctx: BuildContext<BuildJob>): Promise<void>;
10
9
  export declare function androidGetNativelyDefinedChannelAsync(ctx: BuildContext<Job>): Promise<string | null>;
11
- export declare function androidSetClassicReleaseChannelNativelyAsync(ctx: BuildContext<BuildJob>): Promise<void>;
12
- export declare function androidGetNativelyDefinedClassicReleaseChannelAsync(ctx: BuildContext<Job>): Promise<string | null>;
13
10
  export declare function androidGetNativelyDefinedRuntimeVersionAsync(ctx: BuildContext<Job>): Promise<string | null>;
@@ -3,14 +3,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.androidGetNativelyDefinedRuntimeVersionAsync = exports.androidGetNativelyDefinedClassicReleaseChannelAsync = exports.androidSetClassicReleaseChannelNativelyAsync = exports.androidGetNativelyDefinedChannelAsync = exports.androidSetChannelNativelyAsync = exports.androidSetRuntimeVersionNativelyAsync = exports.AndroidMetadataName = void 0;
6
+ exports.androidGetNativelyDefinedRuntimeVersionAsync = exports.androidGetNativelyDefinedChannelAsync = exports.androidSetChannelNativelyAsync = exports.androidSetRuntimeVersionNativelyAsync = exports.AndroidMetadataName = void 0;
7
7
  const assert_1 = __importDefault(require("assert"));
8
8
  const fs_extra_1 = __importDefault(require("fs-extra"));
9
9
  const config_plugins_1 = require("@expo/config-plugins");
10
10
  var AndroidMetadataName;
11
11
  (function (AndroidMetadataName) {
12
12
  AndroidMetadataName["UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY"] = "expo.modules.updates.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY";
13
- AndroidMetadataName["RELEASE_CHANNEL"] = "expo.modules.updates.EXPO_RELEASE_CHANNEL";
14
13
  AndroidMetadataName["RUNTIME_VERSION"] = "expo.modules.updates.EXPO_RUNTIME_VERSION";
15
14
  })(AndroidMetadataName || (exports.AndroidMetadataName = AndroidMetadataName = {}));
16
15
  async function androidSetRuntimeVersionNativelyAsync(ctx, runtimeVersion) {
@@ -58,41 +57,6 @@ async function androidGetNativelyDefinedChannelAsync(ctx) {
58
57
  }
59
58
  }
60
59
  exports.androidGetNativelyDefinedChannelAsync = androidGetNativelyDefinedChannelAsync;
61
- async function androidSetClassicReleaseChannelNativelyAsync(ctx) {
62
- const { releaseChannel } = ctx.job;
63
- (0, assert_1.default)(releaseChannel, 'releaseChannel must be defined');
64
- const escapedReleaseChannel = config_plugins_1.XML.escapeAndroidString(releaseChannel);
65
- const manifestPath = await config_plugins_1.AndroidConfig.Paths.getAndroidManifestAsync(ctx.getReactNativeProjectDirectory());
66
- if (!(await fs_extra_1.default.pathExists(manifestPath))) {
67
- throw new Error(`Couldn't find Android manifest at ${manifestPath}`);
68
- }
69
- // Store the release channel in a string resource to ensure it is interpreted as a string
70
- const stringResourcePath = await config_plugins_1.AndroidConfig.Strings.getProjectStringsXMLPathAsync(ctx.getReactNativeProjectDirectory());
71
- const stringResourceObject = await config_plugins_1.AndroidConfig.Resources.readResourcesXMLAsync({
72
- path: stringResourcePath,
73
- });
74
- const resourceName = 'release_channel';
75
- const releaseChannelResourceItem = config_plugins_1.AndroidConfig.Resources.buildResourceItem({
76
- name: resourceName,
77
- value: escapedReleaseChannel,
78
- });
79
- const newStringResourceObject = config_plugins_1.AndroidConfig.Strings.setStringItem([releaseChannelResourceItem], stringResourceObject);
80
- await config_plugins_1.XML.writeXMLAsync({ path: stringResourcePath, xml: newStringResourceObject });
81
- const androidManifest = await config_plugins_1.AndroidConfig.Manifest.readAndroidManifestAsync(manifestPath);
82
- const mainApp = config_plugins_1.AndroidConfig.Manifest.getMainApplicationOrThrow(androidManifest);
83
- config_plugins_1.AndroidConfig.Manifest.addMetaDataItemToMainApplication(mainApp, AndroidMetadataName.RELEASE_CHANNEL, `@string/${resourceName}`, 'value');
84
- await config_plugins_1.AndroidConfig.Manifest.writeAndroidManifestAsync(manifestPath, androidManifest);
85
- }
86
- exports.androidSetClassicReleaseChannelNativelyAsync = androidSetClassicReleaseChannelNativelyAsync;
87
- async function androidGetNativelyDefinedClassicReleaseChannelAsync(ctx) {
88
- const manifestPath = await config_plugins_1.AndroidConfig.Paths.getAndroidManifestAsync(ctx.getReactNativeProjectDirectory());
89
- if (!(await fs_extra_1.default.pathExists(manifestPath))) {
90
- return null;
91
- }
92
- const androidManifest = await config_plugins_1.AndroidConfig.Manifest.readAndroidManifestAsync(manifestPath);
93
- return config_plugins_1.AndroidConfig.Manifest.getMainApplicationMetaDataValue(androidManifest, AndroidMetadataName.RELEASE_CHANNEL);
94
- }
95
- exports.androidGetNativelyDefinedClassicReleaseChannelAsync = androidGetNativelyDefinedClassicReleaseChannelAsync;
96
60
  async function androidGetNativelyDefinedRuntimeVersionAsync(ctx) {
97
61
  const manifestPath = await config_plugins_1.AndroidConfig.Paths.getAndroidManifestAsync(ctx.getReactNativeProjectDirectory());
98
62
  if (!(await fs_extra_1.default.pathExists(manifestPath))) {
@@ -1 +1 @@
1
- {"version":3,"file":"expoUpdates.js","sourceRoot":"","sources":["../../src/android/expoUpdates.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAE5B,wDAA0B;AAC1B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YAAY,GAAG,MAAM,8BAAa,CAAC,KAAK,CAAC,uBAAuB,CACpE,GAAG,CAAC,8BAA8B,EAAE,CACrC,CAAC;IACF,IAAI,CAAC,CAAC,MAAM,kBAAE,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC;QACzC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,eAAe,GAAG,MAAM,8BAAa,CAAC,QAAQ,CAAC,wBAAwB,CAAC,YAAY,CAAC,CAAC;IAC5F,OAAO,8BAAa,CAAC,QAAQ,CAAC,+BAA+B,CAC3D,eAAe,EACf,mBAAmB,CAAC,eAAe,CACpC,CAAC;AACJ,CAAC;AAfD,oGAeC","sourcesContent":["import assert from 'assert';\n\nimport fs from 'fs-extra';\nimport { AndroidConfig, XML } from '@expo/config-plugins';\nimport { BuildJob, Job } from '@expo/eas-build-job';\n\nimport { BuildContext } from '../context';\n\nexport enum AndroidMetadataName {\n UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY = 'expo.modules.updates.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY',\n RELEASE_CHANNEL = 'expo.modules.updates.EXPO_RELEASE_CHANNEL',\n RUNTIME_VERSION = 'expo.modules.updates.EXPO_RUNTIME_VERSION',\n}\n\nexport async function androidSetRuntimeVersionNativelyAsync(\n ctx: BuildContext<Job>,\n runtimeVersion: string\n): Promise<void> {\n const manifestPath = await AndroidConfig.Paths.getAndroidManifestAsync(\n ctx.getReactNativeProjectDirectory()\n );\n\n if (!(await fs.pathExists(manifestPath))) {\n throw new Error(`Couldn't find Android manifest at ${manifestPath}`);\n }\n\n const androidManifest = await AndroidConfig.Manifest.readAndroidManifestAsync(manifestPath);\n const mainApp = AndroidConfig.Manifest.getMainApplicationOrThrow(androidManifest);\n AndroidConfig.Manifest.addMetaDataItemToMainApplication(\n mainApp,\n AndroidMetadataName.RUNTIME_VERSION,\n runtimeVersion,\n 'value'\n );\n await AndroidConfig.Manifest.writeAndroidManifestAsync(manifestPath, androidManifest);\n}\n\nexport async function androidSetChannelNativelyAsync(ctx: BuildContext<BuildJob>): Promise<void> {\n assert(ctx.job.updates?.channel, 'updates.channel must be defined');\n\n const manifestPath = await AndroidConfig.Paths.getAndroidManifestAsync(\n ctx.getReactNativeProjectDirectory()\n );\n\n if (!(await fs.pathExists(manifestPath))) {\n throw new Error(`Couldn't find Android manifest at ${manifestPath}`);\n }\n\n const androidManifest = await AndroidConfig.Manifest.readAndroidManifestAsync(manifestPath);\n const mainApp = AndroidConfig.Manifest.getMainApplicationOrThrow(androidManifest);\n const stringifiedUpdatesRequestHeaders = AndroidConfig.Manifest.getMainApplicationMetaDataValue(\n androidManifest,\n AndroidMetadataName.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY\n );\n AndroidConfig.Manifest.addMetaDataItemToMainApplication(\n mainApp,\n AndroidMetadataName.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY,\n JSON.stringify({\n ...JSON.parse(stringifiedUpdatesRequestHeaders ?? '{}'),\n 'expo-channel-name': ctx.job.updates.channel,\n }),\n 'value'\n );\n await AndroidConfig.Manifest.writeAndroidManifestAsync(manifestPath, androidManifest);\n}\n\nexport async function androidGetNativelyDefinedChannelAsync(\n ctx: BuildContext<Job>\n): Promise<string | null> {\n const manifestPath = await AndroidConfig.Paths.getAndroidManifestAsync(\n ctx.getReactNativeProjectDirectory()\n );\n\n if (!(await fs.pathExists(manifestPath))) {\n return null;\n }\n\n const androidManifest = await AndroidConfig.Manifest.readAndroidManifestAsync(manifestPath);\n const stringifiedUpdatesRequestHeaders = AndroidConfig.Manifest.getMainApplicationMetaDataValue(\n androidManifest,\n AndroidMetadataName.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY\n );\n try {\n const updatesRequestHeaders = JSON.parse(stringifiedUpdatesRequestHeaders ?? '{}');\n return updatesRequestHeaders['expo-channel-name'] ?? null;\n } catch (err: any) {\n throw new Error(\n `Failed to parse ${AndroidMetadataName.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY} from AndroidManifest.xml: ${err.message}`\n );\n }\n}\n\nexport async function androidSetClassicReleaseChannelNativelyAsync(\n ctx: BuildContext<BuildJob>\n): Promise<void> {\n const { releaseChannel } = ctx.job;\n assert(releaseChannel, 'releaseChannel must be defined');\n const escapedReleaseChannel = XML.escapeAndroidString(releaseChannel);\n\n const manifestPath = await AndroidConfig.Paths.getAndroidManifestAsync(\n ctx.getReactNativeProjectDirectory()\n );\n if (!(await fs.pathExists(manifestPath))) {\n throw new Error(`Couldn't find Android manifest at ${manifestPath}`);\n }\n\n // Store the release channel in a string resource to ensure it is interpreted as a string\n const stringResourcePath = await AndroidConfig.Strings.getProjectStringsXMLPathAsync(\n ctx.getReactNativeProjectDirectory()\n );\n const stringResourceObject = await AndroidConfig.Resources.readResourcesXMLAsync({\n path: stringResourcePath,\n });\n\n const resourceName = 'release_channel';\n const releaseChannelResourceItem = AndroidConfig.Resources.buildResourceItem({\n name: resourceName,\n value: escapedReleaseChannel,\n });\n const newStringResourceObject = AndroidConfig.Strings.setStringItem(\n [releaseChannelResourceItem],\n stringResourceObject\n );\n await XML.writeXMLAsync({ path: stringResourcePath, xml: newStringResourceObject });\n\n const androidManifest = await AndroidConfig.Manifest.readAndroidManifestAsync(manifestPath);\n const mainApp = AndroidConfig.Manifest.getMainApplicationOrThrow(androidManifest);\n AndroidConfig.Manifest.addMetaDataItemToMainApplication(\n mainApp,\n AndroidMetadataName.RELEASE_CHANNEL,\n `@string/${resourceName}`,\n 'value'\n );\n await AndroidConfig.Manifest.writeAndroidManifestAsync(manifestPath, androidManifest);\n}\n\nexport async function androidGetNativelyDefinedClassicReleaseChannelAsync(\n ctx: BuildContext<Job>\n): Promise<string | null> {\n const manifestPath = await AndroidConfig.Paths.getAndroidManifestAsync(\n ctx.getReactNativeProjectDirectory()\n );\n if (!(await fs.pathExists(manifestPath))) {\n return null;\n }\n\n const androidManifest = await AndroidConfig.Manifest.readAndroidManifestAsync(manifestPath);\n return AndroidConfig.Manifest.getMainApplicationMetaDataValue(\n androidManifest,\n AndroidMetadataName.RELEASE_CHANNEL\n );\n}\n\nexport async function androidGetNativelyDefinedRuntimeVersionAsync(\n ctx: BuildContext<Job>\n): Promise<string | null> {\n const manifestPath = await AndroidConfig.Paths.getAndroidManifestAsync(\n ctx.getReactNativeProjectDirectory()\n );\n if (!(await fs.pathExists(manifestPath))) {\n return null;\n }\n\n const androidManifest = await AndroidConfig.Manifest.readAndroidManifestAsync(manifestPath);\n return AndroidConfig.Manifest.getMainApplicationMetaDataValue(\n androidManifest,\n AndroidMetadataName.RUNTIME_VERSION\n );\n}\n"]}
1
+ {"version":3,"file":"expoUpdates.js","sourceRoot":"","sources":["../../src/android/expoUpdates.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAE5B,wDAA0B;AAC1B,yDAAqD;AAKrD,IAAY,mBAGX;AAHD,WAAY,mBAAmB;IAC7B,mIAA4G,CAAA;IAC5G,oFAA6D,CAAA;AAC/D,CAAC,EAHW,mBAAmB,mCAAnB,mBAAmB,QAG9B;AAEM,KAAK,UAAU,qCAAqC,CACzD,GAAsB,EACtB,cAAsB;IAEtB,MAAM,YAAY,GAAG,MAAM,8BAAa,CAAC,KAAK,CAAC,uBAAuB,CACpE,GAAG,CAAC,8BAA8B,EAAE,CACrC,CAAC;IAEF,IAAI,CAAC,CAAC,MAAM,kBAAE,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC;QACzC,MAAM,IAAI,KAAK,CAAC,qCAAqC,YAAY,EAAE,CAAC,CAAC;IACvE,CAAC;IAED,MAAM,eAAe,GAAG,MAAM,8BAAa,CAAC,QAAQ,CAAC,wBAAwB,CAAC,YAAY,CAAC,CAAC;IAC5F,MAAM,OAAO,GAAG,8BAAa,CAAC,QAAQ,CAAC,yBAAyB,CAAC,eAAe,CAAC,CAAC;IAClF,8BAAa,CAAC,QAAQ,CAAC,gCAAgC,CACrD,OAAO,EACP,mBAAmB,CAAC,eAAe,EACnC,cAAc,EAC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AO,8BAAa,CAAC,QAAQ,CAAC,+BAA+B,CAC3D,eAAe,EACf,mBAAmB,CAAC,eAAe,CACpC,CAAC;AACJ,CAAC;AAfD,oGAeC","sourcesContent":["import assert from 'assert';\n\nimport fs from 'fs-extra';\nimport { AndroidConfig } from '@expo/config-plugins';\nimport { BuildJob, Job } from '@expo/eas-build-job';\n\nimport { BuildContext } from '../context';\n\nexport enum AndroidMetadataName {\n UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY = 'expo.modules.updates.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY',\n RUNTIME_VERSION = 'expo.modules.updates.EXPO_RUNTIME_VERSION',\n}\n\nexport async function androidSetRuntimeVersionNativelyAsync(\n ctx: BuildContext<Job>,\n runtimeVersion: string\n): Promise<void> {\n const manifestPath = await AndroidConfig.Paths.getAndroidManifestAsync(\n ctx.getReactNativeProjectDirectory()\n );\n\n if (!(await fs.pathExists(manifestPath))) {\n throw new Error(`Couldn't find Android manifest at ${manifestPath}`);\n }\n\n const androidManifest = await AndroidConfig.Manifest.readAndroidManifestAsync(manifestPath);\n const mainApp = AndroidConfig.Manifest.getMainApplicationOrThrow(androidManifest);\n AndroidConfig.Manifest.addMetaDataItemToMainApplication(\n mainApp,\n AndroidMetadataName.RUNTIME_VERSION,\n runtimeVersion,\n 'value'\n );\n await AndroidConfig.Manifest.writeAndroidManifestAsync(manifestPath, androidManifest);\n}\n\nexport async function androidSetChannelNativelyAsync(ctx: BuildContext<BuildJob>): Promise<void> {\n assert(ctx.job.updates?.channel, 'updates.channel must be defined');\n\n const manifestPath = await AndroidConfig.Paths.getAndroidManifestAsync(\n ctx.getReactNativeProjectDirectory()\n );\n\n if (!(await fs.pathExists(manifestPath))) {\n throw new Error(`Couldn't find Android manifest at ${manifestPath}`);\n }\n\n const androidManifest = await AndroidConfig.Manifest.readAndroidManifestAsync(manifestPath);\n const mainApp = AndroidConfig.Manifest.getMainApplicationOrThrow(androidManifest);\n const stringifiedUpdatesRequestHeaders = AndroidConfig.Manifest.getMainApplicationMetaDataValue(\n androidManifest,\n AndroidMetadataName.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY\n );\n AndroidConfig.Manifest.addMetaDataItemToMainApplication(\n mainApp,\n AndroidMetadataName.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY,\n JSON.stringify({\n ...JSON.parse(stringifiedUpdatesRequestHeaders ?? '{}'),\n 'expo-channel-name': ctx.job.updates.channel,\n }),\n 'value'\n );\n await AndroidConfig.Manifest.writeAndroidManifestAsync(manifestPath, androidManifest);\n}\n\nexport async function androidGetNativelyDefinedChannelAsync(\n ctx: BuildContext<Job>\n): Promise<string | null> {\n const manifestPath = await AndroidConfig.Paths.getAndroidManifestAsync(\n ctx.getReactNativeProjectDirectory()\n );\n\n if (!(await fs.pathExists(manifestPath))) {\n return null;\n }\n\n const androidManifest = await AndroidConfig.Manifest.readAndroidManifestAsync(manifestPath);\n const stringifiedUpdatesRequestHeaders = AndroidConfig.Manifest.getMainApplicationMetaDataValue(\n androidManifest,\n AndroidMetadataName.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY\n );\n try {\n const updatesRequestHeaders = JSON.parse(stringifiedUpdatesRequestHeaders ?? '{}');\n return updatesRequestHeaders['expo-channel-name'] ?? null;\n } catch (err: any) {\n throw new Error(\n `Failed to parse ${AndroidMetadataName.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY} from AndroidManifest.xml: ${err.message}`\n );\n }\n}\n\nexport async function androidGetNativelyDefinedRuntimeVersionAsync(\n ctx: BuildContext<Job>\n): Promise<string | null> {\n const manifestPath = await AndroidConfig.Paths.getAndroidManifestAsync(\n ctx.getReactNativeProjectDirectory()\n );\n if (!(await fs.pathExists(manifestPath))) {\n return null;\n }\n\n const androidManifest = await AndroidConfig.Manifest.readAndroidManifestAsync(manifestPath);\n return AndroidConfig.Manifest.getMainApplicationMetaDataValue(\n androidManifest,\n AndroidMetadataName.RUNTIME_VERSION\n );\n}\n"]}
@@ -7,6 +7,7 @@ exports.downloadAndUnpackProjectFromTarGzAsync = exports.prepareProjectSourcesAs
7
7
  const path_1 = __importDefault(require("path"));
8
8
  const turtle_spawn_1 = __importDefault(require("@expo/turtle-spawn"));
9
9
  const fs_extra_1 = __importDefault(require("fs-extra"));
10
+ const nullthrows_1 = __importDefault(require("nullthrows"));
10
11
  const eas_build_job_1 = require("@expo/eas-build-job");
11
12
  const downloader_1 = __importDefault(require("@expo/downloader"));
12
13
  async function prepareProjectSourcesAsync(ctx, destinationDirectory = ctx.buildDirectory) {
@@ -20,26 +21,66 @@ async function prepareProjectSourcesAsync(ctx, destinationDirectory = ctx.buildD
20
21
  await downloadAndUnpackProjectFromTarGzAsync(ctx, ctx.job.projectArchive.url, destinationDirectory);
21
22
  }
22
23
  else if (ctx.job.projectArchive.type === eas_build_job_1.ArchiveSourceType.GIT) {
23
- await shallowCloneRepositoryAsync(ctx, ctx.job.projectArchive.repositoryUrl, ctx.job.projectArchive.gitRef, destinationDirectory);
24
+ await shallowCloneRepositoryAsync({
25
+ logger: ctx.logger,
26
+ archiveSource: ctx.job.projectArchive,
27
+ destinationDirectory,
28
+ });
24
29
  }
25
30
  }
26
31
  exports.prepareProjectSourcesAsync = prepareProjectSourcesAsync;
27
- async function shallowCloneRepositoryAsync(ctx, projectRepoUrl, gitRef, destinationDirectory) {
32
+ async function shallowCloneRepositoryAsync({ logger, archiveSource, destinationDirectory, }) {
33
+ var _a;
34
+ const { repositoryUrl } = archiveSource;
28
35
  try {
29
36
  await (0, turtle_spawn_1.default)('git', ['init'], { cwd: destinationDirectory });
30
- await (0, turtle_spawn_1.default)('git', ['remote', 'add', 'origin', projectRepoUrl], { cwd: destinationDirectory });
31
- await (0, turtle_spawn_1.default)('git', ['fetch', 'origin', '--depth', '1', gitRef], { cwd: destinationDirectory });
32
- await (0, turtle_spawn_1.default)('git', ['checkout', gitRef], { cwd: destinationDirectory });
37
+ await (0, turtle_spawn_1.default)('git', ['remote', 'add', 'origin', repositoryUrl], { cwd: destinationDirectory });
38
+ let gitRef;
39
+ let gitCommitHash;
40
+ // If gitRef is provided, but gitCommitHash is not,
41
+ // we're handling a legacy case - gitRef is the commit hash.
42
+ // Otherwise we expect gitCommitHash to be present.
43
+ if (archiveSource.gitRef && !archiveSource.gitCommitHash) {
44
+ gitCommitHash = archiveSource.gitRef;
45
+ gitRef = null;
46
+ }
47
+ else {
48
+ gitCommitHash = (0, nullthrows_1.default)(archiveSource.gitCommitHash);
49
+ gitRef = (_a = archiveSource.gitRef) !== null && _a !== void 0 ? _a : null;
50
+ }
51
+ await (0, turtle_spawn_1.default)('git', ['fetch', 'origin', '--depth', '1', '--no-tags', gitCommitHash], {
52
+ cwd: destinationDirectory,
53
+ });
54
+ await (0, turtle_spawn_1.default)('git', ['checkout', gitCommitHash], { cwd: destinationDirectory });
55
+ // If we have a gitRef, we try to add it to the repo.
56
+ if (gitRef) {
57
+ const { name, type } = getStrippedBranchOrTagName(gitRef);
58
+ switch (type) {
59
+ // If the gitRef is for a tag, we add a lightweight tag to current commit.
60
+ case 'tag': {
61
+ await (0, turtle_spawn_1.default)('git', ['tag', name], { cwd: destinationDirectory });
62
+ break;
63
+ }
64
+ // gitRef for a branch may come as:
65
+ // - qualified ref (e.g. refs/heads/feature/add-icon), detected as "branch" for a push,
66
+ // - unqualified ref (e.g. feature/add-icon), detected as "other" for a pull request.
67
+ case 'branch':
68
+ case 'other': {
69
+ await (0, turtle_spawn_1.default)('git', ['checkout', '-b', name], { cwd: destinationDirectory });
70
+ break;
71
+ }
72
+ }
73
+ }
33
74
  }
34
75
  catch (err) {
35
- const sanitizedUrl = getSanitizedGitUrl(projectRepoUrl);
76
+ const sanitizedUrl = getSanitizedGitUrl(repositoryUrl);
36
77
  if (sanitizedUrl) {
37
- ctx.logger.error(`Failed to clone git repository: ${sanitizedUrl}.`);
78
+ logger.error(`Failed to clone git repository: ${sanitizedUrl}.`);
38
79
  }
39
80
  else {
40
- ctx.logger.error('Failed to clone git repository.');
81
+ logger.error('Failed to clone git repository.');
41
82
  }
42
- ctx.logger.error(err.stderr);
83
+ logger.error(err.stderr);
43
84
  throw err;
44
85
  }
45
86
  }
@@ -88,4 +129,26 @@ async function unpackTarGzAsync({ logger, source, destination, }) {
88
129
  logger,
89
130
  });
90
131
  }
132
+ function getStrippedBranchOrTagName(ref) {
133
+ const branchRegex = /(\/?refs)?\/?heads\/(.+)/;
134
+ const branchMatch = ref.match(branchRegex);
135
+ if (branchMatch) {
136
+ return {
137
+ name: branchMatch[2],
138
+ type: 'branch',
139
+ };
140
+ }
141
+ const tagRegex = /(\/?refs)?\/?tags\/(.+)/;
142
+ const tagMatch = ref.match(tagRegex);
143
+ if (tagMatch) {
144
+ return {
145
+ name: tagMatch[2],
146
+ type: 'tag',
147
+ };
148
+ }
149
+ return {
150
+ name: ref,
151
+ type: 'other',
152
+ };
153
+ }
91
154
  //# sourceMappingURL=projectSources.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"projectSources.js","sourceRoot":"","sources":["../../src/common/projectSources.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,sEAAuC;AACvC,wDAA0B;AAC1B,uDAA6D;AAE7D,kEAA4C;AAIrC,KAAK,UAAU,0BAA0B,CAC9C,GAAuB,EACvB,oBAAoB,GAAG,GAAG,CAAC,cAAc;IAEzC,IAAI,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,KAAK,iCAAiB,CAAC,GAAG,EAAE,CAAC;QAC1D,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;IAC3E,CAAC;SAAM,IAAI,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,KAAK,iCAAiB,CAAC,IAAI,EAAE,CAAC;QAClE,MAAM,iCAAiC,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,EAAE,oBAAoB,CAAC,CAAC,CAAC,4BAA4B;IAC/H,CAAC;SAAM,IAAI,GAAG,CAAC,GAAG,CAAC,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EAAE,GAAG,CAAC,MAAM;KACnB,CAAC,CAAC;AACL,CAAC;AApBD,wFAoBC;AAED,KAAK,UAAU,iCAAiC,CAC9C,GAAuB,EACvB,kBAA0B,EAC1B,oBAA4B;IAE5B,MAAM,cAAc,GAAG,cAAI,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC;IACnE,MAAM,kBAAE,CAAC,IAAI,CAAC,kBAAkB,EAAE,cAAc,CAAC,CAAC;IAElD,MAAM,gBAAgB,CAAC;QACrB,WAAW,EAAE,oBAAoB;QACjC,MAAM,EAAE,cAAc;QACtB,MAAM,EAAE,GAAG,CAAC,MAAM;KACnB,CAAC,CAAC;AACL,CAAC;AAED,KAAK,UAAU,gBAAgB,CAAC,EAC9B,MAAM,EACN,MAAM,EACN,WAAW,GAKZ;IACC,MAAM,IAAA,sBAAK,EAAC,KAAK,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,oBAAoB,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE;QACjF,MAAM;KACP,CAAC,CAAC;AACL,CAAC","sourcesContent":["import path from 'path';\n\nimport spawn from '@expo/turtle-spawn';\nimport fs from 'fs-extra';\nimport { ArchiveSourceType, Job } from '@expo/eas-build-job';\nimport { bunyan } from '@expo/logger';\nimport downloadFile from '@expo/downloader';\n\nimport { BuildContext } from '../context';\n\nexport async function prepareProjectSourcesAsync<TJob extends Job>(\n ctx: BuildContext<TJob>,\n destinationDirectory = ctx.buildDirectory\n): Promise<void> {\n if (ctx.job.projectArchive.type === ArchiveSourceType.GCS) {\n throw new Error('GCS project sources should be resolved earlier to url');\n } else if (ctx.job.projectArchive.type === ArchiveSourceType.PATH) {\n await prepareProjectSourcesLocallyAsync(ctx, ctx.job.projectArchive.path, destinationDirectory); // used in eas build --local\n } else if (ctx.job.projectArchive.type === ArchiveSourceType.URL) {\n await downloadAndUnpackProjectFromTarGzAsync(\n ctx,\n ctx.job.projectArchive.url,\n destinationDirectory\n );\n } else if (ctx.job.projectArchive.type === ArchiveSourceType.GIT) {\n await shallowCloneRepositoryAsync(\n ctx,\n ctx.job.projectArchive.repositoryUrl,\n ctx.job.projectArchive.gitRef,\n destinationDirectory\n );\n }\n}\n\nasync function shallowCloneRepositoryAsync<TJob extends Job>(\n ctx: BuildContext<TJob>,\n projectRepoUrl: string,\n gitRef: string,\n destinationDirectory: string\n): Promise<void> {\n try {\n await spawn('git', ['init'], { cwd: destinationDirectory });\n await spawn('git', ['remote', 'add', 'origin', projectRepoUrl], { cwd: destinationDirectory });\n await spawn('git', ['fetch', 'origin', '--depth', '1', gitRef], { cwd: destinationDirectory });\n await spawn('git', ['checkout', gitRef], { cwd: destinationDirectory });\n } catch (err: any) {\n const sanitizedUrl = getSanitizedGitUrl(projectRepoUrl);\n if (sanitizedUrl) {\n ctx.logger.error(`Failed to clone git repository: ${sanitizedUrl}.`);\n } else {\n ctx.logger.error('Failed to clone git repository.');\n }\n ctx.logger.error(err.stderr);\n throw err;\n }\n}\n\nfunction getSanitizedGitUrl(maybeGitUrl: string): string | null {\n try {\n const url = new URL(maybeGitUrl);\n if (url.password) {\n url.password = '*******';\n }\n return url.toString();\n } catch {\n return null;\n }\n}\n\nexport async function downloadAndUnpackProjectFromTarGzAsync<TJob extends Job>(\n ctx: BuildContext<TJob>,\n projectArchiveUrl: string,\n destinationDirectory: string\n): Promise<void> {\n const projectTarball = path.join(ctx.workingdir, 'project.tar.gz');\n try {\n await downloadFile(projectArchiveUrl, projectTarball, { retry: 3 });\n } catch (err: any) {\n ctx.reportError?.('Failed to download project archive', err, {\n extras: { buildId: ctx.env.EAS_BUILD_ID },\n });\n throw err;\n }\n\n await unpackTarGzAsync({\n destination: destinationDirectory,\n source: projectTarball,\n logger: ctx.logger,\n });\n}\n\nasync function prepareProjectSourcesLocallyAsync<TJob extends Job>(\n ctx: BuildContext<TJob>,\n projectArchivePath: string,\n destinationDirectory: string\n): Promise<void> {\n const projectTarball = path.join(ctx.workingdir, 'project.tar.gz');\n await fs.copy(projectArchivePath, projectTarball);\n\n await unpackTarGzAsync({\n destination: destinationDirectory,\n source: projectTarball,\n logger: ctx.logger,\n });\n}\n\nasync function unpackTarGzAsync({\n logger,\n source,\n destination,\n}: {\n logger: bunyan;\n source: string;\n destination: string;\n}): Promise<void> {\n await spawn('tar', ['-C', destination, '--strip-components', '1', '-zxf', source], {\n logger,\n });\n}\n"]}
1
+ {"version":3,"file":"projectSources.js","sourceRoot":"","sources":["../../src/common/projectSources.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,sEAAuC;AACvC,wDAA0B;AAC1B,4DAAoC;AACpC,uDAA4E;AAE5E,kEAA4C;AAIrC,KAAK,UAAU,0BAA0B,CAC9C,GAAuB,EACvB,oBAAoB,GAAG,GAAG,CAAC,cAAc;IAEzC,IAAI,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,KAAK,iCAAiB,CAAC,GAAG,EAAE,CAAC;QAC1D,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;IAC3E,CAAC;SAAM,IAAI,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,KAAK,iCAAiB,CAAC,IAAI,EAAE,CAAC;QAClE,MAAM,iCAAiC,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,EAAE,oBAAoB,CAAC,CAAC,CAAC,4BAA4B;IAC/H,CAAC;SAAM,IAAI,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,KAAK,iCAAiB,CAAC,GAAG,EAAE,CAAC;QACjE,MAAM,sCAAsC,CAC1C,GAAG,EACH,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,GAAG,EAC1B,oBAAoB,CACrB,CAAC;IACJ,CAAC;SAAM,IAAI,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,KAAK,iCAAiB,CAAC,GAAG,EAAE,CAAC;QACjE,MAAM,2BAA2B,CAAC;YAChC,MAA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,MAAM,EACN,MAAM,EACN,WAAW,GAKZ;IACC,MAAM,IAAA,sBAAK,EAAC,KAAK,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,oBAAoB,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE;QACjF,MAAM;KACP,CAAC,CAAC;AACL,CAAC;AAED,SAAS,0BAA0B,CAAC,GAAW;IAI7C,MAAM,WAAW,GAAG,0BAA0B,CAAC;IAC/C,MAAM,WAAW,GAAG,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAE3C,IAAI,WAAW,EAAE,CAAC;QAChB,OAAO;YACL,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC;YACpB,IAAI,EAAE,QAAQ;SACf,CAAC;IACJ,CAAC;IAED,MAAM,QAAQ,GAAG,yBAAyB,CAAC;IAC3C,MAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAErC,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO;YACL,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;YACjB,IAAI,EAAE,KAAK;SACZ,CAAC;IACJ,CAAC;IAED,OAAO;QACL,IAAI,EAAE,GAAG;QACT,IAAI,EAAE,OAAO;KACd,CAAC;AACJ,CAAC","sourcesContent":["import path from 'path';\n\nimport spawn from '@expo/turtle-spawn';\nimport fs from 'fs-extra';\nimport nullthrows from 'nullthrows';\nimport { ArchiveSource, ArchiveSourceType, Job } from '@expo/eas-build-job';\nimport { bunyan } from '@expo/logger';\nimport downloadFile from '@expo/downloader';\n\nimport { BuildContext } from '../context';\n\nexport async function prepareProjectSourcesAsync<TJob extends Job>(\n ctx: BuildContext<TJob>,\n destinationDirectory = ctx.buildDirectory\n): Promise<void> {\n if (ctx.job.projectArchive.type === ArchiveSourceType.GCS) {\n throw new Error('GCS project sources should be resolved earlier to url');\n } else if (ctx.job.projectArchive.type === ArchiveSourceType.PATH) {\n await prepareProjectSourcesLocallyAsync(ctx, ctx.job.projectArchive.path, destinationDirectory); // used in eas build --local\n } else if (ctx.job.projectArchive.type === ArchiveSourceType.URL) {\n await downloadAndUnpackProjectFromTarGzAsync(\n ctx,\n ctx.job.projectArchive.url,\n destinationDirectory\n );\n } else if (ctx.job.projectArchive.type === ArchiveSourceType.GIT) {\n await shallowCloneRepositoryAsync({\n logger: ctx.logger,\n archiveSource: ctx.job.projectArchive,\n destinationDirectory,\n });\n }\n}\n\nasync function shallowCloneRepositoryAsync({\n logger,\n archiveSource,\n destinationDirectory,\n}: {\n logger: bunyan;\n archiveSource: ArchiveSource & { type: ArchiveSourceType.GIT };\n destinationDirectory: string;\n}): Promise<void> {\n const { repositoryUrl } = archiveSource;\n try {\n await spawn('git', ['init'], { cwd: destinationDirectory });\n await spawn('git', ['remote', 'add', 'origin', repositoryUrl], { cwd: destinationDirectory });\n\n let gitRef: string | null;\n let gitCommitHash: string;\n // If gitRef is provided, but gitCommitHash is not,\n // we're handling a legacy case - gitRef is the commit hash.\n // Otherwise we expect gitCommitHash to be present.\n if (archiveSource.gitRef && !archiveSource.gitCommitHash) {\n gitCommitHash = archiveSource.gitRef;\n gitRef = null;\n } else {\n gitCommitHash = nullthrows(archiveSource.gitCommitHash);\n gitRef = archiveSource.gitRef ?? null;\n }\n\n await spawn('git', ['fetch', 'origin', '--depth', '1', '--no-tags', gitCommitHash], {\n cwd: destinationDirectory,\n });\n\n await spawn('git', ['checkout', gitCommitHash], { cwd: destinationDirectory });\n\n // If we have a gitRef, we try to add it to the repo.\n if (gitRef) {\n const { name, type } = getStrippedBranchOrTagName(gitRef);\n switch (type) {\n // If the gitRef is for a tag, we add a lightweight tag to current commit.\n case 'tag': {\n await spawn('git', ['tag', name], { cwd: destinationDirectory });\n break;\n }\n // gitRef for a branch may come as:\n // - qualified ref (e.g. refs/heads/feature/add-icon), detected as \"branch\" for a push,\n // - unqualified ref (e.g. feature/add-icon), detected as \"other\" for a pull request.\n case 'branch':\n case 'other': {\n await spawn('git', ['checkout', '-b', name], { cwd: destinationDirectory });\n break;\n }\n }\n }\n } catch (err: any) {\n const sanitizedUrl = getSanitizedGitUrl(repositoryUrl);\n if (sanitizedUrl) {\n logger.error(`Failed to clone git repository: ${sanitizedUrl}.`);\n } else {\n logger.error('Failed to clone git repository.');\n }\n logger.error(err.stderr);\n throw err;\n }\n}\n\nfunction getSanitizedGitUrl(maybeGitUrl: string): string | null {\n try {\n const url = new URL(maybeGitUrl);\n if (url.password) {\n url.password = '*******';\n }\n return url.toString();\n } catch {\n return null;\n }\n}\n\nexport async function downloadAndUnpackProjectFromTarGzAsync<TJob extends Job>(\n ctx: BuildContext<TJob>,\n projectArchiveUrl: string,\n destinationDirectory: string\n): Promise<void> {\n const projectTarball = path.join(ctx.workingdir, 'project.tar.gz');\n try {\n await downloadFile(projectArchiveUrl, projectTarball, { retry: 3 });\n } catch (err: any) {\n ctx.reportError?.('Failed to download project archive', err, {\n extras: { buildId: ctx.env.EAS_BUILD_ID },\n });\n throw err;\n }\n\n await unpackTarGzAsync({\n destination: destinationDirectory,\n source: projectTarball,\n logger: ctx.logger,\n });\n}\n\nasync function prepareProjectSourcesLocallyAsync<TJob extends Job>(\n ctx: BuildContext<TJob>,\n projectArchivePath: string,\n destinationDirectory: string\n): Promise<void> {\n const projectTarball = path.join(ctx.workingdir, 'project.tar.gz');\n await fs.copy(projectArchivePath, projectTarball);\n\n await unpackTarGzAsync({\n destination: destinationDirectory,\n source: projectTarball,\n logger: ctx.logger,\n });\n}\n\nasync function unpackTarGzAsync({\n logger,\n source,\n destination,\n}: {\n logger: bunyan;\n source: string;\n destination: string;\n}): Promise<void> {\n await spawn('tar', ['-C', destination, '--strip-components', '1', '-zxf', source], {\n logger,\n });\n}\n\nfunction getStrippedBranchOrTagName(ref: string): {\n name: string;\n type: 'branch' | 'tag' | 'other';\n} {\n const branchRegex = /(\\/?refs)?\\/?heads\\/(.+)/;\n const branchMatch = ref.match(branchRegex);\n\n if (branchMatch) {\n return {\n name: branchMatch[2],\n type: 'branch',\n };\n }\n\n const tagRegex = /(\\/?refs)?\\/?tags\\/(.+)/;\n const tagMatch = ref.match(tagRegex);\n\n if (tagMatch) {\n return {\n name: tagMatch[2],\n type: 'tag',\n };\n }\n\n return {\n name: ref,\n type: 'other',\n };\n}\n"]}
@@ -2,12 +2,9 @@ import { BuildJob, Job } from '@expo/eas-build-job';
2
2
  import { BuildContext } from '../context';
3
3
  export declare enum IosMetadataName {
4
4
  UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY = "EXUpdatesRequestHeaders",
5
- RELEASE_CHANNEL = "EXUpdatesReleaseChannel",
6
5
  RUNTIME_VERSION = "EXUpdatesRuntimeVersion"
7
6
  }
8
7
  export declare function iosSetRuntimeVersionNativelyAsync(ctx: BuildContext<Job>, runtimeVersion: string): Promise<void>;
9
8
  export declare function iosSetChannelNativelyAsync(ctx: BuildContext<BuildJob>): Promise<void>;
10
9
  export declare function iosGetNativelyDefinedChannelAsync(ctx: BuildContext<Job>): Promise<string | null>;
11
- export declare function iosSetClassicReleaseChannelNativelyAsync(ctx: BuildContext<BuildJob>): Promise<void>;
12
- export declare function iosGetNativelyDefinedClassicReleaseChannelAsync(ctx: BuildContext<Job>): Promise<string | null>;
13
10
  export declare function iosGetNativelyDefinedRuntimeVersionAsync(ctx: BuildContext<Job>): Promise<string | null>;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.iosGetNativelyDefinedRuntimeVersionAsync = exports.iosGetNativelyDefinedClassicReleaseChannelAsync = exports.iosSetClassicReleaseChannelNativelyAsync = exports.iosGetNativelyDefinedChannelAsync = exports.iosSetChannelNativelyAsync = exports.iosSetRuntimeVersionNativelyAsync = exports.IosMetadataName = void 0;
6
+ exports.iosGetNativelyDefinedRuntimeVersionAsync = exports.iosGetNativelyDefinedChannelAsync = exports.iosSetChannelNativelyAsync = exports.iosSetRuntimeVersionNativelyAsync = exports.IosMetadataName = void 0;
7
7
  const assert_1 = __importDefault(require("assert"));
8
8
  const config_plugins_1 = require("@expo/config-plugins");
9
9
  const fs_extra_1 = __importDefault(require("fs-extra"));
@@ -11,7 +11,6 @@ const plist_1 = __importDefault(require("@expo/plist"));
11
11
  var IosMetadataName;
12
12
  (function (IosMetadataName) {
13
13
  IosMetadataName["UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY"] = "EXUpdatesRequestHeaders";
14
- IosMetadataName["RELEASE_CHANNEL"] = "EXUpdatesReleaseChannel";
15
14
  IosMetadataName["RUNTIME_VERSION"] = "EXUpdatesRuntimeVersion";
16
15
  })(IosMetadataName || (exports.IosMetadataName = IosMetadataName = {}));
17
16
  async function iosSetRuntimeVersionNativelyAsync(ctx, runtimeVersion) {
@@ -60,33 +59,6 @@ async function iosGetNativelyDefinedChannelAsync(ctx) {
60
59
  }
61
60
  }
62
61
  exports.iosGetNativelyDefinedChannelAsync = iosGetNativelyDefinedChannelAsync;
63
- async function iosSetClassicReleaseChannelNativelyAsync(ctx) {
64
- (0, assert_1.default)(ctx.job.releaseChannel, 'releaseChannel must be defined');
65
- const expoPlistPath = config_plugins_1.IOSConfig.Paths.getExpoPlistPath(ctx.getReactNativeProjectDirectory());
66
- if (!(await fs_extra_1.default.pathExists(expoPlistPath))) {
67
- throw new Error(`${expoPlistPath} does not exist`);
68
- }
69
- const expoPlistContents = await fs_extra_1.default.readFile(expoPlistPath, 'utf8');
70
- const items = plist_1.default.parse(expoPlistContents);
71
- items[IosMetadataName.RELEASE_CHANNEL] = ctx.job.releaseChannel;
72
- const updatedExpoPlistContents = plist_1.default.build(items);
73
- await fs_extra_1.default.writeFile(expoPlistPath, updatedExpoPlistContents);
74
- }
75
- exports.iosSetClassicReleaseChannelNativelyAsync = iosSetClassicReleaseChannelNativelyAsync;
76
- async function iosGetNativelyDefinedClassicReleaseChannelAsync(ctx) {
77
- var _a;
78
- const expoPlistPath = config_plugins_1.IOSConfig.Paths.getExpoPlistPath(ctx.getReactNativeProjectDirectory());
79
- if (!(await fs_extra_1.default.pathExists(expoPlistPath))) {
80
- return null;
81
- }
82
- const expoPlistContents = await fs_extra_1.default.readFile(expoPlistPath, 'utf8');
83
- const parsedPlist = plist_1.default.parse(expoPlistContents);
84
- if (!parsedPlist) {
85
- return null;
86
- }
87
- return (_a = parsedPlist[IosMetadataName.RELEASE_CHANNEL]) !== null && _a !== void 0 ? _a : null;
88
- }
89
- exports.iosGetNativelyDefinedClassicReleaseChannelAsync = iosGetNativelyDefinedClassicReleaseChannelAsync;
90
62
  async function iosGetNativelyDefinedRuntimeVersionAsync(ctx) {
91
63
  var _a;
92
64
  const expoPlistPath = config_plugins_1.IOSConfig.Paths.getExpoPlistPath(ctx.getReactNativeProjectDirectory());
@@ -1 +1 @@
1
- {"version":3,"file":"expoUpdates.js","sourceRoot":"","sources":["../../src/ios/expoUpdates.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAE5B,yDAAiD;AACjD,wDAA0B;AAC1B,wDAAgC;AAKhC,IAAY,eAIX;AAJD,WAAY,eAAe;IACzB,wFAAqE,CAAA;IACrE,8DAA2C,CAAA;IAC3C,8DAA2C,CAAA;AAC7C,CAAC,EAJW,eAAe,+BAAf,eAAe,QAI1B;AAEM,KAAK,UAAU,iCAAiC,CACrD,GAAsB,EACtB,cAAsB;IAEtB,MAAM,aAAa,GAAG,0BAAS,CAAC,KAAK,CAAC,gBAAgB,CAAC,GAAG,CAAC,8BAA8B,EAAE,CAAC,CAAC;IAE7F,IAAI,CAAC,CAAC,MAAM,kBAAE,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC;QAC1C,MAAM,IAAI,KAAK,CAAC,GAAG,aAAa,iBAAiB,CAAC,CAAC;IACrD,CAAC;IAED,MAAM,iBAAiB,GAAG,MAAM,kBAAE,CAAC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;IACnE,MAAM,KAAK,G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AAiB,GAAG,MAAM,kBAAE,CAAC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;IACnE,MAAM,WAAW,GAAG,eAAK,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACnD,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,MAAA,WAAW,CAAC,eAAe,CAAC,eAAe,CAAC,mCAAI,IAAI,CAAC;AAC9D,CAAC;AAbD,4FAaC","sourcesContent":["import assert from 'assert';\n\nimport { IOSConfig } from '@expo/config-plugins';\nimport fs from 'fs-extra';\nimport plist from '@expo/plist';\nimport { BuildJob, Job } from '@expo/eas-build-job';\n\nimport { BuildContext } from '../context';\n\nexport enum IosMetadataName {\n UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY = 'EXUpdatesRequestHeaders',\n RELEASE_CHANNEL = 'EXUpdatesReleaseChannel',\n RUNTIME_VERSION = 'EXUpdatesRuntimeVersion',\n}\n\nexport async function iosSetRuntimeVersionNativelyAsync(\n ctx: BuildContext<Job>,\n runtimeVersion: string\n): Promise<void> {\n const expoPlistPath = IOSConfig.Paths.getExpoPlistPath(ctx.getReactNativeProjectDirectory());\n\n if (!(await fs.pathExists(expoPlistPath))) {\n throw new Error(`${expoPlistPath} does not exist`);\n }\n\n const expoPlistContents = await fs.readFile(expoPlistPath, 'utf8');\n const items = plist.parse(expoPlistContents);\n items[IosMetadataName.RUNTIME_VERSION] = runtimeVersion;\n const updatedExpoPlistContents = plist.build(items);\n\n await fs.writeFile(expoPlistPath, updatedExpoPlistContents);\n}\n\nexport async function iosSetChannelNativelyAsync(ctx: BuildContext<BuildJob>): Promise<void> {\n assert(ctx.job.updates?.channel, 'updates.channel must be defined');\n\n const expoPlistPath = IOSConfig.Paths.getExpoPlistPath(ctx.getReactNativeProjectDirectory());\n\n if (!(await fs.pathExists(expoPlistPath))) {\n throw new Error(`${expoPlistPath} does not exist`);\n }\n\n const expoPlistContents = await fs.readFile(expoPlistPath, 'utf8');\n const items: Record<string, string | Record<string, string>> = plist.parse(expoPlistContents);\n items[IosMetadataName.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY] = {\n ...((items[IosMetadataName.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY] as Record<\n string,\n string\n >) ?? {}),\n 'expo-channel-name': ctx.job.updates.channel,\n };\n const updatedExpoPlistContents = plist.build(items);\n\n await fs.writeFile(expoPlistPath, updatedExpoPlistContents);\n}\n\nexport async function iosGetNativelyDefinedChannelAsync(\n ctx: BuildContext<Job>\n): Promise<string | null> {\n const expoPlistPath = IOSConfig.Paths.getExpoPlistPath(ctx.getReactNativeProjectDirectory());\n\n if (!(await fs.pathExists(expoPlistPath))) {\n return null;\n }\n\n const expoPlistContents = await fs.readFile(expoPlistPath, 'utf8');\n try {\n const items: Record<string, string | Record<string, string>> = plist.parse(expoPlistContents);\n const updatesRequestHeaders = (items[\n IosMetadataName.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY\n ] ?? {}) as Record<string, string>;\n return updatesRequestHeaders['expo-channel-name'] ?? null;\n } catch (err: any) {\n throw new Error(\n `Failed to parse ${IosMetadataName.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY} from Expo.plist: ${err.message}`\n );\n }\n}\n\nexport async function iosSetClassicReleaseChannelNativelyAsync(\n ctx: BuildContext<BuildJob>\n): Promise<void> {\n assert(ctx.job.releaseChannel, 'releaseChannel must be defined');\n\n const expoPlistPath = IOSConfig.Paths.getExpoPlistPath(ctx.getReactNativeProjectDirectory());\n\n if (!(await fs.pathExists(expoPlistPath))) {\n throw new Error(`${expoPlistPath} does not exist`);\n }\n\n const expoPlistContents = await fs.readFile(expoPlistPath, 'utf8');\n const items: Record<string, string | Record<string, string>> = plist.parse(expoPlistContents);\n items[IosMetadataName.RELEASE_CHANNEL] = ctx.job.releaseChannel;\n const updatedExpoPlistContents = plist.build(items);\n\n await fs.writeFile(expoPlistPath, updatedExpoPlistContents);\n}\n\nexport async function iosGetNativelyDefinedClassicReleaseChannelAsync(\n ctx: BuildContext<Job>\n): Promise<string | null> {\n const expoPlistPath = IOSConfig.Paths.getExpoPlistPath(ctx.getReactNativeProjectDirectory());\n if (!(await fs.pathExists(expoPlistPath))) {\n return null;\n }\n const expoPlistContents = await fs.readFile(expoPlistPath, 'utf8');\n const parsedPlist = plist.parse(expoPlistContents);\n if (!parsedPlist) {\n return null;\n }\n return parsedPlist[IosMetadataName.RELEASE_CHANNEL] ?? null;\n}\n\nexport async function iosGetNativelyDefinedRuntimeVersionAsync(\n ctx: BuildContext<Job>\n): Promise<string | null> {\n const expoPlistPath = IOSConfig.Paths.getExpoPlistPath(ctx.getReactNativeProjectDirectory());\n if (!(await fs.pathExists(expoPlistPath))) {\n return null;\n }\n const expoPlistContents = await fs.readFile(expoPlistPath, 'utf8');\n const parsedPlist = plist.parse(expoPlistContents);\n if (!parsedPlist) {\n return null;\n }\n return parsedPlist[IosMetadataName.RUNTIME_VERSION] ?? null;\n}\n"]}
1
+ {"version":3,"file":"expoUpdates.js","sourceRoot":"","sources":["../../src/ios/expoUpdates.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAE5B,yDAAiD;AACjD,wDAA0B;AAC1B,wDAAgC;AAKhC,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,wFAAqE,CAAA;IACrE,8DAA2C,CAAA;AAC7C,CAAC,EAHW,eAAe,+BAAf,eAAe,QAG1B;AAEM,KAAK,UAAU,iCAAiC,CACrD,GAAsB,EACtB,cAAsB;IAEtB,MAAM,aAAa,GAAG,0BAAS,CAAC,KAAK,CAAC,gBAAgB,CAAC,GAAG,CAAC,8BAA8B,EAAE,CAAC,CAAC;IAE7F,IAAI,CAAC,CAAC,MAAM,kBAAE,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC;QAC1C,MAAM,IAAI,KAAK,CAAC,GAAG,aAAa,iBAAiB,CAAC,CAAC;IACrD,CAAC;IAED,MAAM,iBA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AAC;IACnE,MAAM,WAAW,GAAG,eAAK,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACnD,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,MAAA,WAAW,CAAC,eAAe,CAAC,eAAe,CAAC,mCAAI,IAAI,CAAC;AAC9D,CAAC;AAbD,4FAaC","sourcesContent":["import assert from 'assert';\n\nimport { IOSConfig } from '@expo/config-plugins';\nimport fs from 'fs-extra';\nimport plist from '@expo/plist';\nimport { BuildJob, Job } from '@expo/eas-build-job';\n\nimport { BuildContext } from '../context';\n\nexport enum IosMetadataName {\n UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY = 'EXUpdatesRequestHeaders',\n RUNTIME_VERSION = 'EXUpdatesRuntimeVersion',\n}\n\nexport async function iosSetRuntimeVersionNativelyAsync(\n ctx: BuildContext<Job>,\n runtimeVersion: string\n): Promise<void> {\n const expoPlistPath = IOSConfig.Paths.getExpoPlistPath(ctx.getReactNativeProjectDirectory());\n\n if (!(await fs.pathExists(expoPlistPath))) {\n throw new Error(`${expoPlistPath} does not exist`);\n }\n\n const expoPlistContents = await fs.readFile(expoPlistPath, 'utf8');\n const items = plist.parse(expoPlistContents);\n items[IosMetadataName.RUNTIME_VERSION] = runtimeVersion;\n const updatedExpoPlistContents = plist.build(items);\n\n await fs.writeFile(expoPlistPath, updatedExpoPlistContents);\n}\n\nexport async function iosSetChannelNativelyAsync(ctx: BuildContext<BuildJob>): Promise<void> {\n assert(ctx.job.updates?.channel, 'updates.channel must be defined');\n\n const expoPlistPath = IOSConfig.Paths.getExpoPlistPath(ctx.getReactNativeProjectDirectory());\n\n if (!(await fs.pathExists(expoPlistPath))) {\n throw new Error(`${expoPlistPath} does not exist`);\n }\n\n const expoPlistContents = await fs.readFile(expoPlistPath, 'utf8');\n const items: Record<string, string | Record<string, string>> = plist.parse(expoPlistContents);\n items[IosMetadataName.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY] = {\n ...((items[IosMetadataName.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY] as Record<\n string,\n string\n >) ?? {}),\n 'expo-channel-name': ctx.job.updates.channel,\n };\n const updatedExpoPlistContents = plist.build(items);\n\n await fs.writeFile(expoPlistPath, updatedExpoPlistContents);\n}\n\nexport async function iosGetNativelyDefinedChannelAsync(\n ctx: BuildContext<Job>\n): Promise<string | null> {\n const expoPlistPath = IOSConfig.Paths.getExpoPlistPath(ctx.getReactNativeProjectDirectory());\n\n if (!(await fs.pathExists(expoPlistPath))) {\n return null;\n }\n\n const expoPlistContents = await fs.readFile(expoPlistPath, 'utf8');\n try {\n const items: Record<string, string | Record<string, string>> = plist.parse(expoPlistContents);\n const updatesRequestHeaders = (items[\n IosMetadataName.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY\n ] ?? {}) as Record<string, string>;\n return updatesRequestHeaders['expo-channel-name'] ?? null;\n } catch (err: any) {\n throw new Error(\n `Failed to parse ${IosMetadataName.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY} from Expo.plist: ${err.message}`\n );\n }\n}\n\nexport async function iosGetNativelyDefinedRuntimeVersionAsync(\n ctx: BuildContext<Job>\n): Promise<string | null> {\n const expoPlistPath = IOSConfig.Paths.getExpoPlistPath(ctx.getReactNativeProjectDirectory());\n if (!(await fs.pathExists(expoPlistPath))) {\n return null;\n }\n const expoPlistContents = await fs.readFile(expoPlistPath, 'utf8');\n const parsedPlist = plist.parse(expoPlistContents);\n if (!parsedPlist) {\n return null;\n }\n return parsedPlist[IosMetadataName.RUNTIME_VERSION] ?? null;\n}\n"]}
@@ -53,12 +53,12 @@ function configureEASUpdateIfInstalledFunction() {
53
53
  logger: stepCtx.logger,
54
54
  sdkVersion: metadata === null || metadata === void 0 ? void 0 : metadata.sdkVersion,
55
55
  }).exp;
56
- const releaseChannelInput = inputs.channel.value;
56
+ const channelInput = inputs.channel.value;
57
57
  const runtimeVersionInput = inputs.runtime_version.value;
58
58
  const resolvedRuntimeVersionInput = inputs.resolved_eas_update_runtime_version.value;
59
59
  const throwIfNotConfigured = inputs.throw_if_not_configured.value;
60
60
  if (runtimeVersionInput && !semver_1.default.valid(runtimeVersionInput)) {
61
- throw new Error(`Runtime version provided by the "runtime_version" input is not a valid semver version: ${releaseChannelInput}`);
61
+ throw new Error(`Runtime version provided by the "runtime_version" input is not a valid semver version: ${runtimeVersionInput}`);
62
62
  }
63
63
  const expoUpdatesPackageVersion = await (0, getExpoUpdatesPackageVersionIfInstalledAsync_1.default)(stepCtx.workingDirectory, stepCtx.logger);
64
64
  if (expoUpdatesPackageVersion === null) {
@@ -75,7 +75,7 @@ function configureEASUpdateIfInstalledFunction() {
75
75
  appConfig,
76
76
  inputs: {
77
77
  runtimeVersion: runtimeVersionInput,
78
- channel: releaseChannelInput,
78
+ channel: channelInput,
79
79
  resolvedRuntimeVersion: resolvedRuntimeVersionInput,
80
80
  },
81
81
  metadata: stepCtx.global.staticContext.metadata,
@@ -1 +1 @@
1
- {"version":3,"file":"configureEASUpdateIfInstalled.js","sourceRoot":"","sources":["../../../src/steps/functions/configureEASUpdateIfInstalled.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAE5B,uCAAyF;AAEzF,oDAA4B;AAE5B,sDAA+D;AAC/D,qDAAsD;AACtD,4IAAoH;AAEpH,SAAgB,qCAAqC;IACnD,OAAO,IAAI,qBAAa,CAAC;QACvB,SAAS,EAAE,KAAK;QAChB,EAAE,EAAE,sBAAsB;QAC1B,IAAI,EAAE,sBAAsB;QAC5B,cAAc,EAAE;YACd,sBAAc,CAAC,cAAc,CAAC;gBAC5B,EAAE,EAAE,iBAAiB;gBACrB,QAAQ,EAAE,KAAK;gBACf,oBAAoB,EAAE,mCAA2B,CAAC,MAAM;aACzD,CAAC;YACF,sBAAc,CAAC,cAAc,CAAC;gBAC5B,EAAE,EAAE,SAAS;gBACb,QAAQ,EAAE,KAAK;gBACf,oBAAoB,EAAE,mCAA2B,CAAC,MAAM;a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O,CAAC,KAA2B,CAAC;YACvE,MAAM,mBAAmB,GAAG,MAAM,CAAC,eAAe,CAAC,KAA2B,CAAC;YAC/E,MAAM,2BAA2B,GAAG,MAAM,CAAC,mCAAmC,CAAC,KAElE,CAAC;YACd,MAAM,oBAAoB,GAAG,MAAM,CAAC,uBAAuB,CAAC,KAAgB,CAAC;YAC7E,IAAI,mBAAmB,IAAI,CAAC,gBAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,EAAE,CAAC;gBAC9D,MAAM,IAAI,KAAK,CACb,0FAA0F,mBAAmB,EAAE,CAChH,CAAC;YACJ,CAAC;YAED,MAAM,yBAAyB,GAAG,MAAM,IAAA,sDAA4C,EAClF,OAAO,CAAC,gBAAgB,EACxB,OAAO,CAAC,MAAM,CACf,CAAC;YACF,IAAI,yBAAyB,KAAK,IAAI,EAAE,CAAC;gBACvC,IAAI,oBAAoB,EAAE,CAAC;oBACzB,MAAM,IAAI,KAAK,CACb,gFAAgF,CACjF,CAAC;gBACJ,CAAC;gBACD,OAAO,CAAC,MAAM,CAAC,IAAI,CACjB,gFAAgF,CACjF,CAAC;gBACF,OAAO;YACT,CAAC;YAED,MAAM,IAAA,qCAAuB,EAAC;gBAC5B,GAAG;gBACH,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;gBAC1C,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,SAAS;gBACT,MAAM,EAAE;oBACN,cAAc,EAAE,mBAAmB;oBACnC,OAAO,EAAE,mBAAmB;oBAC5B,sBAAsB,EAAE,2BAA2B;iBACpD;gBACD,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,QAAQ;aAChD,CAAC,CAAC;QACL,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAzFD,sFAyFC","sourcesContent":["import assert from 'assert';\n\nimport { BuildFunction, BuildStepInput, BuildStepInputValueTypeName } from '@expo/steps';\nimport { Metadata } from '@expo/eas-build-job';\nimport semver from 'semver';\n\nimport { configureEASUpdateAsync } from '../utils/expoUpdates';\nimport { readAppConfig } from '../../utils/appConfig';\nimport getExpoUpdatesPackageVersionIfInstalledAsync from '../../utils/getExpoUpdatesPackageVersionIfInstalledAsync';\n\nexport function configureEASUpdateIfInstalledFunction(): BuildFunction {\n return new BuildFunction({\n namespace: 'eas',\n id: 'configure_eas_update',\n name: 'Configure EAS Update',\n inputProviders: [\n BuildStepInput.createProvider({\n id: 'runtime_version',\n required: false,\n allowedValueTypeName: BuildStepInputValueTypeName.STRING,\n }),\n BuildStepInput.createProvider({\n id: 'channel',\n required: false,\n allowedValueTypeName: BuildStepInputValueTypeName.STRING,\n }),\n BuildStepInput.createProvider({\n id: 'throw_if_not_configured',\n required: false,\n defaultValue: true,\n allowedValueTypeName: BuildStepInputValueTypeName.BOOLEAN,\n }),\n BuildStepInput.createProvider({\n id: 'resolved_eas_update_runtime_version',\n required: false,\n allowedValueTypeName: BuildStepInputValueTypeName.STRING,\n }),\n ],\n fn: async (stepCtx, { env, inputs }) => {\n assert(stepCtx.global.staticContext.job, 'Job is not defined');\n const job = stepCtx.global.staticContext.job;\n assert(job.platform, 'Configuring EAS Update in generic jobs is not supported.');\n const metadata = stepCtx.global.staticContext.metadata as Metadata | undefined;\n\n const appConfig = readAppConfig({\n projectDir: stepCtx.workingDirectory,\n env: Object.keys(env).reduce(\n (acc, key) => {\n acc[key] = env[key] ?? '';\n return acc;\n },\n {} as Record<string, string>\n ),\n logger: stepCtx.logger,\n sdkVersion: metadata?.sdkVersion,\n }).exp;\n\n const releaseChannelInput = inputs.channel.value as string | undefined;\n const runtimeVersionInput = inputs.runtime_version.value as string | undefined;\n const resolvedRuntimeVersionInput = inputs.resolved_eas_update_runtime_version.value as\n | string\n | undefined;\n const throwIfNotConfigured = inputs.throw_if_not_configured.value as boolean;\n if (runtimeVersionInput && !semver.valid(runtimeVersionInput)) {\n throw new Error(\n `Runtime version provided by the \"runtime_version\" input is not a valid semver version: ${releaseChannelInput}`\n );\n }\n\n const expoUpdatesPackageVersion = await getExpoUpdatesPackageVersionIfInstalledAsync(\n stepCtx.workingDirectory,\n stepCtx.logger\n );\n if (expoUpdatesPackageVersion === null) {\n if (throwIfNotConfigured) {\n throw new Error(\n 'Cannot configure EAS Update because the expo-updates package is not installed.'\n );\n }\n stepCtx.logger.warn(\n 'Cannot configure EAS Update because the expo-updates package is not installed.'\n );\n return;\n }\n\n await configureEASUpdateAsync({\n job,\n workingDirectory: stepCtx.workingDirectory,\n logger: stepCtx.logger,\n appConfig,\n inputs: {\n runtimeVersion: runtimeVersionInput,\n channel: releaseChannelInput,\n resolvedRuntimeVersion: resolvedRuntimeVersionInput,\n },\n metadata: stepCtx.global.staticContext.metadata,\n });\n },\n });\n}\n"]}
1
+ {"version":3,"file":"configureEASUpdateIfInstalled.js","sourceRoot":"","sources":["../../../src/steps/functions/configureEASUpdateIfInstalled.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAE5B,uCAAyF;AAEzF,oDAA4B;AAE5B,sDAA+D;AAC/D,qDAAsD;AACtD,4IAAoH;AAEpH,SAAgB,qCAAqC;IACnD,OAAO,IAAI,qBAAa,CAAC;QACvB,SAAS,EAAE,KAAK;QAChB,EAAE,EAAE,sBAAsB;QAC1B,IAAI,EAAE,sBAAsB;QAC5B,cAAc,EAAE;YACd,sBAAc,CAAC,cAAc,CAAC;gBAC5B,EAAE,EAAE,iBAAiB;gBACrB,QAAQ,EAAE,KAAK;gBACf,oBAAoB,EAAE,mCAA2B,CAAC,MAAM;aACzD,CAAC;YACF,sBAAc,CAAC,cAAc,CAAC;gBAC5B,EAAE,EAAE,SAAS;gBACb,QAAQ,EAAE,KAAK;gBACf,oBAAoB,EAAE,mCAA2B,CAAC,MAAM;aACzD,CAAC;YACF,sBAAc,CAAC,cAAc,CAAC;gBAC5B,EAAE,EAAE,yBAAyB;gBAC7B,QAAQ,EAAE,KAAK;gBACf,YAAY,EAAE,IAAI;gBAClB,oBAAoB,EAAE,mCAA2B,CAAC,OAAO;aAC1D,CA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,MAAM,CAAC,uBAAuB,CAAC,KAAgB,CAAC;YAC7E,IAAI,mBAAmB,IAAI,CAAC,gBAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,EAAE,CAAC;gBAC9D,MAAM,IAAI,KAAK,CACb,0FAA0F,mBAAmB,EAAE,CAChH,CAAC;YACJ,CAAC;YAED,MAAM,yBAAyB,GAAG,MAAM,IAAA,sDAA4C,EAClF,OAAO,CAAC,gBAAgB,EACxB,OAAO,CAAC,MAAM,CACf,CAAC;YACF,IAAI,yBAAyB,KAAK,IAAI,EAAE,CAAC;gBACvC,IAAI,oBAAoB,EAAE,CAAC;oBACzB,MAAM,IAAI,KAAK,CACb,gFAAgF,CACjF,CAAC;gBACJ,CAAC;gBACD,OAAO,CAAC,MAAM,CAAC,IAAI,CACjB,gFAAgF,CACjF,CAAC;gBACF,OAAO;YACT,CAAC;YAED,MAAM,IAAA,qCAAuB,EAAC;gBAC5B,GAAG;gBACH,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;gBAC1C,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,SAAS;gBACT,MAAM,EAAE;oBACN,cAAc,EAAE,mBAAmB;oBACnC,OAAO,EAAE,YAAY;oBACrB,sBAAsB,EAAE,2BAA2B;iBACpD;gBACD,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,QAAQ;aAChD,CAAC,CAAC;QACL,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAzFD,sFAyFC","sourcesContent":["import assert from 'assert';\n\nimport { BuildFunction, BuildStepInput, BuildStepInputValueTypeName } from '@expo/steps';\nimport { Metadata } from '@expo/eas-build-job';\nimport semver from 'semver';\n\nimport { configureEASUpdateAsync } from '../utils/expoUpdates';\nimport { readAppConfig } from '../../utils/appConfig';\nimport getExpoUpdatesPackageVersionIfInstalledAsync from '../../utils/getExpoUpdatesPackageVersionIfInstalledAsync';\n\nexport function configureEASUpdateIfInstalledFunction(): BuildFunction {\n return new BuildFunction({\n namespace: 'eas',\n id: 'configure_eas_update',\n name: 'Configure EAS Update',\n inputProviders: [\n BuildStepInput.createProvider({\n id: 'runtime_version',\n required: false,\n allowedValueTypeName: BuildStepInputValueTypeName.STRING,\n }),\n BuildStepInput.createProvider({\n id: 'channel',\n required: false,\n allowedValueTypeName: BuildStepInputValueTypeName.STRING,\n }),\n BuildStepInput.createProvider({\n id: 'throw_if_not_configured',\n required: false,\n defaultValue: true,\n allowedValueTypeName: BuildStepInputValueTypeName.BOOLEAN,\n }),\n BuildStepInput.createProvider({\n id: 'resolved_eas_update_runtime_version',\n required: false,\n allowedValueTypeName: BuildStepInputValueTypeName.STRING,\n }),\n ],\n fn: async (stepCtx, { env, inputs }) => {\n assert(stepCtx.global.staticContext.job, 'Job is not defined');\n const job = stepCtx.global.staticContext.job;\n assert(job.platform, 'Configuring EAS Update in generic jobs is not supported.');\n const metadata = stepCtx.global.staticContext.metadata as Metadata | undefined;\n\n const appConfig = readAppConfig({\n projectDir: stepCtx.workingDirectory,\n env: Object.keys(env).reduce(\n (acc, key) => {\n acc[key] = env[key] ?? '';\n return acc;\n },\n {} as Record<string, string>\n ),\n logger: stepCtx.logger,\n sdkVersion: metadata?.sdkVersion,\n }).exp;\n\n const channelInput = inputs.channel.value as string | undefined;\n const runtimeVersionInput = inputs.runtime_version.value as string | undefined;\n const resolvedRuntimeVersionInput = inputs.resolved_eas_update_runtime_version.value as\n | string\n | undefined;\n const throwIfNotConfigured = inputs.throw_if_not_configured.value as boolean;\n if (runtimeVersionInput && !semver.valid(runtimeVersionInput)) {\n throw new Error(\n `Runtime version provided by the \"runtime_version\" input is not a valid semver version: ${runtimeVersionInput}`\n );\n }\n\n const expoUpdatesPackageVersion = await getExpoUpdatesPackageVersionIfInstalledAsync(\n stepCtx.workingDirectory,\n stepCtx.logger\n );\n if (expoUpdatesPackageVersion === null) {\n if (throwIfNotConfigured) {\n throw new Error(\n 'Cannot configure EAS Update because the expo-updates package is not installed.'\n );\n }\n stepCtx.logger.warn(\n 'Cannot configure EAS Update because the expo-updates package is not installed.'\n );\n return;\n }\n\n await configureEASUpdateAsync({\n job,\n workingDirectory: stepCtx.workingDirectory,\n logger: stepCtx.logger,\n appConfig,\n inputs: {\n runtimeVersion: runtimeVersionInput,\n channel: channelInput,\n resolvedRuntimeVersion: resolvedRuntimeVersionInput,\n },\n metadata: stepCtx.global.staticContext.metadata,\n });\n },\n });\n}\n"]}
@@ -27,16 +27,11 @@ async function configureEASUpdateAsync({ job, workingDirectory, logger, inputs,
27
27
  // NO-OP: Development clients don't need to have a channel set
28
28
  }
29
29
  else {
30
- if (job.releaseChannel !== undefined) {
31
- logger.warn(`This build is configured with EAS Update however has a Classic Updates releaseChannel set instead of having an EAS Update channel.`);
32
- }
33
- else {
34
- const easUpdateUrl = (_h = (_g = appConfig.updates) === null || _g === void 0 ? void 0 : _g.url) !== null && _h !== void 0 ? _h : null;
35
- const jobProfile = (_j = job.buildProfile) !== null && _j !== void 0 ? _j : null;
36
- logger.warn(`This build has an invalid EAS Update configuration: update.url is set to "${easUpdateUrl}" in app config, but a channel is not specified${jobProfile ? '' : ` for the current build profile "${jobProfile}" in eas.json`}.`);
37
- logger.warn(`- No channel will be set and EAS Update will be disabled for the build.`);
38
- logger.warn(`- Run \`eas update:configure\` to set your channel in eas.json. For more details, see https://docs.expo.dev/eas-update/getting-started/#configure-your-project`);
39
- }
30
+ const easUpdateUrl = (_h = (_g = appConfig.updates) === null || _g === void 0 ? void 0 : _g.url) !== null && _h !== void 0 ? _h : null;
31
+ const jobProfile = (_j = job.buildProfile) !== null && _j !== void 0 ? _j : null;
32
+ logger.warn(`This build has an invalid EAS Update configuration: update.url is set to "${easUpdateUrl}" in app config, but a channel is not specified${jobProfile ? '' : ` for the current build profile "${jobProfile}" in eas.json`}.`);
33
+ logger.warn(`- No channel will be set and EAS Update will be disabled for the build.`);
34
+ logger.warn(`- Run \`eas update:configure\` to set your channel in eas.json. For more details, see https://docs.expo.dev/eas-update/getting-started/#configure-your-project`);
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EAAE,gBAAwB;IAC/D,QAAQ,GAAG,CAAC,QAAQ,EAAE,CAAC;QACrB,KAAK,wBAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;YACtB,OAAO,MAAM,IAAA,mDAAqC,EAAC,gBAAgB,CAAC,CAAC;QACvE,CAAC;QACD,KAAK,wBAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;YAClB,OAAO,MAAM,IAAA,+CAAiC,EAAC,gBAAgB,CAAC,CAAC;QACnE,CAAC;QACD;YACE,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;IAClD,CAAC;AACH,CAAC;AAED,KAAK,UAAU,8BAA8B,CAC3C,GAAQ,EACR,cAAsB,EACtB,gBAAwB;IAExB,QAAQ,GAAG,CAAC,QAAQ,EAAE,CAAC;QACrB,KAAK,wBAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;YACtB,MAAM,IAAA,mDAAqC,EAAC,cAAc,EAAE,gBAAgB,CAAC,CAAC;YAC9E,OAAO;QACT,CAAC;QACD,KAAK,wBAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;YAClB,MAAM,IAAA,+CAAiC,EAAC,cAAc,EAAE,gBAAgB,CAAC,CAAC;YAC1E,OAAO;QACT,CAAC;QACD;YACE,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;IAClD,CAAC;AACH,CAAC","sourcesContent":["import { BuildJob, Job, Metadata, Platform } from '@expo/eas-build-job';\nimport { bunyan } from '@expo/logger';\nimport { ExpoConfig } from '@expo/config';\n\nimport {\n iosGetNativelyDefinedChannelAsync,\n iosSetChannelNativelyAsync,\n iosSetRuntimeVersionNativelyAsync,\n} from './ios/expoUpdates';\nimport {\n androidGetNativelyDefinedChannelAsync,\n androidSetChannelNativelyAsync,\n androidSetRuntimeVersionNativelyAsync,\n} from './android/expoUpdates';\n\nexport async function configureEASUpdateAsync({\n job,\n workingDirectory,\n logger,\n inputs,\n appConfig,\n metadata,\n}: {\n job: BuildJob;\n workingDirectory: string;\n logger: bunyan;\n inputs: {\n runtimeVersion?: string;\n channel?: string;\n resolvedRuntimeVersion?: string;\n };\n appConfig: ExpoConfig;\n metadata: Metadata | null;\n}): Promise<void> {\n const runtimeVersion =\n inputs.runtimeVersion ?? job.version?.runtimeVersion ?? inputs.resolvedRuntimeVersion;\n\n if (metadata?.runtimeVersion && metadata.runtimeVersion !== runtimeVersion) {\n logger.warn(\n `Runtime version from the app config evaluated on your local machine (${metadata.runtimeVersion}) does not match the one resolved here (${runtimeVersion}).`\n );\n logger.warn(\n \"If you're using conditional app configs, e.g. depending on an environment variable, make sure to set the variable in eas.json or configure it with EAS Secret.\"\n );\n }\n\n const jobOrInputChannel = inputs.channel ?? job.updates?.channel;\n\n if (isEASUpdateConfigured(appConfig, logger)) {\n if (jobOrInputChannel) {\n await configureEASUpdate(job, logger, jobOrInputChannel, workingDirectory);\n } else {\n const channel = await getChannelAsync(job, workingDirectory);\n const isDevelopmentClient = job.developmentClient ?? false;\n\n if (channel) {\n const configFile = job.platform === Platform.ANDROID ? 'AndroidManifest.xml' : 'Expo.plist';\n logger.info(`The channel name for EAS Update in ${configFile} is set to \"${channel}\"`);\n } else if (isDevelopmentClient) {\n // NO-OP: Development clients don't need to have a channel set\n } else {\n if (job.releaseChannel !== undefined) {\n logger.warn(\n `This build is configured with EAS Update however has a Classic Updates releaseChannel set instead of having an EAS Update channel.`\n );\n } else {\n const easUpdateUrl = appConfig.updates?.url ?? null;\n const jobProfile = job.buildProfile ?? null;\n logger.warn(\n `This build has an invalid EAS Update configuration: update.url is set to \"${easUpdateUrl}\" in app config, but a channel is not specified${\n jobProfile ? '' : ` for the current build profile \"${jobProfile}\" in eas.json`\n }.`\n );\n logger.warn(`- No channel will be set and EAS Update will be disabled for the build.`);\n logger.warn(\n `- Run \\`eas update:configure\\` to set your channel in eas.json. For more details, see https://docs.expo.dev/eas-update/getting-started/#configure-your-project`\n );\n }\n }\n }\n } else {\n logger.info(`Expo Updates is not configured, skipping configuring Expo Updates.`);\n }\n\n if (runtimeVersion) {\n logger.info('Updating runtimeVersion in Expo.plist');\n await setRuntimeVersionNativelyAsync(job, runtimeVersion, workingDirectory);\n }\n}\n\nexport function isEASUpdateConfigured(appConfig: ExpoConfig, logger: bunyan): boolean {\n const rawUrl = appConfig.updates?.url;\n if (!rawUrl) {\n return false;\n }\n try {\n const url = new URL(rawUrl);\n return ['u.expo.dev', 'staging-u.expo.dev'].includes(url.hostname);\n } catch (err) {\n logger.error({ err }, `Cannot parse expo.updates.url = ${rawUrl} as URL`);\n logger.error(`Assuming EAS Update is not configured`);\n return false;\n }\n}\n\nasync function configureEASUpdate(\n job: Job,\n logger: bunyan,\n channel: string,\n workingDirectory: string\n): Promise<void> {\n const newUpdateRequestHeaders: Record<string, string> = {\n 'expo-channel-name': channel,\n };\n\n const configFile = job.platform === Platform.ANDROID ? 'AndroidManifest.xml' : 'Expo.plist';\n logger.info(\n `Setting the update request headers in '${configFile}' to '${JSON.stringify(\n newUpdateRequestHeaders\n )}'`\n );\n\n switch (job.platform) {\n case Platform.ANDROID: {\n await androidSetChannelNativelyAsync(channel, workingDirectory);\n return;\n }\n case Platform.IOS: {\n await iosSetChannelNativelyAsync(channel, workingDirectory);\n return;\n }\n default:\n throw new Error(`Platform is not supported.`);\n }\n}\n\nasync function getChannelAsync(job: Job, workingDirectory: string): Promise<string | null> {\n switch (job.platform) {\n case Platform.ANDROID: {\n return await androidGetNativelyDefinedChannelAsync(workingDirectory);\n }\n case Platform.IOS: {\n return await iosGetNativelyDefinedChannelAsync(workingDirectory);\n }\n default:\n throw new Error(`Platform is not supported.`);\n }\n}\n\nasync function setRuntimeVersionNativelyAsync(\n job: Job,\n runtimeVersion: string,\n workingDirectory: string\n): Promise<void> {\n switch (job.platform) {\n case Platform.ANDROID: {\n await androidSetRuntimeVersionNativelyAsync(runtimeVersion, workingDirectory);\n return;\n }\n case Platform.IOS: {\n await iosSetRuntimeVersionNativelyAsync(runtimeVersion, workingDirectory);\n return;\n }\n default:\n throw new Error(`Platform is not supported.`);\n }\n}\n"]}
1
+ {"version":3,"file":"expoUpdates.js","sourceRoot":"","sources":["../../../src/steps/utils/expoUpdates.ts"],"names":[],"mappings":";;;AAAA,uDAAwE;AAIxE,mDAI2B;AAC3B,uDAI+B;AAExB,KAAK,UAAU,uBAAuB,CAAC,EAC5C,GAAG,EACH,gBAAgB,EAChB,MAAM,EACN,MAAM,EACN,SAAS,EACT,QAAQ,GAYT;;IACC,MAAM,cAAc,GAClB,MAAA,MAAA,MAAM,CAAC,cAAc,mCAAI,MAAA,GAAG,CAAC,OAAO,0CAAE,cAAc,mCAAI,MAAM,CAAC,sBAAsB,CAAC;IAExF,IAAI,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,cAAc,KAAI,QAAQ,CAAC,cAAc,KAAK,cAAc,EAAE,CAAC;QAC3E,MAAM,CAAC,IAAI,CACT,wEAAwE,QAAQ,CAAC,cAAc,2CAA2C,cAAc,IAAI,CAC7J,CAAC;QACF,MAAM,CAAC,IAAI,CACT,gKAAgK,CACjK,CAAC;IACJ,CAAC;IAED,MAAM,iBAAiB,GAAG,MAAA,MAAM,CAAC,OAAO,mCAAI,MAAA,GAAG,CAAC,OAAO,0CAAE,OAAO,CAAC;IAEjE,IAAI,qBAAqB,CAAC,SAAS,EAAE,MAAM,CAAC,EAAE,CAAC;QAC7C,IAAI,iBAAiB,EAAE,CAAC;YACtB,MAAM,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,iBAAiB,EAAE,gBAAgB,CAAC,CAAC;QAC7E,CAAC;aAAM,CAAC;YACN,MAAM,OAAO,GAAG,MAAM,eAAe,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;YAC7D,MAAM,mBAAmB,GAAG,MAAA,GAAG,CAAC,iBAAiB,mCAAI,KAAK,CAAC;YAE3D,IAAI,OAAO,EAAE,CAAC;gBACZ,MAAM,UAAU,GAAG,GAAG,CAAC,QAAQ,KAAK,wBAAQ,CAAC,OAAO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AC,gBAAgB,CAAC,CAAC;QACvE,CAAC;QACD,KAAK,wBAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;YAClB,OAAO,MAAM,IAAA,+CAAiC,EAAC,gBAAgB,CAAC,CAAC;QACnE,CAAC;QACD;YACE,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;IAClD,CAAC;AACH,CAAC;AAED,KAAK,UAAU,8BAA8B,CAC3C,GAAQ,EACR,cAAsB,EACtB,gBAAwB;IAExB,QAAQ,GAAG,CAAC,QAAQ,EAAE,CAAC;QACrB,KAAK,wBAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;YACtB,MAAM,IAAA,mDAAqC,EAAC,cAAc,EAAE,gBAAgB,CAAC,CAAC;YAC9E,OAAO;QACT,CAAC;QACD,KAAK,wBAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;YAClB,MAAM,IAAA,+CAAiC,EAAC,cAAc,EAAE,gBAAgB,CAAC,CAAC;YAC1E,OAAO;QACT,CAAC;QACD;YACE,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;IAClD,CAAC;AACH,CAAC","sourcesContent":["import { BuildJob, Job, Metadata, Platform } from '@expo/eas-build-job';\nimport { bunyan } from '@expo/logger';\nimport { ExpoConfig } from '@expo/config';\n\nimport {\n iosGetNativelyDefinedChannelAsync,\n iosSetChannelNativelyAsync,\n iosSetRuntimeVersionNativelyAsync,\n} from './ios/expoUpdates';\nimport {\n androidGetNativelyDefinedChannelAsync,\n androidSetChannelNativelyAsync,\n androidSetRuntimeVersionNativelyAsync,\n} from './android/expoUpdates';\n\nexport async function configureEASUpdateAsync({\n job,\n workingDirectory,\n logger,\n inputs,\n appConfig,\n metadata,\n}: {\n job: BuildJob;\n workingDirectory: string;\n logger: bunyan;\n inputs: {\n runtimeVersion?: string;\n channel?: string;\n resolvedRuntimeVersion?: string;\n };\n appConfig: ExpoConfig;\n metadata: Metadata | null;\n}): Promise<void> {\n const runtimeVersion =\n inputs.runtimeVersion ?? job.version?.runtimeVersion ?? inputs.resolvedRuntimeVersion;\n\n if (metadata?.runtimeVersion && metadata.runtimeVersion !== runtimeVersion) {\n logger.warn(\n `Runtime version from the app config evaluated on your local machine (${metadata.runtimeVersion}) does not match the one resolved here (${runtimeVersion}).`\n );\n logger.warn(\n \"If you're using conditional app configs, e.g. depending on an environment variable, make sure to set the variable in eas.json or configure it with EAS Secret.\"\n );\n }\n\n const jobOrInputChannel = inputs.channel ?? job.updates?.channel;\n\n if (isEASUpdateConfigured(appConfig, logger)) {\n if (jobOrInputChannel) {\n await configureEASUpdate(job, logger, jobOrInputChannel, workingDirectory);\n } else {\n const channel = await getChannelAsync(job, workingDirectory);\n const isDevelopmentClient = job.developmentClient ?? false;\n\n if (channel) {\n const configFile = job.platform === Platform.ANDROID ? 'AndroidManifest.xml' : 'Expo.plist';\n logger.info(`The channel name for EAS Update in ${configFile} is set to \"${channel}\"`);\n } else if (isDevelopmentClient) {\n // NO-OP: Development clients don't need to have a channel set\n } else {\n const easUpdateUrl = appConfig.updates?.url ?? null;\n const jobProfile = job.buildProfile ?? null;\n logger.warn(\n `This build has an invalid EAS Update configuration: update.url is set to \"${easUpdateUrl}\" in app config, but a channel is not specified${\n jobProfile ? '' : ` for the current build profile \"${jobProfile}\" in eas.json`\n }.`\n );\n logger.warn(`- No channel will be set and EAS Update will be disabled for the build.`);\n logger.warn(\n `- Run \\`eas update:configure\\` to set your channel in eas.json. For more details, see https://docs.expo.dev/eas-update/getting-started/#configure-your-project`\n );\n }\n }\n } else {\n logger.info(`Expo Updates is not configured, skipping configuring Expo Updates.`);\n }\n\n if (runtimeVersion) {\n logger.info('Updating runtimeVersion in Expo.plist');\n await setRuntimeVersionNativelyAsync(job, runtimeVersion, workingDirectory);\n }\n}\n\nexport function isEASUpdateConfigured(appConfig: ExpoConfig, logger: bunyan): boolean {\n const rawUrl = appConfig.updates?.url;\n if (!rawUrl) {\n return false;\n }\n try {\n const url = new URL(rawUrl);\n return ['u.expo.dev', 'staging-u.expo.dev'].includes(url.hostname);\n } catch (err) {\n logger.error({ err }, `Cannot parse expo.updates.url = ${rawUrl} as URL`);\n logger.error(`Assuming EAS Update is not configured`);\n return false;\n }\n}\n\nasync function configureEASUpdate(\n job: Job,\n logger: bunyan,\n channel: string,\n workingDirectory: string\n): Promise<void> {\n const newUpdateRequestHeaders: Record<string, string> = {\n 'expo-channel-name': channel,\n };\n\n const configFile = job.platform === Platform.ANDROID ? 'AndroidManifest.xml' : 'Expo.plist';\n logger.info(\n `Setting the update request headers in '${configFile}' to '${JSON.stringify(\n newUpdateRequestHeaders\n )}'`\n );\n\n switch (job.platform) {\n case Platform.ANDROID: {\n await androidSetChannelNativelyAsync(channel, workingDirectory);\n return;\n }\n case Platform.IOS: {\n await iosSetChannelNativelyAsync(channel, workingDirectory);\n return;\n }\n default:\n throw new Error(`Platform is not supported.`);\n }\n}\n\nasync function getChannelAsync(job: Job, workingDirectory: string): Promise<string | null> {\n switch (job.platform) {\n case Platform.ANDROID: {\n return await androidGetNativelyDefinedChannelAsync(workingDirectory);\n }\n case Platform.IOS: {\n return await iosGetNativelyDefinedChannelAsync(workingDirectory);\n }\n default:\n throw new Error(`Platform is not supported.`);\n }\n}\n\nasync function setRuntimeVersionNativelyAsync(\n job: Job,\n runtimeVersion: string,\n workingDirectory: string\n): Promise<void> {\n switch (job.platform) {\n case Platform.ANDROID: {\n await androidSetRuntimeVersionNativelyAsync(runtimeVersion, workingDirectory);\n return;\n }\n case Platform.IOS: {\n await iosSetRuntimeVersionNativelyAsync(runtimeVersion, workingDirectory);\n return;\n }\n default:\n throw new Error(`Platform is not supported.`);\n }\n}\n"]}
@@ -9,15 +9,6 @@ export declare function setRuntimeVersionNativelyAsync(ctx: BuildContext<Job>, r
9
9
  * Used for when Expo Updates is pointed at an EAS server.
10
10
  */
11
11
  export declare function setChannelNativelyAsync(ctx: BuildContext<BuildJob>): Promise<void>;
12
- /**
13
- * Used for classic Expo Updates
14
- */
15
- export declare function setClassicReleaseChannelNativelyAsync(ctx: BuildContext<BuildJob>): Promise<void>;
16
- /**
17
- * Used for classic Expo Updates
18
- */
19
- export declare function getNativelyDefinedClassicReleaseChannelAsync(ctx: BuildContext<Job>): Promise<string | null>;
20
- export declare function configureClassicExpoUpdatesAsync(ctx: BuildContext<BuildJob>): Promise<void>;
21
12
  export declare function configureEASExpoUpdatesAsync(ctx: BuildContext<BuildJob>): Promise<void>;
22
13
  export declare function configureExpoUpdatesIfInstalledAsync(ctx: BuildContext<BuildJob>, { resolvedRuntimeVersion }: {
23
14
  resolvedRuntimeVersion: string | null;
@@ -33,5 +24,4 @@ export declare function resolveRuntimeVersionForExpoUpdatesIfConfiguredAsync({ c
33
24
  export declare function getChannelAsync(ctx: BuildContext<Job>): Promise<string | null>;
34
25
  export declare function getRuntimeVersionAsync(ctx: BuildContext<Job>): Promise<string | null>;
35
26
  export declare function isEASUpdateConfigured(ctx: BuildContext<Job>): boolean;
36
- export declare function shouldConfigureClassicUpdatesReleaseChannelAsFallback(expoUpdatesPackageVersion: string): boolean;
37
27
  export declare function isModernExpoUpdatesCLIWithRuntimeVersionCommandSupported(expoUpdatesPackageVersion: string): boolean;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.isModernExpoUpdatesCLIWithRuntimeVersionCommandSupported = exports.shouldConfigureClassicUpdatesReleaseChannelAsFallback = exports.isEASUpdateConfigured = exports.getRuntimeVersionAsync = exports.getChannelAsync = exports.resolveRuntimeVersionForExpoUpdatesIfConfiguredAsync = exports.configureExpoUpdatesIfInstalledAsync = exports.configureEASExpoUpdatesAsync = exports.configureClassicExpoUpdatesAsync = exports.getNativelyDefinedClassicReleaseChannelAsync = exports.setClassicReleaseChannelNativelyAsync = exports.setChannelNativelyAsync = exports.setRuntimeVersionNativelyAsync = void 0;
6
+ exports.isModernExpoUpdatesCLIWithRuntimeVersionCommandSupported = exports.isEASUpdateConfigured = exports.getRuntimeVersionAsync = exports.getChannelAsync = exports.resolveRuntimeVersionForExpoUpdatesIfConfiguredAsync = exports.configureExpoUpdatesIfInstalledAsync = exports.configureEASExpoUpdatesAsync = exports.setChannelNativelyAsync = exports.setRuntimeVersionNativelyAsync = void 0;
7
7
  const assert_1 = __importDefault(require("assert"));
8
8
  const eas_build_job_1 = require("@expo/eas-build-job");
9
9
  const semver_1 = __importDefault(require("semver"));
@@ -51,64 +51,6 @@ async function setChannelNativelyAsync(ctx) {
51
51
  }
52
52
  }
53
53
  exports.setChannelNativelyAsync = setChannelNativelyAsync;
54
- /**
55
- * Used for classic Expo Updates
56
- */
57
- async function setClassicReleaseChannelNativelyAsync(ctx) {
58
- (0, assert_1.default)(ctx.job.releaseChannel, 'releaseChannel must be defined');
59
- const configFile = ctx.job.platform === eas_build_job_1.Platform.ANDROID ? 'AndroidManifest.xml' : 'Expo.plist';
60
- ctx.logger.info(`Setting the release channel in '${configFile}' to '${ctx.job.releaseChannel}'`);
61
- switch (ctx.job.platform) {
62
- case eas_build_job_1.Platform.ANDROID: {
63
- await (0, expoUpdates_1.androidSetClassicReleaseChannelNativelyAsync)(ctx);
64
- return;
65
- }
66
- case eas_build_job_1.Platform.IOS: {
67
- await (0, expoUpdates_2.iosSetClassicReleaseChannelNativelyAsync)(ctx);
68
- return;
69
- }
70
- default:
71
- throw new Error(`Platform is not supported.`);
72
- }
73
- }
74
- exports.setClassicReleaseChannelNativelyAsync = setClassicReleaseChannelNativelyAsync;
75
- /**
76
- * Used for classic Expo Updates
77
- */
78
- async function getNativelyDefinedClassicReleaseChannelAsync(ctx) {
79
- switch (ctx.job.platform) {
80
- case eas_build_job_1.Platform.ANDROID: {
81
- return (0, expoUpdates_1.androidGetNativelyDefinedClassicReleaseChannelAsync)(ctx);
82
- }
83
- case eas_build_job_1.Platform.IOS: {
84
- return (0, expoUpdates_2.iosGetNativelyDefinedClassicReleaseChannelAsync)(ctx);
85
- }
86
- default:
87
- throw new Error(`Platform is not supported.`);
88
- }
89
- }
90
- exports.getNativelyDefinedClassicReleaseChannelAsync = getNativelyDefinedClassicReleaseChannelAsync;
91
- async function configureClassicExpoUpdatesAsync(ctx) {
92
- if (ctx.job.releaseChannel) {
93
- await setClassicReleaseChannelNativelyAsync(ctx);
94
- }
95
- else {
96
- /**
97
- * If releaseChannel is not defined:
98
- * 1. Try to infer it from the native value.
99
- * 2. If it is not set, fallback to 'default'.
100
- */
101
- const releaseChannel = await getNativelyDefinedClassicReleaseChannelAsync(ctx);
102
- if (releaseChannel) {
103
- ctx.logger.info(`Using the release channel pre-configured in native project (${releaseChannel})`);
104
- ctx.logger.warn('Please add the "releaseChannel" field to your build profile (eas.json)');
105
- }
106
- else {
107
- ctx.logger.info(`Using default release channel for 'expo-updates' (default)`);
108
- }
109
- }
110
- }
111
- exports.configureClassicExpoUpdatesAsync = configureClassicExpoUpdatesAsync;
112
54
  async function configureEASExpoUpdatesAsync(ctx) {
113
55
  await setChannelNativelyAsync(ctx);
114
56
  }
@@ -140,23 +82,15 @@ async function configureExpoUpdatesIfInstalledAsync(ctx, { resolvedRuntimeVersio
140
82
  // NO-OP: Development clients don't need to have a channel set
141
83
  }
142
84
  else {
143
- if (ctx.job.releaseChannel !== undefined) {
144
- ctx.logger.warn(`This build is configured with EAS Update however has a Classic Updates releaseChannel set instead of having an EAS Update channel.`);
145
- }
146
- else {
147
- const easUpdateUrl = (_g = (_f = ctx.appConfig.updates) === null || _f === void 0 ? void 0 : _f.url) !== null && _g !== void 0 ? _g : null;
148
- const jobProfile = (_h = ctx.job.buildProfile) !== null && _h !== void 0 ? _h : null;
149
- ctx.logger.warn(`This build has an invalid EAS Update configuration: update.url is set to "${easUpdateUrl}" in app config, but a channel is not specified${jobProfile ? '' : ` for the current build profile "${jobProfile}" in eas.json`}.`);
150
- ctx.logger.warn(`- No channel will be set and EAS Update will be disabled for the build.`);
151
- ctx.logger.warn(`- Run \`eas update:configure\` to set your channel in eas.json. For more details, see https://docs.expo.dev/eas-update/getting-started/#configure-your-project`);
152
- }
85
+ const easUpdateUrl = (_g = (_f = ctx.appConfig.updates) === null || _f === void 0 ? void 0 : _f.url) !== null && _g !== void 0 ? _g : null;
86
+ const jobProfile = (_h = ctx.job.buildProfile) !== null && _h !== void 0 ? _h : null;
87
+ ctx.logger.warn(`This build has an invalid EAS Update configuration: update.url is set to "${easUpdateUrl}" in app config, but a channel is not specified${jobProfile ? '' : ` for the current build profile "${jobProfile}" in eas.json`}.`);
88
+ ctx.logger.warn(`- No channel will be set and EAS Update will be disabled for the build.`);
89
+ ctx.logger.warn(`- Run \`eas update:configure\` to set your channel in eas.json. For more details, see https://docs.expo.dev/eas-update/getting-started/#configure-your-project`);
153
90
  ctx.markBuildPhaseHasWarnings();
154
91
  }
155
92
  }
156
93
  }
157
- else if (shouldConfigureClassicUpdatesReleaseChannelAsFallback(expoUpdatesPackageVersion)) {
158
- await configureClassicExpoUpdatesAsync(ctx);
159
- }
160
94
  if ((_j = ctx.job.version) === null || _j === void 0 ? void 0 : _j.runtimeVersion) {
161
95
  ctx.logger.info('Updating runtimeVersion in Expo.plist');
162
96
  await setRuntimeVersionNativelyAsync(ctx, ctx.job.version.runtimeVersion);
@@ -224,15 +158,6 @@ function isEASUpdateConfigured(ctx) {
224
158
  }
225
159
  }
226
160
  exports.isEASUpdateConfigured = isEASUpdateConfigured;
227
- function shouldConfigureClassicUpdatesReleaseChannelAsFallback(expoUpdatesPackageVersion) {
228
- if (expoUpdatesPackageVersion.includes('canary')) {
229
- return false;
230
- }
231
- // Anything before SDK 50 should configure classic updates as a fallback. The first version
232
- // of the expo-updates package published for SDK 50 was 0.19.0
233
- return semver_1.default.lt(expoUpdatesPackageVersion, '0.19.0');
234
- }
235
- exports.shouldConfigureClassicUpdatesReleaseChannelAsFallback = shouldConfigureClassicUpdatesReleaseChannelAsFallback;
236
161
  function isModernExpoUpdatesCLIWithRuntimeVersionCommandSupported(expoUpdatesPackageVersion) {
237
162
  if (expoUpdatesPackageVersion.includes('canary')) {
238
163
  return true;
@@ -1 +1 @@
1
- {"version":3,"file":"expoUpdates.js","sourceRoot":"","sources":["../../src/utils/expoUpdates.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAE5B,uDAAwE;AACxE,oDAA4B;AAK5B,wDAOgC;AAChC,oDAO4B;AAG5B,kIAA0G;AAC1G,6EAA0E;AAEnE,KAAK,UAAU,8BAA8B,CAClD,GAAsB,EACtB,cAAsB;IAEtB,QAAQ,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;QACzB,KAAK,wBAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;YACtB,MAAM,IAAA,mDAAqC,EAAC,GAAG,EAAE,cAAc,CAAC,CAAC;YACjE,OAAO;QACT,CAAC;QACD,KAAK,wBAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;YAClB,MAAM,IAAA,+CAAiC,EAAC,GAAG,EAAE,cAAc,CAAC,CAAC;YAC7D,OAAO;QACT,CAAC;QACD;YACE,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;IAClD,CAAC;AACH,CAAC;AAhBD,wEAgBC;AAED;;GAEG;AACI,KAAK,UAAU,uBAAuB,CAAC,GAA2B;;IACvE,IAAA,gBAAM,EAAC,MAAA,GAAG,CAAC,GAAG,CAAC,OAAO,0CAAE,OAAO,EAAE,iCAAiC,CAAC,CAAC;IACpE,MAAM,uBAAuB,GAA2B;QACtD,mBAAmB,EAAE,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO;KAC7C,CAAC;IAEF,MAAM,UAAU,GAAG,GAAG,CAAC,GAAG,CAAC,QAAQ,KAAK,wBAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,YAAY,CAAC;IAChG,GAAG,CAAC,MAAM,CAAC,IAAI,CACb,0CAA0C,UAAU,SAAS,IAAI,CAAC,SAAS,CACzE,uBAAuB,CACxB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AAC;AAXD,wDAWC;AAED,SAAgB,qBAAqB,CAAC,GAAsB;;IAC1D,MAAM,MAAM,GAAG,MAAA,GAAG,CAAC,SAAS,CAAC,OAAO,0CAAE,GAAG,CAAC;IAC1C,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;QAC5B,OAAO,CAAC,YAAY,EAAE,oBAAoB,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACrE,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,EAAE,mCAAmC,MAAM,SAAS,CAAC,CAAC;QAC9E,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAC1D,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAbD,sDAaC;AAED,SAAgB,qDAAqD,CACnE,yBAAiC;IAEjC,IAAI,yBAAyB,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QACjD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,2FAA2F;IAC3F,8DAA8D;IAC9D,OAAO,gBAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,QAAQ,CAAC,CAAC;AACxD,CAAC;AAVD,sHAUC;AAED,SAAgB,wDAAwD,CACtE,yBAAiC;IAEjC,IAAI,yBAAyB,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QACjD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,uDAAuD;IACvD,OAAO,gBAAM,CAAC,GAAG,CAAC,yBAAyB,EAAE,QAAQ,CAAC,CAAC;AACzD,CAAC;AATD,4HASC","sourcesContent":["import assert from 'assert';\n\nimport { Platform, Job, BuildJob, Workflow } from '@expo/eas-build-job';\nimport semver from 'semver';\nimport { ExpoConfig } from '@expo/config';\nimport { bunyan } from '@expo/logger';\nimport { BuildStepEnv } from '@expo/steps';\n\nimport {\n androidSetRuntimeVersionNativelyAsync,\n androidSetChannelNativelyAsync,\n androidSetClassicReleaseChannelNativelyAsync,\n androidGetNativelyDefinedClassicReleaseChannelAsync,\n androidGetNativelyDefinedRuntimeVersionAsync,\n androidGetNativelyDefinedChannelAsync,\n} from '../android/expoUpdates';\nimport {\n iosSetRuntimeVersionNativelyAsync,\n iosSetChannelNativelyAsync,\n iosSetClassicReleaseChannelNativelyAsync,\n iosGetNativelyDefinedClassicReleaseChannelAsync,\n iosGetNativelyDefinedRuntimeVersionAsync,\n iosGetNativelyDefinedChannelAsync,\n} from '../ios/expoUpdates';\nimport { BuildContext } from '../context';\n\nimport getExpoUpdatesPackageVersionIfInstalledAsync from './getExpoUpdatesPackageVersionIfInstalledAsync';\nimport { resolveRuntimeVersionAsync } from './resolveRuntimeVersionAsync';\n\nexport async function setRuntimeVersionNativelyAsync(\n ctx: BuildContext<Job>,\n runtimeVersion: string\n): Promise<void> {\n switch (ctx.job.platform) {\n case Platform.ANDROID: {\n await androidSetRuntimeVersionNativelyAsync(ctx, runtimeVersion);\n return;\n }\n case Platform.IOS: {\n await iosSetRuntimeVersionNativelyAsync(ctx, runtimeVersion);\n return;\n }\n default:\n throw new Error(`Platform is not supported.`);\n }\n}\n\n/**\n * Used for when Expo Updates is pointed at an EAS server.\n */\nexport async function setChannelNativelyAsync(ctx: BuildContext<BuildJob>): Promise<void> {\n assert(ctx.job.updates?.channel, 'updates.channel must be defined');\n const newUpdateRequestHeaders: Record<string, string> = {\n 'expo-channel-name': ctx.job.updates.channel,\n };\n\n const configFile = ctx.job.platform === Platform.ANDROID ? 'AndroidManifest.xml' : 'Expo.plist';\n ctx.logger.info(\n `Setting the update request headers in '${configFile}' to '${JSON.stringify(\n newUpdateRequestHeaders\n )}'`\n );\n\n switch (ctx.job.platform) {\n case Platform.ANDROID: {\n await androidSetChannelNativelyAsync(ctx);\n return;\n }\n case Platform.IOS: {\n await iosSetChannelNativelyAsync(ctx);\n return;\n }\n default:\n throw new Error(`Platform is not supported.`);\n }\n}\n\n/**\n * Used for classic Expo Updates\n */\nexport async function setClassicReleaseChannelNativelyAsync(\n ctx: BuildContext<BuildJob>\n): Promise<void> {\n assert(ctx.job.releaseChannel, 'releaseChannel must be defined');\n\n const configFile = ctx.job.platform === Platform.ANDROID ? 'AndroidManifest.xml' : 'Expo.plist';\n ctx.logger.info(`Setting the release channel in '${configFile}' to '${ctx.job.releaseChannel}'`);\n\n switch (ctx.job.platform) {\n case Platform.ANDROID: {\n await androidSetClassicReleaseChannelNativelyAsync(ctx);\n return;\n }\n case Platform.IOS: {\n await iosSetClassicReleaseChannelNativelyAsync(ctx);\n return;\n }\n default:\n throw new Error(`Platform is not supported.`);\n }\n}\n\n/**\n * Used for classic Expo Updates\n */\nexport async function getNativelyDefinedClassicReleaseChannelAsync(\n ctx: BuildContext<Job>\n): Promise<string | null> {\n switch (ctx.job.platform) {\n case Platform.ANDROID: {\n return androidGetNativelyDefinedClassicReleaseChannelAsync(ctx);\n }\n case Platform.IOS: {\n return iosGetNativelyDefinedClassicReleaseChannelAsync(ctx);\n }\n default:\n throw new Error(`Platform is not supported.`);\n }\n}\n\nexport async function configureClassicExpoUpdatesAsync(ctx: BuildContext<BuildJob>): Promise<void> {\n if (ctx.job.releaseChannel) {\n await setClassicReleaseChannelNativelyAsync(ctx);\n } else {\n /**\n * If releaseChannel is not defined:\n * 1. Try to infer it from the native value.\n * 2. If it is not set, fallback to 'default'.\n */\n const releaseChannel = await getNativelyDefinedClassicReleaseChannelAsync(ctx);\n if (releaseChannel) {\n ctx.logger.info(\n `Using the release channel pre-configured in native project (${releaseChannel})`\n );\n ctx.logger.warn('Please add the \"releaseChannel\" field to your build profile (eas.json)');\n } else {\n ctx.logger.info(`Using default release channel for 'expo-updates' (default)`);\n }\n }\n}\n\nexport async function configureEASExpoUpdatesAsync(ctx: BuildContext<BuildJob>): Promise<void> {\n await setChannelNativelyAsync(ctx);\n}\n\nexport async function configureExpoUpdatesIfInstalledAsync(\n ctx: BuildContext<BuildJob>,\n { resolvedRuntimeVersion }: { resolvedRuntimeVersion: string | null }\n): Promise<void> {\n const expoUpdatesPackageVersion = await getExpoUpdatesPackageVersionIfInstalledAsync(\n ctx.getReactNativeProjectDirectory(),\n ctx.logger\n );\n if (expoUpdatesPackageVersion === null) {\n return;\n }\n\n const appConfigRuntimeVersion = ctx.job.version?.runtimeVersion ?? resolvedRuntimeVersion;\n if (ctx.metadata?.runtimeVersion && ctx.metadata.runtimeVersion !== appConfigRuntimeVersion) {\n ctx.markBuildPhaseHasWarnings();\n ctx.logger.warn(\n `Runtime version from the app config evaluated on your local machine (${ctx.metadata.runtimeVersion}) does not match the one resolved here (${appConfigRuntimeVersion}).`\n );\n ctx.logger.warn(\n \"If you're using conditional app configs, e.g. depending on an environment variable, make sure to set the variable in eas.json or configure it with EAS Secret.\"\n );\n }\n\n if (isEASUpdateConfigured(ctx)) {\n if (ctx.job.updates?.channel !== undefined) {\n await configureEASExpoUpdatesAsync(ctx);\n } else {\n const channel = await getChannelAsync(ctx);\n const isDevelopmentClient = ctx.job.developmentClient ?? false;\n\n if (channel !== null) {\n const configFile =\n ctx.job.platform === Platform.ANDROID ? 'AndroidManifest.xml' : 'Expo.plist';\n ctx.logger.info(`The channel name for EAS Update in ${configFile} is set to \"${channel}\"`);\n } else if (isDevelopmentClient) {\n // NO-OP: Development clients don't need to have a channel set\n } else {\n if (ctx.job.releaseChannel !== undefined) {\n ctx.logger.warn(\n `This build is configured with EAS Update however has a Classic Updates releaseChannel set instead of having an EAS Update channel.`\n );\n } else {\n const easUpdateUrl = ctx.appConfig.updates?.url ?? null;\n const jobProfile = ctx.job.buildProfile ?? null;\n ctx.logger.warn(\n `This build has an invalid EAS Update configuration: update.url is set to \"${easUpdateUrl}\" in app config, but a channel is not specified${\n jobProfile ? '' : ` for the current build profile \"${jobProfile}\" in eas.json`\n }.`\n );\n ctx.logger.warn(\n `- No channel will be set and EAS Update will be disabled for the build.`\n );\n ctx.logger.warn(\n `- Run \\`eas update:configure\\` to set your channel in eas.json. For more details, see https://docs.expo.dev/eas-update/getting-started/#configure-your-project`\n );\n }\n ctx.markBuildPhaseHasWarnings();\n }\n }\n } else if (shouldConfigureClassicUpdatesReleaseChannelAsFallback(expoUpdatesPackageVersion)) {\n await configureClassicExpoUpdatesAsync(ctx);\n }\n\n if (ctx.job.version?.runtimeVersion) {\n ctx.logger.info('Updating runtimeVersion in Expo.plist');\n await setRuntimeVersionNativelyAsync(ctx, ctx.job.version.runtimeVersion);\n }\n}\n\nexport async function resolveRuntimeVersionForExpoUpdatesIfConfiguredAsync({\n cwd,\n appConfig,\n platform,\n workflow,\n logger,\n env,\n}: {\n cwd: string;\n appConfig: ExpoConfig;\n platform: Platform;\n workflow: Workflow;\n logger: bunyan;\n env: BuildStepEnv;\n}): Promise<string | null> {\n const expoUpdatesPackageVersion = await getExpoUpdatesPackageVersionIfInstalledAsync(cwd, logger);\n if (expoUpdatesPackageVersion === null) {\n return null;\n }\n\n const resolvedRuntimeVersion = await resolveRuntimeVersionAsync({\n projectDir: cwd,\n exp: appConfig,\n platform,\n workflow,\n logger,\n expoUpdatesPackageVersion,\n env,\n });\n\n logger.info(`Resolved runtime version: ${resolvedRuntimeVersion}`);\n return resolvedRuntimeVersion;\n}\n\nexport async function getChannelAsync(ctx: BuildContext<Job>): Promise<string | null> {\n switch (ctx.job.platform) {\n case Platform.ANDROID: {\n return await androidGetNativelyDefinedChannelAsync(ctx);\n }\n case Platform.IOS: {\n return await iosGetNativelyDefinedChannelAsync(ctx);\n }\n default:\n throw new Error(`Platform is not supported.`);\n }\n}\n\nexport async function getRuntimeVersionAsync(ctx: BuildContext<Job>): Promise<string | null> {\n switch (ctx.job.platform) {\n case Platform.ANDROID: {\n return await androidGetNativelyDefinedRuntimeVersionAsync(ctx);\n }\n case Platform.IOS: {\n return await iosGetNativelyDefinedRuntimeVersionAsync(ctx);\n }\n default:\n throw new Error(`Platform is not supported.`);\n }\n}\n\nexport function isEASUpdateConfigured(ctx: BuildContext<Job>): boolean {\n const rawUrl = ctx.appConfig.updates?.url;\n if (!rawUrl) {\n return false;\n }\n try {\n const url = new URL(rawUrl);\n return ['u.expo.dev', 'staging-u.expo.dev'].includes(url.hostname);\n } catch (err) {\n ctx.logger.error({ err }, `Cannot parse expo.updates.url = ${rawUrl} as URL`);\n ctx.logger.error(`Assuming EAS Update is not configured`);\n return false;\n }\n}\n\nexport function shouldConfigureClassicUpdatesReleaseChannelAsFallback(\n expoUpdatesPackageVersion: string\n): boolean {\n if (expoUpdatesPackageVersion.includes('canary')) {\n return false;\n }\n\n // Anything before SDK 50 should configure classic updates as a fallback. The first version\n // of the expo-updates package published for SDK 50 was 0.19.0\n return semver.lt(expoUpdatesPackageVersion, '0.19.0');\n}\n\nexport function isModernExpoUpdatesCLIWithRuntimeVersionCommandSupported(\n expoUpdatesPackageVersion: string\n): boolean {\n if (expoUpdatesPackageVersion.includes('canary')) {\n return true;\n }\n\n // Anything SDK 51 or greater uses the expo-updates CLI\n return semver.gte(expoUpdatesPackageVersion, '0.25.4');\n}\n"]}
1
+ {"version":3,"file":"expoUpdates.js","sourceRoot":"","sources":["../../src/utils/expoUpdates.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAE5B,uDAAwE;AACxE,oDAA4B;AAK5B,wDAKgC;AAChC,oDAK4B;AAG5B,kIAA0G;AAC1G,6EAA0E;AAEnE,KAAK,UAAU,8BAA8B,CAClD,GAAsB,EACtB,cAAsB;IAEtB,QAAQ,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;QACzB,KAAK,wBAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;YACtB,MAAM,IAAA,mDAAqC,EAAC,GAAG,EAAE,cAAc,CAAC,CAAC;YACjE,OAAO;QACT,CAAC;QACD,KAAK,wBAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;YA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E,GAAG,CAAC;IAC1C,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;QAC5B,OAAO,CAAC,YAAY,EAAE,oBAAoB,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACrE,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,EAAE,mCAAmC,MAAM,SAAS,CAAC,CAAC;QAC9E,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAC1D,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAbD,sDAaC;AAED,SAAgB,wDAAwD,CACtE,yBAAiC;IAEjC,IAAI,yBAAyB,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QACjD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,uDAAuD;IACvD,OAAO,gBAAM,CAAC,GAAG,CAAC,yBAAyB,EAAE,QAAQ,CAAC,CAAC;AACzD,CAAC;AATD,4HASC","sourcesContent":["import assert from 'assert';\n\nimport { Platform, Job, BuildJob, Workflow } from '@expo/eas-build-job';\nimport semver from 'semver';\nimport { ExpoConfig } from '@expo/config';\nimport { bunyan } from '@expo/logger';\nimport { BuildStepEnv } from '@expo/steps';\n\nimport {\n androidSetRuntimeVersionNativelyAsync,\n androidSetChannelNativelyAsync,\n androidGetNativelyDefinedRuntimeVersionAsync,\n androidGetNativelyDefinedChannelAsync,\n} from '../android/expoUpdates';\nimport {\n iosSetRuntimeVersionNativelyAsync,\n iosSetChannelNativelyAsync,\n iosGetNativelyDefinedRuntimeVersionAsync,\n iosGetNativelyDefinedChannelAsync,\n} from '../ios/expoUpdates';\nimport { BuildContext } from '../context';\n\nimport getExpoUpdatesPackageVersionIfInstalledAsync from './getExpoUpdatesPackageVersionIfInstalledAsync';\nimport { resolveRuntimeVersionAsync } from './resolveRuntimeVersionAsync';\n\nexport async function setRuntimeVersionNativelyAsync(\n ctx: BuildContext<Job>,\n runtimeVersion: string\n): Promise<void> {\n switch (ctx.job.platform) {\n case Platform.ANDROID: {\n await androidSetRuntimeVersionNativelyAsync(ctx, runtimeVersion);\n return;\n }\n case Platform.IOS: {\n await iosSetRuntimeVersionNativelyAsync(ctx, runtimeVersion);\n return;\n }\n default:\n throw new Error(`Platform is not supported.`);\n }\n}\n\n/**\n * Used for when Expo Updates is pointed at an EAS server.\n */\nexport async function setChannelNativelyAsync(ctx: BuildContext<BuildJob>): Promise<void> {\n assert(ctx.job.updates?.channel, 'updates.channel must be defined');\n const newUpdateRequestHeaders: Record<string, string> = {\n 'expo-channel-name': ctx.job.updates.channel,\n };\n\n const configFile = ctx.job.platform === Platform.ANDROID ? 'AndroidManifest.xml' : 'Expo.plist';\n ctx.logger.info(\n `Setting the update request headers in '${configFile}' to '${JSON.stringify(\n newUpdateRequestHeaders\n )}'`\n );\n\n switch (ctx.job.platform) {\n case Platform.ANDROID: {\n await androidSetChannelNativelyAsync(ctx);\n return;\n }\n case Platform.IOS: {\n await iosSetChannelNativelyAsync(ctx);\n return;\n }\n default:\n throw new Error(`Platform is not supported.`);\n }\n}\n\nexport async function configureEASExpoUpdatesAsync(ctx: BuildContext<BuildJob>): Promise<void> {\n await setChannelNativelyAsync(ctx);\n}\n\nexport async function configureExpoUpdatesIfInstalledAsync(\n ctx: BuildContext<BuildJob>,\n { resolvedRuntimeVersion }: { resolvedRuntimeVersion: string | null }\n): Promise<void> {\n const expoUpdatesPackageVersion = await getExpoUpdatesPackageVersionIfInstalledAsync(\n ctx.getReactNativeProjectDirectory(),\n ctx.logger\n );\n if (expoUpdatesPackageVersion === null) {\n return;\n }\n\n const appConfigRuntimeVersion = ctx.job.version?.runtimeVersion ?? resolvedRuntimeVersion;\n if (ctx.metadata?.runtimeVersion && ctx.metadata.runtimeVersion !== appConfigRuntimeVersion) {\n ctx.markBuildPhaseHasWarnings();\n ctx.logger.warn(\n `Runtime version from the app config evaluated on your local machine (${ctx.metadata.runtimeVersion}) does not match the one resolved here (${appConfigRuntimeVersion}).`\n );\n ctx.logger.warn(\n \"If you're using conditional app configs, e.g. depending on an environment variable, make sure to set the variable in eas.json or configure it with EAS Secret.\"\n );\n }\n\n if (isEASUpdateConfigured(ctx)) {\n if (ctx.job.updates?.channel !== undefined) {\n await configureEASExpoUpdatesAsync(ctx);\n } else {\n const channel = await getChannelAsync(ctx);\n const isDevelopmentClient = ctx.job.developmentClient ?? false;\n\n if (channel !== null) {\n const configFile =\n ctx.job.platform === Platform.ANDROID ? 'AndroidManifest.xml' : 'Expo.plist';\n ctx.logger.info(`The channel name for EAS Update in ${configFile} is set to \"${channel}\"`);\n } else if (isDevelopmentClient) {\n // NO-OP: Development clients don't need to have a channel set\n } else {\n const easUpdateUrl = ctx.appConfig.updates?.url ?? null;\n const jobProfile = ctx.job.buildProfile ?? null;\n ctx.logger.warn(\n `This build has an invalid EAS Update configuration: update.url is set to \"${easUpdateUrl}\" in app config, but a channel is not specified${\n jobProfile ? '' : ` for the current build profile \"${jobProfile}\" in eas.json`\n }.`\n );\n ctx.logger.warn(`- No channel will be set and EAS Update will be disabled for the build.`);\n ctx.logger.warn(\n `- Run \\`eas update:configure\\` to set your channel in eas.json. For more details, see https://docs.expo.dev/eas-update/getting-started/#configure-your-project`\n );\n\n ctx.markBuildPhaseHasWarnings();\n }\n }\n }\n\n if (ctx.job.version?.runtimeVersion) {\n ctx.logger.info('Updating runtimeVersion in Expo.plist');\n await setRuntimeVersionNativelyAsync(ctx, ctx.job.version.runtimeVersion);\n }\n}\n\nexport async function resolveRuntimeVersionForExpoUpdatesIfConfiguredAsync({\n cwd,\n appConfig,\n platform,\n workflow,\n logger,\n env,\n}: {\n cwd: string;\n appConfig: ExpoConfig;\n platform: Platform;\n workflow: Workflow;\n logger: bunyan;\n env: BuildStepEnv;\n}): Promise<string | null> {\n const expoUpdatesPackageVersion = await getExpoUpdatesPackageVersionIfInstalledAsync(cwd, logger);\n if (expoUpdatesPackageVersion === null) {\n return null;\n }\n\n const resolvedRuntimeVersion = await resolveRuntimeVersionAsync({\n projectDir: cwd,\n exp: appConfig,\n platform,\n workflow,\n logger,\n expoUpdatesPackageVersion,\n env,\n });\n\n logger.info(`Resolved runtime version: ${resolvedRuntimeVersion}`);\n return resolvedRuntimeVersion;\n}\n\nexport async function getChannelAsync(ctx: BuildContext<Job>): Promise<string | null> {\n switch (ctx.job.platform) {\n case Platform.ANDROID: {\n return await androidGetNativelyDefinedChannelAsync(ctx);\n }\n case Platform.IOS: {\n return await iosGetNativelyDefinedChannelAsync(ctx);\n }\n default:\n throw new Error(`Platform is not supported.`);\n }\n}\n\nexport async function getRuntimeVersionAsync(ctx: BuildContext<Job>): Promise<string | null> {\n switch (ctx.job.platform) {\n case Platform.ANDROID: {\n return await androidGetNativelyDefinedRuntimeVersionAsync(ctx);\n }\n case Platform.IOS: {\n return await iosGetNativelyDefinedRuntimeVersionAsync(ctx);\n }\n default:\n throw new Error(`Platform is not supported.`);\n }\n}\n\nexport function isEASUpdateConfigured(ctx: BuildContext<Job>): boolean {\n const rawUrl = ctx.appConfig.updates?.url;\n if (!rawUrl) {\n return false;\n }\n try {\n const url = new URL(rawUrl);\n return ['u.expo.dev', 'staging-u.expo.dev'].includes(url.hostname);\n } catch (err) {\n ctx.logger.error({ err }, `Cannot parse expo.updates.url = ${rawUrl} as URL`);\n ctx.logger.error(`Assuming EAS Update is not configured`);\n return false;\n }\n}\n\nexport function isModernExpoUpdatesCLIWithRuntimeVersionCommandSupported(\n expoUpdatesPackageVersion: string\n): boolean {\n if (expoUpdatesPackageVersion.includes('canary')) {\n return true;\n }\n\n // Anything SDK 51 or greater uses the expo-updates CLI\n return semver.gte(expoUpdatesPackageVersion, '0.25.4');\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expo/build-tools",
3
- "version": "1.0.104",
3
+ "version": "1.0.106",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
@@ -25,12 +25,12 @@
25
25
  "@expo/config": "8.5.4",
26
26
  "@expo/config-plugins": "7.8.4",
27
27
  "@expo/downloader": "1.0.57",
28
- "@expo/eas-build-job": "1.0.102",
28
+ "@expo/eas-build-job": "1.0.106",
29
29
  "@expo/env": "^0.0.5",
30
30
  "@expo/logger": "1.0.57",
31
31
  "@expo/package-manager": "1.1.2",
32
32
  "@expo/plist": "^0.0.20",
33
- "@expo/steps": "1.0.102",
33
+ "@expo/steps": "1.0.106",
34
34
  "@expo/template-file": "1.0.57",
35
35
  "@expo/turtle-spawn": "1.0.57",
36
36
  "@expo/xcpretty": "^4.3.0",
@@ -70,5 +70,5 @@
70
70
  "node": "20.11.0",
71
71
  "yarn": "1.22.21"
72
72
  },
73
- "gitHead": "15cad0379e5b65fbdb92688053771685eee5e25b"
73
+ "gitHead": "014500f7b697411d5cfa0dc2a1650d556e85c238"
74
74
  }
@@ -0,0 +1,13 @@
1
+ build:
2
+ name: EAS Update – Publish
3
+ steps:
4
+ - eas/checkout
5
+
6
+ - eas/use_npm_token
7
+
8
+ - eas/install_node_modules
9
+
10
+ - run:
11
+ name: Publish update
12
+ command: |
13
+ EXPO_TOKEN="${ eas.job.secrets.robotAccessToken }" npx -y eas-cli@latest update --auto
@@ -1,10 +0,0 @@
1
- build:
2
- name: EAS Update in the Cloud
3
- steps:
4
- - eas/checkout
5
-
6
- - eas/use_npm_token
7
-
8
- - eas/install_node_modules
9
-
10
- - run: eas update --auto