Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature(preview): add qr-target and use proper QR codes for expo-go and dev-build #247

Merged
merged 10 commits into from
Dec 2, 2023
42 changes: 34 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ jobs:
- name: 🏗 Setup project
run: bun create expo ./temp --template blank

- name: 🏗 Setup `expo-dev-client`
working-directory: ./temp
run: bun expo install expo-dev-client

- name: 👷 Configure project
working-directory: ./temp
run: |
Expand Down Expand Up @@ -165,27 +169,49 @@ jobs:
throw new Error('Message output is empty');
}

- name: 🚀 Create preview (with custom app scheme)
- name: 🚀 Create preview (with "dev-build" QR target)
if: ${{ env.hasAuth == 'true' }}
uses: ./preview
id: custom-app-scheme
id: dev-build-qr
env:
EXPO_TEST_GITHUB_PULL: 206
with:
app-scheme: thisisacustomscheme
working-directory: ./temp
command: eas update --branch test --message "This is a test"
comment: false

- name: 🧪 Comment has custom app scheme
- name: 🧪 Comment has "dev-build" QR
if: ${{ env.hasAuth == 'true' }}
uses: actions/github-script@v7
with:
script: |
const comment = `${{ steps.custom-app-scheme.outputs.comment }}`
if (!comment || !comment.includes('thisisacustomscheme')) {
console.log({ comment });
throw new Error('Message output does not include the app scheme from action input');
const qrUrl = `${{ steps.dev-build-qr.outputs.qr }}`
if (!qrUrl || !qrUrl.includes('appScheme')) {
console.log({ qrUrl });
throw new Error('QR URL is missing "appScheme" to point to a dev build');
}

- name: 🚀 Create preview (with "expo-go" QR target from input)
if: ${{ env.hasAuth == 'true' }}
uses: ./preview
id: expo-go-qr
env:
EXPO_TEST_GITHUB_PULL: 206
with:
working-directory: ./temp
qr-target: expo-go
command: eas update --branch test --message "This is a test"
comment: false

- name: 🧪 Comment has "expo-go" QR code
if: ${{ env.hasAuth == 'true' }}
uses: actions/github-script@v7
with:
script: |
const qrUrl = `${{ steps.expo-go-qr.outputs.qr }}`
if (!qrUrl || qrUrl.includes('appScheme')) {
console.log({ qrUrl });
throw new Error('QR URL points to a dev build, not Expo Go');
}

preview-comment:
Expand Down
29 changes: 27 additions & 2 deletions build/command/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38691,16 +38691,20 @@ function createBuildComment(builds) {
/***/ }),

/***/ 2489:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {

"use strict";

var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getBuildLogsUrl = exports.projectDeepLink = exports.projectLink = exports.projectQR = exports.projectInfo = exports.queryEasBuildInfoAsync = exports.cancelEasBuildAsync = exports.createEasBuildFromRawCommandAsync = exports.easBuild = exports.runCommand = exports.projectOwner = exports.authenticate = exports.parseCommand = exports.appPlatformEmojis = exports.appPlatformDisplayNames = exports.AppPlatform = void 0;
exports.getBuildLogsUrl = exports.projectDeepLink = exports.projectLink = exports.projectQR = exports.projectAppType = exports.projectInfo = exports.queryEasBuildInfoAsync = exports.cancelEasBuildAsync = exports.createEasBuildFromRawCommandAsync = exports.easBuild = exports.runCommand = exports.projectOwner = exports.authenticate = exports.parseCommand = exports.appPlatformEmojis = exports.appPlatformDisplayNames = exports.AppPlatform = void 0;
const core_1 = __nccwpck_require__(2186);
const exec_1 = __nccwpck_require__(1514);
const io_1 = __nccwpck_require__(7436);
const assert_1 = __nccwpck_require__(9491);
const path_1 = __importDefault(__nccwpck_require__(1017));
const url_1 = __nccwpck_require__(7310);
var AppPlatform;
(function (AppPlatform) {
Expand Down Expand Up @@ -38869,6 +38873,27 @@ async function projectInfo(dir) {
return { name, slug, owner };
}
exports.projectInfo = projectInfo;
/**
* Determine if the current project is using `dev-build` or `expo-go`.
* This is based on the `@expo/cli` check to enable dev client mode.
*
* @see https://github.com/expo/expo/blob/190a80f393bc730eb3f300df52d82b701e4b8ff5/packages/%40expo/cli/src/utils/analytics/getDevClientProperties.ts#L12-L15
*/
function projectAppType(dir) {
const packageFile = path_1.default.resolve(dir, 'package.json');
let packageJson = {};
try {
packageJson = require(packageFile);
}
catch (error) {
throw new Error(`Could not load the project package file in: ${packageFile}`, { cause: error });
}
if (packageJson?.dependencies?.['expo-dev-client'] || packageJson?.devDependencies?.['expo-dev-client']) {
return 'dev-build';
}
return 'expo-go';
}
exports.projectAppType = projectAppType;
/**
* Create a QR code for an update on project, with an optional release channel.
*/
Expand Down
29 changes: 27 additions & 2 deletions build/preview-build/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -89233,16 +89233,20 @@ exports.handleCacheError = handleCacheError;
/***/ }),

/***/ 2489:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {

"use strict";

var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getBuildLogsUrl = exports.projectDeepLink = exports.projectLink = exports.projectQR = exports.projectInfo = exports.queryEasBuildInfoAsync = exports.cancelEasBuildAsync = exports.createEasBuildFromRawCommandAsync = exports.easBuild = exports.runCommand = exports.projectOwner = exports.authenticate = exports.parseCommand = exports.appPlatformEmojis = exports.appPlatformDisplayNames = exports.AppPlatform = void 0;
exports.getBuildLogsUrl = exports.projectDeepLink = exports.projectLink = exports.projectQR = exports.projectAppType = exports.projectInfo = exports.queryEasBuildInfoAsync = exports.cancelEasBuildAsync = exports.createEasBuildFromRawCommandAsync = exports.easBuild = exports.runCommand = exports.projectOwner = exports.authenticate = exports.parseCommand = exports.appPlatformEmojis = exports.appPlatformDisplayNames = exports.AppPlatform = void 0;
const core_1 = __nccwpck_require__(2186);
const exec_1 = __nccwpck_require__(1514);
const io_1 = __nccwpck_require__(7436);
const assert_1 = __nccwpck_require__(9491);
const path_1 = __importDefault(__nccwpck_require__(1017));
const url_1 = __nccwpck_require__(7310);
var AppPlatform;
(function (AppPlatform) {
Expand Down Expand Up @@ -89411,6 +89415,27 @@ async function projectInfo(dir) {
return { name, slug, owner };
}
exports.projectInfo = projectInfo;
/**
* Determine if the current project is using `dev-build` or `expo-go`.
* This is based on the `@expo/cli` check to enable dev client mode.
*
* @see https://github.com/expo/expo/blob/190a80f393bc730eb3f300df52d82b701e4b8ff5/packages/%40expo/cli/src/utils/analytics/getDevClientProperties.ts#L12-L15
*/
function projectAppType(dir) {
const packageFile = path_1.default.resolve(dir, 'package.json');
let packageJson = {};
try {
packageJson = require(packageFile);
}
catch (error) {
throw new Error(`Could not load the project package file in: ${packageFile}`, { cause: error });
}
if (packageJson?.dependencies?.['expo-dev-client'] || packageJson?.devDependencies?.['expo-dev-client']) {
return 'dev-build';
}
return 'expo-go';
}
exports.projectAppType = projectAppType;
/**
* Create a QR code for an update on project, with an optional release channel.
*/
Expand Down
29 changes: 27 additions & 2 deletions build/preview-comment/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38635,16 +38635,20 @@ exports.commentAction = commentAction;
/***/ }),

/***/ 2489:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {

"use strict";

var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getBuildLogsUrl = exports.projectDeepLink = exports.projectLink = exports.projectQR = exports.projectInfo = exports.queryEasBuildInfoAsync = exports.cancelEasBuildAsync = exports.createEasBuildFromRawCommandAsync = exports.easBuild = exports.runCommand = exports.projectOwner = exports.authenticate = exports.parseCommand = exports.appPlatformEmojis = exports.appPlatformDisplayNames = exports.AppPlatform = void 0;
exports.getBuildLogsUrl = exports.projectDeepLink = exports.projectLink = exports.projectQR = exports.projectAppType = exports.projectInfo = exports.queryEasBuildInfoAsync = exports.cancelEasBuildAsync = exports.createEasBuildFromRawCommandAsync = exports.easBuild = exports.runCommand = exports.projectOwner = exports.authenticate = exports.parseCommand = exports.appPlatformEmojis = exports.appPlatformDisplayNames = exports.AppPlatform = void 0;
const core_1 = __nccwpck_require__(2186);
const exec_1 = __nccwpck_require__(1514);
const io_1 = __nccwpck_require__(7436);
const assert_1 = __nccwpck_require__(9491);
const path_1 = __importDefault(__nccwpck_require__(1017));
const url_1 = __nccwpck_require__(7310);
var AppPlatform;
(function (AppPlatform) {
Expand Down Expand Up @@ -38813,6 +38817,27 @@ async function projectInfo(dir) {
return { name, slug, owner };
}
exports.projectInfo = projectInfo;
/**
* Determine if the current project is using `dev-build` or `expo-go`.
* This is based on the `@expo/cli` check to enable dev client mode.
*
* @see https://github.com/expo/expo/blob/190a80f393bc730eb3f300df52d82b701e4b8ff5/packages/%40expo/cli/src/utils/analytics/getDevClientProperties.ts#L12-L15
*/
function projectAppType(dir) {
const packageFile = path_1.default.resolve(dir, 'package.json');
let packageJson = {};
try {
packageJson = require(packageFile);
}
catch (error) {
throw new Error(`Could not load the project package file in: ${packageFile}`, { cause: error });
}
if (packageJson?.dependencies?.['expo-dev-client'] || packageJson?.devDependencies?.['expo-dev-client']) {
return 'dev-build';
}
return 'expo-go';
}
exports.projectAppType = projectAppType;
/**
* Create a QR code for an update on project, with an optional release channel.
*/
Expand Down
Loading
Loading