@shopify/shop-minis-cli 0.0.43 → 0.0.45
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/config.d.ts +4 -0
- package/build/commands/config.js +19 -0
- package/build/commands/config.js.map +1 -1
- 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/types/autogenerated/shop-minis-admin-api/graphql.d.ts +266 -30
- package/build/commands/types/autogenerated/shop-minis-admin-api/graphql.js +68 -10
- package/build/commands/types/autogenerated/shop-minis-admin-api/graphql.js.map +1 -1
- 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 +5 -36
- package/templates/__template_common/src/manifest.json +1 -27
- package/templates/__template_common/.eslintrc.json +0 -15
- package/templates/__template_common/patches/react-native+0.68.5.patch +0 -173
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export declare const getPackageManager: () => Promise<"yarn" | "npm" | "pnpm">;
|
|
2
|
+
export 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;
|
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'),
|
|
@@ -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,cA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C,kBAAkB,CAAA;AAEtE,kDAAkD;AAClD,IAAI;IACF,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;CAC9B;AAAC,MAAM;IACN,uCAAuC;CACxC"}
|
|
@@ -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,OAAO,EAAC,SAAS,EAAC,MAAM,yCAAyC,CAAA;AACjE,OAAO,EAAC,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAC,MAAM,iBAAiB,CAAA;AAE9D,OAAO,EAAC,WAAW,EAAC,MAAM,mBAAmB,CAAA;AAU7C,MAAM,CAAC,KAAK,UAAU,UAAU;IAC9B,MAAM,EAAC,MAAM,EAAE,WAAW,EAAC,GAAG,MAAM,SAAS,CAAC,GAAG,QAAQ,EAAE,aAAa,CAAC,CAAA;IAEzE,OAAO,WAAW;SACf,KAAK,CAAC,CAAC,CAAC;SACR,MAAM,CAAC,IAAI,CAA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Q;QACf,QAAQ,EAAE,IAAI;KACf,CACF,CAAA;IACD,eAAe,CAAC,KAAK,EAAE,CAAA;IAEvB,OAAO,IAAI,OAAO,CAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACpD,WAAW,CAAC,GAAG,EAAE,CAAC,wBAAwB,CAAC,YAAY,CAAC,CAAC;aACtD,IAAI,CAAC,OAAO,CAAC;aACb,KAAK,CAAC,MAAM,CAAC;aACb,OAAO,CAAC,GAAG,EAAE;YACZ,eAAe,CAAC,kBAAkB,EAAE,CAAA;QACtC,CAAC,CAAC;aACD,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;QAElB,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,EAAC,OAAO,EAAC,EAAE,EAAE;YACxC,MAAM,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAA;YAC1B,eAAe,CAAC,kBAAkB,EAAE,CAAA;QACtC,CAAC,CAAC,CAAA;QAEF,eAAe,CAAC,EAAE,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,62 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
/**
|
|
3
|
-
* Returns the file extension used for each platform.
|
|
4
|
-
* android: .apk
|
|
5
|
-
* ios: .zip (we intentionally compress .app files before uploading them to the cloud storage)
|
|
6
|
-
*/
|
|
7
|
-
export declare function getBinaryFileExtensionForPlatform(platform: Platform): ".zip" | ".apk";
|
|
8
|
-
/**
|
|
9
|
-
* @example
|
|
10
|
-
* platform android
|
|
11
|
-
* version 2.76.0
|
|
12
|
-
* returns "2-76-0.apk"
|
|
13
|
-
*
|
|
14
|
-
* platform ios
|
|
15
|
-
* version 2.55.0+4
|
|
16
|
-
* returns "2-55-0+4.zip"
|
|
17
|
-
*/
|
|
18
|
-
export declare function versionToBinaryFileName(version: string, platform: Platform): string;
|
|
19
|
-
/**
|
|
20
|
-
* @example
|
|
21
|
-
* binaryFileName "2-76-0.apk"
|
|
22
|
-
* returns "2.76.0"
|
|
23
|
-
*
|
|
24
|
-
* binaryFileName "2-16-0+3.zip"
|
|
25
|
-
* returns "2.16.0+3"
|
|
26
|
-
*/
|
|
27
|
-
export declare function binaryFileNameToVersion(binaryFileName: string): string;
|
|
28
|
-
/**
|
|
29
|
-
* @example
|
|
30
|
-
* 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"]
|
|
31
|
-
* returns "2.77.0+1"
|
|
32
|
-
*/
|
|
33
|
-
export declare function getLatestVersionFromFilesList(filenames: string[]): string | null;
|
|
1
|
+
import { BinaryMetadata } from './types.js';
|
|
34
2
|
/**
|
|
35
3
|
* Returns a boolean indicating if the binary for the given version and platform is already downloaded in the system
|
|
36
4
|
*/
|
|
37
|
-
export declare function isVersionAvailableLocally(
|
|
38
|
-
/**
|
|
39
|
-
* Gets the biggest version in the downloads folder for the given platform.
|
|
40
|
-
*/
|
|
41
|
-
export declare function getLatestDownloadedVersion(platform: Platform): Promise<string | null>;
|
|
42
|
-
/**
|
|
43
|
-
* Compares the current version against the latest available version.
|
|
44
|
-
*
|
|
45
|
-
* Does nothing if the current version is already the latest.
|
|
46
|
-
* Otherwise prompts the user to download the new version.
|
|
47
|
-
*/
|
|
48
|
-
export declare function maybePromptBinaryUpgrade(platform: Platform, { currentVersion, onProgress, onDownloadStart, }?: {
|
|
49
|
-
/**
|
|
50
|
-
* The version that's currently being used.
|
|
51
|
-
* Defaults to the bigger version in the downloads folder.
|
|
52
|
-
*/
|
|
53
|
-
currentVersion?: string;
|
|
54
|
-
/**
|
|
55
|
-
* Download progress callback
|
|
56
|
-
*/
|
|
57
|
-
onProgress?: (progress: number) => void;
|
|
58
|
-
/**
|
|
59
|
-
* Callback executed if the user agrees to update, before starting the download.
|
|
60
|
-
*/
|
|
61
|
-
onDownloadStart?: (version: string) => void;
|
|
62
|
-
}): Promise<string | null>;
|
|
5
|
+
export declare function isVersionAvailableLocally(version: BinaryMetadata): Promise<boolean>;
|
|
@@ -1,94 +1,17 @@
|
|
|
1
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
2
|
import { PATHS } from '../../config.js';
|
|
6
|
-
import {
|
|
7
|
-
/**
|
|
8
|
-
* Returns the file extension used for each platform.
|
|
9
|
-
* android: .apk
|
|
10
|
-
* ios: .zip (we intentionally compress .app files before uploading them to the cloud storage)
|
|
11
|
-
*/
|
|
12
|
-
export function getBinaryFileExtensionForPlatform(platform) {
|
|
13
|
-
return platform === 'ios' ? '.zip' : '.apk';
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* @example
|
|
17
|
-
* platform android
|
|
18
|
-
* version 2.76.0
|
|
19
|
-
* returns "2-76-0.apk"
|
|
20
|
-
*
|
|
21
|
-
* platform ios
|
|
22
|
-
* version 2.55.0+4
|
|
23
|
-
* returns "2-55-0+4.zip"
|
|
24
|
-
*/
|
|
25
|
-
export function versionToBinaryFileName(version, platform) {
|
|
26
|
-
return (version.replace(/\./g, '-') + getBinaryFileExtensionForPlatform(platform));
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* @example
|
|
30
|
-
* binaryFileName "2-76-0.apk"
|
|
31
|
-
* returns "2.76.0"
|
|
32
|
-
*
|
|
33
|
-
* binaryFileName "2-16-0+3.zip"
|
|
34
|
-
* returns "2.16.0+3"
|
|
35
|
-
*/
|
|
36
|
-
export function binaryFileNameToVersion(binaryFileName) {
|
|
37
|
-
return binaryFileName.split('.')[0].replace(/-/g, '.');
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* @example
|
|
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"]
|
|
42
|
-
* returns "2.77.0+1"
|
|
43
|
-
*/
|
|
44
|
-
export function getLatestVersionFromFilesList(filenames) {
|
|
45
|
-
const localVersions = _.uniq(filenames
|
|
46
|
-
.map(binaryFileNameToVersion)
|
|
47
|
-
.filter(version => isValidSemver(version)));
|
|
48
|
-
localVersions.sort(semverCompare);
|
|
49
|
-
const last = localVersions.slice(-1)[0];
|
|
50
|
-
return last ?? null;
|
|
51
|
-
}
|
|
3
|
+
import { metadataToBinaryFileName } from './version.js';
|
|
52
4
|
/**
|
|
53
5
|
* Returns a boolean indicating if the binary for the given version and platform is already downloaded in the system
|
|
54
6
|
*/
|
|
55
|
-
export async function isVersionAvailableLocally(
|
|
7
|
+
export async function isVersionAvailableLocally(version) {
|
|
56
8
|
const localBinariesList = await fs.readdir(PATHS.CACHE_DIR);
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Gets the biggest version in the downloads folder for the given platform.
|
|
62
|
-
*/
|
|
63
|
-
export async function getLatestDownloadedVersion(platform) {
|
|
64
|
-
const localBinariesList = await fs.readdir(PATHS.CACHE_DIR);
|
|
65
|
-
const localBinariesForPlatform = localBinariesList.filter(name => name.endsWith(getBinaryFileExtensionForPlatform(platform)));
|
|
66
|
-
return getLatestVersionFromFilesList(localBinariesForPlatform);
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Compares the current version against the latest available version.
|
|
70
|
-
*
|
|
71
|
-
* Does nothing if the current version is already the latest.
|
|
72
|
-
* Otherwise prompts the user to download the new version.
|
|
73
|
-
*/
|
|
74
|
-
export async function maybePromptBinaryUpgrade(platform, { currentVersion, onProgress, onDownloadStart, } = {}) {
|
|
75
|
-
const _currentVersion = currentVersion || (await getLatestDownloadedVersion(platform));
|
|
76
|
-
const latestVersion = await getLatestRemoteVersion(platform);
|
|
77
|
-
if (latestVersion === _currentVersion) {
|
|
78
|
-
// returns early if user is already on latest version
|
|
79
|
-
return null;
|
|
9
|
+
try {
|
|
10
|
+
const fileName = metadataToBinaryFileName(version);
|
|
11
|
+
return localBinariesList.includes(fileName);
|
|
80
12
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
initial: true,
|
|
84
|
-
name: 'shouldUpdate',
|
|
85
|
-
message: "There's a new version of Shop available. Do you want to upgrade?",
|
|
86
|
-
});
|
|
87
|
-
if (shouldUpdate) {
|
|
88
|
-
onDownloadStart?.(latestVersion);
|
|
89
|
-
await downloadBinary(platform, { version: latestVersion, onProgress });
|
|
90
|
-
return latestVersion;
|
|
13
|
+
catch {
|
|
14
|
+
return false;
|
|
91
15
|
}
|
|
92
|
-
return null;
|
|
93
16
|
}
|
|
94
17
|
//# sourceMappingURL=binaries.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binaries.js","sourceRoot":"","sources":["../../../../src/commands/dev/utils/binaries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"binaries.js","sourceRoot":"","sources":["../../../../src/commands/dev/utils/binaries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,UAAU,CAAA;AAEzB,OAAO,EAAC,KAAK,EAAC,MAAM,iBAAiB,CAAA;AAGrC,OAAO,EAAC,wBAAwB,EAAC,MAAM,cAAc,CAAA;AAErD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAAC,OAAuB;IACrE,MAAM,iBAAiB,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;IAC3D,IAAI;QACF,MAAM,QAAQ,GAAG,wBAAwB,CAAC,OAAO,CAAC,CAAA;QAElD,OAAO,iBAAiB,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;KAC5C;IAAC,MAAM;QACN,OAAO,KAAK,CAAA;KACb;AACH,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BuildType } from './types.js';
|
|
2
|
+
export function getBuildTypeForBinaryBuildType(type) {
|
|
3
|
+
switch (type) {
|
|
4
|
+
case 'release':
|
|
5
|
+
return BuildType.Release;
|
|
6
|
+
case 'nightly':
|
|
7
|
+
return BuildType.Nightly;
|
|
8
|
+
case 'snapshot':
|
|
9
|
+
return BuildType.Snapshot;
|
|
10
|
+
default:
|
|
11
|
+
throw new Error(`Invalid build type: ${type}`);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=build-type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-type.js","sourceRoot":"","sources":["../../../../src/commands/dev/utils/build-type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAA;AAEpC,MAAM,UAAU,8BAA8B,CAAC,IAAY;IACzD,QAAQ,IAAI,EAAE;QACZ,KAAK,SAAS;YACZ,OAAO,SAAS,CAAC,OAAO,CAAA;QAC1B,KAAK,SAAS;YACZ,OAAO,SAAS,CAAC,OAAO,CAAA;QAC1B,KAAK,UAAU;YACb,OAAO,SAAS,CAAC,QAAQ,CAAA;QAC3B;YACE,MAAM,IAAI,KAAK,CAAC,uBAAuB,IAAI,EAAE,CAAC,CAAA;KACjD;AACH,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { DevCommandOptions } from '../index.js';
|
|
2
|
-
export declare function getBundleUrl({ host }: DevCommandOptions):
|
|
3
|
-
export declare function getDeeplink(miniHandle: string, options: DevCommandOptions, universalLink?: boolean):
|
|
2
|
+
export declare function getBundleUrl({ host }: DevCommandOptions): string;
|
|
3
|
+
export declare function getDeeplink(miniHandle: string, options: DevCommandOptions, universalLink?: boolean): string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';
|
|
2
|
-
export
|
|
2
|
+
export function getBundleUrl({ host }) {
|
|
3
3
|
return `http://${host}:8082/index.bundle`;
|
|
4
4
|
}
|
|
5
|
-
|
|
6
|
-
const bundleUrl =
|
|
5
|
+
function getDeeplinkParams(miniHandle, options) {
|
|
6
|
+
const bundleUrl = getBundleUrl(options);
|
|
7
7
|
const params = {
|
|
8
8
|
handle: miniHandle,
|
|
9
9
|
bundleUrl: encodeURIComponent(bundleUrl),
|
|
@@ -45,8 +45,8 @@ function getDevelopmentEntryPointParams() {
|
|
|
45
45
|
return '';
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
export
|
|
49
|
-
const deeplinkParams =
|
|
48
|
+
export function getDeeplink(miniHandle, options, universalLink = false) {
|
|
49
|
+
const deeplinkParams = getDeeplinkParams(miniHandle, options);
|
|
50
50
|
const developmentParams = getDevelopmentEntryPointParams();
|
|
51
51
|
if (universalLink) {
|
|
52
52
|
return `https://shop.app/mini/remote/${deeplinkParams}${developmentParams}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deeplink.js","sourceRoot":"","sources":["../../../../src/commands/dev/utils/deeplink.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAA;AAIzC,MAAM,
|
|
1
|
+
{"version":3,"file":"deeplink.js","sourceRoot":"","sources":["../../../../src/commands/dev/utils/deeplink.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAA;AAIzC,MAAM,UAAU,YAAY,CAAC,EAAC,IAAI,EAAoB;IACpD,OAAO,UAAU,IAAI,oBAAoB,CAAA;AAC3C,CAAC;AAED,SAAS,iBAAiB,CAAC,UAAkB,EAAE,OAA0B;IACvE,MAAM,SAAS,GAAG,YAAY,CAAC,OAAO,CAAC,CAAA;IAEvC,MAAM,MAAM,GAAG;QACb,MAAM,EAAE,UAAU;QAClB,SAAS,EAAE,kBAAkB,CAAC,SA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CAAC,GAAG,CACT,gEAAgE,CACjE,CAAA;YACD,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;YAChB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;SAClB;QACD,sFAAsF;QACtF,OAAO,EAAE,CAAA;KACV;AACH,CAAC;AAED,MAAM,UAAU,WAAW,CACzB,UAAkB,EAClB,OAA0B,EAC1B,aAAa,GAAG,KAAK;IAErB,MAAM,cAAc,GAAG,iBAAiB,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;IAC7D,MAAM,iBAAiB,GAAG,8BAA8B,EAAE,CAAA;IAE1D,IAAI,aAAa,EAAE;QACjB,OAAO,gCAAgC,cAAc,GAAG,iBAAiB,EAAE,CAAA;KAC5E;SAAM;QACL,OAAO,wBAAwB,cAAc,GAAG,iBAAiB,EAAE,CAAA;KACpE;AACH,CAAC"}
|
|
@@ -18,6 +18,8 @@ export declare class InteractiveTerminal {
|
|
|
18
18
|
loadingEnd(endState?: 'succeed' | 'fail' | 'warn' | 'info', logMessage?: string): void;
|
|
19
19
|
handleKeyPress: (key: string) => Promise<void>;
|
|
20
20
|
showSetupAndroidHomeInstructions(): Promise<void>;
|
|
21
|
-
startAndroidApp(deviceId: string): Promise<void>;
|
|
22
21
|
printDeeplinkQRCode(): Promise<void>;
|
|
22
|
+
private startApp;
|
|
23
|
+
private get deeplink();
|
|
24
|
+
private get loadingHandlers();
|
|
23
25
|
}
|