@expo/build-tools 1.0.107 → 1.0.108
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.
|
@@ -7,7 +7,6 @@ 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"));
|
|
11
10
|
const eas_build_job_1 = require("@expo/eas-build-job");
|
|
12
11
|
const downloader_1 = __importDefault(require("@expo/downloader"));
|
|
13
12
|
async function prepareProjectSourcesAsync(ctx, destinationDirectory = ctx.buildDirectory) {
|
|
@@ -30,24 +29,11 @@ async function prepareProjectSourcesAsync(ctx, destinationDirectory = ctx.buildD
|
|
|
30
29
|
}
|
|
31
30
|
exports.prepareProjectSourcesAsync = prepareProjectSourcesAsync;
|
|
32
31
|
async function shallowCloneRepositoryAsync({ logger, archiveSource, destinationDirectory, }) {
|
|
33
|
-
var _a;
|
|
34
32
|
const { repositoryUrl } = archiveSource;
|
|
35
33
|
try {
|
|
36
34
|
await (0, turtle_spawn_1.default)('git', ['init'], { cwd: destinationDirectory });
|
|
37
35
|
await (0, turtle_spawn_1.default)('git', ['remote', 'add', 'origin', repositoryUrl], { cwd: destinationDirectory });
|
|
38
|
-
|
|
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
|
-
}
|
|
36
|
+
const { gitRef, gitCommitHash } = archiveSource;
|
|
51
37
|
await (0, turtle_spawn_1.default)('git', ['fetch', 'origin', '--depth', '1', '--no-tags', gitCommitHash], {
|
|
52
38
|
cwd: destinationDirectory,
|
|
53
39
|
});
|
|
@@ -1 +1 @@
|
|
|
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,2BA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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;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"]}
|
|
1
|
+
{"version":3,"file":"projectSources.js","sourceRoot":"","sources":["../../src/common/projectSources.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,sEAAuC;AACvC,wDAA0B;AAC1B,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,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,aAAa,EAAE,GAAG,CAAC,GAAG,CAAC,c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,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 { 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 const { gitRef, gitCommitHash } = archiveSource;\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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/build-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.108",
|
|
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.
|
|
28
|
+
"@expo/eas-build-job": "1.0.108",
|
|
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.
|
|
33
|
+
"@expo/steps": "1.0.108",
|
|
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": "
|
|
73
|
+
"gitHead": "74d8c65802f43a3e2419e6e4939d77b4135a2935"
|
|
74
74
|
}
|