@capgo/cli 3.14.65 → 3.14.67

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/cli",
3
- "version": "3.14.65",
3
+ "version": "3.14.67",
4
4
  "description": "A CLI to upload to capgo servers",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -14,8 +14,8 @@
14
14
  "url": "https://github.com/Cap-go/capgo-cli/issues"
15
15
  },
16
16
  "engines": {
17
- "npm": ">=7.0.0",
18
- "node": ">=16.0.0"
17
+ "npm": ">=8.0.0",
18
+ "node": ">=20.0.0"
19
19
  },
20
20
  "keywords": [
21
21
  "appflow alternative",
@@ -29,11 +29,11 @@
29
29
  "capgo-cli"
30
30
  ],
31
31
  "scripts": {
32
- "dev": "set NODE_ENV=development && npx webpack --config webpack.config.js",
32
+ "build": "node build.mjs",
33
+ "dev": "NODE_ENV=development node build.mjs",
33
34
  "no-debug": "node dist/index.js",
34
35
  "test": "npx --yes ts-node -T src/index.ts",
35
- "build": "npx --yes webpack --config webpack.config.js",
36
- "dev-build": "SUPA_DB=development npx webpack --config webpack.config.js",
36
+ "dev-build": "SUPA_DB=development node build.mjs",
37
37
  "pack": "pkg",
38
38
  "types": "npx --yes supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",
39
39
  "test_rls": "ts-node ./test/test_headers_rls.ts",
@@ -42,56 +42,53 @@
42
42
  "author": "github.com/riderx",
43
43
  "license": "Apache 2.0",
44
44
  "dependencies": {
45
- "@capacitor/cli": "5.5.1",
46
- "@capgo/find-package-manager": "^0.0.7",
45
+ "@capacitor/cli": "5.7.0",
46
+ "@capgo/find-package-manager": "^0.0.9",
47
47
  "@clack/prompts": "^0.7.0",
48
- "@supabase/supabase-js": "^2.38.5",
48
+ "@supabase/supabase-js": "^2.39.3",
49
49
  "@tomasklaen/checksum": "^1.1.0",
50
50
  "@trufflesuite/spinnies": "^0.1.1",
51
51
  "adm-zip": "^0.5.10",
52
- "axios": "^1.6.2",
53
52
  "ci-info": "^4.0.0",
54
- "commander": "11.1.0",
55
- "console-table-printer": "^2.11.2",
53
+ "commander": "12.0.0",
54
+ "console-table-printer": "^2.12.0",
56
55
  "get-latest-version": "^5.1.0",
56
+ "ky": "^1.2.0",
57
57
  "logsnag": "1.0.0",
58
- "mime": "^3.0.0",
58
+ "mime": "^4.0.1",
59
59
  "node-dir": "^0.1.17",
60
- "open": "^9.1.0",
60
+ "open": "^10.0.3",
61
61
  "prettyjson": "^1.2.5",
62
62
  "prompt-sync": "^4.2.0",
63
63
  "qrcode": "^1.5.3",
64
- "semver": "^7.5.4"
64
+ "semver": "^7.6.0"
65
65
  },
66
66
  "devDependencies": {
67
67
  "@types/adm-zip": "0.5.5",
68
68
  "@types/mime": "^3.0.4",
69
- "@types/node": "^20.9.4",
69
+ "@types/node": "^20.11.17",
70
70
  "@types/node-dir": "^0.0.37",
71
71
  "@types/npmcli__ci-detect": "^2.0.3",
72
72
  "@types/prettyjson": "^0.0.33",
73
73
  "@types/prompt-sync": "^4.2.3",
74
74
  "@types/qrcode": "^1.5.5",
75
75
  "@types/semver": "^7.5.6",
76
- "@typescript-eslint/eslint-plugin": "6.12.0",
77
- "@typescript-eslint/parser": "6.12.0",
78
- "eslint": "8.55.0",
76
+ "@typescript-eslint/eslint-plugin": "6.21.0",
77
+ "@typescript-eslint/parser": "6.21.0",
78
+ "esbuild": "^0.20.0",
79
+ "eslint": "8.56.0",
79
80
  "eslint-config-airbnb-base": "^15.0.0",
80
- "eslint-config-prettier": "^9.0.0",
81
+ "eslint-config-prettier": "^9.1.0",
81
82
  "eslint-import-resolver-typescript": "3.6.1",
82
- "eslint-plugin-import": "2.29.0",
83
- "eslint-plugin-prettier": "^5.0.1",
83
+ "eslint-plugin-import": "2.29.1",
84
+ "eslint-plugin-prettier": "^5.1.3",
84
85
  "git-format-staged": "3.0.0",
85
- "husky": "^8.0.3",
86
- "nodemon": "3.0.2",
86
+ "husky": "^9.0.10",
87
87
  "pkg": "5.8.1",
88
- "prettier": "3.1.1",
88
+ "prettier": "3.2.5",
89
89
  "ts-loader": "^9.5.1",
90
- "ts-node": "^10.9.1",
90
+ "ts-node": "^10.9.2",
91
91
  "tsconfig-paths": "4.2.0",
92
- "typescript": "5.3.3",
93
- "webpack": "5.89.0",
94
- "webpack-cli": "^5.1.4",
95
- "webpack-node-externals": "^3.0.0"
92
+ "typescript": "5.3.3"
96
93
  }
97
94
  }
package/src/api/app.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { SupabaseClient } from '@supabase/supabase-js';
2
2
  import * as p from '@clack/prompts';
3
3
  import { program } from 'commander';
4
- import { Database } from 'types/supabase.types';
4
+ import { Database } from '../types/supabase.types';
5
5
  import { isAllowedApp, isAllowedAppOrg, OptionsBase, OrganizationPerm } from '../utils';
6
6
 
7
7
  export const checkAppExists = async (supabase: SupabaseClient<Database>, appid: string) => {
@@ -2,7 +2,7 @@ import { SupabaseClient } from '@supabase/supabase-js';
2
2
  import { program } from 'commander';
3
3
  import { Table } from 'console-table-printer';
4
4
  import * as p from '@clack/prompts';
5
- import { Database } from 'types/supabase.types';
5
+ import { Database } from '../types/supabase.types';
6
6
  import { formatError, getHumanDate } from '../utils';
7
7
 
8
8
  export const checkVersionNotUsedInChannel = async (supabase: SupabaseClient<Database>,
package/src/api/crypto.ts CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  constants,
5
5
  publicEncrypt, privateDecrypt,
6
6
  randomBytes, createCipheriv, createDecipheriv
7
- } from 'crypto';
7
+ } from 'node:crypto';
8
8
 
9
9
  const algorithm = "aes-128-cbc";
10
10
  const oaepHash = 'sha256';
@@ -1,7 +1,7 @@
1
1
  import { SupabaseClient } from '@supabase/supabase-js';
2
2
  import { program } from 'commander';
3
3
  import * as p from '@clack/prompts';
4
- import { Database } from 'types/supabase.types';
4
+ import { Database } from '../types/supabase.types';
5
5
  import { formatError } from '../utils';
6
6
 
7
7
  export const checkVersionNotUsedInDeviceOverride = async (supabase: SupabaseClient<Database>,
@@ -2,7 +2,7 @@ import { SupabaseClient } from '@supabase/supabase-js';
2
2
  import { program } from 'commander';
3
3
  import { Table } from 'console-table-printer';
4
4
  import * as p from '@clack/prompts';
5
- import { Database } from 'types/supabase.types';
5
+ import { Database } from '../types/supabase.types';
6
6
  // import { definitions } from '../types/types_supabase';
7
7
  import { getHumanDate } from '../utils';
8
8
  import { checkVersionNotUsedInChannel } from './channels';
package/src/app/add.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { randomUUID } from 'crypto';
2
- import { getType } from 'mime';
1
+ import { randomUUID } from 'node:crypto';
2
+ import mime from 'mime';
3
3
  import { program } from 'commander';
4
4
  import * as p from '@clack/prompts';
5
5
  import { existsSync, readFileSync } from 'node:fs';
@@ -56,13 +56,13 @@ export const addApp = async (appId: string, options: Options, throwErr = true) =
56
56
 
57
57
  if (icon && existsSync(icon)) {
58
58
  iconBuff = readFileSync(icon);
59
- const contentType = getType(icon);
59
+ const contentType = mime.getType(icon);
60
60
  iconType = contentType || 'image/png';
61
61
  p.log.warn(`Found app icon ${icon}`);
62
62
  }
63
63
  else if (existsSync(newIconPath)) {
64
64
  iconBuff = readFileSync(newIconPath);
65
- const contentType = getType(newIconPath);
65
+ const contentType = mime.getType(newIconPath);
66
66
  iconType = contentType || 'image/png';
67
67
  p.log.warn(`Found app icon ${newIconPath}`);
68
68
  } else {
package/src/app/debug.ts CHANGED
@@ -2,7 +2,7 @@ import * as p from '@clack/prompts';
2
2
  import { SupabaseClient } from '@supabase/supabase-js';
3
3
  import { program } from 'commander';
4
4
  import LogSnag from 'logsnag';
5
- import { Database } from 'types/supabase.types';
5
+ import { Database } from '../types/supabase.types';
6
6
  import { checkAppExistsAndHasPermissionErr } from '../api/app';
7
7
  import { checkLatest } from '../api/update';
8
8
  import { convertAppName, createSupabaseClient, findSavedKey, getLocalConfig, useLogSnag, verifyUser, getConfig } from '../utils';
@@ -50,7 +50,9 @@ interface QueryStats {
50
50
  export async function getStats(supabase: SupabaseClient<Database>, query: QueryStats)
51
51
  : Promise<Database['public']['Tables']['stats']['Row'] | null> {
52
52
  try {
53
- const res = await supabase.functions.invoke('get_stats', { body: JSON.stringify(query) })
53
+ const pathStats = 'get_stats'
54
+ // const pathStats = 'private/stats' // TODO: switch to new endpoint when new backend released
55
+ const res = await supabase.functions.invoke(pathStats, { body: JSON.stringify(query) })
54
56
  const listData = res.data.data as Database['public']['Tables']['stats']['Row'][]
55
57
  if (listData?.length > 0) {
56
58
  return listData[0]
package/src/app/info.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { readFileSync } from "fs"
2
- import { join } from "path"
3
- import os from 'os';
2
+ import { join } from "node:path"
3
+ import os from 'node:os';
4
4
  import getLatest from "get-latest-version"
5
5
  import Spinnies from '@trufflesuite/spinnies';
6
6
  import pack from '../../package.json'
package/src/app/list.ts CHANGED
@@ -2,7 +2,7 @@ import { program } from 'commander';
2
2
  import { Table } from 'console-table-printer';
3
3
  import { SupabaseClient } from '@supabase/supabase-js';
4
4
  import * as p from '@clack/prompts';
5
- import { Database } from 'types/supabase.types';
5
+ import { Database } from '../types/supabase.types';
6
6
  import { OptionsBase, createSupabaseClient, findSavedKey, getHumanDate, verifyUser } from '../utils';
7
7
  import { checkLatest } from '../api/update';
8
8
 
package/src/app/set.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { randomUUID } from "crypto";
2
- import { getType } from 'mime';
2
+ import mime from 'mime';
3
3
  import { program } from "commander";
4
4
  import * as p from '@clack/prompts';
5
5
  import { existsSync, readFileSync } from "node:fs";
@@ -44,13 +44,13 @@ export const setApp = async (appId: string, options: Options) => {
44
44
 
45
45
  if (icon && existsSync(icon)) {
46
46
  iconBuff = readFileSync(icon);
47
- const contentType = getType(icon);
47
+ const contentType = mime.getType(icon);
48
48
  iconType = contentType || 'image/png';
49
49
  p.log.warn(`Found app icon ${icon}`);
50
50
  }
51
51
  else if (existsSync(newIconPath)) {
52
52
  iconBuff = readFileSync(newIconPath);
53
- const contentType = getType(newIconPath);
53
+ const contentType = mime.getType(newIconPath);
54
54
  iconType = contentType || 'image/png';
55
55
  p.log.warn(`Found app icon ${newIconPath}`);
56
56
  } else {
@@ -1,4 +1,4 @@
1
- import fs from "fs";
1
+ import fs from 'node:fs';
2
2
  import path from "path";
3
3
 
4
4
  const searchInFile = (filePath: string, searchString: string) => {
@@ -3,7 +3,7 @@ import semver from 'semver/preload';
3
3
  import * as p from '@clack/prompts';
4
4
  import promptSync from 'prompt-sync';
5
5
  import { SupabaseClient } from '@supabase/supabase-js';
6
- import { Database } from 'types/supabase.types';
6
+ import { Database } from '../types/supabase.types';
7
7
  import { OptionsBase, createSupabaseClient, findSavedKey, getConfig, getHumanDate, verifyUser } from '../utils';
8
8
  import { deleteSpecificVersion, displayBundles, getActiveAppVersions, getChannelsVersion } from '../api/versions';
9
9
  import { checkAppExistsAndHasPermissionErr } from '../api/app';
@@ -1,4 +1,4 @@
1
- import { existsSync, readFileSync, writeFileSync } from 'fs'
1
+ import { existsSync, readFileSync, writeFileSync } from 'node:fs'
2
2
  import { program } from 'commander'
3
3
  import * as p from '@clack/prompts';
4
4
  import { decryptSource } from '../api/crypto';
@@ -1,6 +1,6 @@
1
1
  import { program } from 'commander';
2
2
  import * as p from '@clack/prompts';
3
- import { getVersionData } from 'api/versions';
3
+ import { getVersionData } from '../api/versions';
4
4
  import { checkVersionNotUsedInDeviceOverride } from '../api/devices_override';
5
5
  import { checkVersionNotUsedInChannel } from '../api/channels';
6
6
  import { checkAppExistsAndHasPermissionErr } from "../api/app";
@@ -1,11 +1,11 @@
1
- import { randomUUID } from 'crypto';
2
- import { existsSync, readFileSync } from 'fs';
1
+ import { randomUUID } from 'node:crypto';
2
+ import { existsSync, readFileSync } from 'node:fs';
3
3
  import AdmZip from 'adm-zip';
4
4
  import { program } from 'commander';
5
5
  import * as p from '@clack/prompts';
6
6
  import { checksum as getChecksum } from '@tomasklaen/checksum';
7
7
  import ciDetect from 'ci-info';
8
- import axios from "axios";
8
+ import ky from 'ky';
9
9
  import { checkLatest } from '../api/update';
10
10
  import { checkAppExistsAndHasPermissionOrgErr } from "../api/app";
11
11
  import { encryptSource } from '../api/crypto';
@@ -320,11 +320,8 @@ It will be also visible in your dashboard\n`);
320
320
  p.log.error(`Cannot get upload url`);
321
321
  program.error('');
322
322
  }
323
-
324
- await axios({
325
- method: "put",
326
- url,
327
- data: zipped,
323
+ await ky.put(url, {
324
+ body: zipped,
328
325
  headers: (!localS3 ? {
329
326
  "Content-Type": "application/octet-stream",
330
327
  "Cache-Control": "public, max-age=456789, immutable",
package/src/bundle/zip.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { randomUUID } from 'crypto';
2
- import { writeFileSync } from 'fs';
1
+ import { randomUUID } from 'node:crypto';
2
+ import { writeFileSync } from 'node:fs';
3
3
  import AdmZip from 'adm-zip';
4
4
  import { program } from 'commander';
5
5
  import * as p from '@clack/prompts';
@@ -1,6 +1,6 @@
1
1
  import { program } from 'commander';
2
2
  import * as p from '@clack/prompts';
3
- import { Database } from 'types/supabase.types';
3
+ import { Database } from '../types/supabase.types';
4
4
  import { checkAppExistsAndHasPermissionErr } from "../api/app";
5
5
  import {
6
6
  OptionsBase,
package/src/index.ts CHANGED
@@ -64,7 +64,6 @@ app
64
64
 
65
65
  app
66
66
  .command('delete [appId]')
67
- .alias('d')
68
67
  .description('Delete an app in Capgo Cloud')
69
68
  .action(deleteApp)
70
69
  .option('-a, --apikey <apikey>', 'apikey to link to your account');
@@ -78,7 +77,6 @@ app
78
77
 
79
78
  app
80
79
  .command('debug [appId]')
81
- .alias('d')
82
80
  .description('Listen for live updates event in Capgo Cloud to debug your app')
83
81
  .option('-a, --apikey <apikey>', 'apikey to link to your account')
84
82
  .option('-d, --device <device>', 'the specific device to debug')
@@ -151,7 +149,6 @@ bundle
151
149
 
152
150
  bundle
153
151
  .command('unlink [appId]')
154
- .alias('u')
155
152
  .description('Unlink a bundle in Capgo Cloud')
156
153
  .action(listBundle)
157
154
  .option('-a, --apikey <apikey>', 'apikey to link to your account')
@@ -169,7 +166,6 @@ bundle
169
166
 
170
167
  bundle
171
168
  .command('decrypt [zipPath] [sessionKey]')
172
- .alias('l')
173
169
  .description('Decrypt a signed zip bundle')
174
170
  .action(decryptZip)
175
171
  .option('--key <key>', 'custom path for private signing key')
package/src/init.ts CHANGED
@@ -1,11 +1,11 @@
1
- import { writeFileSync, readFileSync } from 'fs';
1
+ import { writeFileSync, readFileSync } from 'node:fs';
2
2
  import { execSync, ExecSyncOptions, spawnSync } from 'child_process';
3
3
  import { findPackageManagerType } from '@capgo/find-package-manager'
4
4
  import * as p from '@clack/prompts';
5
5
  import { SupabaseClient } from '@supabase/supabase-js';
6
6
  import LogSnag from 'logsnag';
7
7
  import semver from 'semver'
8
- import { Database } from 'types/supabase.types';
8
+ import { Database } from './types/supabase.types';
9
9
  import { markSnag , waitLog } from './app/debug';
10
10
  import { createKey } from './key';
11
11
  import { addChannel } from './channel/add';
package/src/key.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { existsSync, readFileSync, writeFileSync } from 'fs'
1
+ import { existsSync, readFileSync, writeFileSync } from 'node:fs'
2
2
  import { program } from 'commander'
3
3
  import { writeConfig } from '@capacitor/cli/dist/config';
4
4
  import * as p from '@clack/prompts';
package/src/login.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { existsSync, writeFileSync, appendFileSync } from 'fs'
2
- import { homedir } from 'os'
1
+ import { existsSync, writeFileSync, appendFileSync } from 'node:fs'
2
+ import { homedir } from 'node:os'
3
3
  import { program } from 'commander';
4
4
  import * as p from '@clack/prompts';
5
5
  import { createSupabaseClient, useLogSnag, verifyUser } from './utils';
package/src/utils.ts CHANGED
@@ -1,15 +1,15 @@
1
- import { existsSync, readdirSync, readFileSync } from 'fs';
2
- import { homedir } from 'os';
3
- import { resolve } from 'path';
1
+ import { existsSync, readdirSync, readFileSync } from 'node:fs';
2
+ import { homedir } from 'node:os';
3
+ import { resolve } from 'node:path';
4
4
  import { loadConfig } from '@capacitor/cli/dist/config';
5
5
  import { program } from 'commander';
6
6
  import { createClient, SupabaseClient } from '@supabase/supabase-js';
7
7
  import prettyjson from 'prettyjson';
8
8
  import { LogSnag } from 'logsnag';
9
9
  import * as p from '@clack/prompts';
10
- import { Database } from 'types/supabase.types';
11
- import axios from 'axios';
10
+ import ky from 'ky';
12
11
  import { promiseFiles } from 'node-dir'
12
+ import { Database } from './types/supabase.types';
13
13
 
14
14
  export const baseKey = '.capgo_key';
15
15
  export const baseKeyPub = `${baseKey}.pub`;
@@ -68,9 +68,9 @@ interface CapgoConfig {
68
68
  export const getRemoteConfig = async () => {
69
69
  // call host + /api/get_config and parse the result as json using axios
70
70
  const localConfig = await getLocalConfig()
71
- return axios
71
+ return ky
72
72
  .get(`${defaultApiHost}/get_config`)
73
- .then((res) => res.data as CapgoConfig)
73
+ .then((res) => res.json<CapgoConfig>())
74
74
  .then(data => ({ ...data, ...localConfig } as CapgoConfig))
75
75
  .catch(() => {
76
76
  console.log('Local config', localConfig);
@@ -404,7 +404,9 @@ export async function uploadUrl(supabase: SupabaseClient<Database>, appId: strin
404
404
  bucket_id: bucketId,
405
405
  }
406
406
  try {
407
- const res = await supabase.functions.invoke('upload_link', { body: JSON.stringify(data) })
407
+ const pathUploadLink = 'private/upload_link'
408
+ // const pathUploadLink = 'private/upload_link' // TODO: switch to new endpoint when new backend released
409
+ const res = await supabase.functions.invoke(pathUploadLink, { body: JSON.stringify(data) })
408
410
  return res.data.url
409
411
  } catch (error) {
410
412
  p.log.error(`Cannot get upload url ${JSON.stringify(error)}`);
package/tsconfig.json CHANGED
@@ -11,17 +11,29 @@
11
11
  "sourceMap": true,
12
12
  "outDir": "dist",
13
13
  "baseUrl": "src",
14
- "lib": ["es2016", "dom"],
14
+ "lib": [
15
+ "es2016",
16
+ "dom"
17
+ ],
15
18
  "typeRoots": [
16
19
  "src/types/*"
17
20
  ],
18
- },
19
- "include": ["src/**/*"],
20
- "exclude": ["node_modules", "dist", "__tests__", "**/*.spec.ts"],
21
- "paths": {
21
+ "paths": {
22
22
  "*": [
23
- "src/types/*"
23
+ "src/types/*"
24
24
  ],
25
- "@capacitor/cli/dist/config": ["src/types/capacitor-cli.d.ts"]
26
- }
25
+ "@capacitor/cli/dist/config": [
26
+ "src/types/capacitor-cli.d.ts"
27
+ ]
28
+ }
29
+ },
30
+ "include": [
31
+ "src/**/*"
32
+ ],
33
+ "exclude": [
34
+ "node_modules",
35
+ "dist",
36
+ "__tests__",
37
+ "**/*.spec.ts"
38
+ ],
27
39
  }
package/webpack.config.js DELETED
@@ -1,34 +0,0 @@
1
- const path = require('path');
2
- const webpack = require('webpack');
3
- const nodeExternals = require('webpack-node-externals');
4
- console.log(process.env.NODE_ENV || 'production');
5
- module.exports = {
6
- mode: process.env.NODE_ENV || 'production',
7
- target: 'node',
8
- externals: [nodeExternals()],
9
- entry: './src/index.ts',
10
- module: {
11
- rules: [
12
- {
13
- test: /\.ts$/,
14
- loader: 'ts-loader',
15
- exclude: /node_modules/,
16
- },
17
- ],
18
- },
19
- devtool: process.env.NODE_ENV === 'development' ? 'eval-source-map' : undefined,
20
- watch: process.env.NODE_ENV === 'development',
21
- plugins: [
22
- new webpack.BannerPlugin({ banner: '#!/usr/bin/env node', raw: true }),
23
- new webpack.EnvironmentPlugin({
24
- SUPA_DB: 'production',
25
- }),
26
- ],
27
- resolve: {
28
- extensions: ['.ts', '.js'],
29
- },
30
- output: {
31
- filename: 'index.js',
32
- path: path.resolve(__dirname, 'dist'),
33
- },
34
- };