@capawesome/cli 1.14.0 → 2.0.1
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 +34 -0
- package/README.md +7 -3
- package/dist/commands/apps/bundles/create.js +206 -239
- package/dist/commands/apps/bundles/create.test.js +276 -0
- package/dist/commands/apps/bundles/delete.js +35 -60
- package/dist/commands/apps/bundles/delete.test.js +139 -0
- package/dist/commands/apps/bundles/update.js +61 -89
- package/dist/commands/apps/bundles/update.test.js +141 -0
- package/dist/commands/apps/channels/create.js +45 -75
- package/dist/commands/apps/channels/create.test.js +119 -0
- package/dist/commands/apps/channels/delete.js +46 -69
- package/dist/commands/apps/channels/delete.test.js +141 -0
- package/dist/commands/apps/channels/get.js +52 -94
- package/dist/commands/apps/channels/get.test.js +135 -0
- package/dist/commands/apps/channels/list.js +37 -82
- package/dist/commands/apps/channels/list.test.js +121 -0
- package/dist/commands/apps/channels/update.js +39 -83
- package/dist/commands/apps/channels/update.test.js +138 -0
- package/dist/commands/apps/create.js +28 -53
- package/dist/commands/apps/create.test.js +117 -0
- package/dist/commands/apps/delete.js +29 -50
- package/dist/commands/apps/delete.test.js +120 -0
- package/dist/commands/apps/devices/delete.js +35 -60
- package/dist/commands/apps/devices/delete.test.js +139 -0
- package/dist/commands/doctor.js +12 -29
- package/dist/commands/doctor.test.js +52 -0
- package/dist/commands/login.js +50 -71
- package/dist/commands/login.test.js +116 -0
- package/dist/commands/logout.js +13 -31
- package/dist/commands/logout.test.js +47 -0
- package/dist/commands/manifests/generate.js +20 -38
- package/dist/commands/manifests/generate.test.js +60 -0
- package/dist/commands/organizations/create.js +25 -0
- package/dist/commands/organizations/create.test.js +80 -0
- package/dist/commands/whoami.js +20 -31
- package/dist/commands/whoami.test.js +30 -0
- package/dist/config/consts.js +4 -5
- package/dist/config/index.js +1 -17
- package/dist/index.js +59 -80
- package/dist/services/app-bundle-files.js +117 -136
- package/dist/services/app-bundles.js +22 -41
- package/dist/services/app-channels.js +54 -77
- package/dist/services/app-devices.js +10 -25
- package/dist/services/apps.js +25 -43
- package/dist/services/authorization-service.js +4 -8
- package/dist/services/config.js +15 -28
- package/dist/services/organizations.js +19 -26
- package/dist/services/session-code.js +7 -22
- package/dist/services/sessions.js +13 -30
- package/dist/services/update.js +17 -55
- package/dist/services/users.js +11 -26
- package/dist/types/app-bundle-file.js +1 -2
- package/dist/types/app-bundle.js +1 -2
- package/dist/types/app-channel.js +1 -2
- package/dist/types/app-device.js +1 -2
- package/dist/types/app.js +1 -2
- package/dist/types/index.js +8 -24
- package/dist/types/npm-package.js +1 -2
- package/dist/types/organization.js +1 -2
- package/dist/types/session-code.js +1 -2
- package/dist/types/session.js +1 -2
- package/dist/types/user.js +1 -2
- package/dist/utils/buffer.js +12 -43
- package/dist/utils/error.js +24 -14
- package/dist/utils/file.js +22 -41
- package/dist/utils/hash.js +3 -39
- package/dist/utils/http-client.js +27 -53
- package/dist/utils/manifest.js +11 -24
- package/dist/utils/private-key.js +23 -0
- package/dist/utils/prompt.js +9 -26
- package/dist/utils/signature.js +3 -39
- package/dist/utils/user-config.js +12 -0
- package/dist/utils/zip.js +11 -27
- package/package.json +22 -9
- package/dist/utils/ci.js +0 -7
- package/dist/utils/userConfig.js +0 -16
package/dist/utils/hash.js
CHANGED
|
@@ -1,40 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.createHash = void 0;
|
|
36
|
-
const createHash = (data) => __awaiter(void 0, void 0, void 0, function* () {
|
|
37
|
-
const crypto = yield Promise.resolve().then(() => __importStar(require('crypto')));
|
|
1
|
+
export const createHash = async (data) => {
|
|
2
|
+
const crypto = await import('crypto');
|
|
38
3
|
return crypto.createHash('sha256').update(data).digest('hex');
|
|
39
|
-
}
|
|
40
|
-
exports.createHash = createHash;
|
|
4
|
+
};
|
|
@@ -1,61 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const axios_1 = __importDefault(require("axios"));
|
|
16
|
-
const package_json_1 = require("../../package.json");
|
|
17
|
-
const config_1 = __importDefault(require("../services/config"));
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import pkg from '../../package.json' with { type: 'json' };
|
|
3
|
+
import configService from '../services/config.js';
|
|
18
4
|
class HttpClientImpl {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
5
|
+
baseHeaders = {
|
|
6
|
+
'User-Agent': `Capawesome CLI v${pkg.version}`,
|
|
7
|
+
};
|
|
8
|
+
async delete(url, config) {
|
|
9
|
+
const baseUrl = await configService.getValueForKey('API_BASE_URL');
|
|
10
|
+
const urlWithHost = url.startsWith('http') ? url : baseUrl + url;
|
|
11
|
+
return axios.delete(urlWithHost, { ...config, headers: { ...this.baseHeaders, ...config?.headers } });
|
|
23
12
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return axios_1.default.delete(urlWithHost, Object.assign(Object.assign({}, config), { headers: Object.assign(Object.assign({}, this.baseHeaders), config === null || config === void 0 ? void 0 : config.headers) }));
|
|
29
|
-
});
|
|
13
|
+
async get(url, config) {
|
|
14
|
+
const baseUrl = await configService.getValueForKey('API_BASE_URL');
|
|
15
|
+
const urlWithHost = url.startsWith('http') ? url : baseUrl + url;
|
|
16
|
+
return axios.get(urlWithHost, { ...config, headers: { ...this.baseHeaders, ...config?.headers } });
|
|
30
17
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return axios_1.default.get(urlWithHost, Object.assign(Object.assign({}, config), { headers: Object.assign(Object.assign({}, this.baseHeaders), config === null || config === void 0 ? void 0 : config.headers) }));
|
|
36
|
-
});
|
|
18
|
+
async patch(url, data, config) {
|
|
19
|
+
const baseUrl = await configService.getValueForKey('API_BASE_URL');
|
|
20
|
+
const urlWithHost = url.startsWith('http') ? url : baseUrl + url;
|
|
21
|
+
return axios.patch(urlWithHost, data, { ...config, headers: { ...this.baseHeaders, ...config?.headers } });
|
|
37
22
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
return axios_1.default.patch(urlWithHost, data, Object.assign(Object.assign({}, config), { headers: Object.assign(Object.assign({}, this.baseHeaders), config === null || config === void 0 ? void 0 : config.headers) }));
|
|
43
|
-
});
|
|
23
|
+
async post(url, data, config) {
|
|
24
|
+
const baseUrl = await configService.getValueForKey('API_BASE_URL');
|
|
25
|
+
const urlWithHost = url.startsWith('http') ? url : baseUrl + url;
|
|
26
|
+
return axios.post(urlWithHost, data, { ...config, headers: { ...this.baseHeaders, ...config?.headers } });
|
|
44
27
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
return axios_1.default.post(urlWithHost, data, Object.assign(Object.assign({}, config), { headers: Object.assign(Object.assign({}, this.baseHeaders), config === null || config === void 0 ? void 0 : config.headers) }));
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
put(url, data, config) {
|
|
53
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
54
|
-
const baseUrl = yield config_1.default.getValueForKey('API_BASE_URL');
|
|
55
|
-
const urlWithHost = url.startsWith('http') ? url : baseUrl + url;
|
|
56
|
-
return axios_1.default.put(urlWithHost, data, Object.assign(Object.assign({}, config), { headers: Object.assign(Object.assign({}, this.baseHeaders), config === null || config === void 0 ? void 0 : config.headers) }));
|
|
57
|
-
});
|
|
28
|
+
async put(url, data, config) {
|
|
29
|
+
const baseUrl = await configService.getValueForKey('API_BASE_URL');
|
|
30
|
+
const urlWithHost = url.startsWith('http') ? url : baseUrl + url;
|
|
31
|
+
return axios.put(urlWithHost, data, { ...config, headers: { ...this.baseHeaders, ...config?.headers } });
|
|
58
32
|
}
|
|
59
33
|
}
|
|
60
34
|
let httpClient = new HttpClientImpl();
|
|
61
|
-
|
|
35
|
+
export default httpClient;
|
package/dist/utils/manifest.js
CHANGED
|
@@ -1,28 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.generateManifestJson = void 0;
|
|
13
|
-
const config_1 = require("../config");
|
|
14
|
-
const buffer_1 = require("./buffer");
|
|
15
|
-
const file_1 = require("./file");
|
|
16
|
-
const hash_1 = require("./hash");
|
|
17
|
-
const ignoreFiles = ['.DS_Store', config_1.MANIFEST_JSON_FILE_NAME];
|
|
18
|
-
const generateManifestJson = (path) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1
|
+
import { MANIFEST_JSON_FILE_NAME } from '../config/index.js';
|
|
2
|
+
import { createBufferFromPath } from './buffer.js';
|
|
3
|
+
import { getFilesInDirectoryAndSubdirectories, writeFile } from './file.js';
|
|
4
|
+
import { createHash } from './hash.js';
|
|
5
|
+
const ignoreFiles = ['.DS_Store', MANIFEST_JSON_FILE_NAME];
|
|
6
|
+
export const generateManifestJson = async (path) => {
|
|
19
7
|
const manifestItems = [];
|
|
20
8
|
// Get all files
|
|
21
|
-
const files =
|
|
9
|
+
const files = await getFilesInDirectoryAndSubdirectories(path);
|
|
22
10
|
// Iterate over each file
|
|
23
11
|
for (const [index, file] of files.entries()) {
|
|
24
|
-
const fileBuffer =
|
|
25
|
-
const checksum =
|
|
12
|
+
const fileBuffer = await createBufferFromPath(file.path);
|
|
13
|
+
const checksum = await createHash(fileBuffer);
|
|
26
14
|
const sizeInBytes = fileBuffer.byteLength;
|
|
27
15
|
// Skip ignored files
|
|
28
16
|
if (ignoreFiles.includes(file.name)) {
|
|
@@ -35,6 +23,5 @@ const generateManifestJson = (path) => __awaiter(void 0, void 0, void 0, functio
|
|
|
35
23
|
});
|
|
36
24
|
}
|
|
37
25
|
// Write the manifest file
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
exports.generateManifestJson = generateManifestJson;
|
|
26
|
+
writeFile(`${path}/${MANIFEST_JSON_FILE_NAME}`, JSON.stringify(manifestItems, null, 2));
|
|
27
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export const formatPrivateKey = (privateKey) => {
|
|
2
|
+
// Extract the header, key data, and footer using regex that preserves spaces
|
|
3
|
+
const beginMatch = privateKey.match(/-----BEGIN [^-]+ ?-----/);
|
|
4
|
+
const endMatch = privateKey.match(/-----END [^-]+ ?-----/);
|
|
5
|
+
if (!beginMatch || !endMatch) {
|
|
6
|
+
return privateKey; // Return as-is if not properly formatted PEM
|
|
7
|
+
}
|
|
8
|
+
const header = beginMatch[0];
|
|
9
|
+
const footer = endMatch[0];
|
|
10
|
+
// Remove all whitespace from the entire key, then find the positions
|
|
11
|
+
const cleanKey = privateKey.replace(/\s/g, '');
|
|
12
|
+
const cleanHeader = header.replace(/\s/g, '');
|
|
13
|
+
const cleanFooter = footer.replace(/\s/g, '');
|
|
14
|
+
const headerEnd = cleanKey.indexOf(cleanHeader) + cleanHeader.length;
|
|
15
|
+
const footerStart = cleanKey.indexOf(cleanFooter);
|
|
16
|
+
if (headerEnd >= footerStart) {
|
|
17
|
+
return privateKey; // Return as-is if structure is invalid
|
|
18
|
+
}
|
|
19
|
+
const keyData = cleanKey.substring(headerEnd, footerStart);
|
|
20
|
+
// Split the key data into 64-character lines
|
|
21
|
+
const formattedKeyData = keyData.match(/.{1,64}/g)?.join('\n') || keyData;
|
|
22
|
+
return `${header}\n${formattedKeyData}\n${footer}`;
|
|
23
|
+
};
|
package/dist/utils/prompt.js
CHANGED
|
@@ -1,40 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.passwordPrompt = exports.prompt = void 0;
|
|
16
|
-
const prompts_1 = require("@clack/prompts");
|
|
17
|
-
const consola_1 = __importDefault(require("consola"));
|
|
18
|
-
const prompt = (message, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
|
-
options = Object.assign(Object.assign({}, (options || {})), { cancel: 'symbol' });
|
|
20
|
-
const response = yield consola_1.default.prompt(message, options);
|
|
1
|
+
import { password as clackPassword } from '@clack/prompts';
|
|
2
|
+
import consola from 'consola';
|
|
3
|
+
export const prompt = async (message, options) => {
|
|
4
|
+
options = { ...(options || {}), cancel: 'symbol' };
|
|
5
|
+
const response = await consola.prompt(message, options);
|
|
21
6
|
// See https://github.com/unjs/consola/pull/325#issue-2751614453
|
|
22
7
|
if (response === Symbol.for('cancel')) {
|
|
23
8
|
process.exit(0);
|
|
24
9
|
}
|
|
25
10
|
return response;
|
|
26
|
-
}
|
|
27
|
-
exports.prompt = prompt;
|
|
11
|
+
};
|
|
28
12
|
/**
|
|
29
13
|
* This is a workaround to support password prompts.
|
|
30
14
|
*
|
|
31
15
|
* @see https://github.com/unjs/consola/issues/285
|
|
32
16
|
*/
|
|
33
|
-
const passwordPrompt = (message) =>
|
|
34
|
-
const result =
|
|
17
|
+
export const passwordPrompt = async (message) => {
|
|
18
|
+
const result = await clackPassword({ message });
|
|
35
19
|
if (typeof result === 'symbol') {
|
|
36
20
|
process.exit(0);
|
|
37
21
|
}
|
|
38
22
|
return result;
|
|
39
|
-
}
|
|
40
|
-
exports.passwordPrompt = passwordPrompt;
|
|
23
|
+
};
|
package/dist/utils/signature.js
CHANGED
|
@@ -1,43 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.createSignature = void 0;
|
|
36
|
-
const createSignature = (privateKey, data) => __awaiter(void 0, void 0, void 0, function* () {
|
|
37
|
-
const crypto = yield Promise.resolve().then(() => __importStar(require('crypto')));
|
|
1
|
+
export const createSignature = async (privateKey, data) => {
|
|
2
|
+
const crypto = await import('crypto');
|
|
38
3
|
const sign = crypto.createSign('sha256');
|
|
39
4
|
sign.update(data);
|
|
40
5
|
sign.end();
|
|
41
6
|
return sign.sign(privateKey).toString('base64');
|
|
42
|
-
}
|
|
43
|
-
exports.createSignature = createSignature;
|
|
7
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { readUser, writeUser } from 'rc9';
|
|
2
|
+
class UserConfigImpl {
|
|
3
|
+
file = '.capawesome';
|
|
4
|
+
read() {
|
|
5
|
+
return readUser({ name: this.file });
|
|
6
|
+
}
|
|
7
|
+
write(config) {
|
|
8
|
+
writeUser(config, { name: this.file });
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
const userConfig = new UserConfigImpl();
|
|
12
|
+
export default userConfig;
|
package/dist/utils/zip.js
CHANGED
|
@@ -1,30 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const archiver_1 = __importDefault(require("archiver"));
|
|
1
|
+
import archiver from 'archiver';
|
|
16
2
|
class ZipImpl {
|
|
17
|
-
zipFolder(sourceFolder) {
|
|
18
|
-
return
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
archive.finalize();
|
|
27
|
-
});
|
|
3
|
+
async zipFolder(sourceFolder) {
|
|
4
|
+
return new Promise((resolve, reject) => {
|
|
5
|
+
const archive = archiver('zip', { zlib: { level: 9 } });
|
|
6
|
+
const buffers = [];
|
|
7
|
+
archive.on('data', (data) => buffers.push(data));
|
|
8
|
+
archive.on('error', (err) => reject(err));
|
|
9
|
+
archive.on('end', () => resolve(Buffer.concat(buffers)));
|
|
10
|
+
archive.directory(sourceFolder, false);
|
|
11
|
+
archive.finalize();
|
|
28
12
|
});
|
|
29
13
|
}
|
|
30
14
|
isZipped(path) {
|
|
@@ -32,4 +16,4 @@ class ZipImpl {
|
|
|
32
16
|
}
|
|
33
17
|
}
|
|
34
18
|
const zip = new ZipImpl();
|
|
35
|
-
|
|
19
|
+
export default zip;
|
package/package.json
CHANGED
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capawesome/cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "The Capawesome Cloud Command Line Interface (CLI) to manage Live Updates and more.",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"scripts": {
|
|
6
|
-
"build": "
|
|
7
|
+
"build": "rimraf ./dist && tsc && tsc-alias",
|
|
7
8
|
"start": "npm run build && node ./dist/index.js",
|
|
9
|
+
"test": "vitest run",
|
|
10
|
+
"test:watch": "vitest --watch",
|
|
11
|
+
"test:ui": "vitest --ui",
|
|
8
12
|
"lint": "npm run prettier -- --check",
|
|
9
13
|
"fmt": "npm run prettier -- --write",
|
|
10
14
|
"prettier": "prettier \"**/*.{css,html,ts,js}\"",
|
|
11
15
|
"prepublishOnly": "npm run build",
|
|
12
16
|
"release": "commit-and-tag-version"
|
|
13
17
|
},
|
|
18
|
+
"engines": {
|
|
19
|
+
"npm": ">=8.0.0",
|
|
20
|
+
"node": ">=18.0.0"
|
|
21
|
+
},
|
|
14
22
|
"bin": {
|
|
15
23
|
"capawesome": "./dist/index.js"
|
|
16
24
|
},
|
|
@@ -41,30 +49,35 @@
|
|
|
41
49
|
],
|
|
42
50
|
"dependencies": {
|
|
43
51
|
"@clack/prompts": "0.7.0",
|
|
52
|
+
"@robingenz/zli": "0.1.4",
|
|
44
53
|
"@sentry/node": "8.55.0",
|
|
45
54
|
"archiver": "7.0.1",
|
|
46
55
|
"axios": "1.8.4",
|
|
47
56
|
"c12": "2.0.1",
|
|
48
|
-
"citty": "0.1.6",
|
|
49
57
|
"consola": "3.3.0",
|
|
50
58
|
"form-data": "4.0.4",
|
|
51
|
-
"mime": "
|
|
52
|
-
"open": "
|
|
59
|
+
"mime": "4.0.7",
|
|
60
|
+
"open": "10.2.0",
|
|
53
61
|
"rc9": "2.1.2",
|
|
54
62
|
"semver": "7.6.3",
|
|
55
|
-
"
|
|
63
|
+
"std-env": "3.9.0",
|
|
64
|
+
"systeminformation": "5.25.11",
|
|
65
|
+
"zod": "4.0.17"
|
|
56
66
|
},
|
|
57
67
|
"devDependencies": {
|
|
58
68
|
"@ionic/prettier-config": "4.0.0",
|
|
59
69
|
"@types/archiver": "6.0.3",
|
|
60
70
|
"@types/mime": "3.0.4",
|
|
61
|
-
"@types/node": "
|
|
71
|
+
"@types/node": "24.2.1",
|
|
62
72
|
"@types/semver": "7.5.8",
|
|
73
|
+
"@vitest/ui": "3.2.4",
|
|
63
74
|
"commit-and-tag-version": "12.5.0",
|
|
64
|
-
"
|
|
75
|
+
"nock": "14.0.10",
|
|
65
76
|
"prettier": "3.3.3",
|
|
66
77
|
"rimraf": "6.0.1",
|
|
67
|
-
"
|
|
78
|
+
"tsc-alias": "1.8.16",
|
|
79
|
+
"typescript": "5.6.3",
|
|
80
|
+
"vitest": "3.2.4"
|
|
68
81
|
},
|
|
69
82
|
"prettier": "@ionic/prettier-config"
|
|
70
83
|
}
|
package/dist/utils/ci.js
DELETED
package/dist/utils/userConfig.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const rc9_1 = require("rc9");
|
|
4
|
-
class UserConfigImpl {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.file = '.capawesome';
|
|
7
|
-
}
|
|
8
|
-
read() {
|
|
9
|
-
return (0, rc9_1.readUser)({ name: this.file });
|
|
10
|
-
}
|
|
11
|
-
write(config) {
|
|
12
|
-
(0, rc9_1.writeUser)(config, { name: this.file });
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
const userConfig = new UserConfigImpl();
|
|
16
|
-
exports.default = userConfig;
|