eas-cli-local-build-plugin 0.0.57 → 0.0.61

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.
@@ -5,11 +5,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.prepareBuildArtifact = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
- const dateformat_1 = __importDefault(require("dateformat"));
9
8
  const fs_extra_1 = __importDefault(require("fs-extra"));
10
9
  const tar_1 = __importDefault(require("tar"));
11
10
  const config_1 = __importDefault(require("./config"));
12
11
  async function prepareBuildArtifact(ctx, artifactPaths) {
12
+ var _a;
13
13
  ctx.logger.info({ phase: 'PREPARE_ARTIFACTS' }, 'Archiving artifacts');
14
14
  let suffix;
15
15
  let localPath;
@@ -29,8 +29,8 @@ async function prepareBuildArtifact(ctx, artifactPaths) {
29
29
  suffix = '.tar.gz';
30
30
  localPath = archivePath;
31
31
  }
32
- const artifactName = `build-${formatDateForFilename(new Date())}${suffix}`;
33
- const destPath = path_1.default.join(config_1.default.artifactsDir, artifactName);
32
+ const artifactName = `build-${Date.now()}${suffix}`;
33
+ const destPath = (_a = config_1.default.artifactPath) !== null && _a !== void 0 ? _a : path_1.default.join(config_1.default.artifactsDir, artifactName);
34
34
  await fs_extra_1.default.copy(localPath, destPath);
35
35
  ctx.logger.info({ phase: 'PREPARE_ARTIFACTS' }, `Writing artifacts to ${destPath}`);
36
36
  return destPath;
@@ -48,7 +48,4 @@ function getCommonParentDir(path1, path2) {
48
48
  }
49
49
  return '/';
50
50
  }
51
- function formatDateForFilename(date) {
52
- return dateformat_1.default(date, 'dd-mm-yyyy-HH:MM');
53
- }
54
51
  //# sourceMappingURL=buildArtifact.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"buildArtifact.js","sourceRoot":"","sources":["../src/buildArtifact.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAIxB,4DAAoC;AACpC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3E,MAAM,QAAQ,GAAG,cAAI,CAAC,IAAI,CAAC,gBAAM,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;IAC9D,MAAM,kBAAE,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IACnC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,mBAAmB,EAAE,EAAE,wBAAwB,QAAQ,EAAE,CAAC,CAAC;IACpF,OAAO,QAAQ,CAAC;AAClB,CAAC;AApCD,oDAoCC;AAED,SAAS,kBAAkB,CAAC,KAAa,EAAE,KAAa;IACtD,MAAM,eAAe,GAAG,cAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,eAAe,GAAG,cAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC9C,IAAI,OAAO,GAAG,cAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IAC5C,OAAO,OAAO,KAAK,GAAG,EAAE;QACtB,IAAI,eAAe,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE;YACvC,OAAO,OAAO,CAAC;SAChB;QACD,OAAO,GAAG,cAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;KACjC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,qBAAqB,CAAC,IAAU;IACvC,OAAO,oBAAU,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC;AAC9C,CAAC","sourcesContent":["import path from 'path';\n\nimport { BuildContext } from '@expo/build-tools';\nimport { Job } from '@expo/eas-build-job';\nimport dateFormat from 'dateformat';\nimport fs from 'fs-extra';\nimport tar from 'tar';\n\nimport config from './config';\n\nexport async function prepareBuildArtifact(\n ctx: BuildContext<Job>,\n artifactPaths: string[]\n): Promise<string | undefined> {\n ctx.logger.info({ phase: 'PREPARE_ARTIFACTS' }, 'Archiving artifacts');\n let suffix;\n let localPath;\n if (artifactPaths.length === 1 && !(await fs.lstat(artifactPaths[0])).isDirectory()) {\n [localPath] = artifactPaths;\n suffix = path.extname(artifactPaths[0]);\n } else {\n const parentDir = artifactPaths.reduce(\n (acc, item) => getCommonParentDir(acc, item),\n artifactPaths[0]\n );\n const relativePathsToArchive = artifactPaths.map((absolute) =>\n path.relative(parentDir, absolute)\n );\n\n const archivePath = path.join(config.workingdir, 'artifacts.tar.gz');\n await tar.c(\n {\n gzip: true,\n file: archivePath,\n cwd: parentDir,\n },\n relativePathsToArchive\n );\n suffix = '.tar.gz';\n localPath = archivePath;\n }\n const artifactName = `build-${formatDateForFilename(new Date())}${suffix}`;\n const destPath = path.join(config.artifactsDir, artifactName);\n await fs.copy(localPath, destPath);\n ctx.logger.info({ phase: 'PREPARE_ARTIFACTS' }, `Writing artifacts to ${destPath}`);\n return destPath;\n}\n\nfunction getCommonParentDir(path1: string, path2: string): string {\n const normalizedPath1 = path.normalize(path1);\n const normalizedPath2 = path.normalize(path2);\n let current = path.dirname(normalizedPath1);\n while (current !== '/') {\n if (normalizedPath2.startsWith(current)) {\n return current;\n }\n current = path.dirname(current);\n }\n return '/';\n}\n\nfunction formatDateForFilename(date: Date): string {\n return dateFormat(date, 'dd-mm-yyyy-HH:MM');\n}\n"]}
1
+ {"version":3,"file":"buildArtifact.js","sourceRoot":"","sources":["../src/buildArtifact.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAIxB,wDAA0B;AAC1B,8CAAsB;AAEtB,sDAA8B;AAEvB,KAAK,UAAU,oBAAoB,CACxC,GAAsB,EACtB,aAAuB;;IAEvB,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,mBAAmB,EAAE,EAAE,qBAAqB,CAAC,CAAC;IACvE,IAAI,MAAM,CAAC;IACX,IAAI,SAAS,CAAC;IACd,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,kBAAE,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,EAAE;Q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,eAAe,GAAG,cAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,eAAe,GAAG,cAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC9C,IAAI,OAAO,GAAG,cAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IAC5C,OAAO,OAAO,KAAK,GAAG,EAAE;QACtB,IAAI,eAAe,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE;YACvC,OAAO,OAAO,CAAC;SAChB;QACD,OAAO,GAAG,cAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;KACjC;IACD,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["import path from 'path';\n\nimport { BuildContext } from '@expo/build-tools';\nimport { Job } from '@expo/eas-build-job';\nimport fs from 'fs-extra';\nimport tar from 'tar';\n\nimport config from './config';\n\nexport async function prepareBuildArtifact(\n ctx: BuildContext<Job>,\n artifactPaths: string[]\n): Promise<string | undefined> {\n ctx.logger.info({ phase: 'PREPARE_ARTIFACTS' }, 'Archiving artifacts');\n let suffix;\n let localPath;\n if (artifactPaths.length === 1 && !(await fs.lstat(artifactPaths[0])).isDirectory()) {\n [localPath] = artifactPaths;\n suffix = path.extname(artifactPaths[0]);\n } else {\n const parentDir = artifactPaths.reduce(\n (acc, item) => getCommonParentDir(acc, item),\n artifactPaths[0]\n );\n const relativePathsToArchive = artifactPaths.map((absolute) =>\n path.relative(parentDir, absolute)\n );\n\n const archivePath = path.join(config.workingdir, 'artifacts.tar.gz');\n await tar.c(\n {\n gzip: true,\n file: archivePath,\n cwd: parentDir,\n },\n relativePathsToArchive\n );\n suffix = '.tar.gz';\n localPath = archivePath;\n }\n const artifactName = `build-${Date.now()}${suffix}`;\n const destPath = config.artifactPath ?? path.join(config.artifactsDir, artifactName);\n await fs.copy(localPath, destPath);\n ctx.logger.info({ phase: 'PREPARE_ARTIFACTS' }, `Writing artifacts to ${destPath}`);\n return destPath;\n}\n\nfunction getCommonParentDir(path1: string, path2: string): string {\n const normalizedPath1 = path.normalize(path1);\n const normalizedPath2 = path.normalize(path2);\n let current = path.dirname(normalizedPath1);\n while (current !== '/') {\n if (normalizedPath2.startsWith(current)) {\n return current;\n }\n current = path.dirname(current);\n }\n return '/';\n}\n"]}
package/dist/config.d.ts CHANGED
@@ -3,6 +3,7 @@ declare const _default: {
3
3
  skipCleanup: boolean;
4
4
  skipNativeBuild: boolean;
5
5
  artifactsDir: string;
6
+ artifactPath: string | undefined;
6
7
  logger: {
7
8
  level: "debug" | "info" | "warn" | "error";
8
9
  };
package/dist/config.js CHANGED
@@ -12,6 +12,7 @@ const envWorkingdir = process.env.EAS_LOCAL_BUILD_WORKINGDIR;
12
12
  const envSkipCleanup = process.env.EAS_LOCAL_BUILD_SKIP_CLEANUP;
13
13
  const envSkipNativeBuild = process.env.EAS_LOCAL_BUILD_SKIP_NATIVE_BUILD;
14
14
  const envArtifactsDir = process.env.EAS_LOCAL_BUILD_ARTIFACTS_DIR;
15
+ const envArtifactPath = process.env.EAS_LOCAL_BUILD_ARTIFACT_PATH;
15
16
  if (envLoggerLevel && !['debug', 'info', 'warn', 'error'].includes(envLoggerLevel)) {
16
17
  throw new Error('Invalid value for EAS_LOCAL_BUILD_LOGGER_LEVEL, one of info, warn, or error is expected');
17
18
  }
@@ -20,6 +21,7 @@ exports.default = {
20
21
  skipCleanup: envSkipCleanup === '1',
21
22
  skipNativeBuild: envSkipNativeBuild === '1',
22
23
  artifactsDir: envArtifactsDir !== null && envArtifactsDir !== void 0 ? envArtifactsDir : process.cwd(),
24
+ artifactPath: envArtifactPath,
23
25
  logger: {
24
26
  level: (envLoggerLevel !== null && envLoggerLevel !== void 0 ? envLoggerLevel : 'info'),
25
27
  },
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;;;AAAA,gDAAwB;AAExB,+BAAoC;AACpC,0DAAiC;AAEjC,MAAM,EAAE,IAAI,EAAE,GAAG,mBAAQ,CAAC,iBAAiB,CAAC,CAAC;AAE7C,MAAM,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC;AAChE,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC;AAC7D,MAAM,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC;AAChE,MAAM,kBAAkB,GAAG,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC;AACzE,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC;AAElE,IAAI,cAAc,IAAI,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE;IAClF,MAAM,IAAI,KAAK,CACb,yFAAyF,CAC1F,CAAC;CACH;AAED,kBAAe;IACb,UAAU,EAAE,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,cAAI,CAAC,IAAI,CAAC,IAAI,EAAE,SAAM,EAAE,CAAC;IACtD,WAAW,EAAE,cAAc,KAAK,GAAG;IACnC,eAAe,EAAE,kBAAkB,KAAK,GAAG;IAC3C,YAAY,EAAE,eAAe,aAAf,eAAe,cAAf,eAAe,GAAI,OAAO,CAAC,GAAG,EAAE;IAC9C,MAAM,EAAE;QACN,KAAK,EAAE,CAAC,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,MAAM,CAAwC;KACzE;CACF,CAAC","sourcesContent":["import path from 'path';\n\nimport { v4 as uuidv4 } from 'uuid';\nimport envPaths from 'env-paths';\n\nconst { temp } = envPaths('eas-build-local');\n\nconst envLoggerLevel = process.env.EAS_LOCAL_BUILD_LOGGER_LEVEL;\nconst envWorkingdir = process.env.EAS_LOCAL_BUILD_WORKINGDIR;\nconst envSkipCleanup = process.env.EAS_LOCAL_BUILD_SKIP_CLEANUP;\nconst envSkipNativeBuild = process.env.EAS_LOCAL_BUILD_SKIP_NATIVE_BUILD;\nconst envArtifactsDir = process.env.EAS_LOCAL_BUILD_ARTIFACTS_DIR;\n\nif (envLoggerLevel && !['debug', 'info', 'warn', 'error'].includes(envLoggerLevel)) {\n throw new Error(\n 'Invalid value for EAS_LOCAL_BUILD_LOGGER_LEVEL, one of info, warn, or error is expected'\n );\n}\n\nexport default {\n workingdir: envWorkingdir ?? path.join(temp, uuidv4()),\n skipCleanup: envSkipCleanup === '1',\n skipNativeBuild: envSkipNativeBuild === '1',\n artifactsDir: envArtifactsDir ?? process.cwd(),\n logger: {\n level: (envLoggerLevel ?? 'info') as 'debug' | 'info' | 'warn' | 'error',\n },\n};\n"]}
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;;;AAAA,gDAAwB;AAExB,+BAAoC;AACpC,0DAAiC;AAEjC,MAAM,EAAE,IAAI,EAAE,GAAG,mBAAQ,CAAC,iBAAiB,CAAC,CAAC;AAE7C,MAAM,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC;AAChE,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC;AAC7D,MAAM,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC;AAChE,MAAM,kBAAkB,GAAG,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC;AACzE,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC;AAClE,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC;AAElE,IAAI,cAAc,IAAI,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE;IAClF,MAAM,IAAI,KAAK,CACb,yFAAyF,CAC1F,CAAC;CACH;AAED,kBAAe;IACb,UAAU,EAAE,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,cAAI,CAAC,IAAI,CAAC,IAAI,EAAE,SAAM,EAAE,CAAC;IACtD,WAAW,EAAE,cAAc,KAAK,GAAG;IACnC,eAAe,EAAE,kBAAkB,KAAK,GAAG;IAC3C,YAAY,EAAE,eAAe,aAAf,eAAe,cAAf,eAAe,GAAI,OAAO,CAAC,GAAG,EAAE;IAC9C,YAAY,EAAE,eAAe;IAC7B,MAAM,EAAE;QACN,KAAK,EAAE,CAAC,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,MAAM,CAAwC;KACzE;CACF,CAAC","sourcesContent":["import path from 'path';\n\nimport { v4 as uuidv4 } from 'uuid';\nimport envPaths from 'env-paths';\n\nconst { temp } = envPaths('eas-build-local');\n\nconst envLoggerLevel = process.env.EAS_LOCAL_BUILD_LOGGER_LEVEL;\nconst envWorkingdir = process.env.EAS_LOCAL_BUILD_WORKINGDIR;\nconst envSkipCleanup = process.env.EAS_LOCAL_BUILD_SKIP_CLEANUP;\nconst envSkipNativeBuild = process.env.EAS_LOCAL_BUILD_SKIP_NATIVE_BUILD;\nconst envArtifactsDir = process.env.EAS_LOCAL_BUILD_ARTIFACTS_DIR;\nconst envArtifactPath = process.env.EAS_LOCAL_BUILD_ARTIFACT_PATH;\n\nif (envLoggerLevel && !['debug', 'info', 'warn', 'error'].includes(envLoggerLevel)) {\n throw new Error(\n 'Invalid value for EAS_LOCAL_BUILD_LOGGER_LEVEL, one of info, warn, or error is expected'\n );\n}\n\nexport default {\n workingdir: envWorkingdir ?? path.join(temp, uuidv4()),\n skipCleanup: envSkipCleanup === '1',\n skipNativeBuild: envSkipNativeBuild === '1',\n artifactsDir: envArtifactsDir ?? process.cwd(),\n artifactPath: envArtifactPath,\n logger: {\n level: (envLoggerLevel ?? 'info') as 'debug' | 'info' | 'warn' | 'error',\n },\n};\n"]}
package/dist/eject.d.ts CHANGED
@@ -2,4 +2,5 @@ import { Job } from '@expo/eas-build-job';
2
2
  import { BuildContext, EjectProvider, EjectOptions } from '@expo/build-tools';
3
3
  export declare class LocalExpoCliEjectProvider implements EjectProvider<Job> {
4
4
  runEject(ctx: BuildContext<Job>, options?: EjectOptions): Promise<void>;
5
+ private getPrebuildCommand;
5
6
  }
package/dist/eject.js CHANGED
@@ -17,10 +17,34 @@ class LocalExpoCliEjectProvider {
17
17
  env: Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options.extraEnvs), ctx.env),
18
18
  };
19
19
  const expoCliBinPath = (_a = process.env.EXPO_CLI_PATH) !== null && _a !== void 0 ? _a : path_1.default.resolve(path_1.default.dirname(expoCliPackage), '../bin/expo.js');
20
- logger.debug(`${expoCliBinPath} prebuild --non-interactive --platform ${job.platform}`);
21
- await turtle_spawn_1.default(expoCliBinPath, ['prebuild', '--non-interactive', '--platform', job.platform], Object.assign(Object.assign({}, spawnOptions), { cwd: ctx.reactNativeProjectDirectory }));
20
+ const prebuildCommand = this.getPrebuildCommand(job);
21
+ logger.debug(`${expoCliBinPath} ${prebuildCommand}`);
22
+ await turtle_spawn_1.default('bash', ['-c', `${expoCliBinPath} ${prebuildCommand}`], Object.assign(Object.assign({}, spawnOptions), { cwd: ctx.reactNativeProjectDirectory }));
22
23
  await turtle_spawn_1.default(ctx.packageManager, ['install'], Object.assign(Object.assign({}, spawnOptions), { cwd: ctx.reactNativeProjectDirectory }));
23
24
  }
25
+ getPrebuildCommand(job) {
26
+ var _a, _b;
27
+ let prebuildCommand = (_b = (_a = job.experimental) === null || _a === void 0 ? void 0 : _a.prebuildCommand) !== null && _b !== void 0 ? _b : `prebuild --non-interactive --platform ${job.platform}`;
28
+ if (!prebuildCommand.match(/(?:--platform| -p)/)) {
29
+ prebuildCommand = `${prebuildCommand} --platform ${job.platform}`;
30
+ }
31
+ if (!prebuildCommand.match(/--non-interactive/)) {
32
+ prebuildCommand = `${prebuildCommand} --non-interactive`;
33
+ }
34
+ const npxCommandPrefix = 'npx ';
35
+ const expoCommandPrefix = 'expo ';
36
+ const expoCliCommandPrefix = 'expo-cli ';
37
+ if (prebuildCommand.startsWith(npxCommandPrefix)) {
38
+ prebuildCommand = prebuildCommand.substr(npxCommandPrefix.length).trim();
39
+ }
40
+ if (prebuildCommand.startsWith(expoCommandPrefix)) {
41
+ prebuildCommand = prebuildCommand.substr(expoCommandPrefix.length).trim();
42
+ }
43
+ if (prebuildCommand.startsWith(expoCliCommandPrefix)) {
44
+ prebuildCommand = prebuildCommand.substr(expoCliCommandPrefix.length).trim();
45
+ }
46
+ return prebuildCommand;
47
+ }
24
48
  }
25
49
  exports.LocalExpoCliEjectProvider = LocalExpoCliEjectProvider;
26
50
  //# sourceMappingURL=eject.js.map
package/dist/eject.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"eject.js","sourceRoot":"","sources":["../src/eject.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAIxB,sEAA4C;AAE5C,MAAM,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAEnD,MAAa,yBAAyB;IACpC,KAAK,CAAC,QAAQ,CAAC,GAAsB,EAAE,OAAsB;;QAC3D,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC;QAE5B,MAAM,YAAY,GAAG;YACnB,GAAG,EAAE,GAAG,CAAC,cAAc;YACvB,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,GAAG,kCACE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,GAClB,GAAG,CAAC,GAAG,CACX;SACF,CAAC;QAEF,MAAM,cAAc,GAClB,MAAA,OAAO,CAAC,GAAG,CAAC,aAAa,mCAAI,cAAI,CAAC,OAAO,CAAC,cAAI,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,gBAAgB,CAAC,CAAC;QAC5F,MAAM,CAAC,KAAK,CAAC,GAAG,cAAc,0CAA0C,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;QACxF,MAAM,sBAAU,CACd,cAAc,EACd,CAAC,UAAU,EAAE,mBAAmB,EAAE,YAAY,EAAE,GAAG,CAAC,QAAQ,CAAC,kCAExD,YAAY,KACf,GAAG,EAAE,GAAG,CAAC,2BAA2B,IAEvC,CAAC;QAEF,MAAM,sBAAU,CAAC,GAAG,CAAC,cAAc,EAAE,CAAC,SAAS,CAAC,kCAC3C,YAAY,KACf,GAAG,EAAE,GAAG,CAAC,2BAA2B,IACpC,CAAC;IACL,CAAC;CACF;AA9BD,8DA8BC","sourcesContent":["import path from 'path';\n\nimport { Job } from '@expo/eas-build-job';\nimport { BuildContext, EjectProvider, EjectOptions } from '@expo/build-tools';\nimport spawnAsync from '@expo/turtle-spawn';\n\nconst expoCliPackage = require.resolve('expo-cli');\n\nexport class LocalExpoCliEjectProvider implements EjectProvider<Job> {\n async runEject(ctx: BuildContext<Job>, options?: EjectOptions): Promise<void> {\n const { logger, job } = ctx;\n\n const spawnOptions = {\n cwd: ctx.buildDirectory,\n logger: ctx.logger,\n env: {\n ...options?.extraEnvs,\n ...ctx.env,\n },\n };\n\n const expoCliBinPath =\n process.env.EXPO_CLI_PATH ?? path.resolve(path.dirname(expoCliPackage), '../bin/expo.js');\n logger.debug(`${expoCliBinPath} prebuild --non-interactive --platform ${job.platform}`);\n await spawnAsync(\n expoCliBinPath,\n ['prebuild', '--non-interactive', '--platform', job.platform],\n {\n ...spawnOptions,\n cwd: ctx.reactNativeProjectDirectory,\n }\n );\n\n await spawnAsync(ctx.packageManager, ['install'], {\n ...spawnOptions,\n cwd: ctx.reactNativeProjectDirectory,\n });\n }\n}\n"]}
1
+ {"version":3,"file":"eject.js","sourceRoot":"","sources":["../src/eject.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAIxB,sEAA4C;AAE5C,MAAM,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAEnD,MAAa,yBAAyB;IACpC,KAAK,CAAC,QAAQ,CAAC,GAAsB,EAAE,OAAsB;;QAC3D,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC;QAE5B,MAAM,YAAY,GAAG;YACnB,GAAG,EAAE,GA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oB,GAAG,WAAW,CAAC;QACzC,IAAI,eAAe,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE;YAChD,eAAe,GAAG,eAAe,CAAC,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;SAC1E;QACD,IAAI,eAAe,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE;YACjD,eAAe,GAAG,eAAe,CAAC,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;SAC3E;QACD,IAAI,eAAe,CAAC,UAAU,CAAC,oBAAoB,CAAC,EAAE;YACpD,eAAe,GAAG,eAAe,CAAC,MAAM,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;SAC9E;QACD,OAAO,eAAe,CAAC;IACzB,CAAC;CACF;AAnDD,8DAmDC","sourcesContent":["import path from 'path';\n\nimport { Job } from '@expo/eas-build-job';\nimport { BuildContext, EjectProvider, EjectOptions } from '@expo/build-tools';\nimport spawnAsync from '@expo/turtle-spawn';\n\nconst expoCliPackage = require.resolve('expo-cli');\n\nexport class LocalExpoCliEjectProvider implements EjectProvider<Job> {\n async runEject(ctx: BuildContext<Job>, options?: EjectOptions): Promise<void> {\n const { logger, job } = ctx;\n\n const spawnOptions = {\n cwd: ctx.buildDirectory,\n logger: ctx.logger,\n env: {\n ...options?.extraEnvs,\n ...ctx.env,\n },\n };\n\n const expoCliBinPath =\n process.env.EXPO_CLI_PATH ?? path.resolve(path.dirname(expoCliPackage), '../bin/expo.js');\n const prebuildCommand = this.getPrebuildCommand(job);\n logger.debug(`${expoCliBinPath} ${prebuildCommand}`);\n await spawnAsync('bash', ['-c', `${expoCliBinPath} ${prebuildCommand}`], {\n ...spawnOptions,\n cwd: ctx.reactNativeProjectDirectory,\n });\n\n await spawnAsync(ctx.packageManager, ['install'], {\n ...spawnOptions,\n cwd: ctx.reactNativeProjectDirectory,\n });\n }\n\n private getPrebuildCommand(job: Job): string {\n let prebuildCommand =\n job.experimental?.prebuildCommand ?? `prebuild --non-interactive --platform ${job.platform}`;\n if (!prebuildCommand.match(/(?:--platform| -p)/)) {\n prebuildCommand = `${prebuildCommand} --platform ${job.platform}`;\n }\n if (!prebuildCommand.match(/--non-interactive/)) {\n prebuildCommand = `${prebuildCommand} --non-interactive`;\n }\n const npxCommandPrefix = 'npx ';\n const expoCommandPrefix = 'expo ';\n const expoCliCommandPrefix = 'expo-cli ';\n if (prebuildCommand.startsWith(npxCommandPrefix)) {\n prebuildCommand = prebuildCommand.substr(npxCommandPrefix.length).trim();\n }\n if (prebuildCommand.startsWith(expoCommandPrefix)) {\n prebuildCommand = prebuildCommand.substr(expoCommandPrefix.length).trim();\n }\n if (prebuildCommand.startsWith(expoCliCommandPrefix)) {\n prebuildCommand = prebuildCommand.substr(expoCliCommandPrefix.length).trim();\n }\n return prebuildCommand;\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eas-cli-local-build-plugin",
3
- "version": "0.0.57",
3
+ "version": "0.0.61",
4
4
  "description": "Tool for running EAS compatible builds on a local machine.",
5
5
  "main": "dist/main.js",
6
6
  "bin": {
@@ -19,14 +19,13 @@
19
19
  "bugs": "https://github.com/expo/eas-build/issues",
20
20
  "license": "BUSL-1.1",
21
21
  "dependencies": {
22
- "@expo/build-tools": "0.1.103",
22
+ "@expo/build-tools": "0.1.106",
23
23
  "@expo/bunyan": "^4.0.0",
24
- "@expo/eas-build-job": "0.2.62",
24
+ "@expo/eas-build-job": "0.2.64",
25
25
  "@expo/spawn-async": "^1.5.0",
26
26
  "@expo/turtle-spawn": "0.0.21",
27
27
  "chalk": "^4.1.0",
28
- "dateformat": "^4.6.2",
29
- "expo-cli": "5.0.2",
28
+ "expo-cli": "5.0.5",
30
29
  "fs-extra": "^9.1.0",
31
30
  "joi": "^17.4.2",
32
31
  "lodash": "^4.17.21",
@@ -35,7 +34,6 @@
35
34
  "uuid": "^8.3.2"
36
35
  },
37
36
  "devDependencies": {
38
- "@types/dateformat": "^3.0.1",
39
37
  "@types/fs-extra": "^9.0.9",
40
38
  "@types/hapi__joi": "^17.1.6",
41
39
  "@types/lodash": "^4.14.168",
@@ -2,7 +2,6 @@ import path from 'path';
2
2
 
3
3
  import { BuildContext } from '@expo/build-tools';
4
4
  import { Job } from '@expo/eas-build-job';
5
- import dateFormat from 'dateformat';
6
5
  import fs from 'fs-extra';
7
6
  import tar from 'tar';
8
7
 
@@ -39,8 +38,8 @@ export async function prepareBuildArtifact(
39
38
  suffix = '.tar.gz';
40
39
  localPath = archivePath;
41
40
  }
42
- const artifactName = `build-${formatDateForFilename(new Date())}${suffix}`;
43
- const destPath = path.join(config.artifactsDir, artifactName);
41
+ const artifactName = `build-${Date.now()}${suffix}`;
42
+ const destPath = config.artifactPath ?? path.join(config.artifactsDir, artifactName);
44
43
  await fs.copy(localPath, destPath);
45
44
  ctx.logger.info({ phase: 'PREPARE_ARTIFACTS' }, `Writing artifacts to ${destPath}`);
46
45
  return destPath;
@@ -58,7 +57,3 @@ function getCommonParentDir(path1: string, path2: string): string {
58
57
  }
59
58
  return '/';
60
59
  }
61
-
62
- function formatDateForFilename(date: Date): string {
63
- return dateFormat(date, 'dd-mm-yyyy-HH:MM');
64
- }
package/src/config.ts CHANGED
@@ -10,6 +10,7 @@ const envWorkingdir = process.env.EAS_LOCAL_BUILD_WORKINGDIR;
10
10
  const envSkipCleanup = process.env.EAS_LOCAL_BUILD_SKIP_CLEANUP;
11
11
  const envSkipNativeBuild = process.env.EAS_LOCAL_BUILD_SKIP_NATIVE_BUILD;
12
12
  const envArtifactsDir = process.env.EAS_LOCAL_BUILD_ARTIFACTS_DIR;
13
+ const envArtifactPath = process.env.EAS_LOCAL_BUILD_ARTIFACT_PATH;
13
14
 
14
15
  if (envLoggerLevel && !['debug', 'info', 'warn', 'error'].includes(envLoggerLevel)) {
15
16
  throw new Error(
@@ -22,6 +23,7 @@ export default {
22
23
  skipCleanup: envSkipCleanup === '1',
23
24
  skipNativeBuild: envSkipNativeBuild === '1',
24
25
  artifactsDir: envArtifactsDir ?? process.cwd(),
26
+ artifactPath: envArtifactPath,
25
27
  logger: {
26
28
  level: (envLoggerLevel ?? 'info') as 'debug' | 'info' | 'warn' | 'error',
27
29
  },
package/src/eject.ts CHANGED
@@ -21,19 +21,40 @@ export class LocalExpoCliEjectProvider implements EjectProvider<Job> {
21
21
 
22
22
  const expoCliBinPath =
23
23
  process.env.EXPO_CLI_PATH ?? path.resolve(path.dirname(expoCliPackage), '../bin/expo.js');
24
- logger.debug(`${expoCliBinPath} prebuild --non-interactive --platform ${job.platform}`);
25
- await spawnAsync(
26
- expoCliBinPath,
27
- ['prebuild', '--non-interactive', '--platform', job.platform],
28
- {
29
- ...spawnOptions,
30
- cwd: ctx.reactNativeProjectDirectory,
31
- }
32
- );
24
+ const prebuildCommand = this.getPrebuildCommand(job);
25
+ logger.debug(`${expoCliBinPath} ${prebuildCommand}`);
26
+ await spawnAsync('bash', ['-c', `${expoCliBinPath} ${prebuildCommand}`], {
27
+ ...spawnOptions,
28
+ cwd: ctx.reactNativeProjectDirectory,
29
+ });
33
30
 
34
31
  await spawnAsync(ctx.packageManager, ['install'], {
35
32
  ...spawnOptions,
36
33
  cwd: ctx.reactNativeProjectDirectory,
37
34
  });
38
35
  }
36
+
37
+ private getPrebuildCommand(job: Job): string {
38
+ let prebuildCommand =
39
+ job.experimental?.prebuildCommand ?? `prebuild --non-interactive --platform ${job.platform}`;
40
+ if (!prebuildCommand.match(/(?:--platform| -p)/)) {
41
+ prebuildCommand = `${prebuildCommand} --platform ${job.platform}`;
42
+ }
43
+ if (!prebuildCommand.match(/--non-interactive/)) {
44
+ prebuildCommand = `${prebuildCommand} --non-interactive`;
45
+ }
46
+ const npxCommandPrefix = 'npx ';
47
+ const expoCommandPrefix = 'expo ';
48
+ const expoCliCommandPrefix = 'expo-cli ';
49
+ if (prebuildCommand.startsWith(npxCommandPrefix)) {
50
+ prebuildCommand = prebuildCommand.substr(npxCommandPrefix.length).trim();
51
+ }
52
+ if (prebuildCommand.startsWith(expoCommandPrefix)) {
53
+ prebuildCommand = prebuildCommand.substr(expoCommandPrefix.length).trim();
54
+ }
55
+ if (prebuildCommand.startsWith(expoCliCommandPrefix)) {
56
+ prebuildCommand = prebuildCommand.substr(expoCliCommandPrefix.length).trim();
57
+ }
58
+ return prebuildCommand;
59
+ }
39
60
  }