@capgo/cli 0.13.13 → 0.15.0
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/.cz.toml +1 -1
- package/.vscode/settings.json +2 -1
- package/CHANGELOG.md +18 -0
- package/dist/index.js +1 -1
- package/package.json +3 -1
- package/src/bin/add.ts +29 -1
- package/src/bin/delete.ts +13 -2
- package/src/bin/login.ts +18 -0
- package/src/bin/set.ts +13 -1
- package/src/bin/types_supabase.ts +960 -60
- package/src/bin/upload.ts +17 -1
- package/src/bin/utils.ts +11 -1
package/src/bin/upload.ts
CHANGED
|
@@ -3,9 +3,10 @@ import { program } from 'commander';
|
|
|
3
3
|
import { randomUUID } from 'crypto';
|
|
4
4
|
import cliProgress from 'cli-progress';
|
|
5
5
|
import semver from 'semver'
|
|
6
|
+
import { checksum as getChecksum } from '@tomasklaen/checksum';
|
|
6
7
|
import {
|
|
7
8
|
host, hostWeb, getConfig, createSupabaseClient,
|
|
8
|
-
updateOrCreateChannel, updateOrCreateVersion, formatError, findSavedKey, checkPlan, checkKey
|
|
9
|
+
updateOrCreateChannel, updateOrCreateVersion, formatError, findSavedKey, checkPlan, checkKey, useLogSnag
|
|
9
10
|
} from './utils';
|
|
10
11
|
|
|
11
12
|
interface Options {
|
|
@@ -23,6 +24,8 @@ export const uploadVersion = async (appid: string, options: Options) => {
|
|
|
23
24
|
let { version, path, channel } = options;
|
|
24
25
|
const { external } = options;
|
|
25
26
|
const apikey = options.apikey || findSavedKey()
|
|
27
|
+
const snag = useLogSnag()
|
|
28
|
+
|
|
26
29
|
channel = channel || 'dev';
|
|
27
30
|
const config = await getConfig();
|
|
28
31
|
appid = appid || config?.app?.appId
|
|
@@ -97,10 +100,12 @@ export const uploadVersion = async (appid: string, options: Options) => {
|
|
|
97
100
|
}
|
|
98
101
|
b1.increment();
|
|
99
102
|
const fileName = randomUUID()
|
|
103
|
+
let checksum = ''
|
|
100
104
|
if (!external) {
|
|
101
105
|
const zip = new AdmZip();
|
|
102
106
|
zip.addLocalFolder(path);
|
|
103
107
|
const zipped = zip.toBuffer();
|
|
108
|
+
checksum = await getChecksum(zipped, 'crc32');
|
|
104
109
|
const mbSize = Math.floor(zipped.byteLength / 1024 / 1024);
|
|
105
110
|
const filePath = `apps/${userId}/${appid}/versions`
|
|
106
111
|
b1.increment();
|
|
@@ -132,6 +137,7 @@ export const uploadVersion = async (appid: string, options: Options) => {
|
|
|
132
137
|
name: version,
|
|
133
138
|
app_id: appid,
|
|
134
139
|
external_url: external,
|
|
140
|
+
checksum,
|
|
135
141
|
}, apikey)
|
|
136
142
|
if (dbError) {
|
|
137
143
|
multibar.stop()
|
|
@@ -158,4 +164,14 @@ export const uploadVersion = async (appid: string, options: Options) => {
|
|
|
158
164
|
console.log(`Or set the channel ${channel} as public here: ${hostWeb}/app/package/${appidWeb}`)
|
|
159
165
|
console.log("To use with live update in your own app")
|
|
160
166
|
console.log(`You can link specific device to this version to make user try it first, here: ${hostWeb}/app/p/${appidWeb}/devices`)
|
|
167
|
+
snag.publish({
|
|
168
|
+
channel: 'app',
|
|
169
|
+
event: 'App Uploaded',
|
|
170
|
+
icon: '⏫',
|
|
171
|
+
tags: {
|
|
172
|
+
userId,
|
|
173
|
+
appId: appid,
|
|
174
|
+
},
|
|
175
|
+
notify: false,
|
|
176
|
+
})
|
|
161
177
|
}
|
package/src/bin/utils.ts
CHANGED
|
@@ -4,8 +4,10 @@ import { createClient, SupabaseClient } from '@supabase/supabase-js'
|
|
|
4
4
|
import prettyjson from 'prettyjson';
|
|
5
5
|
import fs from 'fs'
|
|
6
6
|
import os from 'os'
|
|
7
|
+
import { LogSnag } from 'logsnag'
|
|
7
8
|
import { definitions } from './types_supabase';
|
|
8
9
|
|
|
10
|
+
|
|
9
11
|
export const host = 'https://capgo.app';
|
|
10
12
|
export const hostWeb = 'https://web.capgo.app';
|
|
11
13
|
export const hostSupa = process.env.SUPA_DB === 'production'
|
|
@@ -148,4 +150,12 @@ export const updateOrCreateChannel = async (supabase: SupabaseClient, update: Pa
|
|
|
148
150
|
return supabase
|
|
149
151
|
.from<definitions['channels']>('channels')
|
|
150
152
|
.insert(update, { returning: "minimal" })
|
|
151
|
-
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export const useLogSnag = (): LogSnag => {
|
|
156
|
+
const logsnag = new LogSnag({
|
|
157
|
+
token: 'c124f5e9d0ce5bdd14bbb48f815d5583',
|
|
158
|
+
project: 'capgo',
|
|
159
|
+
})
|
|
160
|
+
return logsnag
|
|
161
|
+
}
|