@expo/steps 0.0.8 → 0.0.9

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 (88) hide show
  1. package/dist_commonjs/BuildConfig.cjs +13 -9
  2. package/dist_commonjs/BuildConfig.d.ts +1 -2
  3. package/dist_commonjs/BuildConfig.js.map +1 -1
  4. package/dist_commonjs/BuildConfigParser.cjs +68 -45
  5. package/dist_commonjs/BuildConfigParser.d.ts +9 -4
  6. package/dist_commonjs/BuildConfigParser.js.map +1 -1
  7. package/dist_commonjs/BuildFunction.cjs +23 -12
  8. package/dist_commonjs/BuildFunction.d.ts +20 -15
  9. package/dist_commonjs/BuildFunction.js.map +1 -1
  10. package/dist_commonjs/BuildStep.cjs +56 -36
  11. package/dist_commonjs/BuildStep.d.ts +17 -9
  12. package/dist_commonjs/BuildStep.js.map +1 -1
  13. package/dist_commonjs/BuildStepContext.cjs +3 -0
  14. package/dist_commonjs/BuildStepContext.d.ts +4 -0
  15. package/dist_commonjs/BuildStepContext.js.map +1 -1
  16. package/dist_commonjs/BuildStepInput.cjs +14 -1
  17. package/dist_commonjs/BuildStepInput.d.ts +8 -1
  18. package/dist_commonjs/BuildStepInput.js.map +1 -1
  19. package/dist_commonjs/BuildStepOutput.cjs +14 -1
  20. package/dist_commonjs/BuildStepOutput.d.ts +7 -1
  21. package/dist_commonjs/BuildStepOutput.js.map +1 -1
  22. package/dist_commonjs/BuildTemporaryFiles.cjs +1 -59
  23. package/dist_commonjs/BuildTemporaryFiles.d.ts +0 -4
  24. package/dist_commonjs/BuildTemporaryFiles.js.map +1 -1
  25. package/dist_commonjs/BuildWorkflow.cjs +3 -16
  26. package/dist_commonjs/BuildWorkflow.d.ts +0 -3
  27. package/dist_commonjs/BuildWorkflow.js.map +1 -1
  28. package/dist_commonjs/BuildWorkflowValidator.cjs +2 -11
  29. package/dist_commonjs/BuildWorkflowValidator.js.map +1 -1
  30. package/dist_commonjs/cli/cli.cjs +0 -4
  31. package/dist_commonjs/cli/cli.js.map +1 -1
  32. package/dist_commonjs/index.cjs +7 -3
  33. package/dist_commonjs/index.d.ts +3 -1
  34. package/dist_commonjs/index.js.map +1 -1
  35. package/dist_commonjs/utils/expodash/duplicates.cjs +18 -0
  36. package/dist_commonjs/utils/expodash/duplicates.d.ts +1 -0
  37. package/dist_commonjs/utils/expodash/duplicates.js.map +1 -0
  38. package/dist_esm/BuildConfig.d.ts +1 -2
  39. package/dist_esm/BuildConfig.js +13 -9
  40. package/dist_esm/BuildConfig.js.map +1 -1
  41. package/dist_esm/BuildConfigParser.d.ts +9 -4
  42. package/dist_esm/BuildConfigParser.js +68 -45
  43. package/dist_esm/BuildConfigParser.js.map +1 -1
  44. package/dist_esm/BuildFunction.d.ts +20 -15
  45. package/dist_esm/BuildFunction.js +20 -12
  46. package/dist_esm/BuildFunction.js.map +1 -1
  47. package/dist_esm/BuildStep.d.ts +17 -9
  48. package/dist_esm/BuildStep.js +56 -36
  49. package/dist_esm/BuildStep.js.map +1 -1
  50. package/dist_esm/BuildStepContext.d.ts +4 -0
  51. package/dist_esm/BuildStepContext.js +3 -0
  52. package/dist_esm/BuildStepContext.js.map +1 -1
  53. package/dist_esm/BuildStepInput.d.ts +8 -1
  54. package/dist_esm/BuildStepInput.js +12 -0
  55. package/dist_esm/BuildStepInput.js.map +1 -1
  56. package/dist_esm/BuildStepOutput.d.ts +7 -1
  57. package/dist_esm/BuildStepOutput.js +12 -0
  58. package/dist_esm/BuildStepOutput.js.map +1 -1
  59. package/dist_esm/BuildTemporaryFiles.d.ts +0 -4
  60. package/dist_esm/BuildTemporaryFiles.js +0 -55
  61. package/dist_esm/BuildTemporaryFiles.js.map +1 -1
  62. package/dist_esm/BuildWorkflow.d.ts +0 -3
  63. package/dist_esm/BuildWorkflow.js +3 -16
  64. package/dist_esm/BuildWorkflow.js.map +1 -1
  65. package/dist_esm/BuildWorkflowValidator.js +2 -11
  66. package/dist_esm/BuildWorkflowValidator.js.map +1 -1
  67. package/dist_esm/cli/cli.js +0 -4
  68. package/dist_esm/cli/cli.js.map +1 -1
  69. package/dist_esm/index.d.ts +3 -1
  70. package/dist_esm/index.js +3 -1
  71. package/dist_esm/index.js.map +1 -1
  72. package/dist_esm/utils/expodash/duplicates.d.ts +1 -0
  73. package/dist_esm/utils/expodash/duplicates.js +14 -0
  74. package/dist_esm/utils/expodash/duplicates.js.map +1 -0
  75. package/package.json +2 -1
  76. package/bin/upload-artifact +0 -12
  77. package/dist_commonjs/BuildArtifacts.cjs +0 -9
  78. package/dist_commonjs/BuildArtifacts.d.ts +0 -5
  79. package/dist_commonjs/BuildArtifacts.js.map +0 -1
  80. package/dist_commonjs/bin/uploadArtifact.cjs +0 -30
  81. package/dist_commonjs/bin/uploadArtifact.d.ts +0 -1
  82. package/dist_commonjs/bin/uploadArtifact.js.map +0 -1
  83. package/dist_esm/BuildArtifacts.d.ts +0 -5
  84. package/dist_esm/BuildArtifacts.js +0 -6
  85. package/dist_esm/BuildArtifacts.js.map +0 -1
  86. package/dist_esm/bin/uploadArtifact.d.ts +0 -1
  87. package/dist_esm/bin/uploadArtifact.js +0 -25
  88. package/dist_esm/bin/uploadArtifact.js.map +0 -1
@@ -1,8 +1,6 @@
1
1
  import path from 'path';
2
2
  import fs from 'fs/promises';
3
3
  import { v4 as uuidv4 } from 'uuid';
4
- import { BuildArtifactType } from './BuildArtifacts.js';
5
- import { BuildInternalError } from './errors/BuildInternalError.js';
6
4
  export async function saveScriptToTemporaryFileAsync(ctx, stepId, scriptContents) {
7
5
  const scriptsDir = getTemporaryScriptsDirPath(ctx, stepId);
8
6
  await fs.mkdir(scriptsDir, { recursive: true });
@@ -10,46 +8,11 @@ export async function saveScriptToTemporaryFileAsync(ctx, stepId, scriptContents
10
8
  await fs.writeFile(temporaryScriptPath, scriptContents);
11
9
  return temporaryScriptPath;
12
10
  }
13
- export async function saveArtifactToTemporaryDirectoryAsync(ctx, type, artifactPath) {
14
- let targetArtifactPath;
15
- if (type === BuildArtifactType.APPLICATION_ARCHIVE) {
16
- targetArtifactPath = path.join(getTemporaryApplicationArchiveDirPath(ctx), path.basename(artifactPath));
17
- }
18
- else if (type === BuildArtifactType.BUILD_ARTIFACT) {
19
- targetArtifactPath = path.join(getTemporaryBuildArtifactsDirPath(ctx), path.basename(artifactPath));
20
- }
21
- else {
22
- throw new BuildInternalError(`Uploading artifacts of type "${type}" is not implemented.`);
23
- }
24
- await fs.mkdir(path.dirname(targetArtifactPath), { recursive: true });
25
- await fs.copyFile(artifactPath, targetArtifactPath);
26
- return targetArtifactPath;
27
- }
28
11
  export async function createTemporaryOutputsDirectoryAsync(ctx, stepId) {
29
12
  const directory = getTemporaryOutputsDirPath(ctx, stepId);
30
13
  await fs.mkdir(directory, { recursive: true });
31
14
  return directory;
32
15
  }
33
- export async function findArtifactsByTypeAsync(ctx, type) {
34
- let artifactsDirPath;
35
- if (type === BuildArtifactType.APPLICATION_ARCHIVE) {
36
- artifactsDirPath = getTemporaryApplicationArchiveDirPath(ctx);
37
- }
38
- else if (type === BuildArtifactType.BUILD_ARTIFACT) {
39
- artifactsDirPath = getTemporaryBuildArtifactsDirPath(ctx);
40
- }
41
- else {
42
- throw new BuildInternalError(`Finding artifacts of type "${type}" is not implemented.`);
43
- }
44
- try {
45
- const filenames = await fs.readdir(artifactsDirPath);
46
- return filenames.map((filename) => path.join(artifactsDirPath, filename));
47
- }
48
- catch (err) {
49
- ctx.logger.debug({ err }, `Failed reading artifacts of type "${type}" from "${artifactsDirPath}". The directory probably doesn't exist.`);
50
- return [];
51
- }
52
- }
53
16
  export async function cleanUpStepTemporaryDirectoriesAsync(ctx, stepId) {
54
17
  if (ctx.skipCleanup) {
55
18
  return;
@@ -58,15 +21,6 @@ export async function cleanUpStepTemporaryDirectoriesAsync(ctx, stepId) {
58
21
  await fs.rm(stepTemporaryDirectory, { recursive: true, force: true });
59
22
  ctx.logger.debug({ stepTemporaryDirectory }, 'Removed step temporary directory');
60
23
  }
61
- export async function cleanUpWorkflowTemporaryDirectoriesAsync(ctx) {
62
- if (ctx.skipCleanup) {
63
- return;
64
- }
65
- const temporaryDirectories = [getTemporaryArtifactsDirPath(ctx)];
66
- const rmPromises = temporaryDirectories.map((dir) => fs.rm(dir, { recursive: true, force: true }));
67
- await Promise.all(rmPromises);
68
- ctx.logger.debug({ temporaryDirectories }, 'Removed temporary directories');
69
- }
70
24
  function getTemporaryStepDirPath(ctx, stepId) {
71
25
  return path.join(ctx.baseWorkingDirectory, 'steps', stepId);
72
26
  }
@@ -76,13 +30,4 @@ function getTemporaryScriptsDirPath(ctx, stepId) {
76
30
  function getTemporaryOutputsDirPath(ctx, stepId) {
77
31
  return path.join(getTemporaryStepDirPath(ctx, stepId), 'outputs');
78
32
  }
79
- function getTemporaryApplicationArchiveDirPath(ctx) {
80
- return path.join(getTemporaryArtifactsDirPath(ctx), 'application-archive');
81
- }
82
- function getTemporaryBuildArtifactsDirPath(ctx) {
83
- return path.join(getTemporaryArtifactsDirPath(ctx), 'build-artifacts');
84
- }
85
- function getTemporaryArtifactsDirPath(ctx) {
86
- return path.join(ctx.baseWorkingDirectory, 'artifacts');
87
- }
88
33
  //# sourceMappingURL=BuildTemporaryFiles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BuildTemporaryFiles.js","sourceRoot":"","sources":["../src/BuildTemporaryFiles.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,aAAa,CAAC;AAE7B,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAGpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE,MAAM,CAAC,KAAK,UAAU,8BAA8B,CAClD,GAAqB,EACrB,MAAc,EACd,cAAsB;IAEtB,MAAM,UAAU,GAAG,0BAA0B,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAC3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,OAAO,IAAI,CAAC,IAAI,CAAC,4BAA4B,CAAC,GAAG,CAAC,EAAE,iBAAiB,CAAC,CAAC;AACzE,CAAC;AAED,SAAS,4BAA4B,CAAC,GAAqB;IACzD,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,oBAAoB,EAAE,WAAW,CAAC,CAAC;AAC1D,CAAC","sourcesContent":["import path from 'path';\nimport fs from 'fs/promises';\n\nimport { v4 as uuidv4 } from 'uuid';\n\nimport { BuildStepContext } from './BuildStepContext.js';\nimport { BuildArtifactType } from './BuildArtifacts.js';\nimport { BuildInternalError } from './errors/BuildInternalError.js';\n\nexport async function saveScriptToTemporaryFileAsync(\n ctx: BuildStepContext,\n stepId: string,\n scriptContents: string\n): Promise<string> {\n const scriptsDir = getTemporaryScriptsDirPath(ctx, stepId);\n await fs.mkdir(scriptsDir, { recursive: true });\n const temporaryScriptPath = path.join(scriptsDir, `${uuidv4()}.sh`);\n await fs.writeFile(temporaryScriptPath, scriptContents);\n return temporaryScriptPath;\n}\n\nexport async function saveArtifactToTemporaryDirectoryAsync(\n ctx: BuildStepContext,\n type: BuildArtifactType,\n artifactPath: string\n): Promise<string> {\n let targetArtifactPath: string;\n if (type === BuildArtifactType.APPLICATION_ARCHIVE) {\n targetArtifactPath = path.join(\n getTemporaryApplicationArchiveDirPath(ctx),\n path.basename(artifactPath)\n );\n } else if (type === BuildArtifactType.BUILD_ARTIFACT) {\n targetArtifactPath = path.join(\n getTemporaryBuildArtifactsDirPath(ctx),\n path.basename(artifactPath)\n );\n } else {\n throw new BuildInternalError(`Uploading artifacts of type \"${type}\" is not implemented.`);\n }\n\n await fs.mkdir(path.dirname(targetArtifactPath), { recursive: true });\n await fs.copyFile(artifactPath, targetArtifactPath);\n return targetArtifactPath;\n}\n\nexport async function createTemporaryOutputsDirectoryAsync(\n ctx: BuildStepContext,\n stepId: string\n): Promise<string> {\n const directory = getTemporaryOutputsDirPath(ctx, stepId);\n await fs.mkdir(directory, { recursive: true });\n return directory;\n}\n\nexport async function findArtifactsByTypeAsync(\n ctx: BuildStepContext,\n type: BuildArtifactType\n): Promise<string[]> {\n let artifactsDirPath: string;\n if (type === BuildArtifactType.APPLICATION_ARCHIVE) {\n artifactsDirPath = getTemporaryApplicationArchiveDirPath(ctx);\n } else if (type === BuildArtifactType.BUILD_ARTIFACT) {\n artifactsDirPath = getTemporaryBuildArtifactsDirPath(ctx);\n } else {\n throw new BuildInternalError(`Finding artifacts of type \"${type}\" is not implemented.`);\n }\n try {\n const filenames = await fs.readdir(artifactsDirPath);\n return filenames.map((filename) => path.join(artifactsDirPath, filename));\n } catch (err) {\n ctx.logger.debug(\n { err },\n `Failed reading artifacts of type \"${type}\" from \"${artifactsDirPath}\". The directory probably doesn't exist.`\n );\n return [];\n }\n}\n\nexport async function cleanUpStepTemporaryDirectoriesAsync(\n ctx: BuildStepContext,\n stepId: string\n): Promise<void> {\n if (ctx.skipCleanup) {\n return;\n }\n const stepTemporaryDirectory = getTemporaryStepDirPath(ctx, stepId);\n await fs.rm(stepTemporaryDirectory, { recursive: true, force: true });\n ctx.logger.debug({ stepTemporaryDirectory }, 'Removed step temporary directory');\n}\n\nexport async function cleanUpWorkflowTemporaryDirectoriesAsync(\n ctx: BuildStepContext\n): Promise<void> {\n if (ctx.skipCleanup) {\n return;\n }\n\n const temporaryDirectories: string[] = [getTemporaryArtifactsDirPath(ctx)];\n const rmPromises = temporaryDirectories.map((dir) =>\n fs.rm(dir, { recursive: true, force: true })\n );\n await Promise.all(rmPromises);\n ctx.logger.debug({ temporaryDirectories }, 'Removed temporary directories');\n}\n\nfunction getTemporaryStepDirPath(ctx: BuildStepContext, stepId: string): string {\n return path.join(ctx.baseWorkingDirectory, 'steps', stepId);\n}\n\nfunction getTemporaryScriptsDirPath(ctx: BuildStepContext, stepId: string): string {\n return path.join(getTemporaryStepDirPath(ctx, stepId), 'scripts');\n}\n\nfunction getTemporaryOutputsDirPath(ctx: BuildStepContext, stepId: string): string {\n return path.join(getTemporaryStepDirPath(ctx, stepId), 'outputs');\n}\n\nfunction getTemporaryApplicationArchiveDirPath(ctx: BuildStepContext): string {\n return path.join(getTemporaryArtifactsDirPath(ctx), 'application-archive');\n}\n\nfunction getTemporaryBuildArtifactsDirPath(ctx: BuildStepContext): string {\n return path.join(getTemporaryArtifactsDirPath(ctx), 'build-artifacts');\n}\n\nfunction getTemporaryArtifactsDirPath(ctx: BuildStepContext): string {\n return path.join(ctx.baseWorkingDirectory, 'artifacts');\n}\n"]}
1
+ {"version":3,"file":"BuildTemporaryFiles.js","sourceRoot":"","sources":["../src/BuildTemporaryFiles.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,aAAa,CAAC;AAE7B,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAIpC,MAAM,CAAC,KAAK,UAAU,8BAA8B,CAClD,GAAqB,EACrB,MAAc,EACd,cAAsB;IAEtB,MAAM,UAAU,GAAG,0BAA0B,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAC3D,MAAM,EAAE,CAAC,KAAK,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAChD,MAAM,mBAAmB,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,GAAG,MAAM,EAAE,KAAK,CAAC,CAAC;IACpE,MAAM,EAAE,CAAC,SAAS,CAAC,mBAAmB,EAAE,cAAc,CAAC,CAAC;IACxD,OAAO,mBAAmB,CAAC;AAC7B,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,oCAAoC,CACxD,GAAqB,EACrB,MAAc;IAEd,MAAM,SAAS,GAAG,0BAA0B,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAC1D,MAAM,EAAE,CAAC,KAAK,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC/C,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,oCAAoC,CACxD,GAAqB,EACrB,MAAc;IAEd,IAAI,GAAG,CAAC,WAAW,EAAE;QACnB,OAAO;KACR;IACD,MAAM,sBAAsB,GAAG,uBAAuB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACpE,MAAM,EAAE,CAAC,EAAE,CAAC,sBAAsB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACtE,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,sBAAsB,EAAE,EAAE,kCAAkC,CAAC,CAAC;AACnF,CAAC;AACD,SAAS,uBAAuB,CAAC,GAAqB,EAAE,MAAc;IACpE,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,oBAAoB,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AAC9D,CAAC;AAED,SAAS,0BAA0B,CAAC,GAAqB,EAAE,MAAc;IACvE,OAAO,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,SAAS,CAAC,CAAC;AACpE,CAAC;AAED,SAAS,0BAA0B,CAAC,GAAqB,EAAE,MAAc;IACvE,OAAO,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,SAAS,CAAC,CAAC;AACpE,CAAC","sourcesContent":["import path from 'path';\nimport fs from 'fs/promises';\n\nimport { v4 as uuidv4 } from 'uuid';\n\nimport { BuildStepContext } from './BuildStepContext.js';\n\nexport async function saveScriptToTemporaryFileAsync(\n ctx: BuildStepContext,\n stepId: string,\n scriptContents: string\n): Promise<string> {\n const scriptsDir = getTemporaryScriptsDirPath(ctx, stepId);\n await fs.mkdir(scriptsDir, { recursive: true });\n const temporaryScriptPath = path.join(scriptsDir, `${uuidv4()}.sh`);\n await fs.writeFile(temporaryScriptPath, scriptContents);\n return temporaryScriptPath;\n}\n\nexport async function createTemporaryOutputsDirectoryAsync(\n ctx: BuildStepContext,\n stepId: string\n): Promise<string> {\n const directory = getTemporaryOutputsDirPath(ctx, stepId);\n await fs.mkdir(directory, { recursive: true });\n return directory;\n}\n\nexport async function cleanUpStepTemporaryDirectoriesAsync(\n ctx: BuildStepContext,\n stepId: string\n): Promise<void> {\n if (ctx.skipCleanup) {\n return;\n }\n const stepTemporaryDirectory = getTemporaryStepDirPath(ctx, stepId);\n await fs.rm(stepTemporaryDirectory, { recursive: true, force: true });\n ctx.logger.debug({ stepTemporaryDirectory }, 'Removed step temporary directory');\n}\nfunction getTemporaryStepDirPath(ctx: BuildStepContext, stepId: string): string {\n return path.join(ctx.baseWorkingDirectory, 'steps', stepId);\n}\n\nfunction getTemporaryScriptsDirPath(ctx: BuildStepContext, stepId: string): string {\n return path.join(getTemporaryStepDirPath(ctx, stepId), 'scripts');\n}\n\nfunction getTemporaryOutputsDirPath(ctx: BuildStepContext, stepId: string): string {\n return path.join(getTemporaryStepDirPath(ctx, stepId), 'outputs');\n}\n"]}
@@ -1,4 +1,3 @@
1
- import { BuildArtifacts } from './BuildArtifacts.js';
2
1
  import { BuildFunctionById } from './BuildFunction.js';
3
2
  import { BuildStep } from './BuildStep.js';
4
3
  import { BuildStepContext } from './BuildStepContext.js';
@@ -12,6 +11,4 @@ export declare class BuildWorkflow {
12
11
  buildFunctions: BuildFunctionById;
13
12
  });
14
13
  executeAsync(env?: BuildStepEnv): Promise<void>;
15
- collectArtifactsAsync(): Promise<BuildArtifacts>;
16
- cleanUpAsync(): Promise<void>;
17
14
  }
@@ -1,7 +1,7 @@
1
- import { BuildArtifactType } from './BuildArtifacts.js';
2
- import { cleanUpWorkflowTemporaryDirectoriesAsync, findArtifactsByTypeAsync, } from './BuildTemporaryFiles.js';
3
1
  export class BuildWorkflow {
4
- constructor(ctx, { buildSteps, buildFunctions }) {
2
+ constructor(
3
+ // @ts-expect-error ctx is not used in this class but let's keep it here for consistency
4
+ ctx, { buildSteps, buildFunctions }) {
5
5
  this.ctx = ctx;
6
6
  this.buildSteps = buildSteps;
7
7
  this.buildFunctions = buildFunctions;
@@ -11,18 +11,5 @@ export class BuildWorkflow {
11
11
  await step.executeAsync(env);
12
12
  }
13
13
  }
14
- async collectArtifactsAsync() {
15
- const applicationArchives = await findArtifactsByTypeAsync(this.ctx, BuildArtifactType.APPLICATION_ARCHIVE);
16
- const buildArtifacts = await findArtifactsByTypeAsync(this.ctx, BuildArtifactType.BUILD_ARTIFACT);
17
- return {
18
- ...(applicationArchives.length > 0 && {
19
- [BuildArtifactType.APPLICATION_ARCHIVE]: applicationArchives,
20
- }),
21
- ...(buildArtifacts.length > 0 && { [BuildArtifactType.BUILD_ARTIFACT]: buildArtifacts }),
22
- };
23
- }
24
- async cleanUpAsync() {
25
- await cleanUpWorkflowTemporaryDirectoriesAsync(this.ctx);
26
- }
27
14
  }
28
15
  //# sourceMappingURL=BuildWorkflow.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BuildWorkflow.js","sourceRoot":"","sources":["../src/BuildWorkflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAKxE,OAAO,EACL,wCAAwC,EACxC,wBAAwB,GACzB,MAAM,0BAA0B,CAAC;AAElC,MAAM,OAAO,aAAa;IAIxB,YACmB,GAAqB,EACtC,EAAE,UAAU,EAAE,cAAc,EAAkE;QAD7E,QAAG,GAAH,GAAG,CAAkB;QAGtC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACvC,CAAC;IAEM,KAAK,CAAC,YAAY,CAAC,MAAoB,OAAO,CAAC,GAAG;QACvD,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,UAAU,EAAE;YAClC,MAAM,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;SAC9B;IACH,CAAC;IAEM,KAAK,CAAC,qBAAqB;QAChC,MAAM,mBAAmB,GAAG,MAAM,wBAAwB,CACxD,IAAI,CAAC,GAAG,EACR,iBAAiB,CAAC,mBAAmB,CACtC,CAAC;QACF,MAAM,cAAc,GAAG,MAAM,wBAAwB,CACnD,IAAI,CAAC,GAAG,EACR,iBAAiB,CAAC,cAAc,CACjC,CAAC;QACF,OAAO;YACL,GAAG,CAAC,mBAAmB,CAAC,MAAM,GAAG,CAAC,IAAI;gBACpC,CAAC,iBAAiB,CAAC,mBAAmB,CAAC,EAAE,mBAAmB;aAC7D,CAAC;YACF,GAAG,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,iBAAiB,CAAC,cAAc,CAAC,EAAE,cAAc,EAAE,CAAC;SACzF,CAAC;IACJ,CAAC;IAEM,KAAK,CAAC,YAAY;QACvB,MAAM,wCAAwC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC3D,CAAC;CACF","sourcesContent":["import { BuildArtifacts, BuildArtifactType } from './BuildArtifacts.js';\nimport { BuildFunctionById } from './BuildFunction.js';\nimport { BuildStep } from './BuildStep.js';\nimport { BuildStepContext } from './BuildStepContext.js';\nimport { BuildStepEnv } from './BuildStepEnv.js';\nimport {\n cleanUpWorkflowTemporaryDirectoriesAsync,\n findArtifactsByTypeAsync,\n} from './BuildTemporaryFiles.js';\n\nexport class BuildWorkflow {\n public readonly buildSteps: BuildStep[];\n public readonly buildFunctions: BuildFunctionById;\n\n constructor(\n private readonly ctx: BuildStepContext,\n { buildSteps, buildFunctions }: { buildSteps: BuildStep[]; buildFunctions: BuildFunctionById }\n ) {\n this.buildSteps = buildSteps;\n this.buildFunctions = buildFunctions;\n }\n\n public async executeAsync(env: BuildStepEnv = process.env): Promise<void> {\n for (const step of this.buildSteps) {\n await step.executeAsync(env);\n }\n }\n\n public async collectArtifactsAsync(): Promise<BuildArtifacts> {\n const applicationArchives = await findArtifactsByTypeAsync(\n this.ctx,\n BuildArtifactType.APPLICATION_ARCHIVE\n );\n const buildArtifacts = await findArtifactsByTypeAsync(\n this.ctx,\n BuildArtifactType.BUILD_ARTIFACT\n );\n return {\n ...(applicationArchives.length > 0 && {\n [BuildArtifactType.APPLICATION_ARCHIVE]: applicationArchives,\n }),\n ...(buildArtifacts.length > 0 && { [BuildArtifactType.BUILD_ARTIFACT]: buildArtifacts }),\n };\n }\n\n public async cleanUpAsync(): Promise<void> {\n await cleanUpWorkflowTemporaryDirectoriesAsync(this.ctx);\n }\n}\n"]}
1
+ {"version":3,"file":"BuildWorkflow.js","sourceRoot":"","sources":["../src/BuildWorkflow.ts"],"names":[],"mappings":"AAKA,MAAM,OAAO,aAAa;IAIxB;IACE,wFAAwF;IACvE,GAAqB,EACtC,EAAE,UAAU,EAAE,cAAc,EAAkE;QAD7E,QAAG,GAAH,GAAG,CAAkB;QAGtC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACvC,CAAC;IAEM,KAAK,CAAC,YAAY,CAAC,MAAoB,OAAO,CAAC,GAAG;QACvD,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,UAAU,EAAE;YAClC,MAAM,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;SAC9B;IACH,CAAC;CACF","sourcesContent":["import { BuildFunctionById } from './BuildFunction.js';\nimport { BuildStep } from './BuildStep.js';\nimport { BuildStepContext } from './BuildStepContext.js';\nimport { BuildStepEnv } from './BuildStepEnv.js';\n\nexport class BuildWorkflow {\n public readonly buildSteps: BuildStep[];\n public readonly buildFunctions: BuildFunctionById;\n\n constructor(\n // @ts-expect-error ctx is not used in this class but let's keep it here for consistency\n private readonly ctx: BuildStepContext,\n { buildSteps, buildFunctions }: { buildSteps: BuildStep[]; buildFunctions: BuildFunctionById }\n ) {\n this.buildSteps = buildSteps;\n this.buildFunctions = buildFunctions;\n }\n\n public async executeAsync(env: BuildStepEnv = process.env): Promise<void> {\n for (const step of this.buildSteps) {\n await step.executeAsync(env);\n }\n }\n}\n"]}
@@ -1,5 +1,6 @@
1
1
  import { BuildConfigError } from './errors/BuildConfigError.js';
2
2
  import { BuildWorkflowError } from './errors/BuildWorkflowError.js';
3
+ import { duplicates } from './utils/expodash/duplicates.js';
3
4
  import { findOutputPaths } from './utils/template.js';
4
5
  export class BuildWorkflowValidator {
5
6
  constructor(workflow) {
@@ -15,17 +16,7 @@ export class BuildWorkflowValidator {
15
16
  }
16
17
  validateUniqueStepIds() {
17
18
  const stepIds = this.workflow.buildSteps.map(({ id }) => id);
18
- const visitedStepIdsSet = new Set();
19
- const duplicatedStepIdsSet = new Set();
20
- for (const stepId of stepIds) {
21
- if (visitedStepIdsSet.has(stepId)) {
22
- duplicatedStepIdsSet.add(stepId);
23
- }
24
- else {
25
- visitedStepIdsSet.add(stepId);
26
- }
27
- }
28
- const duplicatedStepIds = [...duplicatedStepIdsSet];
19
+ const duplicatedStepIds = duplicates(stepIds);
29
20
  if (duplicatedStepIds.length === 0) {
30
21
  return [];
31
22
  }
@@ -1 +1 @@
1
- {"version":3,"file":"BuildWorkflowValidator.js","sourceRoot":"","sources":["../src/BuildWorkflowValidator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,OAAO,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,kBAAkB,CAAC,2BAA2B,EAAE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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"]}
1
+ {"version":3,"file":"BuildWorkflowValidator.js","sourceRoot":"","sources":["../src/BuildWorkflowValidator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,OAAO,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,kBAAkB,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,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC;QAC7D,MAAM,iBAAiB,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;QAC9C,IAAI,iBAAiB,CAAC,MAAM,KAAK,CAAC,EAAE;YAClC,OAAO,EAAE,CAAC;SACX;aAAM;YACL,MAAM,KAAK,GAAG,IAAI,gBAAgB,CAChC,wBAAwB,iBAAiB,CAAC,GAAG,C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C;yBACpB;qBACF;yBAAM;wBACL,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,kBAAkB,CAAC,QAAQ,CAAC,EAAE;4BACtD,MAAM,KAAK,GAAG,IAAI,gBAAgB,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","sourcesContent":["import { BuildStep } from './BuildStep.js';\nimport { BuildWorkflow } from './BuildWorkflow.js';\nimport { BuildConfigError } from './errors/BuildConfigError.js';\nimport { BuildWorkflowError } from './errors/BuildWorkflowError.js';\nimport { duplicates } from './utils/expodash/duplicates.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 duplicatedStepIds = duplicates(stepIds);\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"]}
@@ -13,10 +13,6 @@ async function runAsync(configPath, workingDirectory) {
13
13
  const parser = new BuildConfigParser(ctx, { configPath });
14
14
  const workflow = await parser.parseAsync();
15
15
  await workflow.executeAsync();
16
- const artifacts = await workflow.collectArtifactsAsync();
17
- if (Object.keys(artifacts).length > 0) {
18
- logger.info({ artifacts }, 'The workflow produced artifacts');
19
- }
20
16
  }
21
17
  const relativeConfigPath = process.argv[2];
22
18
  const relativeWorkingDirectoryPath = process.argv[3];
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli/cli.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,MAAM,MAAM,GAAG,YAAY,CAAC;IAC1B,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,MAAM;CAC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AAM,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"]}
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli/cli.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,MAAM,MAAM,GAAG,YAAY,CAAC;IAC1B,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,MAAM;CACd,CAAC,CAAC;AAEH,KAAK,UAAU,QAAQ,CAAC,UAAkB,EAAE,gBAAwB;IAClE,MAAM,WAAW,GAAG,MAAM,EAAE,CAAC;IAC7B,MAAM,GAAG,GAAG,IAAI,gBAAgB,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAAC;IAC/E,MAAM,MAAM,GAAG,IAAI,iBAAiB,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;AAChC,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,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,kBAAkB,CAAC,CAAC;AACnE,MAAM,gBAAgB,GAAG,IAAI,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}\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"]}
@@ -1,3 +1,5 @@
1
- export { BuildArtifactType } from './BuildArtifacts.js';
2
1
  export { BuildConfigParser } from './BuildConfigParser.js';
2
+ export { BuildFunction } from './BuildFunction.js';
3
+ export { BuildStepInput } from './BuildStepInput.js';
4
+ export { BuildStepOutput } from './BuildStepOutput.js';
3
5
  export { BuildStepContext } from './BuildStepContext.js';
package/dist_esm/index.js CHANGED
@@ -1,4 +1,6 @@
1
- export { BuildArtifactType } from './BuildArtifacts.js';
2
1
  export { BuildConfigParser } from './BuildConfigParser.js';
2
+ export { BuildFunction } from './BuildFunction.js';
3
+ export { BuildStepInput } from './BuildStepInput.js';
4
+ export { BuildStepOutput } from './BuildStepOutput.js';
3
5
  export { BuildStepContext } from './BuildStepContext.js';
4
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC","sourcesContent":["export { BuildArtifactType } from './BuildArtifacts.js';\nexport { BuildConfigParser } from './BuildConfigParser.js';\nexport { BuildStepContext } from './BuildStepContext.js';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC","sourcesContent":["export { BuildConfigParser } from './BuildConfigParser.js';\nexport { BuildFunction } from './BuildFunction.js';\nexport { BuildStepInput } from './BuildStepInput.js';\nexport { BuildStepOutput } from './BuildStepOutput.js';\nexport { BuildStepContext } from './BuildStepContext.js';\n"]}
@@ -0,0 +1 @@
1
+ export declare function duplicates<T = any>(items: T[]): T[];
@@ -0,0 +1,14 @@
1
+ export function duplicates(items) {
2
+ const visitedItemsSet = new Set();
3
+ const duplicatedItemsSet = new Set();
4
+ for (const item of items) {
5
+ if (visitedItemsSet.has(item)) {
6
+ duplicatedItemsSet.add(item);
7
+ }
8
+ else {
9
+ visitedItemsSet.add(item);
10
+ }
11
+ }
12
+ return [...duplicatedItemsSet];
13
+ }
14
+ //# sourceMappingURL=duplicates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"duplicates.js","sourceRoot":"","sources":["../../../src/utils/expodash/duplicates.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,UAAU,CAAU,KAAU;IAC5C,MAAM,eAAe,GAAG,IAAI,GAAG,EAAK,CAAC;IACrC,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAAK,CAAC;IACxC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACxB,IAAI,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YAC7B,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;SAC9B;aAAM;YACL,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;SAC3B;KACF;IACD,OAAO,CAAC,GAAG,kBAAkB,CAAC,CAAC;AACjC,CAAC","sourcesContent":["export function duplicates<T = any>(items: T[]): T[] {\n const visitedItemsSet = new Set<T>();\n const duplicatedItemsSet = new Set<T>();\n for (const item of items) {\n if (visitedItemsSet.has(item)) {\n duplicatedItemsSet.add(item);\n } else {\n visitedItemsSet.add(item);\n }\n }\n return [...duplicatedItemsSet];\n}\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@expo/steps",
3
3
  "type": "module",
4
- "version": "0.0.8",
4
+ "version": "0.0.9",
5
5
  "main": "./dist_commonjs/index.cjs",
6
6
  "types": "./dist_esm/index.d.ts",
7
7
  "exports": {
@@ -39,6 +39,7 @@
39
39
  "jest": "^29.4.1",
40
40
  "ts-jest": "^29.0.5",
41
41
  "ts-mockito": "^2.6.1",
42
+ "ts-node": "^10.9.1",
42
43
  "typescript": "^4.9.5"
43
44
  },
44
45
  "engines": {
@@ -1,12 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- set -eo pipefail
4
-
5
- if [[ -z "$__EXPO_STEPS_BUILD_ID" || -z "$__EXPO_STEPS_WORKING_DIRECTORY" ]]; then
6
- echo "Set __EXPO_STEPS_BUILD_ID and __EXPO_STEPS_WORKING_DIRECTORY"
7
- exit 1
8
- fi
9
-
10
- STEPS_ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/.. && pwd )"
11
-
12
- node $STEPS_ROOT_DIR/dist_commonjs/bin/uploadArtifact.cjs $@
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BuildArtifactType = void 0;
4
- var BuildArtifactType;
5
- (function (BuildArtifactType) {
6
- BuildArtifactType["APPLICATION_ARCHIVE"] = "application-archive";
7
- BuildArtifactType["BUILD_ARTIFACT"] = "build-artifact";
8
- })(BuildArtifactType = exports.BuildArtifactType || (exports.BuildArtifactType = {}));
9
- //# sourceMappingURL=BuildArtifacts.js.map
@@ -1,5 +0,0 @@
1
- export declare enum BuildArtifactType {
2
- APPLICATION_ARCHIVE = "application-archive",
3
- BUILD_ARTIFACT = "build-artifact"
4
- }
5
- export type BuildArtifacts = Partial<Record<BuildArtifactType, string[]>>;
@@ -1 +0,0 @@
1
- {"version":3,"file":"BuildArtifacts.js","sourceRoot":"","sources":["../src/BuildArtifacts.ts"],"names":[],"mappings":";;;AAAA,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,gEAA2C,CAAA;IAC3C,sDAAiC,CAAA;AACnC,CAAC,EAHW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,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"]}
@@ -1,30 +0,0 @@
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
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- {"version":3,"file":"uploadArtifact.js","sourceRoot":"","sources":["../../src/bin/uploadArtifact.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,yCAA4C;AAC5C,8CAAsB;AAEtB,0DAAoD;AACpD,4DAAyD;AACzD,gEAA0D;AAC1D,sEAAkF;AAElF,MAAM,IAAI,GAAG,IAAA,aAAG,EAAC;IACf,QAAQ,EAAE,MAAM;CACjB,CAAC,CAAC;AAEH,MAAM,eAAe,GAAG,IAAA,0BAAU,EAChC,MAAA,IAAI,CAAC,CAAC,0CAAG,CAAC,CAAC,EACX,4FAA4F,CAC7F,CAAC;AACF,MAAM,YAAY,GAAG,cAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,eAAe,CAAC,CAAC;AAElE,MAAM,MAAM,GAAG,IAAA,qBAAY,EAAC;IAC1B,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,MAAM;CACd,CAAC,CAAC;AAEH,MAAM,GAAG,GAAG,IAAI,sCAAgB,CAC9B,IAAA,0BAAU,EAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,4BAA4B,CAAC,EAC3E,MAAM,EACN,KAAK,EACL,IAAA,0BAAU,EAAC,OAAO,CAAC,GAAG,CAAC,8BAA8B,EAAE,4BAA4B,CAAC,CACrF,CAAC;AAEF,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAkC,CAAC;AAChE,MAAM,IAAI,GAAG,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,qCAAiB,CAAC,mBAAmB,CAAC;AAE9D,IAAA,8DAAqC,EAAC,GAAG,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IAC3E,OAAO,CAAC,KAAK,CAAC,qBAAqB,YAAY,eAAe,EAAE,GAAG,CAAC,CAAC;IACrE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC","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"]}
@@ -1,5 +0,0 @@
1
- export declare enum BuildArtifactType {
2
- APPLICATION_ARCHIVE = "application-archive",
3
- BUILD_ARTIFACT = "build-artifact"
4
- }
5
- export type BuildArtifacts = Partial<Record<BuildArtifactType, string[]>>;
@@ -1,6 +0,0 @@
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
@@ -1 +0,0 @@
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"]}
@@ -1 +0,0 @@
1
- export {};
@@ -1,25 +0,0 @@
1
- var _a;
2
- import path from 'path';
3
- import { createLogger } from '@expo/logger';
4
- import arg from 'arg';
5
- import { nullthrows } from '../utils/nullthrows.js';
6
- import { BuildArtifactType } from '../BuildArtifacts.js';
7
- import { BuildStepContext } from '../BuildStepContext.js';
8
- import { saveArtifactToTemporaryDirectoryAsync } from '../BuildTemporaryFiles.js';
9
- const args = arg({
10
- '--type': String,
11
- });
12
- const artifactPathArg = 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"');
13
- const artifactPath = path.resolve(process.cwd(), artifactPathArg);
14
- const logger = createLogger({
15
- name: 'eas-build',
16
- level: 'info',
17
- });
18
- const ctx = new BuildStepContext(nullthrows(process.env.__EXPO_STEPS_BUILD_ID, 'Set __EXPO_STEPS_BUILD_ID.'), logger, false, nullthrows(process.env.__EXPO_STEPS_WORKING_DIRECTORY, 'Set __EXPO_STEPS_BUILD_ID.'));
19
- const rawType = args['--type'];
20
- const type = rawType !== null && rawType !== void 0 ? rawType : BuildArtifactType.APPLICATION_ARCHIVE;
21
- saveArtifactToTemporaryDirectoryAsync(ctx, type, artifactPath).catch((err) => {
22
- console.error(`Failed preparing "${artifactPath}" for upload.`, err);
23
- process.exit(2);
24
- });
25
- //# sourceMappingURL=uploadArtifact.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"uploadArtifact.js","sourceRoot":"","sources":["../../src/bin/uploadArtifact.ts"],"names":[],"mappings":";AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,qCAAqC,EAAE,MAAM,2BAA2B,CAAC;AAElF,MAAM,IAAI,GAAG,GAAG,CAAC;IACf,QAAQ,EAAE,MAAM;CACjB,CAAC,CAAC;AAEH,MAAM,eAAe,GAAG,UAAU,CAChC,MAAA,IAAI,CAAC,CAAC,0CAAG,CAAC,CAAC,EACX,4FAA4F,CAC7F,CAAC;AACF,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,eAAe,CAAC,CAAC;AAElE,MAAM,MAAM,GAAG,YAAY,CAAC;IAC1B,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,MAAM;CACd,CAAC,CAAC;AAEH,MAAM,GAAG,GAAG,IAAI,gBAAgB,CAC9B,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,4BAA4B,CAAC,EAC3E,MAAM,EACN,KAAK,EACL,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,8BAA8B,EAAE,4BAA4B,CAAC,CACrF,CAAC;AAEF,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAkC,CAAC;AAChE,MAAM,IAAI,GAAG,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,iBAAiB,CAAC,mBAAmB,CAAC;AAE9D,qCAAqC,CAAC,GAAG,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IAC3E,OAAO,CAAC,KAAK,CAAC,qBAAqB,YAAY,eAAe,EAAE,GAAG,CAAC,CAAC;IACrE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC","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"]}