@shopify/shop-minis-cli 0.0.38 → 0.0.39
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/.eslintrc.cjs +84 -0
- package/.vscode/extensions.json +3 -0
- package/.vscode/settings.json +8 -0
- package/.vscode/shop-minis-cli.code-workspace +8 -0
- package/build/commands/cancel-submission/index.d.ts +2 -0
- package/build/commands/cancel-submission/index.js +22 -0
- package/build/commands/cancel-submission/index.js.map +1 -0
- package/build/commands/cancel-submission/types.d.ts +3 -0
- package/build/commands/cancel-submission/types.js +2 -0
- package/build/commands/cancel-submission/types.js.map +1 -0
- package/build/commands/check-submission/index.d.ts +2 -0
- package/build/commands/check-submission/index.js +22 -0
- package/build/commands/check-submission/index.js.map +1 -0
- package/build/commands/check-submission/types.d.ts +3 -0
- package/build/commands/check-submission/types.js +2 -0
- package/build/commands/check-submission/types.js.map +1 -0
- package/build/commands/config.d.ts +10 -0
- package/build/commands/config.js +34 -0
- package/build/commands/config.js.map +1 -0
- package/build/commands/create-mini/index.js +38 -40
- package/build/commands/create-mini/index.js.map +1 -1
- package/build/commands/create-mini/utils/template-app.js +20 -25
- package/build/commands/create-mini/utils/template-app.js.map +1 -1
- package/build/commands/dev/index.js +13 -20
- package/build/commands/dev/index.js.map +1 -1
- package/build/commands/dev/utils/android.js +34 -48
- package/build/commands/dev/utils/android.js.map +1 -1
- package/build/commands/dev/utils/binaries.d.ts +1 -22
- package/build/commands/dev/utils/binaries.js +19 -98
- package/build/commands/dev/utils/binaries.js.map +1 -1
- package/build/commands/dev/utils/deeplink.d.ts +1 -1
- package/build/commands/dev/utils/deeplink.js +2 -7
- package/build/commands/dev/utils/deeplink.js.map +1 -1
- package/build/commands/dev/utils/interactive-terminal.d.ts +1 -1
- package/build/commands/dev/utils/interactive-terminal.js +46 -52
- package/build/commands/dev/utils/interactive-terminal.js.map +1 -1
- package/build/commands/dev/utils/metro/metro-config.js +19 -20
- package/build/commands/dev/utils/metro/metro-config.js.map +1 -1
- package/build/commands/dev/utils/metro/metro-reporter.d.ts +2 -3
- package/build/commands/dev/utils/metro/metro-reporter.js +7 -12
- package/build/commands/dev/utils/metro/metro-reporter.js.map +1 -1
- package/build/commands/dev/utils/metro/metro-server-middleware.js +5 -12
- package/build/commands/dev/utils/metro/metro-server-middleware.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 +6 -13
- package/build/commands/dev/utils/metro/metro-server.js.map +1 -1
- package/build/commands/dev/utils/network.d.ts +20 -0
- package/build/commands/dev/utils/network.js +62 -0
- package/build/commands/dev/utils/network.js.map +1 -0
- package/build/commands/dev/utils/qr-code.js +3 -10
- package/build/commands/dev/utils/qr-code.js.map +1 -1
- package/build/commands/dev/utils/simulator.js +25 -35
- package/build/commands/dev/utils/simulator.js.map +1 -1
- package/build/commands/dev/utils/types.d.ts +1 -0
- package/build/commands/dev/utils/types.js +2 -0
- package/build/commands/dev/utils/types.js.map +1 -0
- package/build/commands/dev/utils/with-retries.js +1 -5
- package/build/commands/dev/utils/with-retries.js.map +1 -1
- package/build/commands/generate-graphql-types/index.js +25 -26
- package/build/commands/generate-graphql-types/index.js.map +1 -1
- package/build/commands/schemas/contextual-image.schema.d.ts +22 -0
- package/build/commands/schemas/contextual-image.schema.js +23 -0
- package/build/commands/schemas/contextual-image.schema.js.map +1 -0
- package/build/commands/schemas/contextual-object.schema.d.ts +18 -0
- package/build/commands/schemas/contextual-object.schema.js +19 -0
- package/build/commands/schemas/contextual-object.schema.js.map +1 -0
- package/build/commands/schemas/manifest.schema.d.ts +181 -0
- package/build/commands/schemas/manifest.schema.js +230 -0
- package/build/commands/schemas/manifest.schema.js.map +1 -0
- package/build/commands/schemas/visibility.schema.d.ts +18 -0
- package/build/commands/schemas/visibility.schema.js +19 -0
- package/build/commands/schemas/visibility.schema.js.map +1 -0
- package/build/commands/submit/config.d.ts +9 -0
- package/build/commands/submit/config.js +18 -0
- package/build/commands/submit/config.js.map +1 -0
- package/build/commands/submit/errors.d.ts +19 -0
- package/build/commands/submit/errors.js +87 -0
- package/build/commands/submit/errors.js.map +1 -0
- package/build/commands/submit/gcs.d.ts +6 -0
- package/build/commands/submit/gcs.js +10 -0
- package/build/commands/submit/gcs.js.map +1 -0
- package/build/commands/submit/graphql.d.ts +73 -0
- package/build/commands/submit/graphql.js +100 -0
- package/build/commands/submit/graphql.js.map +1 -0
- package/build/commands/submit/index.d.ts +2 -0
- package/build/commands/submit/index.js +21 -0
- package/build/commands/submit/index.js.map +1 -0
- package/build/commands/submit/submit.d.ts +4 -0
- package/build/commands/submit/submit.js +171 -0
- package/build/commands/submit/submit.js.map +1 -0
- package/build/commands/submit/tasks.d.ts +39 -0
- package/build/commands/submit/tasks.js +167 -0
- package/build/commands/submit/tasks.js.map +1 -0
- package/build/commands/submit/types.d.ts +14 -0
- package/build/commands/submit/types.js +2 -0
- package/build/commands/submit/types.js.map +1 -0
- package/build/commands/submit/validation.d.ts +2 -0
- package/build/commands/submit/validation.js +14 -0
- package/build/commands/submit/validation.js.map +1 -0
- package/build/commands/types/autogenerated/shop-minis-admin-api/fragment-masking.d.ts +13 -0
- package/build/commands/types/autogenerated/shop-minis-admin-api/fragment-masking.js +7 -0
- package/build/commands/types/autogenerated/shop-minis-admin-api/fragment-masking.js.map +1 -0
- package/build/commands/types/autogenerated/shop-minis-admin-api/gql.d.ts +54 -0
- package/build/commands/types/autogenerated/shop-minis-admin-api/gql.js +21 -0
- package/build/commands/types/autogenerated/shop-minis-admin-api/gql.js.map +1 -0
- package/build/commands/types/autogenerated/shop-minis-admin-api/graphql.d.ts +613 -0
- package/build/commands/types/autogenerated/shop-minis-admin-api/graphql.js +427 -0
- package/build/commands/types/autogenerated/shop-minis-admin-api/graphql.js.map +1 -0
- package/build/commands/types/autogenerated/shop-minis-admin-api/index.d.ts +2 -0
- package/build/commands/types/autogenerated/shop-minis-admin-api/index.js +3 -0
- package/build/commands/types/autogenerated/shop-minis-admin-api/index.js.map +1 -0
- package/build/commands/types/helpers.d.ts +1 -0
- package/build/commands/types/helpers.js +2 -0
- package/build/commands/types/helpers.js.map +1 -0
- package/build/commands/utils/archive.d.ts +30 -0
- package/build/commands/utils/archive.js +38 -0
- package/build/commands/utils/archive.js.map +1 -0
- package/build/commands/utils/exec-async-child-process.d.ts +1 -1
- package/build/commands/utils/exec-async-child-process.js +6 -13
- package/build/commands/utils/exec-async-child-process.js.map +1 -1
- package/build/commands/utils/file.d.ts +1 -0
- package/build/commands/utils/file.js +7 -0
- package/build/commands/utils/file.js.map +1 -0
- package/build/commands/{check/utils/manifest.d.ts → utils/minis-manifest.d.ts} +1 -0
- package/build/commands/utils/minis-manifest.js +42 -0
- package/build/commands/utils/minis-manifest.js.map +1 -0
- package/build/commands/utils/wrap-with-loading-indicator.js +3 -10
- package/build/commands/utils/wrap-with-loading-indicator.js.map +1 -1
- package/build/dev-panel/middleware.js +5 -10
- package/build/dev-panel/middleware.js.map +1 -1
- package/build/index.js +15 -13
- package/build/index.js.map +1 -1
- package/jest.config.ts +11 -0
- package/package.json +4 -7
- package/scripts/graphql-codegen.ts +23 -0
- package/templates/__template_common/.eslintrc.json +2 -119
- package/templates/__template_common/gitignore +1 -0
- package/templates/__template_common/package.json +8 -7
- package/templates/__template_common/src/manifest.json +1 -0
- package/templates/__template_hello_world/src/screens/BottomSheetScreen.tsx +6 -5
- package/templates/__template_hello_world/src/screens/QuizScreen.tsx +2 -2
- package/templates/__template_hello_world/src/screens/QuizSlideScreen.tsx +2 -2
- package/build/commands/check/index.d.ts +0 -6
- package/build/commands/check/index.js +0 -87
- package/build/commands/check/index.js.map +0 -1
- package/build/commands/check/utils/manifest.js +0 -26
- package/build/commands/check/utils/manifest.js.map +0 -1
- package/build/commands/check/utils/schemas/contextual-image.schema.json +0 -21
- package/build/commands/check/utils/schemas/contextual-object.schema.json +0 -17
- package/build/commands/check/utils/schemas/manifest.schema.json +0 -226
- package/build/commands/check/utils/schemas/visibility.schema.json +0 -17
- package/build/commands/check/utils/versions.d.ts +0 -1
- package/build/commands/check/utils/versions.js +0 -14
- package/build/commands/check/utils/versions.js.map +0 -1
- package/build/commands/dev/utils/binaries.test.d.ts +0 -1
- package/build/commands/dev/utils/binaries.test.js +0 -275
- package/build/commands/dev/utils/binaries.test.js.map +0 -1
- package/build/commands/dev/utils/minis-manifest.d.ts +0 -1
- package/build/commands/dev/utils/minis-manifest.js +0 -24
- package/build/commands/dev/utils/minis-manifest.js.map +0 -1
- package/templates/__template_hello_world/src/utils/getFlagEmoji.spec.tsx +0 -19
|
@@ -1,23 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
11
|
-
const prompts_1 = __importDefault(require("prompts"));
|
|
12
|
-
const exec_async_child_process_1 = require("../../utils/exec-async-child-process");
|
|
13
|
-
const with_retries_1 = require("./with-retries");
|
|
14
|
-
const binaries_1 = require("./binaries");
|
|
1
|
+
import child_process from 'child_process';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import fs from 'fs';
|
|
4
|
+
import _ from 'lodash';
|
|
5
|
+
import prompts from 'prompts';
|
|
6
|
+
import { execAsync } from '../../utils/exec-async-child-process.js';
|
|
7
|
+
import { PATHS } from '../../config.js';
|
|
8
|
+
import { withRetries } from './with-retries.js';
|
|
9
|
+
import { versionToBinaryFileName } from './binaries.js';
|
|
15
10
|
const DEFAULT_ANDROID_HOME_MACOS = `${process.env.HOME}/Library/Android/sdk`;
|
|
16
11
|
function whichAndroidHome() {
|
|
17
12
|
if (process.env.ANDROID_HOME) {
|
|
18
13
|
return process.env.ANDROID_HOME;
|
|
19
14
|
}
|
|
20
|
-
if (
|
|
15
|
+
if (fs.existsSync(DEFAULT_ANDROID_HOME_MACOS)) {
|
|
21
16
|
return DEFAULT_ANDROID_HOME_MACOS;
|
|
22
17
|
}
|
|
23
18
|
return null;
|
|
@@ -28,8 +23,8 @@ function whichEmulator() {
|
|
|
28
23
|
function whichAdb() {
|
|
29
24
|
return `${whichAndroidHome()}/platform-tools/adb`;
|
|
30
25
|
}
|
|
31
|
-
async function getDevices() {
|
|
32
|
-
const { stdout: devicesList } = await
|
|
26
|
+
export async function getDevices() {
|
|
27
|
+
const { stdout: devicesList } = await execAsync(`${whichAdb()} devices -l`);
|
|
33
28
|
return devicesList
|
|
34
29
|
.slice(1)
|
|
35
30
|
.filter(name => !name.includes('emulator'))
|
|
@@ -41,9 +36,8 @@ async function getDevices() {
|
|
|
41
36
|
isAuthorized: true,
|
|
42
37
|
}));
|
|
43
38
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const { stdout: devicesList } = await (0, exec_async_child_process_1.execAsync)(`${whichEmulator()} -list-avds`);
|
|
39
|
+
export async function getEmulators() {
|
|
40
|
+
const { stdout: devicesList } = await execAsync(`${whichEmulator()} -list-avds`);
|
|
47
41
|
return devicesList.map(name => ({
|
|
48
42
|
name,
|
|
49
43
|
description: `${name} (emulator)`,
|
|
@@ -52,19 +46,17 @@ async function getEmulators() {
|
|
|
52
46
|
isAuthorized: true,
|
|
53
47
|
}));
|
|
54
48
|
}
|
|
55
|
-
|
|
56
|
-
function androidHomeExists() {
|
|
49
|
+
export function androidHomeExists() {
|
|
57
50
|
return Boolean(whichAndroidHome());
|
|
58
51
|
}
|
|
59
|
-
|
|
60
|
-
async function promptForAndroidDevices() {
|
|
52
|
+
export async function promptForAndroidDevices() {
|
|
61
53
|
const devices = await getDevices();
|
|
62
54
|
const emulators = await getEmulators();
|
|
63
55
|
const androidDevices = devices.concat(emulators);
|
|
64
56
|
if (!androidDevices.length) {
|
|
65
57
|
return null;
|
|
66
58
|
}
|
|
67
|
-
const { value } = await (
|
|
59
|
+
const { value } = await prompts({
|
|
68
60
|
type: 'autocomplete',
|
|
69
61
|
name: 'value',
|
|
70
62
|
limit: 11,
|
|
@@ -82,8 +74,7 @@ async function promptForAndroidDevices() {
|
|
|
82
74
|
});
|
|
83
75
|
return value;
|
|
84
76
|
}
|
|
85
|
-
|
|
86
|
-
async function maybeLaunchEmulator(emulatorName) {
|
|
77
|
+
export async function maybeLaunchEmulator(emulatorName) {
|
|
87
78
|
let emulatorId = await getIdForEmulatorWithName(emulatorName); // if emulatorId is defined the emulator is already running
|
|
88
79
|
if (!emulatorId) {
|
|
89
80
|
emulatorId = await doLaunchEmulator(emulatorName);
|
|
@@ -93,38 +84,33 @@ async function maybeLaunchEmulator(emulatorName) {
|
|
|
93
84
|
}
|
|
94
85
|
return emulatorId;
|
|
95
86
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
await (0, exec_async_child_process_1.execAsync)(`${whichAdb()} -s ${emulatorId} install -r "${binaryPath}"`);
|
|
87
|
+
export async function installShopInEmulator(emulatorId, version) {
|
|
88
|
+
const fileName = versionToBinaryFileName(version, 'android');
|
|
89
|
+
const binaryPath = path.join(PATHS.CACHE_DIR, fileName);
|
|
90
|
+
await execAsync(`${whichAdb()} -s ${emulatorId} install -r "${binaryPath}"`);
|
|
101
91
|
}
|
|
102
|
-
|
|
103
|
-
async function getInstalledShopVersion(emulatorId) {
|
|
92
|
+
export async function getInstalledShopVersion(emulatorId) {
|
|
104
93
|
try {
|
|
105
|
-
const { stdout } = await
|
|
94
|
+
const { stdout } = await execAsync(`${whichAdb()} -s ${emulatorId} shell dumpsys package com.shopify.arrive.internal | grep versionName`);
|
|
106
95
|
// stdout: ["versionName=2.86.0"]
|
|
107
|
-
return
|
|
96
|
+
return _.last(stdout?.[0]?.split('='));
|
|
108
97
|
}
|
|
109
98
|
catch {
|
|
110
99
|
return null;
|
|
111
100
|
}
|
|
112
101
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
await (0, exec_async_child_process_1.execAsync)(`${whichAdb()} -s ${emulatorId} reverse tcp:8082 tcp:8082`);
|
|
102
|
+
export async function connectDevelopmentServer(emulatorId) {
|
|
103
|
+
await execAsync(`${whichAdb()} -s ${emulatorId} reverse tcp:8082 tcp:8082`);
|
|
116
104
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
await (0, exec_async_child_process_1.execAsync)(`${whichAdb()} -s ${emulatorId} shell am start -a android.intent.action.VIEW -d ${deeplink}`);
|
|
105
|
+
export async function deeplinkToEmulator(emulatorId, deeplink) {
|
|
106
|
+
await execAsync(`${whichAdb()} -s ${emulatorId} shell am start -a android.intent.action.VIEW -d ${deeplink}`);
|
|
120
107
|
}
|
|
121
|
-
exports.deeplinkToEmulator = deeplinkToEmulator;
|
|
122
108
|
async function getNameForEmulatorWithId(emulatorId) {
|
|
123
|
-
const { stdout } = await
|
|
109
|
+
const { stdout } = await execAsync(`${whichAdb()} -s ${emulatorId} emu avd name`);
|
|
124
110
|
return stdout[0];
|
|
125
111
|
}
|
|
126
112
|
async function getIdForEmulatorWithName(emulatorName) {
|
|
127
|
-
const { stdout } = await
|
|
113
|
+
const { stdout } = await execAsync(`${whichAdb()} devices`);
|
|
128
114
|
const emulatorIds = stdout.filter(result => result.startsWith('emulator-'));
|
|
129
115
|
for (const emulatorId of emulatorIds) {
|
|
130
116
|
const name = await getNameForEmulatorWithId(emulatorId);
|
|
@@ -136,16 +122,16 @@ async function getIdForEmulatorWithName(emulatorName) {
|
|
|
136
122
|
}
|
|
137
123
|
async function waitForEmulatorToBoot(emulatorId, timeout = 60 * 2 * 1000 // 2 minutes
|
|
138
124
|
) {
|
|
139
|
-
await
|
|
125
|
+
await execAsync(`${whichAdb()} -s ${emulatorId} wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done;'`, { timeout });
|
|
140
126
|
}
|
|
141
127
|
function doLaunchEmulator(emulatorName) {
|
|
142
|
-
const emulatorProcess =
|
|
128
|
+
const emulatorProcess = child_process.spawn(whichEmulator(), [`@${emulatorName}`], {
|
|
143
129
|
stdio: 'ignore',
|
|
144
130
|
detached: true,
|
|
145
131
|
});
|
|
146
132
|
emulatorProcess.unref();
|
|
147
133
|
return new Promise((resolve, reject) => {
|
|
148
|
-
|
|
134
|
+
withRetries(() => getIdForEmulatorWithName(emulatorName))
|
|
149
135
|
.then(resolve)
|
|
150
136
|
.catch(reject)
|
|
151
137
|
.finally(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"android.js","sourceRoot":"","sources":["../../../../src/commands/dev/utils/android.ts"],"names":[],"mappings":"
|
|
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;AACvB,OAAO,EAAE,MAAM,IAAI,CAAA;AAEnB,OAAO,CAAC,MAAM,QAAQ,CAAA;AACtB,OAAO,OAAO,MAAM,SAAS,CAAA;AAE7B,OAAO,EAAC,SAAS,EAAC,MAAM,yCAAyC,CAAA;AACjE,OAAO,EAAC,KAAK,EAAC,MAAM,iBAAiB,CAAA;AAErC,OAAO,EAAC,WAAW,EAAC,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAC,uBAAuB,EAAC,MAAM,eAAe,CAAA;AAErD,MAAM,0BAA0B,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,sBAAsB,CAAA;AAU5E,SAAS,gBAAgB;IACvB,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE;QAC5B,OAAO,OAAO,CAAC,GAAG,CAAC,YAAY,CAAA;KAChC;IAED,IAAI,EAAE,CAAC,UAAU,CAAC,0BAA0B,CAAC,EAAE;QAC7C,OAAO,0BAA0B,CAAA;KAClC;IAED,OAAO,IAAI,CAAA;AACb,CAAC;AAED,SAAS,aAAa;IACpB,OAAO,GAAG,gBAAgB,EAAE,oBAAoB,CAAA;AAClD,CAAC;AAED,SAAS,QAAQ;IACf,OAAO,GAAG,gBAAgB,EA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AAE,CAAC,MAAM,EAAE,GAAG,EAAE;YAC9B,MAAM,CAAC,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC,CAAA;YACtD,eAAe,CAAC,kBAAkB,EAAE,CAAA;QACtC,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
type Platform = 'ios' | 'android';
|
|
1
|
+
import { Platform } from './types.js';
|
|
3
2
|
/**
|
|
4
3
|
* Returns the file extension used for each platform.
|
|
5
4
|
* android: .apk
|
|
@@ -40,25 +39,6 @@ export declare function isVersionAvailableLocally(platform: Platform, version: s
|
|
|
40
39
|
* Gets the biggest version in the downloads folder for the given platform.
|
|
41
40
|
*/
|
|
42
41
|
export declare function getLatestDownloadedVersion(platform: Platform): Promise<string | null>;
|
|
43
|
-
/**
|
|
44
|
-
* Returns the latest version that's present in the remote storage of binaries
|
|
45
|
-
* TODO: this won't handle a bucket that has more than 50 files.
|
|
46
|
-
*/
|
|
47
|
-
export declare function getLatestRemoteVersion(platform: Platform): Promise<string>;
|
|
48
|
-
/**
|
|
49
|
-
* Downloads a binary from the remote storage
|
|
50
|
-
* @returns Promise that resolves to the downloaded version
|
|
51
|
-
*/
|
|
52
|
-
export declare function downloadBinary(platform: Platform, { onProgress, version, }?: {
|
|
53
|
-
/**
|
|
54
|
-
* Download progress callback
|
|
55
|
-
*/
|
|
56
|
-
onProgress?: (progress: number) => void;
|
|
57
|
-
/**
|
|
58
|
-
* Version to download. Defaults to latest version available
|
|
59
|
-
*/
|
|
60
|
-
version?: string;
|
|
61
|
-
}): Promise<string>;
|
|
62
42
|
/**
|
|
63
43
|
* Compares the current version against the latest available version.
|
|
64
44
|
*
|
|
@@ -80,4 +60,3 @@ export declare function maybePromptBinaryUpgrade(platform: Platform, { currentVe
|
|
|
80
60
|
*/
|
|
81
61
|
onDownloadStart?: (version: string) => void;
|
|
82
62
|
}): Promise<string | null>;
|
|
83
|
-
export {};
|
|
@@ -1,38 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
|
-
const http_1 = __importDefault(require("http"));
|
|
9
|
-
const storage_1 = require("@google-cloud/storage");
|
|
10
|
-
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
11
|
-
const semver_1 = require("semver");
|
|
12
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
13
|
-
const prompts_1 = __importDefault(require("prompts"));
|
|
14
|
-
exports.BINARIES_PATH = path_1.default.join(process.cwd(), './.minis-cache');
|
|
15
|
-
// TODO: set up domain and ssl certificate for cdn
|
|
16
|
-
// https://console.cloud.google.com/net-services/cdn/backendBucket/details/minis-binaries-backend-bucket?project=arrive-167720
|
|
17
|
-
// https://console.cloud.google.com/storage/browser/minis_cli_binaries
|
|
18
|
-
const CDN_ADDRESS = 'http://35.244.235.176/';
|
|
19
|
-
try {
|
|
20
|
-
fs_extra_1.default.mkdirSync(exports.BINARIES_PATH);
|
|
21
|
-
}
|
|
22
|
-
catch {
|
|
23
|
-
// directory already exists. do nothing
|
|
24
|
-
}
|
|
25
|
-
const GOOGLE_CLOUD_BUCKET_NAME = 'minis_cli_binaries';
|
|
26
|
-
const bucket = new storage_1.Storage().bucket(GOOGLE_CLOUD_BUCKET_NAME);
|
|
1
|
+
import fs from 'fs-extra';
|
|
2
|
+
import { compareBuild as semverCompare, valid as isValidSemver } from 'semver';
|
|
3
|
+
import _ from 'lodash';
|
|
4
|
+
import prompts from 'prompts';
|
|
5
|
+
import { PATHS } from '../../config.js';
|
|
6
|
+
import { downloadBinary, getLatestRemoteVersion } from './network.js';
|
|
27
7
|
/**
|
|
28
8
|
* Returns the file extension used for each platform.
|
|
29
9
|
* android: .apk
|
|
30
10
|
* ios: .zip (we intentionally compress .app files before uploading them to the cloud storage)
|
|
31
11
|
*/
|
|
32
|
-
function getBinaryFileExtensionForPlatform(platform) {
|
|
12
|
+
export function getBinaryFileExtensionForPlatform(platform) {
|
|
33
13
|
return platform === 'ios' ? '.zip' : '.apk';
|
|
34
14
|
}
|
|
35
|
-
exports.getBinaryFileExtensionForPlatform = getBinaryFileExtensionForPlatform;
|
|
36
15
|
/**
|
|
37
16
|
* @example
|
|
38
17
|
* platform android
|
|
@@ -43,10 +22,9 @@ exports.getBinaryFileExtensionForPlatform = getBinaryFileExtensionForPlatform;
|
|
|
43
22
|
* version 2.55.0+4
|
|
44
23
|
* returns "2-55-0+4.zip"
|
|
45
24
|
*/
|
|
46
|
-
function versionToBinaryFileName(version, platform) {
|
|
25
|
+
export function versionToBinaryFileName(version, platform) {
|
|
47
26
|
return (version.replace(/\./g, '-') + getBinaryFileExtensionForPlatform(platform));
|
|
48
27
|
}
|
|
49
|
-
exports.versionToBinaryFileName = versionToBinaryFileName;
|
|
50
28
|
/**
|
|
51
29
|
* @example
|
|
52
30
|
* binaryFileName "2-76-0.apk"
|
|
@@ -55,108 +33,52 @@ exports.versionToBinaryFileName = versionToBinaryFileName;
|
|
|
55
33
|
* binaryFileName "2-16-0+3.zip"
|
|
56
34
|
* returns "2.16.0+3"
|
|
57
35
|
*/
|
|
58
|
-
function binaryFileNameToVersion(binaryFileName) {
|
|
36
|
+
export function binaryFileNameToVersion(binaryFileName) {
|
|
59
37
|
return binaryFileName.split('.')[0].replace(/-/g, '.');
|
|
60
38
|
}
|
|
61
|
-
exports.binaryFileNameToVersion = binaryFileNameToVersion;
|
|
62
39
|
/**
|
|
63
40
|
* @example
|
|
64
41
|
* filenames ["2-76-0+3.apk", "2-76-0+3.zip", "2-77-0.apk", "2-77-0.zip", "2-77-0+1.apk", "2-77-0+1.zip"]
|
|
65
42
|
* returns "2.77.0+1"
|
|
66
43
|
*/
|
|
67
|
-
function getLatestVersionFromFilesList(filenames) {
|
|
68
|
-
const localVersions =
|
|
44
|
+
export function getLatestVersionFromFilesList(filenames) {
|
|
45
|
+
const localVersions = _.uniq(filenames
|
|
69
46
|
.map(binaryFileNameToVersion)
|
|
70
|
-
.filter(version => (
|
|
71
|
-
localVersions.sort(
|
|
47
|
+
.filter(version => isValidSemver(version)));
|
|
48
|
+
localVersions.sort(semverCompare);
|
|
72
49
|
const last = localVersions.slice(-1)[0];
|
|
73
50
|
return last ?? null;
|
|
74
51
|
}
|
|
75
|
-
exports.getLatestVersionFromFilesList = getLatestVersionFromFilesList;
|
|
76
52
|
/**
|
|
77
53
|
* Returns a boolean indicating if the binary for the given version and platform is already downloaded in the system
|
|
78
54
|
*/
|
|
79
|
-
async function isVersionAvailableLocally(platform, version) {
|
|
80
|
-
const localBinariesList = await
|
|
55
|
+
export async function isVersionAvailableLocally(platform, version) {
|
|
56
|
+
const localBinariesList = await fs.readdir(PATHS.CACHE_DIR);
|
|
81
57
|
const fileName = versionToBinaryFileName(version, platform);
|
|
82
58
|
return localBinariesList.includes(fileName);
|
|
83
59
|
}
|
|
84
|
-
exports.isVersionAvailableLocally = isVersionAvailableLocally;
|
|
85
60
|
/**
|
|
86
61
|
* Gets the biggest version in the downloads folder for the given platform.
|
|
87
62
|
*/
|
|
88
|
-
async function getLatestDownloadedVersion(platform) {
|
|
89
|
-
const localBinariesList = await
|
|
63
|
+
export async function getLatestDownloadedVersion(platform) {
|
|
64
|
+
const localBinariesList = await fs.readdir(PATHS.CACHE_DIR);
|
|
90
65
|
const localBinariesForPlatform = localBinariesList.filter(name => name.endsWith(getBinaryFileExtensionForPlatform(platform)));
|
|
91
66
|
return getLatestVersionFromFilesList(localBinariesForPlatform);
|
|
92
67
|
}
|
|
93
|
-
exports.getLatestDownloadedVersion = getLatestDownloadedVersion;
|
|
94
|
-
/**
|
|
95
|
-
* Returns the latest version that's present in the remote storage of binaries
|
|
96
|
-
* TODO: this won't handle a bucket that has more than 50 files.
|
|
97
|
-
*/
|
|
98
|
-
async function getLatestRemoteVersion(platform) {
|
|
99
|
-
const filesResponse = await bucket.getFiles();
|
|
100
|
-
const filesMetadata = filesResponse[0];
|
|
101
|
-
const fileNames = filesMetadata
|
|
102
|
-
.map(file => file.name)
|
|
103
|
-
.filter(name => name.endsWith(getBinaryFileExtensionForPlatform(platform)));
|
|
104
|
-
return getLatestVersionFromFilesList(fileNames);
|
|
105
|
-
}
|
|
106
|
-
exports.getLatestRemoteVersion = getLatestRemoteVersion;
|
|
107
|
-
/**
|
|
108
|
-
* Downloads a binary from the remote storage
|
|
109
|
-
* @returns Promise that resolves to the downloaded version
|
|
110
|
-
*/
|
|
111
|
-
async function downloadBinary(platform, { onProgress, version, } = {}) {
|
|
112
|
-
const versionToDownload = version || (await getLatestRemoteVersion(platform));
|
|
113
|
-
const isVersionAlreadyDownloaded = await isVersionAvailableLocally(platform, versionToDownload);
|
|
114
|
-
if (isVersionAlreadyDownloaded) {
|
|
115
|
-
onProgress?.(100);
|
|
116
|
-
return versionToDownload;
|
|
117
|
-
}
|
|
118
|
-
const fileName = versionToBinaryFileName(versionToDownload, platform);
|
|
119
|
-
const bucketResponse = await bucket.getFiles({
|
|
120
|
-
prefix: fileName,
|
|
121
|
-
});
|
|
122
|
-
const remoteFile = bucketResponse[0][0];
|
|
123
|
-
const fileSize = parseInt(remoteFile.metadata.size, 10);
|
|
124
|
-
return new Promise((resolve, reject) => {
|
|
125
|
-
const writeStream = fs_extra_1.default.createWriteStream(`${exports.BINARIES_PATH}/${fileName}`);
|
|
126
|
-
const progressInterval = setInterval(() => {
|
|
127
|
-
const progress = Math.round((writeStream.bytesWritten / fileSize) * 100);
|
|
128
|
-
onProgress?.(progress);
|
|
129
|
-
}, 200);
|
|
130
|
-
http_1.default.get(`${CDN_ADDRESS}${fileName}`, cdnResponse => {
|
|
131
|
-
cdnResponse.pipe(writeStream);
|
|
132
|
-
writeStream.on('finish', () => {
|
|
133
|
-
writeStream.close();
|
|
134
|
-
onProgress?.(100);
|
|
135
|
-
resolve(versionToDownload);
|
|
136
|
-
clearInterval(progressInterval);
|
|
137
|
-
});
|
|
138
|
-
writeStream.on('error', err => {
|
|
139
|
-
reject(err);
|
|
140
|
-
clearInterval(progressInterval);
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
exports.downloadBinary = downloadBinary;
|
|
146
68
|
/**
|
|
147
69
|
* Compares the current version against the latest available version.
|
|
148
70
|
*
|
|
149
71
|
* Does nothing if the current version is already the latest.
|
|
150
72
|
* Otherwise prompts the user to download the new version.
|
|
151
73
|
*/
|
|
152
|
-
async function maybePromptBinaryUpgrade(platform, { currentVersion, onProgress, onDownloadStart, } = {}) {
|
|
74
|
+
export async function maybePromptBinaryUpgrade(platform, { currentVersion, onProgress, onDownloadStart, } = {}) {
|
|
153
75
|
const _currentVersion = currentVersion || (await getLatestDownloadedVersion(platform));
|
|
154
76
|
const latestVersion = await getLatestRemoteVersion(platform);
|
|
155
77
|
if (latestVersion === _currentVersion) {
|
|
156
78
|
// returns early if user is already on latest version
|
|
157
79
|
return null;
|
|
158
80
|
}
|
|
159
|
-
const { shouldUpdate } = await (
|
|
81
|
+
const { shouldUpdate } = await prompts({
|
|
160
82
|
type: 'confirm',
|
|
161
83
|
initial: true,
|
|
162
84
|
name: 'shouldUpdate',
|
|
@@ -169,5 +91,4 @@ async function maybePromptBinaryUpgrade(platform, { currentVersion, onProgress,
|
|
|
169
91
|
}
|
|
170
92
|
return null;
|
|
171
93
|
}
|
|
172
|
-
exports.maybePromptBinaryUpgrade = maybePromptBinaryUpgrade;
|
|
173
94
|
//# sourceMappingURL=binaries.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binaries.js","sourceRoot":"","sources":["../../../../src/commands/dev/utils/binaries.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"binaries.js","sourceRoot":"","sources":["../../../../src/commands/dev/utils/binaries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,UAAU,CAAA;AACzB,OAAO,EAAC,YAAY,IAAI,aAAa,EAAE,KAAK,IAA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OAAO,EAAE,aAAa,EAAE,UAAU,EAAC,CAAC,CAAA;QACpE,OAAO,aAAa,CAAA;KACrB;IAED,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { DevCommandOptions } from '
|
|
1
|
+
import type { DevCommandOptions } from '../index.js';
|
|
2
2
|
export declare function getBundleUrl({ host }: DevCommandOptions): Promise<string>;
|
|
3
3
|
export declare function getDeeplink(miniHandle: string, options: DevCommandOptions, universalLink?: boolean): Promise<string>;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getDeeplink = exports.getBundleUrl = void 0;
|
|
4
|
-
async function getBundleUrl({ host }) {
|
|
1
|
+
export async function getBundleUrl({ host }) {
|
|
5
2
|
return `http://${host}:8082/index.bundle`;
|
|
6
3
|
}
|
|
7
|
-
exports.getBundleUrl = getBundleUrl;
|
|
8
4
|
async function getDeeplinkParams(miniHandle, options) {
|
|
9
5
|
const bundleUrl = await getBundleUrl(options);
|
|
10
6
|
const params = {
|
|
@@ -17,7 +13,7 @@ async function getDeeplinkParams(miniHandle, options) {
|
|
|
17
13
|
const stringifiedParams = JSON.stringify(params);
|
|
18
14
|
return Buffer.from(stringifiedParams).toString('base64');
|
|
19
15
|
}
|
|
20
|
-
async function getDeeplink(miniHandle, options, universalLink = false) {
|
|
16
|
+
export async function getDeeplink(miniHandle, options, universalLink = false) {
|
|
21
17
|
const deeplinkParams = await getDeeplinkParams(miniHandle, options);
|
|
22
18
|
if (universalLink) {
|
|
23
19
|
return `https://shop.app/mini/remote/${deeplinkParams}`;
|
|
@@ -26,5 +22,4 @@ async function getDeeplink(miniHandle, options, universalLink = false) {
|
|
|
26
22
|
return `arrive://mini/remote/${deeplinkParams}`;
|
|
27
23
|
}
|
|
28
24
|
}
|
|
29
|
-
exports.getDeeplink = getDeeplink;
|
|
30
25
|
//# sourceMappingURL=deeplink.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deeplink.js","sourceRoot":"","sources":["../../../../src/commands/dev/utils/deeplink.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deeplink.js","sourceRoot":"","sources":["../../../../src/commands/dev/utils/deeplink.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,EAAC,IAAI,EAAoB;IAC1D,OAAO,UAAU,IAAI,oBAAoB,CAAA;AAC3C,CAAC;AAED,KAAK,UAAU,iBAAiB,CAC9B,UAAkB,EAClB,OAA0B;IAE1B,MAAM,SAAS,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,CAAA;IAE7C,MAAM,MAAM,GAAG;QACb,MAAM,EAAE,UAAU;QAClB,SAAS,EAAE,kBAAkB,CAAC,SAAS,CAAC;QACxC,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,qCAAqC;QAC5D,QAAQ,EAAE,EAAE;QACZ,iBAAiB,EAAE,IAAI;KACxB,CAAA;IAED,MAAM,iBAAiB,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;IAEhD,OAAO,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;AAC1D,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,UAAkB,EAClB,OAA0B,EAC1B,aAAa,GAAG,KAAK;IAErB,MAAM,cAAc,GAAG,MAAM,iBAAiB,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;IAEnE,IAAI,aAAa,EAAE;QACjB,OAAO,gCAAgC,cAAc,EAAE,CAAA;KACxD;SAAM;QACL,OAAO,wBAAwB,cAAc,EAAE,CAAA;KAChD;AACH,CAAC"}
|