@shopify/shop-minis-cli 0.0.42 → 0.0.44
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.
- package/build/commands/cancel-submission/cancel-submission.js +3 -2
- package/build/commands/cancel-submission/cancel-submission.js.map +1 -1
- package/build/commands/check-submission/index.js +39 -6
- package/build/commands/check-submission/index.js.map +1 -1
- package/build/commands/check-submission/types.d.ts +1 -1
- package/build/commands/config.d.ts +5 -0
- package/build/commands/config.js +20 -0
- package/build/commands/config.js.map +1 -1
- package/build/commands/data/cancel-submission.d.ts +22 -0
- package/build/commands/data/cancel-submission.js +26 -0
- package/build/commands/data/cancel-submission.js.map +1 -0
- package/build/commands/data/client.d.ts +7 -0
- package/build/commands/data/client.js +8 -0
- package/build/commands/data/client.js.map +1 -0
- package/build/commands/data/create-submission.d.ts +20 -0
- package/build/commands/data/create-submission.js +27 -0
- package/build/commands/data/create-submission.js.map +1 -0
- package/build/commands/data/create-upload.d.ts +21 -0
- package/build/commands/data/create-upload.js +40 -0
- package/build/commands/data/create-upload.js.map +1 -0
- package/build/commands/data/get-submissions.d.ts +27 -0
- package/build/commands/data/get-submissions.js +33 -0
- package/build/commands/data/get-submissions.js.map +1 -0
- package/build/commands/dev/index.d.ts +2 -0
- package/build/commands/dev/index.js +8 -2
- package/build/commands/dev/index.js.map +1 -1
- package/build/commands/dev/utils/android.d.ts +6 -4
- package/build/commands/dev/utils/android.js +29 -29
- package/build/commands/dev/utils/android.js.map +1 -1
- package/build/commands/dev/utils/binaries.d.ts +2 -59
- package/build/commands/dev/utils/binaries.js +7 -84
- package/build/commands/dev/utils/binaries.js.map +1 -1
- package/build/commands/dev/utils/build-type.d.ts +2 -0
- package/build/commands/dev/utils/build-type.js +14 -0
- package/build/commands/dev/utils/build-type.js.map +1 -0
- package/build/commands/dev/utils/deeplink.d.ts +2 -2
- package/build/commands/dev/utils/deeplink.js +5 -5
- package/build/commands/dev/utils/deeplink.js.map +1 -1
- package/build/commands/dev/utils/interactive-terminal.d.ts +3 -1
- package/build/commands/dev/utils/interactive-terminal.js +37 -78
- package/build/commands/dev/utils/interactive-terminal.js.map +1 -1
- package/build/commands/dev/utils/metro/metro-server.d.ts +1 -1
- package/build/commands/dev/utils/metro/metro-server.js +1 -1
- package/build/commands/dev/utils/metro/metro-server.js.map +1 -1
- package/build/commands/dev/utils/network.d.ts +8 -8
- package/build/commands/dev/utils/network.js +69 -23
- package/build/commands/dev/utils/network.js.map +1 -1
- package/build/commands/dev/utils/patch-package.d.ts +4 -0
- package/build/commands/dev/utils/patch-package.js +72 -0
- package/build/commands/dev/utils/patch-package.js.map +1 -0
- package/build/commands/dev/utils/platform.d.ts +18 -0
- package/build/commands/dev/utils/platform.js +41 -0
- package/build/commands/dev/utils/platform.js.map +1 -0
- package/build/commands/dev/utils/simulator.d.ts +5 -2
- package/build/commands/dev/utils/simulator.js +27 -13
- package/build/commands/dev/utils/simulator.js.map +1 -1
- package/build/commands/dev/utils/start-app.d.ts +23 -0
- package/build/commands/dev/utils/start-app.js +85 -0
- package/build/commands/dev/utils/start-app.js.map +1 -0
- package/build/commands/dev/utils/types.d.ts +24 -1
- package/build/commands/dev/utils/types.js +6 -1
- package/build/commands/dev/utils/types.js.map +1 -1
- package/build/commands/dev/utils/version.d.ts +64 -0
- package/build/commands/dev/utils/version.js +101 -0
- package/build/commands/dev/utils/version.js.map +1 -0
- package/build/commands/submit/errors.d.ts +1 -1
- package/build/commands/submit/errors.js +1 -1
- package/build/commands/submit/errors.js.map +1 -1
- package/build/commands/submit/submit.js +2 -1
- package/build/commands/submit/submit.js.map +1 -1
- package/build/commands/submit/tasks.d.ts +0 -1
- package/build/commands/submit/tasks.js +4 -48
- package/build/commands/submit/tasks.js.map +1 -1
- package/build/commands/types/autogenerated/shop-minis-admin-api/gql.d.ts +9 -9
- package/build/commands/types/autogenerated/shop-minis-admin-api/gql.js +2 -2
- package/build/commands/types/autogenerated/shop-minis-admin-api/gql.js.map +1 -1
- package/build/commands/types/autogenerated/shop-minis-admin-api/graphql.d.ts +301 -65
- package/build/commands/types/autogenerated/shop-minis-admin-api/graphql.js +155 -97
- package/build/commands/types/autogenerated/shop-minis-admin-api/graphql.js.map +1 -1
- package/build/commands/utils/common-tasks.d.ts +1 -0
- package/build/commands/utils/common-tasks.js +49 -0
- package/build/commands/utils/common-tasks.js.map +1 -0
- package/build/index.js +2 -1
- package/build/index.js.map +1 -1
- package/jest.config.ts +2 -2
- package/package.json +3 -1
- package/templates/__template_common/.eslintrc.js +29 -0
- package/templates/__template_common/index.tsx +0 -2
- package/templates/__template_common/package.json +4 -33
- package/templates/__template_common/patches/react-native+0.71.4.patch +78 -0
- package/templates/__template_common/src/manifest.json +1 -27
- package/templates/__template_hello_world/src/components/ComponentLink.ts +4 -0
- package/templates/__template_hello_world/src/components/ComponentListItem.tsx +1 -0
- package/templates/__template_hello_world/src/components/FeaturedComponents.tsx +2 -0
- package/templates/__template_hello_world/src/components/quiz/QuizSlide.tsx +6 -3
- package/templates/__template_hello_world/src/components/quiz/TextFieldSlide.tsx +88 -7
- package/templates/__template_hello_world/src/routes.tsx +6 -0
- package/templates/__template_hello_world/src/screens/AccordionScreen.tsx +73 -0
- package/templates/__template_hello_world/src/screens/InputScreen.tsx +4 -10
- package/templates/__template_hello_world/src/types.ts +1 -0
- package/templates/__template_hello_world/src/utils/mockQuizData.ts +19 -0
- package/build/commands/utils/graphql.d.ts +0 -92
- package/build/commands/utils/graphql.js +0 -123
- package/build/commands/utils/graphql.js.map +0 -1
- package/templates/__template_common/.eslintrc.json +0 -15
- package/templates/__template_common/patches/react-native+0.68.5.patch +0 -173
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { renderSuccess, renderInfo, renderConfirmationPrompt, } from '@shopify/cli-kit/node/ui';
|
|
2
2
|
import { AbortError, handler as handleError } from '@shopify/cli-kit/node/error';
|
|
3
|
-
import { getPendingSubmission as graphqlGetPendingSubmission
|
|
4
|
-
import {
|
|
3
|
+
import { getPendingSubmission as graphqlGetPendingSubmission } from '../data/get-submissions.js';
|
|
4
|
+
import { cancelSubmission as graphqlCancelSubmission } from '../data/cancel-submission.js';
|
|
5
|
+
import { assertNetworkAndAuth } from '../utils/common-tasks.js';
|
|
5
6
|
export const cancelSubmission = async () => {
|
|
6
7
|
try {
|
|
7
8
|
await assertNetworkAndAuth();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cancel-submission.js","sourceRoot":"","sources":["../../../src/commands/cancel-submission/cancel-submission.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,UAAU,EACV,wBAAwB,GACzB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAC,UAAU,EAAE,OAAO,IAAI,WAAW,EAAC,MAAM,6BAA6B,CAAA;AAE9E,OAAO,
|
|
1
|
+
{"version":3,"file":"cancel-submission.js","sourceRoot":"","sources":["../../../src/commands/cancel-submission/cancel-submission.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,UAAU,EACV,wBAAwB,GACzB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAC,UAAU,EAAE,OAAO,IAAI,WAAW,EAAC,MAAM,6BAA6B,CAAA;AAE9E,OAAO,EAAC,oBAAoB,IAAI,2BAA2B,EAAC,MAAM,4BAA4B,CAAA;AAC9F,OAAO,EAAC,gBAAgB,IAAI,uBAAuB,EAAC,MAAM,8BAA8B,CAAA;AACxF,OAAO,EAAC,oBAAoB,EAAC,MAAM,0BAA0B,CAAA;AAE7D,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,IAAI,EAAE;IACzC,IAAI;QACF,MAAM,oBAAoB,EAAE,CAAA;QAE5B,MAAM,iBAAiB,GAAG,MAAM,2BAA2B,EAAE,CAAA;QAE7D,IAAI,iBAAiB,EAAE;YACrB,MAAM,cAAc,GAAG,MAAM,wBAAwB,CAAC;gBACpD,OAAO,EAAE;oBACP,4CAA4C;oBAC5C,EAAC,IAAI,EAAE,iBAAiB,CAAC,SAAS,EAAC;oBACnC,WAAW,iBAAiB,CAAC,WAAW,GAAG;iBAC5C;aACF,CAAC,CAAA;YACF,IAAI,CAAC,cAAc;gBAAE,OAAM;YAE3B,MAAM,EAAC,UAAU,EAAE,mBAAmB,EAAC,GAAG,MAAM,uBAAuB,CAAC;gBACtE,SAAS,EAAE,iBAAiB,CAAC,SAAS;aACvC,CAAC,CAAA;YAEF,IAAI,mBAAmB,EAAE;gBACvB,aAAa,CAAC;oBACZ,QAAQ,EAAE,sBAAsB;oBAChC,IAAI,EAAE;wBACJ,gCAAgC;wBAChC;4BACE,IAAI,EAAE,mBAAmB,CAAC,SAAS;yBACpC;wBACD,gBAAgB;qBACjB;iBACF,CAAC,CAAA;aACH;iBAAM;gBACL,MAAM,IAAI,UAAU,CAClB,8BAA8B,EAC9B,mDAAmD,EACnD;oBACE,sCAAsC;oBACtC,sCAAsC;iBACvC,CACF,CAAA;aACF;SACF;aAAM;YACL,UAAU,CAAC;gBACT,QAAQ,EAAE,uBAAuB;gBACjC,IAAI,EAAE;oBACJ,6FAA6F;iBAC9F;aACF,CAAC,CAAA;SACH;KACF;IAAC,OAAO,KAAU,EAAE;QACnB,gCAAgC;QAChC,WAAW,CAAC,KAAK,CAAC,CAAA;QAElB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;KAChB;AACH,CAAC,CAAA"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import { outputDebug } from '@shopify/cli-kit/node/output';
|
|
3
|
-
import {
|
|
3
|
+
import { handler as handleError } from '@shopify/cli-kit/node/error';
|
|
4
|
+
import { renderInfo } from '@shopify/cli-kit/node/ui';
|
|
4
5
|
import { getMiniManifest } from '../utils/minis-manifest.js';
|
|
5
|
-
import {
|
|
6
|
+
import { getSubmissions } from '../data/get-submissions.js';
|
|
7
|
+
import { assertNetworkAndAuth } from '../utils/common-tasks.js';
|
|
6
8
|
export function loadCommand(parentProgram) {
|
|
7
9
|
const command = new Command()
|
|
8
10
|
.name('check-submission')
|
|
@@ -12,10 +14,41 @@ export function loadCommand(parentProgram) {
|
|
|
12
14
|
const miniHandle = getMiniManifest().handle;
|
|
13
15
|
outputDebug(`Check submission args ${JSON.stringify(args)}`);
|
|
14
16
|
outputDebug(`Checking submissions for mini "${miniHandle}" at ${process.cwd()}`);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
try {
|
|
18
|
+
await assertNetworkAndAuth();
|
|
19
|
+
const { nodes } = await getSubmissions();
|
|
20
|
+
if (nodes.length === 0) {
|
|
21
|
+
renderInfo({
|
|
22
|
+
headline: 'No submissions found',
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
const latestSubmission = nodes[0];
|
|
27
|
+
const nextSteps = latestSubmission.status === 'REJECTED'
|
|
28
|
+
? [
|
|
29
|
+
'Check the email for more information and feedback on your submission.',
|
|
30
|
+
]
|
|
31
|
+
: [];
|
|
32
|
+
const formattedDate = new Intl.DateTimeFormat(undefined, {
|
|
33
|
+
dateStyle: 'full',
|
|
34
|
+
timeStyle: 'full',
|
|
35
|
+
}).format(new Date(latestSubmission.submittedAt));
|
|
36
|
+
const formattedStatus = latestSubmission.status[0].toLocaleUpperCase() +
|
|
37
|
+
latestSubmission.status.slice(1).toLocaleLowerCase();
|
|
38
|
+
renderInfo({
|
|
39
|
+
headline: `Status: ${formattedStatus}`,
|
|
40
|
+
body: `Description:\n${latestSubmission.description}\n\n` +
|
|
41
|
+
`Reference: ${latestSubmission.reference}\n\n` +
|
|
42
|
+
`Submitted ${formattedDate}`,
|
|
43
|
+
nextSteps,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
// Always output the error first
|
|
49
|
+
handleError(error);
|
|
50
|
+
process.exit(1);
|
|
51
|
+
}
|
|
19
52
|
});
|
|
20
53
|
parentProgram.addCommand(command);
|
|
21
54
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/check-submission/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAA;AACjC,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAA;AACxD,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/check-submission/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAA;AACjC,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAA;AACxD,OAAO,EAAC,OAAO,IAAI,WAAW,EAAC,MAAM,6BAA6B,CAAA;AAClE,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAA;AAEnD,OAAO,EAAC,eAAe,EAAC,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EAAC,cAAc,EAAC,MAAM,4BAA4B,CAAA;AACzD,OAAO,EAAC,oBAAoB,EAAC,MAAM,0BAA0B,CAAA;AAI7D,MAAM,UAAU,WAAW,CAAC,aAAsB;IAChD,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE;SAC1B,IAAI,CAAC,kBAAkB,CAAC;SACxB,WAAW,CAAC,mBAAmB,CAAC;SAChC,MAAM,CAAC,WAAW,EAAE,0BAA0B,CAAC,CAAC,0BAA0B;SAC1E,MAAM,CAAC,KAAK,EAAE,IAAgC,EAAE,EAAE;QACjD,MAAM,UAAU,GAAG,eAAe,EAAE,CAAC,MAAM,CAAA;QAE3C,WAAW,CAAC,yBAAyB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QAC5D,WAAW,CACT,kCAAkC,UAAU,QAAQ,OAAO,CAAC,GAAG,EAAE,EAAE,CACpE,CAAA;QAED,IAAI;YACF,MAAM,oBAAoB,EAAE,CAAA;YAE5B,MAAM,EAAC,KAAK,EAAC,GAAG,MAAM,c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declare function whichAndroidHome(): string | null;
|
|
3
|
+
export declare function androidHomeExists(): boolean;
|
|
4
|
+
export declare function whichEmulator(): string;
|
|
5
|
+
export declare function whichAdb(): string;
|
|
2
6
|
export declare const CLI_VERSION: any;
|
|
3
7
|
export declare const PATHS: {
|
|
4
8
|
CACHE_DIR: string;
|
|
@@ -6,5 +10,6 @@ export declare const PATHS: {
|
|
|
6
10
|
export declare const EMAILS: {
|
|
7
11
|
CONTACT_US: string;
|
|
8
12
|
};
|
|
13
|
+
export declare const APPLY_FOR_EARLY_ACCESS_URL = "https://shop.app/minis/apply";
|
|
9
14
|
export declare const SHOP_MINIS_ADMIN_API = "https://server.shop.app/minis/admin-api/alpha/graphql.json";
|
|
10
15
|
export declare const SHOP_MINIS_ADMIN_API_KEY: string | undefined;
|
package/build/commands/config.js
CHANGED
|
@@ -15,6 +15,25 @@ export const getPackageManager = async () => {
|
|
|
15
15
|
}
|
|
16
16
|
return packageManager;
|
|
17
17
|
};
|
|
18
|
+
const DEFAULT_ANDROID_HOME_MACOS = `${process.env.HOME}/Library/Android/sdk`;
|
|
19
|
+
export function whichAndroidHome() {
|
|
20
|
+
if (process.env.ANDROID_HOME) {
|
|
21
|
+
return process.env.ANDROID_HOME;
|
|
22
|
+
}
|
|
23
|
+
if (fs.existsSync(DEFAULT_ANDROID_HOME_MACOS)) {
|
|
24
|
+
return DEFAULT_ANDROID_HOME_MACOS;
|
|
25
|
+
}
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
export function androidHomeExists() {
|
|
29
|
+
return Boolean(whichAndroidHome());
|
|
30
|
+
}
|
|
31
|
+
export function whichEmulator() {
|
|
32
|
+
return `${whichAndroidHome()}/emulator/emulator`;
|
|
33
|
+
}
|
|
34
|
+
export function whichAdb() {
|
|
35
|
+
return `${whichAndroidHome()}/platform-tools/adb`;
|
|
36
|
+
}
|
|
18
37
|
export const CLI_VERSION = createRequire(import.meta.url)('../../package.json').version;
|
|
19
38
|
export const PATHS = {
|
|
20
39
|
CACHE_DIR: path.resolve(process.cwd(), '.minis-cache'),
|
|
@@ -22,6 +41,7 @@ export const PATHS = {
|
|
|
22
41
|
export const EMAILS = {
|
|
23
42
|
CONTACT_US: 'shopminisdevelopers@shopify.com',
|
|
24
43
|
};
|
|
44
|
+
export const APPLY_FOR_EARLY_ACCESS_URL = 'https://shop.app/minis/apply';
|
|
25
45
|
export const SHOP_MINIS_ADMIN_API = 'https://server.shop.app/minis/admin-api/alpha/graphql.json';
|
|
26
46
|
export const SHOP_MINIS_ADMIN_API_KEY = process.env.SHOP_MINIS_API_KEY;
|
|
27
47
|
// Create the cache directory if it doesn't exist.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAA;AACzC,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,OAAO,EAAE,MAAM,UAAU,CAAA;AACzB,OAAO,EACL,iBAAiB,IAAI,kBAAkB,GAExC,MAAM,4CAA4C,CAAA;AACnD,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAA;AACxD,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAEhC,MAAM,CAAC,MAAM,EAAE,CAAA;AAEf,4FAA4F;AAC5F,IAAI,cAAc,GAA0B,IAAI,CAAA;AAChD,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,IAAI,EAAE;IAC1C,IAAI,CAAC,cAAc,EAAE;QACnB,kDAAkD;QAClD,cAAc,GAAG,MAAM,kBAAkB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAA;QAExD,WAAW,CACT,mDAAmD,cAAc,EAAE,CACpE,CAAA;KACF;IAED,OAAO,cAAc,CAAA;AACvB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CACvD,oBAA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
1
|
+
export declare const cancelSubmissionQuery: import("@graphql-typed-document-node/core").TypedDocumentNode<import("../types/autogenerated/shop-minis-admin-api/graphql.js").CancelSubmissionMutation, import("../types/autogenerated/shop-minis-admin-api/graphql.js").Exact<{
|
|
2
|
+
reference: string;
|
|
3
|
+
}>>;
|
|
4
|
+
export interface CancelSubmissionParameters {
|
|
5
|
+
reference: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const cancelSubmission: ({ reference, }: CancelSubmissionParameters) => Promise<{
|
|
8
|
+
__typename?: "SubmissionCancelPayload" | undefined;
|
|
9
|
+
submission?: {
|
|
10
|
+
__typename?: "Submission" | undefined;
|
|
11
|
+
reference: string;
|
|
12
|
+
description: string;
|
|
13
|
+
status: import("../types/autogenerated/shop-minis-admin-api/graphql.js").SubmissionStatus;
|
|
14
|
+
submittedAt: any;
|
|
15
|
+
} | null | undefined;
|
|
16
|
+
userErrors: {
|
|
17
|
+
__typename?: "SubmissionCancelUserError" | undefined;
|
|
18
|
+
code: import("../types/autogenerated/shop-minis-admin-api/graphql.js").SubmissionCancelUserErrorCode;
|
|
19
|
+
message: string;
|
|
20
|
+
field?: string[] | null | undefined;
|
|
21
|
+
}[];
|
|
22
|
+
}>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { graphql } from '../types/autogenerated/shop-minis-admin-api/gql.js';
|
|
2
|
+
import { client } from './client.js';
|
|
3
|
+
export const cancelSubmissionQuery = graphql(/* GraphQL */ `
|
|
4
|
+
mutation CancelSubmission($reference: String!) {
|
|
5
|
+
submissionCancel(reference: $reference) {
|
|
6
|
+
submission {
|
|
7
|
+
reference
|
|
8
|
+
description
|
|
9
|
+
status
|
|
10
|
+
submittedAt
|
|
11
|
+
}
|
|
12
|
+
userErrors {
|
|
13
|
+
code
|
|
14
|
+
message
|
|
15
|
+
field
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
`);
|
|
20
|
+
export const cancelSubmission = async ({ reference, }) => {
|
|
21
|
+
const data = await client.request(cancelSubmissionQuery, {
|
|
22
|
+
reference,
|
|
23
|
+
}, {});
|
|
24
|
+
return data.submissionCancel;
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=cancel-submission.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cancel-submission.js","sourceRoot":"","sources":["../../../src/commands/data/cancel-submission.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,oDAAoD,CAAA;AAE1E,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAA;AAElC,MAAM,CAAC,MAAM,qBAAqB,GAAG,OAAO,CAAC,aAAa,CAAC;;;;;;;;;;;;;;;;CAgB1D,CAAC,CAAA;AAMF,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EAAE,EACrC,SAAS,GACkB,EAAE,EAAE;IAC/B,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,OAAO,CAC/B,qBAAqB,EACrB;QACE,SAAS;KACV,EACD,EAAE,CACH,CAAA;IAED,OAAO,IAAI,CAAC,gBAAgB,CAAA;AAC9B,CAAC,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { GraphQLClient } from 'graphql-request';
|
|
2
|
+
import { SHOP_MINIS_ADMIN_API, SHOP_MINIS_ADMIN_API_KEY } from '../config.js';
|
|
3
|
+
export const client = new GraphQLClient(SHOP_MINIS_ADMIN_API, {
|
|
4
|
+
headers: {
|
|
5
|
+
Authorization: `Bearer ${SHOP_MINIS_ADMIN_API_KEY}`,
|
|
6
|
+
},
|
|
7
|
+
});
|
|
8
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/commands/data/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAA;AAE7C,OAAO,EAAC,oBAAoB,EAAE,wBAAwB,EAAC,MAAM,cAAc,CAAA;AAE3E,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,oBAAoB,EAAE;IAC5D,OAAO,EAAE;QACP,aAAa,EAAE,UAAU,wBAAwB,EAAE;KACpD;CACF,CAAC,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface CreateSubmissionParameters {
|
|
2
|
+
description: string;
|
|
3
|
+
uploadId: string;
|
|
4
|
+
}
|
|
5
|
+
export declare const createSubmission: ({ description, uploadId, }: CreateSubmissionParameters) => Promise<{
|
|
6
|
+
__typename?: "SubmissionCreatePayload" | undefined;
|
|
7
|
+
submission?: {
|
|
8
|
+
__typename?: "Submission" | undefined;
|
|
9
|
+
reference: string;
|
|
10
|
+
description: string;
|
|
11
|
+
status: import("../types/autogenerated/shop-minis-admin-api/graphql.js").SubmissionStatus;
|
|
12
|
+
submittedAt: any;
|
|
13
|
+
} | null | undefined;
|
|
14
|
+
userErrors: {
|
|
15
|
+
__typename?: "SubmissionCreateUserError" | undefined;
|
|
16
|
+
code: import("../types/autogenerated/shop-minis-admin-api/graphql.js").SubmissionCreateUserErrorCode;
|
|
17
|
+
message: string;
|
|
18
|
+
field?: string[] | null | undefined;
|
|
19
|
+
}[];
|
|
20
|
+
}>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { graphql } from '../types/autogenerated/shop-minis-admin-api/gql.js';
|
|
2
|
+
import { client } from './client.js';
|
|
3
|
+
const createSubmissionQuery = graphql(/* GraphQL */ `
|
|
4
|
+
mutation CreateSubmission($description: String!, $uploadId: ID!) {
|
|
5
|
+
submissionCreate(description: $description, uploadId: $uploadId) {
|
|
6
|
+
submission {
|
|
7
|
+
reference
|
|
8
|
+
description
|
|
9
|
+
status
|
|
10
|
+
submittedAt
|
|
11
|
+
}
|
|
12
|
+
userErrors {
|
|
13
|
+
code
|
|
14
|
+
message
|
|
15
|
+
field
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
`);
|
|
20
|
+
export const createSubmission = async ({ description, uploadId, }) => {
|
|
21
|
+
const data = await client.request(createSubmissionQuery, {
|
|
22
|
+
description,
|
|
23
|
+
uploadId,
|
|
24
|
+
}, {});
|
|
25
|
+
return data.submissionCreate;
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=create-submission.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-submission.js","sourceRoot":"","sources":["../../../src/commands/data/create-submission.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,oDAAoD,CAAA;AAE1E,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAA;AAElC,MAAM,qBAAqB,GAAG,OAAO,CAAC,aAAa,CAAC;;;;;;;;;;;;;;;;CAgBnD,CAAC,CAAA;AAOF,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EAAE,EACrC,WAAW,EACX,QAAQ,GACmB,EAAE,EAAE;IAC/B,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,OAAO,CAC/B,qBAAqB,EACrB;QACE,WAAW;QACX,QAAQ;KACT,EACD,EAAE,CACH,CAAA;IAED,OAAO,IAAI,CAAC,gBAAgB,CAAA;AAC9B,CAAC,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface CreateUploadParameters {
|
|
2
|
+
filename: string;
|
|
3
|
+
fileSize: number;
|
|
4
|
+
checksum: string;
|
|
5
|
+
mimeType: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const createUpload: ({ filename, fileSize, checksum, mimeType, }: CreateUploadParameters) => Promise<{
|
|
8
|
+
__typename?: "SubmissionUploadCreatePayload" | undefined;
|
|
9
|
+
upload?: {
|
|
10
|
+
__typename?: "StagedUpload" | undefined;
|
|
11
|
+
url: any;
|
|
12
|
+
headers: string;
|
|
13
|
+
id: string;
|
|
14
|
+
} | null | undefined;
|
|
15
|
+
userErrors: {
|
|
16
|
+
__typename?: "SubmissionUploadCreateUserError" | undefined;
|
|
17
|
+
code: import("../types/autogenerated/shop-minis-admin-api/graphql.js").SubmissionUploadCreateUserErrorCode;
|
|
18
|
+
message: string;
|
|
19
|
+
field?: string[] | null | undefined;
|
|
20
|
+
}[];
|
|
21
|
+
}>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { graphql } from '../types/autogenerated/shop-minis-admin-api/gql.js';
|
|
2
|
+
import { client } from './client.js';
|
|
3
|
+
const createUploadQuery = graphql(/* GraphQL */ `
|
|
4
|
+
mutation CreateUpload(
|
|
5
|
+
$filename: String!
|
|
6
|
+
$fileSize: Int!
|
|
7
|
+
$checksum: String!
|
|
8
|
+
$mimeType: String!
|
|
9
|
+
) {
|
|
10
|
+
submissionUploadCreate(
|
|
11
|
+
input: {
|
|
12
|
+
filename: $filename
|
|
13
|
+
fileSize: $fileSize
|
|
14
|
+
checksum: $checksum
|
|
15
|
+
mimeType: $mimeType
|
|
16
|
+
}
|
|
17
|
+
) {
|
|
18
|
+
upload {
|
|
19
|
+
url
|
|
20
|
+
headers
|
|
21
|
+
id
|
|
22
|
+
}
|
|
23
|
+
userErrors {
|
|
24
|
+
code
|
|
25
|
+
message
|
|
26
|
+
field
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
`);
|
|
31
|
+
export const createUpload = async ({ filename, fileSize, checksum, mimeType, }) => {
|
|
32
|
+
const data = await client.request(createUploadQuery, {
|
|
33
|
+
filename,
|
|
34
|
+
fileSize,
|
|
35
|
+
checksum,
|
|
36
|
+
mimeType,
|
|
37
|
+
}, {});
|
|
38
|
+
return data.submissionUploadCreate;
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=create-upload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-upload.js","sourceRoot":"","sources":["../../../src/commands/data/create-upload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,oDAAoD,CAAA;AAE1E,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAA;AAElC,MAAM,iBAAiB,GAAG,OAAO,CAAC,aAAa,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2B/C,CAAC,CAAA;AASF,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,EAAE,EACjC,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,GACe,EAAE,EAAE;IAC3B,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,OAAO,CAC/B,iBAAiB,EACjB;QACE,QAAQ;QACR,QAAQ;QACR,QAAQ;QACR,QAAQ;KACT,EACD,EAAE,CACH,CAAA;IAED,OAAO,IAAI,CAAC,sBAAsB,CAAA;AACpC,CAAC,CAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface GetSubmissionsParameters {
|
|
2
|
+
first?: number;
|
|
3
|
+
}
|
|
4
|
+
export declare const getSubmissions: ({ first, }?: GetSubmissionsParameters | undefined) => Promise<{
|
|
5
|
+
__typename?: "SubmissionConnection" | undefined;
|
|
6
|
+
nodes: {
|
|
7
|
+
__typename?: "Submission" | undefined;
|
|
8
|
+
reference: string;
|
|
9
|
+
description: string;
|
|
10
|
+
status: import("../types/autogenerated/shop-minis-admin-api/graphql.js").SubmissionStatus;
|
|
11
|
+
submittedAt: any;
|
|
12
|
+
}[];
|
|
13
|
+
pageInfo: {
|
|
14
|
+
__typename?: "PageInfo" | undefined;
|
|
15
|
+
hasNextPage: boolean;
|
|
16
|
+
hasPreviousPage: boolean;
|
|
17
|
+
startCursor?: string | null | undefined;
|
|
18
|
+
endCursor?: string | null | undefined;
|
|
19
|
+
};
|
|
20
|
+
}>;
|
|
21
|
+
export declare function getPendingSubmission(): Promise<{
|
|
22
|
+
__typename?: "Submission" | undefined;
|
|
23
|
+
reference: string;
|
|
24
|
+
description: string;
|
|
25
|
+
status: import("../types/autogenerated/shop-minis-admin-api/graphql.js").SubmissionStatus;
|
|
26
|
+
submittedAt: any;
|
|
27
|
+
} | null>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { graphql } from '../types/autogenerated/shop-minis-admin-api/gql.js';
|
|
2
|
+
import { client } from './client.js';
|
|
3
|
+
const getSubmissionQuery = graphql(/* GraphQL */ `
|
|
4
|
+
query Submissions($first: Int) {
|
|
5
|
+
submissions(first: $first) {
|
|
6
|
+
nodes {
|
|
7
|
+
reference
|
|
8
|
+
description
|
|
9
|
+
status
|
|
10
|
+
submittedAt
|
|
11
|
+
}
|
|
12
|
+
pageInfo {
|
|
13
|
+
hasNextPage
|
|
14
|
+
hasPreviousPage
|
|
15
|
+
startCursor
|
|
16
|
+
endCursor
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
`);
|
|
21
|
+
export const getSubmissions = async ({ first = 10, } = {}) => {
|
|
22
|
+
const data = await client.request(getSubmissionQuery, { first }, {});
|
|
23
|
+
return data.submissions;
|
|
24
|
+
};
|
|
25
|
+
export async function getPendingSubmission() {
|
|
26
|
+
const submissions = await getSubmissions();
|
|
27
|
+
const pendingSubmissions = submissions.nodes.filter(submission => submission.status === 'PENDING');
|
|
28
|
+
// There should only ever be one
|
|
29
|
+
if (pendingSubmissions.length)
|
|
30
|
+
return pendingSubmissions[0];
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=get-submissions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-submissions.js","sourceRoot":"","sources":["../../../src/commands/data/get-submissions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,oDAAoD,CAAA;AAE1E,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAA;AAElC,MAAM,kBAAkB,GAAG,OAAO,CAAC,aAAa,CAAC;;;;;;;;;;;;;;;;;CAiBhD,CAAC,CAAA;AAMF,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,EAAE,EACnC,KAAK,GAAG,EAAE,MAC8B,EAAE,EAAE,EAAE;IAC9C,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,kBAAkB,EAAE,EAAC,KAAK,EAAC,EAAE,EAAE,CAAC,CAAA;IAElE,OAAO,IAAI,CAAC,WAAW,CAAA;AACzB,CAAC,CAAA;AAED,MAAM,CAAC,KAAK,UAAU,oBAAoB;IACxC,MAAM,WAAW,GAAG,MAAM,cAAc,EAAE,CAAA;IAC1C,MAAM,kBAAkB,GAAG,WAAW,CAAC,KAAK,CAAC,MAAM,CACjD,UAAU,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,KAAK,SAAS,CAC9C,CAAA;IAED,gCAAgC;IAChC,IAAI,kBAAkB,CAAC,MAAM;QAAE,OAAO,kBAAkB,CAAC,CAAC,CAAC,CAAA;IAE3D,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
|
+
import { BuildType } from './utils/types.js';
|
|
2
3
|
export interface DevCommandOptions {
|
|
3
4
|
resetCache?: boolean;
|
|
4
5
|
host?: string;
|
|
6
|
+
buildType: BuildType;
|
|
5
7
|
}
|
|
6
8
|
export declare function loadCommand(parentProgram: Command): Promise<void>;
|
|
@@ -1,18 +1,24 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
1
|
+
import { Command, Option } from 'commander';
|
|
2
2
|
import chalk from 'chalk';
|
|
3
3
|
import internalIp from 'internal-ip';
|
|
4
4
|
import { getMiniManifest } from '../utils/minis-manifest.js';
|
|
5
5
|
import { InteractiveTerminal } from './utils/interactive-terminal.js';
|
|
6
6
|
import { runMetro } from './utils/metro/metro-server.js';
|
|
7
|
+
import { maybeApplyPatches } from './utils/patch-package.js';
|
|
8
|
+
import { BuildType } from './utils/types.js';
|
|
7
9
|
export async function loadCommand(parentProgram) {
|
|
8
10
|
const ip = await internalIp.v4();
|
|
9
11
|
const command = new Command()
|
|
10
12
|
.name('dev')
|
|
11
|
-
.version('2.0.0')
|
|
12
13
|
.description('Start a local dev server for the mini app')
|
|
13
14
|
.option('--reset-cache', 'reset the dev server cache')
|
|
14
15
|
.option('--host <host>', "packager's host", ip)
|
|
16
|
+
.option('--verbose', 'print debugging messages') // compatible with cli-kit
|
|
17
|
+
.addOption(new Option('--build-type <buildType>', 'build type')
|
|
18
|
+
.choices(Object.values(BuildType))
|
|
19
|
+
.default(BuildType.Release))
|
|
15
20
|
.action(async (options) => {
|
|
21
|
+
maybeApplyPatches();
|
|
16
22
|
await runMetro(options);
|
|
17
23
|
const miniHandle = getMiniManifest().handle;
|
|
18
24
|
console.log('Local development environment for', chalk.green(miniHandle), 'is running...');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/dev/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/dev/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,MAAM,EAAC,MAAM,WAAW,CAAA;AACzC,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,UAAU,MAAM,aAAa,CAAA;AAEpC,OAAO,EAAC,eAAe,EAAC,MAAM,4BAA4B,CAAA;AAE1D,OAAO,EAAC,mBAAmB,EAAC,MAAM,iCAAiC,CAAA;AACnE,OAAO,EAAC,QAAQ,EAAC,MAAM,+BAA+B,CAAA;AACtD,OAAO,EAAC,iBAAiB,EAAC,MAAM,0BAA0B,CAAA;AAC1D,OAAO,EAAC,SAAS,EAAC,MAAM,kBAAkB,CAAA;AAQ1C,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,aAAsB;IACtD,MAAM,EAAE,GAAG,MAAM,UAAU,CAAC,EAAE,EAAE,CAAA;IAEhC,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE;SAC1B,IAAI,CAAC,KAAK,CAAC;SACX,WAAW,CAAC,2CAA2C,CAAC;SACxD,MAAM,CAAC,eAAe,EAAE,4BAA4B,CAAC;SACrD,MAAM,CAAC,eAAe,EAAE,iBAAiB,EAAE,EAAE,CAAC;SAC9C,MAAM,CAAC,WAAW,EAAE,0BAA0B,CAAC,CAAC,0BAA0B;SAC1E,SAAS,CACR,IAAI,MAAM,CAAC,0BAA0B,EAAE,YAAY,CAAC;SACjD,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;SACjC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,CAC9B;SACA,MAAM,CAAC,KAAK,EAAE,OAA0B,EAAE,EAAE;QAC3C,iBAAiB,EAAE,CAAA;QACnB,MAAM,QAAQ,CAAC,OAAO,CAAC,CAAA;QAEvB,MAAM,UAAU,GAAG,eAAe,EAAE,CAAC,MAAM,CAAA;QAC3C,OAAO,CAAC,GAAG,CACT,mCAAmC,EACnC,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,EACvB,eAAe,CAChB,CAAA;QAED,MAAM,mBAAmB,GAAG,IAAI,mBAAmB,CAAC,OAAO,CAAC,CAAA;QAC5D,mBAAmB,CAAC,KAAK,EAAE,CAAA;IAC7B,CAAC,CAAC,CAAA;IAEJ,aAAa,CAAC,UAAU,CAAC,OAAO,CAAC,CAAA;AACnC,CAAC"}
|
|
@@ -7,10 +7,12 @@ export interface androidDevice {
|
|
|
7
7
|
}
|
|
8
8
|
export declare function getDevices(): Promise<androidDevice[]>;
|
|
9
9
|
export declare function getEmulators(): Promise<androidDevice[]>;
|
|
10
|
-
export declare function androidHomeExists(): boolean;
|
|
11
10
|
export declare function promptForAndroidDevices(): Promise<androidDevice | null>;
|
|
12
11
|
export declare function maybeLaunchEmulator(emulatorName: string): Promise<string | null>;
|
|
13
|
-
export declare function installShopInEmulator(emulatorId: string,
|
|
14
|
-
export declare function getInstalledShopVersion(emulatorId: string): Promise<
|
|
12
|
+
export declare function installShopInEmulator(emulatorId: string, fileName: string): Promise<void>;
|
|
13
|
+
export declare function getInstalledShopVersion(emulatorId: string): Promise<{
|
|
14
|
+
version: string;
|
|
15
|
+
build: string;
|
|
16
|
+
} | null>;
|
|
15
17
|
export declare function connectDevelopmentServer(emulatorId: string): Promise<void>;
|
|
16
|
-
export declare function deeplinkToEmulator(emulatorId: string,
|
|
18
|
+
export declare function deeplinkToEmulator(emulatorId: string, originalDeeplink: string): Promise<void>;
|
|
@@ -1,28 +1,10 @@
|
|
|
1
1
|
import child_process from 'child_process';
|
|
2
2
|
import path from 'path';
|
|
3
|
-
import fs from 'fs';
|
|
4
3
|
import _ from 'lodash';
|
|
5
4
|
import prompts from 'prompts';
|
|
6
5
|
import { execAsync } from '../../utils/exec-async-child-process.js';
|
|
7
|
-
import { PATHS } from '../../config.js';
|
|
6
|
+
import { PATHS, whichAdb, whichEmulator } from '../../config.js';
|
|
8
7
|
import { withRetries } from './with-retries.js';
|
|
9
|
-
import { versionToBinaryFileName } from './binaries.js';
|
|
10
|
-
const DEFAULT_ANDROID_HOME_MACOS = `${process.env.HOME}/Library/Android/sdk`;
|
|
11
|
-
function whichAndroidHome() {
|
|
12
|
-
if (process.env.ANDROID_HOME) {
|
|
13
|
-
return process.env.ANDROID_HOME;
|
|
14
|
-
}
|
|
15
|
-
if (fs.existsSync(DEFAULT_ANDROID_HOME_MACOS)) {
|
|
16
|
-
return DEFAULT_ANDROID_HOME_MACOS;
|
|
17
|
-
}
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
function whichEmulator() {
|
|
21
|
-
return `${whichAndroidHome()}/emulator/emulator`;
|
|
22
|
-
}
|
|
23
|
-
function whichAdb() {
|
|
24
|
-
return `${whichAndroidHome()}/platform-tools/adb`;
|
|
25
|
-
}
|
|
26
8
|
export async function getDevices() {
|
|
27
9
|
const { stdout: devicesList } = await execAsync(`${whichAdb()} devices -l`);
|
|
28
10
|
return devicesList
|
|
@@ -46,9 +28,6 @@ export async function getEmulators() {
|
|
|
46
28
|
isAuthorized: true,
|
|
47
29
|
}));
|
|
48
30
|
}
|
|
49
|
-
export function androidHomeExists() {
|
|
50
|
-
return Boolean(whichAndroidHome());
|
|
51
|
-
}
|
|
52
31
|
export async function promptForAndroidDevices() {
|
|
53
32
|
const devices = await getDevices();
|
|
54
33
|
const emulators = await getEmulators();
|
|
@@ -84,16 +63,25 @@ export async function maybeLaunchEmulator(emulatorName) {
|
|
|
84
63
|
}
|
|
85
64
|
return emulatorId;
|
|
86
65
|
}
|
|
87
|
-
export async function installShopInEmulator(emulatorId,
|
|
88
|
-
const fileName = versionToBinaryFileName(version, 'android');
|
|
66
|
+
export async function installShopInEmulator(emulatorId, fileName) {
|
|
89
67
|
const binaryPath = path.join(PATHS.CACHE_DIR, fileName);
|
|
90
|
-
await execAsync(`${whichAdb()} -s ${emulatorId} install -r "${binaryPath}"`);
|
|
68
|
+
await execAsync(`${whichAdb()} -s ${emulatorId} install -r -d "${binaryPath}"`);
|
|
91
69
|
}
|
|
92
70
|
export async function getInstalledShopVersion(emulatorId) {
|
|
93
71
|
try {
|
|
94
|
-
const
|
|
72
|
+
const versionName = await execAsync(`${whichAdb()} -s ${emulatorId} shell dumpsys package com.shopify.arrive.internal | grep versionName`);
|
|
73
|
+
const versionCode = await execAsync(`${whichAdb()} -s ${emulatorId} shell dumpsys package com.shopify.arrive.internal | grep versionCode`);
|
|
95
74
|
// stdout: ["versionName=2.86.0"]
|
|
96
|
-
|
|
75
|
+
const version = _.last(versionName.stdout[0]?.split('='));
|
|
76
|
+
// stdout: ["versionCode=1680515537 minSdk=21 targetSdk=33"]
|
|
77
|
+
const build = _.last(versionCode.stdout[0]?.split(' ')[0]?.split('='));
|
|
78
|
+
if (version == null || build == null) {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
version,
|
|
83
|
+
build,
|
|
84
|
+
};
|
|
97
85
|
}
|
|
98
86
|
catch {
|
|
99
87
|
return null;
|
|
@@ -102,8 +90,20 @@ export async function getInstalledShopVersion(emulatorId) {
|
|
|
102
90
|
export async function connectDevelopmentServer(emulatorId) {
|
|
103
91
|
await execAsync(`${whichAdb()} -s ${emulatorId} reverse tcp:8082 tcp:8082`);
|
|
104
92
|
}
|
|
105
|
-
export async function deeplinkToEmulator(emulatorId,
|
|
106
|
-
|
|
93
|
+
export async function deeplinkToEmulator(emulatorId, originalDeeplink) {
|
|
94
|
+
let deeplink = originalDeeplink;
|
|
95
|
+
// If we have a querystring we need to modify it to escape ampersands
|
|
96
|
+
// https://stackoverflow.com/a/45323695
|
|
97
|
+
const queryIndex = deeplink.indexOf('?');
|
|
98
|
+
if (queryIndex !== -1) {
|
|
99
|
+
const urlObj = new URL(deeplink);
|
|
100
|
+
const preQueryString = deeplink.substring(0, queryIndex);
|
|
101
|
+
const queryString = Array.from(urlObj.searchParams.entries())
|
|
102
|
+
.map(([key, value]) => `${key}=${value}`)
|
|
103
|
+
.join('\\&');
|
|
104
|
+
deeplink = `${preQueryString}?${queryString}`;
|
|
105
|
+
}
|
|
106
|
+
await execAsync(`${whichAdb()} -s ${emulatorId} shell am start -a android.intent.action.VIEW -d "${deeplink}"`);
|
|
107
107
|
}
|
|
108
108
|
async function getNameForEmulatorWithId(emulatorId) {
|
|
109
109
|
const { stdout } = await execAsync(`${whichAdb()} -s ${emulatorId} emu avd name`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"android.js","sourceRoot":"","sources":["../../../../src/commands/dev/utils/android.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,eAAe,CAAA;AACzC,OAAO,IAAI,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"android.js","sourceRoot":"","sources":["../../../../src/commands/dev/utils/android.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,eAAe,CAAA;AACzC,OAAO,IAAI,MAAM,MAAM,CAAA;AAEvB,OAAO,CAAC,MAAM,QAAQ,CAAA;AACtB,OAAO,OAAO,MAAM,SAAS,CAAA;AAE7B,OA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