@capgo/cli 3.14.4 → 3.14.6
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/CHANGELOG.md +9 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/bundle/upload.ts +18 -3
- package/src/channel/set.ts +0 -4
- package/src/index.ts +10 -2
- package/src/types/supabase.types.ts +414 -186
- package/src/utils.ts +20 -0
package/src/bundle/upload.ts
CHANGED
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
updateOrCreateChannel, updateOrCreateVersion,
|
|
17
17
|
formatError, findSavedKey, checkPlanValid,
|
|
18
18
|
useLogSnag, verifyUser, regexSemver, baseKeyPub, convertAppName, defaulPublicKey
|
|
19
|
-
} from '../utils';
|
|
19
|
+
, requireUpdateMetadata } from '../utils';
|
|
20
20
|
import { checkIndexPosition, searchInDirectory } from './check';
|
|
21
21
|
|
|
22
22
|
const alertMb = 20;
|
|
@@ -31,7 +31,8 @@ interface Options extends OptionsBase {
|
|
|
31
31
|
keyData?: string,
|
|
32
32
|
ivSessionKey?: string,
|
|
33
33
|
bundleUrl?: boolean
|
|
34
|
-
codeCheck?: boolean
|
|
34
|
+
codeCheck?: boolean,
|
|
35
|
+
minUpdateVersion?: string
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
export const uploadBundle = async (appid: string, options: Options, shouldExit = true) => {
|
|
@@ -39,7 +40,7 @@ export const uploadBundle = async (appid: string, options: Options, shouldExit =
|
|
|
39
40
|
p.intro(`Uploading`);
|
|
40
41
|
await checkLatest();
|
|
41
42
|
let { bundle, path, channel } = options;
|
|
42
|
-
const { external, key = false, displayIvSession } = options;
|
|
43
|
+
const { external, key = false, displayIvSession, minUpdateVersion } = options;
|
|
43
44
|
const apikey = options.apikey || findSavedKey()
|
|
44
45
|
const snag = useLogSnag()
|
|
45
46
|
|
|
@@ -95,6 +96,19 @@ export const uploadBundle = async (appid: string, options: Options, shouldExit =
|
|
|
95
96
|
// Check we have app access to this appId
|
|
96
97
|
await checkAppExistsAndHasPermissionErr(supabase, appid);
|
|
97
98
|
|
|
99
|
+
const updateMetadataRequired = await requireUpdateMetadata(supabase, channel)
|
|
100
|
+
if (updateMetadataRequired && !minUpdateVersion) {
|
|
101
|
+
p.log.error(`You need to provide a min-update-version to upload a bundle to this channel`);
|
|
102
|
+
program.error('');
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (minUpdateVersion) {
|
|
106
|
+
if (!regexSemver.test(minUpdateVersion)) {
|
|
107
|
+
p.log.error(`Your minimal version update ${minUpdateVersion}, is not valid it should follow semver convention : https://semver.org/`);
|
|
108
|
+
program.error('');
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
98
112
|
const { data: isTrial, error: isTrialsError } = await supabase
|
|
99
113
|
.rpc('is_trial', { userid: userId })
|
|
100
114
|
.single()
|
|
@@ -208,6 +222,7 @@ It will be also visible in your dashboard\n`);
|
|
|
208
222
|
session_key: sessionKey,
|
|
209
223
|
external_url: external,
|
|
210
224
|
storage_provider: external ? 'external' : 'r2-direct',
|
|
225
|
+
minUpdateVersion,
|
|
211
226
|
checksum,
|
|
212
227
|
}
|
|
213
228
|
const { error: dbError } = await updateOrCreateVersion(supabase, versionData, apikey)
|
package/src/channel/set.ts
CHANGED
|
@@ -99,10 +99,6 @@ export const setChannel = async (channel: string, appId: string, options: Option
|
|
|
99
99
|
p.log.info(`Set ${appId} channel: ${channel} to ${downgrade ? 'allow' : 'disallow'} downgrade`);
|
|
100
100
|
channelPayload.disableAutoUpdateUnderNative = !downgrade
|
|
101
101
|
}
|
|
102
|
-
if (upgrade != null) {
|
|
103
|
-
p.log.info(`Set ${appId} channel: ${channel} to ${upgrade ? 'allow' : 'disallow'} upgrade`);
|
|
104
|
-
channelPayload.disableAutoUpdateToMajor = !upgrade
|
|
105
|
-
}
|
|
106
102
|
if (ios != null) {
|
|
107
103
|
p.log.info(`Set ${appId} channel: ${channel} to ${ios ? 'allow' : 'disallow'} ios update`);
|
|
108
104
|
channelPayload.ios = !!ios
|
package/src/index.ts
CHANGED
|
@@ -118,7 +118,11 @@ bundle
|
|
|
118
118
|
.option('--no-key', 'ignore signing key and send clear update')
|
|
119
119
|
.option('--no-code-check', 'Ignore checking if notifyAppReady() is called in soure code and index present in root folder')
|
|
120
120
|
.option('--display-iv-session', 'Show in the console the iv and session key used to encrypt the update')
|
|
121
|
-
.option('-b, --bundle <bundle>', 'bundle version number of the bundle to upload')
|
|
121
|
+
.option('-b, --bundle <bundle>', 'bundle version number of the bundle to upload')
|
|
122
|
+
.option(
|
|
123
|
+
'--min-update-version <minUpdateVersion>',
|
|
124
|
+
'Minimal version required to update to this version. Used only if the disable auto update is set to metadata in channel'
|
|
125
|
+
)
|
|
122
126
|
|
|
123
127
|
bundle
|
|
124
128
|
.command('delete [bundleId] [appId]')
|
|
@@ -252,6 +256,10 @@ program
|
|
|
252
256
|
.option('--bundle-url', 'prints bundle url into stdout')
|
|
253
257
|
.option('--no-key', 'ignore signing key and send clear update')
|
|
254
258
|
.option('--display-iv-session', 'Show in the console the iv and session key used to encrypt the update')
|
|
255
|
-
.option('-b, --bundle <bundle>', 'bundle version number of the file to upload')
|
|
259
|
+
.option('-b, --bundle <bundle>', 'bundle version number of the file to upload')
|
|
260
|
+
.option(
|
|
261
|
+
'--min-update-version <minUpdateVersion>',
|
|
262
|
+
'Minimal version required to update to this version. Used only if the disable auto update is set to metadata in channel'
|
|
263
|
+
);
|
|
256
264
|
|
|
257
265
|
program.parseAsync();
|