@expo/steps 0.0.7 → 0.0.8

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.
Files changed (163) hide show
  1. package/dist_commonjs/BuildArtifacts.cjs +9 -0
  2. package/dist_commonjs/BuildArtifacts.d.ts +5 -0
  3. package/dist_commonjs/BuildArtifacts.js.map +1 -0
  4. package/dist_commonjs/BuildConfig.cjs +108 -0
  5. package/dist_commonjs/BuildConfig.d.ts +53 -0
  6. package/dist_commonjs/BuildConfig.js.map +1 -0
  7. package/dist_commonjs/BuildConfigParser.cjs +154 -0
  8. package/dist_commonjs/BuildConfigParser.d.ts +19 -0
  9. package/dist_commonjs/BuildConfigParser.js.map +1 -0
  10. package/dist_commonjs/BuildFunction.cjs +40 -0
  11. package/dist_commonjs/BuildFunction.d.ts +32 -0
  12. package/dist_commonjs/BuildFunction.js.map +1 -0
  13. package/dist_commonjs/BuildPlatform.cjs +9 -0
  14. package/dist_commonjs/BuildPlatform.d.ts +4 -0
  15. package/dist_commonjs/BuildPlatform.js.map +1 -0
  16. package/dist_commonjs/BuildStep.cjs +179 -0
  17. package/dist_commonjs/BuildStep.d.ts +48 -0
  18. package/dist_commonjs/BuildStep.js.map +1 -0
  19. package/dist_commonjs/BuildStepContext.cjs +32 -0
  20. package/dist_commonjs/BuildStepContext.d.ts +13 -0
  21. package/dist_commonjs/BuildStepContext.js.map +1 -0
  22. package/dist_commonjs/BuildStepEnv.cjs +3 -0
  23. package/dist_commonjs/BuildStepEnv.d.ts +1 -0
  24. package/dist_commonjs/BuildStepEnv.js.map +1 -0
  25. package/dist_commonjs/BuildStepInput.cjs +36 -0
  26. package/dist_commonjs/BuildStepInput.d.ts +18 -0
  27. package/dist_commonjs/BuildStepInput.js.map +1 -0
  28. package/dist_commonjs/BuildStepOutput.cjs +29 -0
  29. package/dist_commonjs/BuildStepOutput.d.ts +16 -0
  30. package/dist_commonjs/BuildStepOutput.js.map +1 -0
  31. package/dist_commonjs/BuildTemporaryFiles.cjs +100 -0
  32. package/dist_commonjs/BuildTemporaryFiles.d.ts +8 -0
  33. package/dist_commonjs/BuildTemporaryFiles.js.map +1 -0
  34. package/dist_commonjs/BuildWorkflow.cjs +32 -0
  35. package/dist_commonjs/BuildWorkflow.d.ts +17 -0
  36. package/dist_commonjs/BuildWorkflow.js.map +1 -0
  37. package/dist_commonjs/BuildWorkflowValidator.cjs +76 -0
  38. package/dist_commonjs/BuildWorkflowValidator.d.ts +8 -0
  39. package/dist_commonjs/BuildWorkflowValidator.js.map +1 -0
  40. package/dist_commonjs/bin/uploadArtifact.cjs +30 -0
  41. package/dist_commonjs/bin/uploadArtifact.d.ts +1 -0
  42. package/dist_commonjs/bin/uploadArtifact.js.map +1 -0
  43. package/dist_commonjs/cli/cli.cjs +37 -0
  44. package/dist_commonjs/cli/cli.d.ts +1 -0
  45. package/dist_commonjs/cli/cli.js.map +1 -0
  46. package/dist_commonjs/errors/BuildConfigError.cjs +8 -0
  47. package/dist_commonjs/errors/BuildConfigError.d.ts +3 -0
  48. package/dist_commonjs/errors/BuildConfigError.js.map +1 -0
  49. package/dist_commonjs/errors/BuildInternalError.cjs +7 -0
  50. package/dist_commonjs/errors/BuildInternalError.d.ts +2 -0
  51. package/dist_commonjs/errors/BuildInternalError.js.map +1 -0
  52. package/dist_commonjs/errors/BuildStepRuntimeError.cjs +8 -0
  53. package/dist_commonjs/errors/BuildStepRuntimeError.d.ts +3 -0
  54. package/dist_commonjs/errors/BuildStepRuntimeError.js.map +1 -0
  55. package/dist_commonjs/errors/BuildWorkflowError.cjs +13 -0
  56. package/dist_commonjs/errors/BuildWorkflowError.d.ts +10 -0
  57. package/dist_commonjs/errors/BuildWorkflowError.js.map +1 -0
  58. package/dist_commonjs/errors/UserError.cjs +14 -0
  59. package/dist_commonjs/errors/UserError.d.ts +9 -0
  60. package/dist_commonjs/errors/UserError.js.map +1 -0
  61. package/dist_commonjs/index.cjs +10 -0
  62. package/dist_commonjs/index.d.ts +3 -0
  63. package/dist_commonjs/index.js.map +1 -0
  64. package/dist_commonjs/utils/expodash/uniq.cjs +9 -0
  65. package/dist_commonjs/utils/expodash/uniq.d.ts +1 -0
  66. package/dist_commonjs/utils/expodash/uniq.js.map +1 -0
  67. package/dist_commonjs/utils/nullthrows.cjs +11 -0
  68. package/dist_commonjs/utils/nullthrows.d.ts +1 -0
  69. package/dist_commonjs/utils/nullthrows.js.map +1 -0
  70. package/dist_commonjs/utils/shell/bin.cjs +11 -0
  71. package/dist_commonjs/utils/shell/bin.d.ts +1 -0
  72. package/dist_commonjs/utils/shell/bin.js.map +1 -0
  73. package/dist_commonjs/utils/shell/command.cjs +36 -0
  74. package/dist_commonjs/utils/shell/command.d.ts +6 -0
  75. package/dist_commonjs/utils/shell/command.js.map +1 -0
  76. package/dist_commonjs/utils/shell/spawn.cjs +25 -0
  77. package/dist_commonjs/utils/shell/spawn.d.ts +9 -0
  78. package/dist_commonjs/utils/shell/spawn.js.map +1 -0
  79. package/dist_commonjs/utils/template.cjs +47 -0
  80. package/dist_commonjs/utils/template.d.ts +11 -0
  81. package/dist_commonjs/utils/template.js.map +1 -0
  82. package/dist_esm/BuildArtifacts.d.ts +5 -0
  83. package/dist_esm/BuildArtifacts.js +6 -0
  84. package/dist_esm/BuildArtifacts.js.map +1 -0
  85. package/dist_esm/BuildConfig.d.ts +53 -0
  86. package/dist_esm/BuildConfig.js +97 -0
  87. package/dist_esm/BuildConfig.js.map +1 -0
  88. package/dist_esm/BuildConfigParser.d.ts +19 -0
  89. package/dist_esm/BuildConfigParser.js +147 -0
  90. package/dist_esm/BuildConfigParser.js.map +1 -0
  91. package/dist_esm/BuildFunction.d.ts +32 -0
  92. package/dist_esm/BuildFunction.js +36 -0
  93. package/dist_esm/BuildFunction.js.map +1 -0
  94. package/dist_esm/BuildPlatform.d.ts +4 -0
  95. package/dist_esm/BuildPlatform.js +6 -0
  96. package/dist_esm/BuildPlatform.js.map +1 -0
  97. package/dist_esm/BuildStep.d.ts +48 -0
  98. package/dist_esm/BuildStep.js +172 -0
  99. package/dist_esm/BuildStep.js.map +1 -0
  100. package/dist_esm/BuildStepContext.d.ts +13 -0
  101. package/dist_esm/BuildStepContext.js +25 -0
  102. package/dist_esm/BuildStepContext.js.map +1 -0
  103. package/dist_esm/BuildStepEnv.d.ts +1 -0
  104. package/dist_esm/BuildStepEnv.js +2 -0
  105. package/dist_esm/BuildStepEnv.js.map +1 -0
  106. package/dist_esm/BuildStepInput.d.ts +18 -0
  107. package/dist_esm/BuildStepInput.js +32 -0
  108. package/dist_esm/BuildStepInput.js.map +1 -0
  109. package/dist_esm/BuildStepOutput.d.ts +16 -0
  110. package/dist_esm/BuildStepOutput.js +25 -0
  111. package/dist_esm/BuildStepOutput.js.map +1 -0
  112. package/dist_esm/BuildTemporaryFiles.d.ts +8 -0
  113. package/dist_esm/BuildTemporaryFiles.js +88 -0
  114. package/dist_esm/BuildTemporaryFiles.js.map +1 -0
  115. package/dist_esm/BuildWorkflow.d.ts +17 -0
  116. package/dist_esm/BuildWorkflow.js +28 -0
  117. package/dist_esm/BuildWorkflow.js.map +1 -0
  118. package/dist_esm/BuildWorkflowValidator.d.ts +8 -0
  119. package/dist_esm/BuildWorkflowValidator.js +72 -0
  120. package/dist_esm/BuildWorkflowValidator.js.map +1 -0
  121. package/dist_esm/bin/uploadArtifact.d.ts +1 -0
  122. package/dist_esm/bin/uploadArtifact.js +25 -0
  123. package/dist_esm/bin/uploadArtifact.js.map +1 -0
  124. package/dist_esm/cli/cli.d.ts +1 -0
  125. package/dist_esm/cli/cli.js +32 -0
  126. package/dist_esm/cli/cli.js.map +1 -0
  127. package/dist_esm/errors/BuildConfigError.d.ts +3 -0
  128. package/dist_esm/errors/BuildConfigError.js +4 -0
  129. package/dist_esm/errors/BuildConfigError.js.map +1 -0
  130. package/dist_esm/errors/BuildInternalError.d.ts +2 -0
  131. package/dist_esm/errors/BuildInternalError.js +3 -0
  132. package/dist_esm/errors/BuildInternalError.js.map +1 -0
  133. package/dist_esm/errors/BuildStepRuntimeError.d.ts +3 -0
  134. package/dist_esm/errors/BuildStepRuntimeError.js +4 -0
  135. package/dist_esm/errors/BuildStepRuntimeError.js.map +1 -0
  136. package/dist_esm/errors/BuildWorkflowError.d.ts +10 -0
  137. package/dist_esm/errors/BuildWorkflowError.js +9 -0
  138. package/dist_esm/errors/BuildWorkflowError.js.map +1 -0
  139. package/dist_esm/errors/UserError.d.ts +9 -0
  140. package/dist_esm/errors/UserError.js +10 -0
  141. package/dist_esm/errors/UserError.js.map +1 -0
  142. package/dist_esm/index.d.ts +3 -0
  143. package/dist_esm/index.js +4 -0
  144. package/dist_esm/index.js.map +1 -0
  145. package/dist_esm/utils/expodash/uniq.d.ts +1 -0
  146. package/dist_esm/utils/expodash/uniq.js +5 -0
  147. package/dist_esm/utils/expodash/uniq.js.map +1 -0
  148. package/dist_esm/utils/nullthrows.d.ts +1 -0
  149. package/dist_esm/utils/nullthrows.js +7 -0
  150. package/dist_esm/utils/nullthrows.js.map +1 -0
  151. package/dist_esm/utils/shell/bin.d.ts +1 -0
  152. package/dist_esm/utils/shell/bin.js +5 -0
  153. package/dist_esm/utils/shell/bin.js.map +1 -0
  154. package/dist_esm/utils/shell/command.d.ts +6 -0
  155. package/dist_esm/utils/shell/command.js +28 -0
  156. package/dist_esm/utils/shell/command.js.map +1 -0
  157. package/dist_esm/utils/shell/spawn.d.ts +9 -0
  158. package/dist_esm/utils/shell/spawn.js +18 -0
  159. package/dist_esm/utils/shell/spawn.js.map +1 -0
  160. package/dist_esm/utils/template.d.ts +11 -0
  161. package/dist_esm/utils/template.js +40 -0
  162. package/dist_esm/utils/template.js.map +1 -0
  163. package/package.json +2 -1
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BuildWorkflowValidator = void 0;
4
+ const BuildConfigError_js_1 = require("./errors/BuildConfigError.cjs");
5
+ const BuildWorkflowError_js_1 = require("./errors/BuildWorkflowError.cjs");
6
+ const template_js_1 = require("./utils/template.cjs");
7
+ class BuildWorkflowValidator {
8
+ constructor(workflow) {
9
+ this.workflow = workflow;
10
+ }
11
+ validate() {
12
+ const errors = [];
13
+ errors.push(...this.validateUniqueStepIds());
14
+ errors.push(...this.validateInputs());
15
+ if (errors.length !== 0) {
16
+ throw new BuildWorkflowError_js_1.BuildWorkflowError('Build workflow is invalid', errors);
17
+ }
18
+ }
19
+ validateUniqueStepIds() {
20
+ const stepIds = this.workflow.buildSteps.map(({ id }) => id);
21
+ const visitedStepIdsSet = new Set();
22
+ const duplicatedStepIdsSet = new Set();
23
+ for (const stepId of stepIds) {
24
+ if (visitedStepIdsSet.has(stepId)) {
25
+ duplicatedStepIdsSet.add(stepId);
26
+ }
27
+ else {
28
+ visitedStepIdsSet.add(stepId);
29
+ }
30
+ }
31
+ const duplicatedStepIds = [...duplicatedStepIdsSet];
32
+ if (duplicatedStepIds.length === 0) {
33
+ return [];
34
+ }
35
+ else {
36
+ const error = new BuildConfigError_js_1.BuildConfigError(`Duplicated step IDs: ${duplicatedStepIds.map((i) => `"${i}"`).join(', ')}`);
37
+ return [error];
38
+ }
39
+ }
40
+ validateInputs() {
41
+ var _a;
42
+ const errors = [];
43
+ const allStepIds = new Set(this.workflow.buildSteps.map((s) => s.id));
44
+ const stepByStepId = {};
45
+ for (const step of this.workflow.buildSteps) {
46
+ for (const input of (_a = step.inputs) !== null && _a !== void 0 ? _a : []) {
47
+ if (input.defaultValue === undefined) {
48
+ continue;
49
+ }
50
+ const paths = (0, template_js_1.findOutputPaths)(input.defaultValue);
51
+ for (const { stepId, outputId } of paths) {
52
+ if (!(stepId in stepByStepId)) {
53
+ if (allStepIds.has(stepId)) {
54
+ const error = new BuildConfigError_js_1.BuildConfigError(`Input parameter "${input.id}" for step "${step.id}" uses an expression that references an output parameter from the future step "${stepId}".`);
55
+ errors.push(error);
56
+ }
57
+ else {
58
+ const error = new BuildConfigError_js_1.BuildConfigError(`Input parameter "${input.id}" for step "${step.id}" uses an expression that references an output parameter from a non-existent step "${stepId}".`);
59
+ errors.push(error);
60
+ }
61
+ }
62
+ else {
63
+ if (!stepByStepId[stepId].hasOutputParameter(outputId)) {
64
+ const error = new BuildConfigError_js_1.BuildConfigError(`Input parameter "${input.id}" for step "${step.id}" uses an expression that references an undefined output parameter "${outputId}" from step "${stepId}".`);
65
+ errors.push(error);
66
+ }
67
+ }
68
+ }
69
+ }
70
+ stepByStepId[step.id] = step;
71
+ }
72
+ return errors;
73
+ }
74
+ }
75
+ exports.BuildWorkflowValidator = BuildWorkflowValidator;
76
+ //# sourceMappingURL=BuildWorkflowValidator.js.map
@@ -0,0 +1,8 @@
1
+ import { BuildWorkflow } from './BuildWorkflow.js';
2
+ export declare class BuildWorkflowValidator {
3
+ private readonly workflow;
4
+ constructor(workflow: BuildWorkflow);
5
+ validate(): void;
6
+ private validateUniqueStepIds;
7
+ private validateInputs;
8
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BuildWorkflowValidator.js","sourceRoot":"","sources":["../src/BuildWorkflowValidator.ts"],"names":[],"mappings":";;;AAEA,sEAAgE;AAChE,0EAAoE;AACpE,qDAAsD;AAEtD,MAAa,sBAAsB;IACjC,YAA6B,QAAuB;QAAvB,aAAQ,GAAR,QAAQ,CAAe;IAAG,CAAC;IAEjD,QAAQ;QACb,MAAM,MAAM,GAAuB,EAAE,CAAC;QACtC,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,qBAAqB,EAAE,CAAC,CAAC;QAC7C,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;QACtC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;YACvB,MAAM,IAAI,0CAAkB,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAAC;SACnE;IACH,CAAC;IAEO,qBAAqB;QAC3B,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,E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AAG,IAAA,6BAAe,EAAC,KAAK,CAAC,YAAY,CAAC,CAAC;gBAClD,KAAK,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,KAAK,EAAE;oBACxC,IAAI,CAAC,CAAC,MAAM,IAAI,YAAY,CAAC,EAAE;wBAC7B,IAAI,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;4BAC1B,MAAM,KAAK,GAAG,IAAI,sCAAgB,CAChC,oBAAoB,KAAK,CAAC,EAAE,eAAe,IAAI,CAAC,EAAE,kFAAkF,MAAM,IAAI,CAC/I,CAAC;4BACF,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;yBACpB;6BAAM;4BACL,MAAM,KAAK,GAAG,IAAI,sCAAgB,CAChC,oBAAoB,KAAK,CAAC,EAAE,eAAe,IAAI,CAAC,EAAE,sFAAsF,MAAM,IAAI,CACnJ,CAAC;4BACF,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;yBACpB;qBACF;yBAAM;wBACL,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,kBAAkB,CAAC,QAAQ,CAAC,EAAE;4BACtD,MAAM,KAAK,GAAG,IAAI,sCAAgB,CAChC,oBAAoB,KAAK,CAAC,EAAE,eAAe,IAAI,CAAC,EAAE,uEAAuE,QAAQ,gBAAgB,MAAM,IAAI,CAC5J,CAAC;4BACF,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;yBACpB;qBACF;iBACF;aACF;YACD,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC;SAC9B;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAzED,wDAyEC","sourcesContent":["import { BuildStep } from './BuildStep.js';\nimport { BuildWorkflow } from './BuildWorkflow.js';\nimport { BuildConfigError } from './errors/BuildConfigError.js';\nimport { BuildWorkflowError } from './errors/BuildWorkflowError.js';\nimport { findOutputPaths } from './utils/template.js';\n\nexport class BuildWorkflowValidator {\n constructor(private readonly workflow: BuildWorkflow) {}\n\n public validate(): void {\n const errors: BuildConfigError[] = [];\n errors.push(...this.validateUniqueStepIds());\n errors.push(...this.validateInputs());\n if (errors.length !== 0) {\n throw new BuildWorkflowError('Build workflow is invalid', errors);\n }\n }\n\n private validateUniqueStepIds(): BuildConfigError[] {\n const stepIds = this.workflow.buildSteps.map(({ id }) => id);\n const visitedStepIdsSet = new Set<string>();\n const duplicatedStepIdsSet = new Set<string>();\n for (const stepId of stepIds) {\n if (visitedStepIdsSet.has(stepId)) {\n duplicatedStepIdsSet.add(stepId);\n } else {\n visitedStepIdsSet.add(stepId);\n }\n }\n const duplicatedStepIds = [...duplicatedStepIdsSet];\n if (duplicatedStepIds.length === 0) {\n return [];\n } else {\n const error = new BuildConfigError(\n `Duplicated step IDs: ${duplicatedStepIds.map((i) => `\"${i}\"`).join(', ')}`\n );\n return [error];\n }\n }\n\n private validateInputs(): BuildConfigError[] {\n const errors: BuildConfigError[] = [];\n\n const allStepIds = new Set(this.workflow.buildSteps.map((s) => s.id));\n const stepByStepId: Record<string, BuildStep> = {};\n for (const step of this.workflow.buildSteps) {\n for (const input of step.inputs ?? []) {\n if (input.defaultValue === undefined) {\n continue;\n }\n const paths = findOutputPaths(input.defaultValue);\n for (const { stepId, outputId } of paths) {\n if (!(stepId in stepByStepId)) {\n if (allStepIds.has(stepId)) {\n const error = new BuildConfigError(\n `Input parameter \"${input.id}\" for step \"${step.id}\" uses an expression that references an output parameter from the future step \"${stepId}\".`\n );\n errors.push(error);\n } else {\n const error = new BuildConfigError(\n `Input parameter \"${input.id}\" for step \"${step.id}\" uses an expression that references an output parameter from a non-existent step \"${stepId}\".`\n );\n errors.push(error);\n }\n } else {\n if (!stepByStepId[stepId].hasOutputParameter(outputId)) {\n const error = new BuildConfigError(\n `Input parameter \"${input.id}\" for step \"${step.id}\" uses an expression that references an undefined output parameter \"${outputId}\" from step \"${stepId}\".`\n );\n errors.push(error);\n }\n }\n }\n }\n stepByStepId[step.id] = step;\n }\n\n return errors;\n }\n}\n"]}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ var _a;
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ const path_1 = __importDefault(require("path"));
8
+ const logger_1 = require("@expo/logger");
9
+ const arg_1 = __importDefault(require("arg"));
10
+ const nullthrows_js_1 = require("../utils/nullthrows.cjs");
11
+ const BuildArtifacts_js_1 = require("../BuildArtifacts.cjs");
12
+ const BuildStepContext_js_1 = require("../BuildStepContext.cjs");
13
+ const BuildTemporaryFiles_js_1 = require("../BuildTemporaryFiles.cjs");
14
+ const args = (0, arg_1.default)({
15
+ '--type': String,
16
+ });
17
+ const artifactPathArg = (0, nullthrows_js_1.nullthrows)((_a = args._) === null || _a === void 0 ? void 0 : _a[0], 'upload-artifact must be run with the artifact path, e.g. "upload-artifact path/to/app.ipa"');
18
+ const artifactPath = path_1.default.resolve(process.cwd(), artifactPathArg);
19
+ const logger = (0, logger_1.createLogger)({
20
+ name: 'eas-build',
21
+ level: 'info',
22
+ });
23
+ const ctx = new BuildStepContext_js_1.BuildStepContext((0, nullthrows_js_1.nullthrows)(process.env.__EXPO_STEPS_BUILD_ID, 'Set __EXPO_STEPS_BUILD_ID.'), logger, false, (0, nullthrows_js_1.nullthrows)(process.env.__EXPO_STEPS_WORKING_DIRECTORY, 'Set __EXPO_STEPS_BUILD_ID.'));
24
+ const rawType = args['--type'];
25
+ const type = rawType !== null && rawType !== void 0 ? rawType : BuildArtifacts_js_1.BuildArtifactType.APPLICATION_ARCHIVE;
26
+ (0, BuildTemporaryFiles_js_1.saveArtifactToTemporaryDirectoryAsync)(ctx, type, artifactPath).catch((err) => {
27
+ console.error(`Failed preparing "${artifactPath}" for upload.`, err);
28
+ process.exit(2);
29
+ });
30
+ //# sourceMappingURL=uploadArtifact.js.map
@@ -0,0 +1 @@
1
+ export {};
@@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AAC","sourcesContent":["import path from 'path';\n\nimport { createLogger } from '@expo/logger';\nimport arg from 'arg';\n\nimport { nullthrows } from '../utils/nullthrows.js';\nimport { BuildArtifactType } from '../BuildArtifacts.js';\nimport { BuildStepContext } from '../BuildStepContext.js';\nimport { saveArtifactToTemporaryDirectoryAsync } from '../BuildTemporaryFiles.js';\n\nconst args = arg({\n '--type': String,\n});\n\nconst artifactPathArg = nullthrows(\n args._?.[0],\n 'upload-artifact must be run with the artifact path, e.g. \"upload-artifact path/to/app.ipa\"'\n);\nconst artifactPath = path.resolve(process.cwd(), artifactPathArg);\n\nconst logger = createLogger({\n name: 'eas-build',\n level: 'info',\n});\n\nconst ctx = new BuildStepContext(\n nullthrows(process.env.__EXPO_STEPS_BUILD_ID, 'Set __EXPO_STEPS_BUILD_ID.'),\n logger,\n false,\n nullthrows(process.env.__EXPO_STEPS_WORKING_DIRECTORY, 'Set __EXPO_STEPS_BUILD_ID.')\n);\n\nconst rawType = args['--type'] as BuildArtifactType | undefined;\nconst type = rawType ?? BuildArtifactType.APPLICATION_ARCHIVE;\n\nsaveArtifactToTemporaryDirectoryAsync(ctx, type, artifactPath).catch((err) => {\n console.error(`Failed preparing \"${artifactPath}\" for upload.`, err);\n process.exit(2);\n});\n"]}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const path_1 = __importDefault(require("path"));
7
+ const logger_1 = require("@expo/logger");
8
+ const uuid_1 = require("uuid");
9
+ const BuildConfigParser_js_1 = require("../BuildConfigParser.cjs");
10
+ const BuildStepContext_js_1 = require("../BuildStepContext.cjs");
11
+ const logger = (0, logger_1.createLogger)({
12
+ name: 'steps-cli',
13
+ level: 'info',
14
+ });
15
+ async function runAsync(configPath, workingDirectory) {
16
+ const fakeBuildId = (0, uuid_1.v4)();
17
+ const ctx = new BuildStepContext_js_1.BuildStepContext(fakeBuildId, logger, false, workingDirectory);
18
+ const parser = new BuildConfigParser_js_1.BuildConfigParser(ctx, { configPath });
19
+ const workflow = await parser.parseAsync();
20
+ await workflow.executeAsync();
21
+ const artifacts = await workflow.collectArtifactsAsync();
22
+ if (Object.keys(artifacts).length > 0) {
23
+ logger.info({ artifacts }, 'The workflow produced artifacts');
24
+ }
25
+ }
26
+ const relativeConfigPath = process.argv[2];
27
+ const relativeWorkingDirectoryPath = process.argv[3];
28
+ if (!relativeConfigPath && !relativeWorkingDirectoryPath) {
29
+ console.error('Usage: yarn cli config.yml path/to/working/directory');
30
+ process.exit(1);
31
+ }
32
+ const configPath = path_1.default.resolve(process.cwd(), relativeConfigPath);
33
+ const workingDirectory = path_1.default.resolve(process.cwd(), relativeWorkingDirectoryPath);
34
+ runAsync(configPath, workingDirectory).catch((err) => {
35
+ logger.error({ err }, 'Build failed');
36
+ });
37
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli/cli.ts"],"names":[],"mappings":";;;;;AAAA,gDAAwB;AAExB,yCAA4C;AAC5C,+BAAoC;AAEpC,kEAA4D;AAC5D,gEAA0D;AAE1D,MAAM,MAAM,GAAG,IAAA,qBAAY,EAAC;IAC1B,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,MAAM;CACd,CAAC,CAAC;AAEH,KAAK,UAAU,QAAQ,CAAC,UAAkB,EAAE,gBAAwB;IAClE,MAAM,WAAW,GAAG,IAAA,SAAM,GAAE,CAAC;IAC7B,MAAM,GAAG,GAAG,IAAI,sCAAgB,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAAC;IAC/E,MAAM,MAAM,GAAG,IAAI,wCAAiB,CAAC,GAAG,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC;IAC1D,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,UAAU,EAAE,CAAC;IAC3C,MAAM,QAAQ,CAAC,YAAY,EAAE,CAAC;IAC9B,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,qBAAqB,EAAE,CAAC;IACzD,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;QACrC,MAAM,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,EAAE,iCAAiC,CAAC,CAAC;KAC/D;AACH,CAAC;AAED,MAAM,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAC3C,MAAM,4BAA4B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAErD,IAAI,CAAC,kBAAkB,IAAI,CAAC,4BAA4B,EAAE;IACxD,OAAO,CAAC,KAAK,CAAC,sDAAsD,CAAC,CAAC;IACtE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;CACjB;AAED,MAAM,UAAU,GAAG,cAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,kBAAkB,CAAC,CAAC;AACnE,MAAM,gBAAgB,GAAG,cAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,4BAA4B,CAAC,CAAC;AAEnF,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnD,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,EAAE,cAAc,CAAC,CAAC;AACxC,CAAC,CAAC,CAAC","sourcesContent":["import path from 'path';\n\nimport { createLogger } from '@expo/logger';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport { BuildConfigParser } from '../BuildConfigParser.js';\nimport { BuildStepContext } from '../BuildStepContext.js';\n\nconst logger = createLogger({\n name: 'steps-cli',\n level: 'info',\n});\n\nasync function runAsync(configPath: string, workingDirectory: string): Promise<void> {\n const fakeBuildId = uuidv4();\n const ctx = new BuildStepContext(fakeBuildId, logger, false, workingDirectory);\n const parser = new BuildConfigParser(ctx, { configPath });\n const workflow = await parser.parseAsync();\n await workflow.executeAsync();\n const artifacts = await workflow.collectArtifactsAsync();\n if (Object.keys(artifacts).length > 0) {\n logger.info({ artifacts }, 'The workflow produced artifacts');\n }\n}\n\nconst relativeConfigPath = process.argv[2];\nconst relativeWorkingDirectoryPath = process.argv[3];\n\nif (!relativeConfigPath && !relativeWorkingDirectoryPath) {\n console.error('Usage: yarn cli config.yml path/to/working/directory');\n process.exit(1);\n}\n\nconst configPath = path.resolve(process.cwd(), relativeConfigPath);\nconst workingDirectory = path.resolve(process.cwd(), relativeWorkingDirectoryPath);\n\nrunAsync(configPath, workingDirectory).catch((err) => {\n logger.error({ err }, 'Build failed');\n});\n"]}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BuildConfigError = void 0;
4
+ const UserError_js_1 = require("./UserError.cjs");
5
+ class BuildConfigError extends UserError_js_1.UserError {
6
+ }
7
+ exports.BuildConfigError = BuildConfigError;
8
+ //# sourceMappingURL=BuildConfigError.js.map
@@ -0,0 +1,3 @@
1
+ import { UserError } from './UserError.js';
2
+ export declare class BuildConfigError extends UserError {
3
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BuildConfigError.js","sourceRoot":"","sources":["../../src/errors/BuildConfigError.ts"],"names":[],"mappings":";;;AAAA,iDAA2C;AAE3C,MAAa,gBAAiB,SAAQ,wBAAS;CAAG;AAAlD,4CAAkD","sourcesContent":["import { UserError } from './UserError.js';\n\nexport class BuildConfigError extends UserError {}\n"]}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BuildInternalError = void 0;
4
+ class BuildInternalError extends Error {
5
+ }
6
+ exports.BuildInternalError = BuildInternalError;
7
+ //# sourceMappingURL=BuildInternalError.js.map
@@ -0,0 +1,2 @@
1
+ export declare class BuildInternalError extends Error {
2
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BuildInternalError.js","sourceRoot":"","sources":["../../src/errors/BuildInternalError.ts"],"names":[],"mappings":";;;AAAA,MAAa,kBAAmB,SAAQ,KAAK;CAAG;AAAhD,gDAAgD","sourcesContent":["export class BuildInternalError extends Error {}\n"]}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BuildStepRuntimeError = void 0;
4
+ const UserError_js_1 = require("./UserError.cjs");
5
+ class BuildStepRuntimeError extends UserError_js_1.UserError {
6
+ }
7
+ exports.BuildStepRuntimeError = BuildStepRuntimeError;
8
+ //# sourceMappingURL=BuildStepRuntimeError.js.map
@@ -0,0 +1,3 @@
1
+ import { UserError } from './UserError.js';
2
+ export declare class BuildStepRuntimeError extends UserError {
3
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BuildStepRuntimeError.js","sourceRoot":"","sources":["../../src/errors/BuildStepRuntimeError.ts"],"names":[],"mappings":";;;AAAA,iDAA2C;AAE3C,MAAa,qBAAsB,SAAQ,wBAAS;CAAG;AAAvD,sDAAuD","sourcesContent":["import { UserError } from './UserError.js';\n\nexport class BuildStepRuntimeError extends UserError {}\n"]}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BuildWorkflowError = void 0;
4
+ const UserError_js_1 = require("./UserError.cjs");
5
+ class BuildWorkflowError extends UserError_js_1.UserError {
6
+ constructor(message, errors, extra) {
7
+ super(message, extra);
8
+ this.message = message;
9
+ this.errors = errors;
10
+ }
11
+ }
12
+ exports.BuildWorkflowError = BuildWorkflowError;
13
+ //# sourceMappingURL=BuildWorkflowError.js.map
@@ -0,0 +1,10 @@
1
+ import { BuildConfigError } from './BuildConfigError.js';
2
+ import { UserError } from './UserError.js';
3
+ export declare class BuildWorkflowError extends UserError {
4
+ readonly message: string;
5
+ readonly errors: BuildConfigError[];
6
+ constructor(message: string, errors: BuildConfigError[], extra?: {
7
+ metadata?: object;
8
+ cause?: Error;
9
+ });
10
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BuildWorkflowError.js","sourceRoot":"","sources":["../../src/errors/BuildWorkflowError.ts"],"names":[],"mappings":";;;AACA,iDAA2C;AAE3C,MAAa,kBAAmB,SAAQ,wBAAS;IAC/C,YAC2B,OAAe,EACxB,MAA0B,EAC1C,KAGC;QAED,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAPG,YAAO,GAAP,OAAO,CAAQ;QACxB,WAAM,GAAN,MAAM,CAAoB;IAO5C,CAAC;CACF;AAXD,gDAWC","sourcesContent":["import { BuildConfigError } from './BuildConfigError.js';\nimport { UserError } from './UserError.js';\n\nexport class BuildWorkflowError extends UserError {\n constructor(\n public override readonly message: string,\n public readonly errors: BuildConfigError[],\n extra?: {\n metadata?: object;\n cause?: Error;\n }\n ) {\n super(message, extra);\n }\n}\n"]}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UserError = void 0;
4
+ class UserError extends Error {
5
+ constructor(message, extra) {
6
+ var _a;
7
+ super(message);
8
+ this.message = message;
9
+ this.metadata = (_a = extra === null || extra === void 0 ? void 0 : extra.cause) !== null && _a !== void 0 ? _a : {};
10
+ this.cause = extra === null || extra === void 0 ? void 0 : extra.cause;
11
+ }
12
+ }
13
+ exports.UserError = UserError;
14
+ //# sourceMappingURL=UserError.js.map
@@ -0,0 +1,9 @@
1
+ export declare abstract class UserError extends Error {
2
+ readonly message: string;
3
+ readonly cause?: Error;
4
+ readonly metadata: object;
5
+ constructor(message: string, extra?: {
6
+ metadata?: object;
7
+ cause?: Error;
8
+ });
9
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserError.js","sourceRoot":"","sources":["../../src/errors/UserError.ts"],"names":[],"mappings":";;;AAAA,MAAsB,SAAU,SAAQ,KAAK;IAI3C,YAC2B,OAAe,EACxC,KAGC;;QAED,KAAK,CAAC,OAAO,CAAC,CAAC;QANU,YAAO,GAAP,OAAO,CAAQ;QAOxC,IAAI,CAAC,QAAQ,GAAG,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK,mCAAI,EAAE,CAAC;QACnC,IAAI,CAAC,KAAK,GAAG,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK,CAAC;IAC5B,CAAC;CACF;AAfD,8BAeC","sourcesContent":["export abstract class UserError extends Error {\n public readonly cause?: Error;\n public readonly metadata: object;\n\n constructor(\n public override readonly message: string,\n extra?: {\n metadata?: object;\n cause?: Error;\n }\n ) {\n super(message);\n this.metadata = extra?.cause ?? {};\n this.cause = extra?.cause;\n }\n}\n"]}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BuildStepContext = exports.BuildConfigParser = exports.BuildArtifactType = void 0;
4
+ var BuildArtifacts_js_1 = require("./BuildArtifacts.cjs");
5
+ Object.defineProperty(exports, "BuildArtifactType", { enumerable: true, get: function () { return BuildArtifacts_js_1.BuildArtifactType; } });
6
+ var BuildConfigParser_js_1 = require("./BuildConfigParser.cjs");
7
+ Object.defineProperty(exports, "BuildConfigParser", { enumerable: true, get: function () { return BuildConfigParser_js_1.BuildConfigParser; } });
8
+ var BuildStepContext_js_1 = require("./BuildStepContext.cjs");
9
+ Object.defineProperty(exports, "BuildStepContext", { enumerable: true, get: function () { return BuildStepContext_js_1.BuildStepContext; } });
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,3 @@
1
+ export { BuildArtifactType } from './BuildArtifacts.js';
2
+ export { BuildConfigParser } from './BuildConfigParser.js';
3
+ export { BuildStepContext } from './BuildStepContext.js';
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,yDAAwD;AAA/C,sHAAA,iBAAiB,OAAA;AAC1B,+DAA2D;AAAlD,yHAAA,iBAAiB,OAAA;AAC1B,6DAAyD;AAAhD,uHAAA,gBAAgB,OAAA","sourcesContent":["export { BuildArtifactType } from './BuildArtifacts.js';\nexport { BuildConfigParser } from './BuildConfigParser.js';\nexport { BuildStepContext } from './BuildStepContext.js';\n"]}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.uniq = void 0;
4
+ function uniq(items) {
5
+ const set = new Set(items);
6
+ return [...set];
7
+ }
8
+ exports.uniq = uniq;
9
+ //# sourceMappingURL=uniq.js.map
@@ -0,0 +1 @@
1
+ export declare function uniq<T = any>(items: T[]): T[];
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uniq.js","sourceRoot":"","sources":["../../../src/utils/expodash/uniq.ts"],"names":[],"mappings":";;;AAAA,SAAgB,IAAI,CAAU,KAAU;IACtC,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;IAC3B,OAAO,CAAC,GAAG,GAAG,CAAC,CAAC;AAClB,CAAC;AAHD,oBAGC","sourcesContent":["export function uniq<T = any>(items: T[]): T[] {\n const set = new Set(items);\n return [...set];\n}\n"]}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.nullthrows = void 0;
4
+ function nullthrows(value, message) {
5
+ if (value != null) {
6
+ return value;
7
+ }
8
+ throw new TypeError(message !== null && message !== void 0 ? message : `Expected value not to be null or undefined but got ${value}`);
9
+ }
10
+ exports.nullthrows = nullthrows;
11
+ //# sourceMappingURL=nullthrows.js.map
@@ -0,0 +1 @@
1
+ export declare function nullthrows<T>(value: T | null | undefined, message?: string): NonNullable<T>;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nullthrows.js","sourceRoot":"","sources":["../../src/utils/nullthrows.ts"],"names":[],"mappings":";;;AAAA,SAAgB,UAAU,CAAI,KAA2B,EAAE,OAAgB;IACzE,IAAI,KAAK,IAAI,IAAI,EAAE;QACjB,OAAO,KAAK,CAAC;KACd;IACD,MAAM,IAAI,SAAS,CAAC,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,sDAAsD,KAAK,EAAE,CAAC,CAAC;AAChG,CAAC;AALD,gCAKC","sourcesContent":["export function nullthrows<T>(value: T | null | undefined, message?: string): NonNullable<T> {\n if (value != null) {\n return value;\n }\n throw new TypeError(message ?? `Expected value not to be null or undefined but got ${value}`);\n}\n"]}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.BIN_PATH = void 0;
7
+ const path_1 = __importDefault(require("path"));
8
+ const this_file_1 = require("this-file");
9
+ const ctx = (0, this_file_1.createContext)();
10
+ exports.BIN_PATH = path_1.default.join(ctx.dirname, '../../../bin');
11
+ //# sourceMappingURL=bin.js.map
@@ -0,0 +1 @@
1
+ export declare const BIN_PATH: string;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.js","sourceRoot":"","sources":["../../../src/utils/shell/bin.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,yCAA0C;AAE1C,MAAM,GAAG,GAAG,IAAA,yBAAa,GAAE,CAAC;AAEf,QAAA,QAAQ,GAAG,cAAI,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC","sourcesContent":["import path from 'path';\n\nimport { createContext } from 'this-file';\n\nconst ctx = createContext();\n\nexport const BIN_PATH = path.join(ctx.dirname, '../../../bin');\n"]}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getShellCommandAndArgs = exports.getDefaultShell = void 0;
7
+ const os_1 = __importDefault(require("os"));
8
+ // stolen from https://circleci.com/docs/configuration-reference/
9
+ const DEFAULT_SHELL = '/bin/bash -eo pipefail';
10
+ const SHELL_BY_PLATFORM = {
11
+ darwin: '/bin/bash --login -eo pipefail',
12
+ };
13
+ function getDefaultShell(platform = os_1.default.platform()) {
14
+ const platformSpecificShell = SHELL_BY_PLATFORM[platform];
15
+ if (platformSpecificShell) {
16
+ return platformSpecificShell;
17
+ }
18
+ else {
19
+ return DEFAULT_SHELL;
20
+ }
21
+ }
22
+ exports.getDefaultShell = getDefaultShell;
23
+ function getShellCommandAndArgs(shell, script) {
24
+ const splits = shell.split(' ');
25
+ const command = splits[0];
26
+ const args = [...splits.slice(1)];
27
+ if (script) {
28
+ args.push(script);
29
+ }
30
+ return {
31
+ command,
32
+ args,
33
+ };
34
+ }
35
+ exports.getShellCommandAndArgs = getShellCommandAndArgs;
36
+ //# sourceMappingURL=command.js.map
@@ -0,0 +1,6 @@
1
+ /// <reference types="node" />
2
+ export declare function getDefaultShell(platform?: NodeJS.Platform): string;
3
+ export declare function getShellCommandAndArgs(shell: string, script?: string): {
4
+ command: string;
5
+ args?: string[];
6
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command.js","sourceRoot":"","sources":["../../../src/utils/shell/command.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AAEpB,iEAAiE;AACjE,MAAM,aAAa,GAAG,wBAAwB,CAAC;AAC/C,MAAM,iBAAiB,GAA6C;IAClE,MAAM,EAAE,gCAAgC;CACzC,CAAC;AAEF,SAAgB,eAAe,CAAC,WAA4B,YAAE,CAAC,QAAQ,EAAE;IACvE,MAAM,qBAAqB,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAC1D,IAAI,qBAAqB,EAAE;QACzB,OAAO,qBAAqB,CAAC;KAC9B;SAAM;QACL,OAAO,aAAa,CAAC;KACtB;AACH,CAAC;AAPD,0CAOC;AAED,SAAgB,sBAAsB,CACpC,KAAa,EACb,MAAe;IAEf,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAChC,MAAM,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IAC1B,MAAM,IAAI,GAAG,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAClC,IAAI,MAAM,EAAE;QACV,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;KACnB;IACD,OAAO;QACL,OAAO;QACP,IAAI;KACL,CAAC;AACJ,CAAC;AAdD,wDAcC","sourcesContent":["import os from 'os';\n\n// stolen from https://circleci.com/docs/configuration-reference/\nconst DEFAULT_SHELL = '/bin/bash -eo pipefail';\nconst SHELL_BY_PLATFORM: Partial<Record<NodeJS.Platform, string>> = {\n darwin: '/bin/bash --login -eo pipefail',\n};\n\nexport function getDefaultShell(platform: NodeJS.Platform = os.platform()): string {\n const platformSpecificShell = SHELL_BY_PLATFORM[platform];\n if (platformSpecificShell) {\n return platformSpecificShell;\n } else {\n return DEFAULT_SHELL;\n }\n}\n\nexport function getShellCommandAndArgs(\n shell: string,\n script?: string\n): { command: string; args?: string[] } {\n const splits = shell.split(' ');\n const command = splits[0];\n const args = [...splits.slice(1)];\n if (script) {\n args.push(script);\n }\n return {\n command,\n args,\n };\n}\n"]}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.spawnAsync = void 0;
7
+ const logger_1 = require("@expo/logger");
8
+ const spawn_async_1 = __importDefault(require("@expo/spawn-async"));
9
+ // eslint-disable-next-line async-protect/async-suffix
10
+ function spawnAsync(command, args, allOptions = {
11
+ stdio: 'inherit',
12
+ cwd: process.cwd(),
13
+ }) {
14
+ const { logger, ...options } = allOptions;
15
+ if (logger) {
16
+ options.stdio = 'pipe';
17
+ }
18
+ const promise = (0, spawn_async_1.default)(command, args, options);
19
+ if (logger && promise.child) {
20
+ (0, logger_1.pipeSpawnOutput)(logger, promise.child, options);
21
+ }
22
+ return promise;
23
+ }
24
+ exports.spawnAsync = spawnAsync;
25
+ //# sourceMappingURL=spawn.js.map
@@ -0,0 +1,9 @@
1
+ import { bunyan, PipeMode } from '@expo/logger';
2
+ import { SpawnResult, SpawnPromise, SpawnOptions as SpawnOptionsOriginal } from '@expo/spawn-async';
3
+ type SpawnOptions = SpawnOptionsOriginal & {
4
+ logger?: bunyan;
5
+ lineTransformer?: (line: string) => string | null;
6
+ mode?: PipeMode;
7
+ };
8
+ export declare function spawnAsync(command: string, args: string[], allOptions?: SpawnOptions): SpawnPromise<SpawnResult>;
9
+ export {};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spawn.js","sourceRoot":"","sources":["../../../src/utils/shell/spawn.ts"],"names":[],"mappings":";;;;;;AAAA,yCAAiE;AACjE,oEAI2B;AAQ3B,sDAAsD;AACtD,SAAgB,UAAU,CACxB,OAAe,EACf,IAAc,EACd,aAA2B;IACzB,KAAK,EAAE,SAAS;IAChB,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;CACnB;IAED,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,GAAG,UAAU,CAAC;IAC1C,IAAI,MAAM,EAAE;QACV,OAAO,CAAC,KAAK,GAAG,MAAM,CAAC;KACxB;IACD,MAAM,OAAO,GAAG,IAAA,qBAAkB,EAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAC3D,IAAI,MAAM,IAAI,OAAO,CAAC,KAAK,EAAE;QAC3B,IAAA,wBAAe,EAAC,MAAM,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;KACjD;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAjBD,gCAiBC","sourcesContent":["import { pipeSpawnOutput, bunyan, PipeMode } from '@expo/logger';\nimport spawnAsyncOriginal, {\n SpawnResult,\n SpawnPromise,\n SpawnOptions as SpawnOptionsOriginal,\n} from '@expo/spawn-async';\n\ntype SpawnOptions = SpawnOptionsOriginal & {\n logger?: bunyan;\n lineTransformer?: (line: string) => string | null;\n mode?: PipeMode;\n};\n\n// eslint-disable-next-line async-protect/async-suffix\nexport function spawnAsync(\n command: string,\n args: string[],\n allOptions: SpawnOptions = {\n stdio: 'inherit',\n cwd: process.cwd(),\n }\n): SpawnPromise<SpawnResult> {\n const { logger, ...options } = allOptions;\n if (logger) {\n options.stdio = 'pipe';\n }\n const promise = spawnAsyncOriginal(command, args, options);\n if (logger && promise.child) {\n pipeSpawnOutput(logger, promise.child, options);\n }\n return promise;\n}\n"]}
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseOutputPath = exports.findOutputPaths = exports.interpolateWithOutputs = exports.interpolateWithInputs = exports.BUILD_STEP_OUTPUT_EXPRESSION_REGEXP = exports.BUILD_STEP_INPUT_EXPRESSION_REGEXP = void 0;
4
+ const BuildConfigError_js_1 = require("../errors/BuildConfigError.cjs");
5
+ const nullthrows_js_1 = require("./nullthrows.cjs");
6
+ exports.BUILD_STEP_INPUT_EXPRESSION_REGEXP = /\${\s*inputs\.([\S]+)\s*}/;
7
+ exports.BUILD_STEP_OUTPUT_EXPRESSION_REGEXP = /\${\s*steps\.([\S]+)\s*}/;
8
+ function interpolateWithInputs(templateString, inputs) {
9
+ return interpolate(templateString, exports.BUILD_STEP_INPUT_EXPRESSION_REGEXP, inputs);
10
+ }
11
+ exports.interpolateWithInputs = interpolateWithInputs;
12
+ function interpolateWithOutputs(templateString, fn) {
13
+ return interpolate(templateString, exports.BUILD_STEP_OUTPUT_EXPRESSION_REGEXP, fn);
14
+ }
15
+ exports.interpolateWithOutputs = interpolateWithOutputs;
16
+ function interpolate(templateString, regex, varsOrFn) {
17
+ const matched = templateString.match(new RegExp(regex, 'g'));
18
+ if (!matched) {
19
+ return templateString;
20
+ }
21
+ let result = templateString;
22
+ for (const match of matched) {
23
+ const [, key] = (0, nullthrows_js_1.nullthrows)(match.match(regex));
24
+ const value = typeof varsOrFn === 'function' ? varsOrFn(key) : varsOrFn[key];
25
+ result = result.replace(match, value);
26
+ }
27
+ return result;
28
+ }
29
+ function findOutputPaths(templateString) {
30
+ const result = [];
31
+ const matches = templateString.matchAll(new RegExp(exports.BUILD_STEP_OUTPUT_EXPRESSION_REGEXP, 'g'));
32
+ for (const match of matches) {
33
+ result.push(parseOutputPath(match[1]));
34
+ }
35
+ return result;
36
+ }
37
+ exports.findOutputPaths = findOutputPaths;
38
+ function parseOutputPath(outputPath) {
39
+ const splits = outputPath.split('.');
40
+ if (splits.length !== 2) {
41
+ throw new BuildConfigError_js_1.BuildConfigError(`Step output path must consist of two components joined with a dot, where first is the step ID, and second is the output name, e.g. "step3.output1". Passed: "${outputPath}"`);
42
+ }
43
+ const [stepId, outputId] = splits;
44
+ return { stepId, outputId };
45
+ }
46
+ exports.parseOutputPath = parseOutputPath;
47
+ //# sourceMappingURL=template.js.map
@@ -0,0 +1,11 @@
1
+ export declare const BUILD_STEP_INPUT_EXPRESSION_REGEXP: RegExp;
2
+ export declare const BUILD_STEP_OUTPUT_EXPRESSION_REGEXP: RegExp;
3
+ export declare function interpolateWithInputs(templateString: string, inputs: Record<string, string>): string;
4
+ export declare function interpolateWithOutputs(templateString: string, fn: (path: string) => string): string;
5
+ interface BuildOutputPath {
6
+ stepId: string;
7
+ outputId: string;
8
+ }
9
+ export declare function findOutputPaths(templateString: string): BuildOutputPath[];
10
+ export declare function parseOutputPath(outputPath: string): BuildOutputPath;
11
+ export {};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.js","sourceRoot":"","sources":["../../src/utils/template.ts"],"names":[],"mappings":";;;AAAA,uEAAiE;AAEjE,mDAA6C;AAEhC,QAAA,kCAAkC,GAAG,2BAA2B,CAAC;AACjE,QAAA,mCAAmC,GAAG,0BAA0B,CAAC;AAE9E,SAAgB,qBAAqB,CACnC,cAAsB,EACtB,MAA8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AAC;AAChB,CAAC;AAPD,0CAOC;AAED,SAAgB,eAAe,CAAC,UAAkB;IAChD,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACrC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;QACvB,MAAM,IAAI,sCAAgB,CACxB,gKAAgK,UAAU,GAAG,CAC9K,CAAC;KACH;IACD,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,MAAM,CAAC;IAClC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;AAC9B,CAAC;AATD,0CASC","sourcesContent":["import { BuildConfigError } from '../errors/BuildConfigError.js';\n\nimport { nullthrows } from './nullthrows.js';\n\nexport const BUILD_STEP_INPUT_EXPRESSION_REGEXP = /\\${\\s*inputs\\.([\\S]+)\\s*}/;\nexport const BUILD_STEP_OUTPUT_EXPRESSION_REGEXP = /\\${\\s*steps\\.([\\S]+)\\s*}/;\n\nexport function interpolateWithInputs(\n templateString: string,\n inputs: Record<string, string>\n): string {\n return interpolate(templateString, BUILD_STEP_INPUT_EXPRESSION_REGEXP, inputs);\n}\n\nexport function interpolateWithOutputs(\n templateString: string,\n fn: (path: string) => string\n): string {\n return interpolate(templateString, BUILD_STEP_OUTPUT_EXPRESSION_REGEXP, fn);\n}\n\nfunction interpolate(\n templateString: string,\n regex: RegExp,\n varsOrFn: Record<string, string> | ((key: string) => string)\n): string {\n const matched = templateString.match(new RegExp(regex, 'g'));\n if (!matched) {\n return templateString;\n }\n let result = templateString;\n for (const match of matched) {\n const [, key] = nullthrows(match.match(regex));\n const value = typeof varsOrFn === 'function' ? varsOrFn(key) : varsOrFn[key];\n result = result.replace(match, value);\n }\n return result;\n}\n\ninterface BuildOutputPath {\n stepId: string;\n outputId: string;\n}\n\nexport function findOutputPaths(templateString: string): BuildOutputPath[] {\n const result: BuildOutputPath[] = [];\n const matches = templateString.matchAll(new RegExp(BUILD_STEP_OUTPUT_EXPRESSION_REGEXP, 'g'));\n for (const match of matches) {\n result.push(parseOutputPath(match[1]));\n }\n return result;\n}\n\nexport function parseOutputPath(outputPath: string): BuildOutputPath {\n const splits = outputPath.split('.');\n if (splits.length !== 2) {\n throw new BuildConfigError(\n `Step output path must consist of two components joined with a dot, where first is the step ID, and second is the output name, e.g. \"step3.output1\". Passed: \"${outputPath}\"`\n );\n }\n const [stepId, outputId] = splits;\n return { stepId, outputId };\n}\n"]}
@@ -0,0 +1,5 @@
1
+ export declare enum BuildArtifactType {
2
+ APPLICATION_ARCHIVE = "application-archive",
3
+ BUILD_ARTIFACT = "build-artifact"
4
+ }
5
+ export type BuildArtifacts = Partial<Record<BuildArtifactType, string[]>>;
@@ -0,0 +1,6 @@
1
+ export var BuildArtifactType;
2
+ (function (BuildArtifactType) {
3
+ BuildArtifactType["APPLICATION_ARCHIVE"] = "application-archive";
4
+ BuildArtifactType["BUILD_ARTIFACT"] = "build-artifact";
5
+ })(BuildArtifactType || (BuildArtifactType = {}));
6
+ //# sourceMappingURL=BuildArtifacts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BuildArtifacts.js","sourceRoot":"","sources":["../src/BuildArtifacts.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,gEAA2C,CAAA;IAC3C,sDAAiC,CAAA;AACnC,CAAC,EAHW,iBAAiB,KAAjB,iBAAiB,QAG5B","sourcesContent":["export enum BuildArtifactType {\n APPLICATION_ARCHIVE = 'application-archive',\n BUILD_ARTIFACT = 'build-artifact',\n}\n\nexport type BuildArtifacts = Partial<Record<BuildArtifactType, string[]>>;\n"]}