@capawesome/cli 0.0.16 → 1.0.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/CHANGELOG.md CHANGED
@@ -2,6 +2,21 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
4
4
 
5
+ ## [1.0.0](https://github.com/capawesome-team/cli/compare/v0.0.17...v1.0.0) (2024-11-01)
6
+
7
+
8
+ ### Features
9
+
10
+ * **apps:** add new `--expires-in-days` option to `apps:bundles:create` ([5e83d14](https://github.com/capawesome-team/cli/commit/5e83d1422f927c7202cde0f57d47e790aeaf02c1))
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * **login:** log error if email or password are not provided ([844acc4](https://github.com/capawesome-team/cli/commit/844acc4952886cfed83573b18961c482eae6f410))
16
+ * **manifests:** ignore `.DS_Store` file ([5e7ef8e](https://github.com/capawesome-team/cli/commit/5e7ef8ed9ec95bb48f3c4508648fe35f9d6090e8))
17
+
18
+ ## [0.0.17](https://github.com/capawesome-team/cli/compare/v0.0.16...v0.0.17) (2024-10-24)
19
+
5
20
  ## [0.0.16](https://github.com/capawesome-team/cli/compare/v0.0.15...v0.0.16) (2024-10-20)
6
21
 
7
22
 
@@ -14,7 +14,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const citty_1 = require("citty");
16
16
  const consola_1 = __importDefault(require("consola"));
17
- const form_data_1 = __importDefault(require("form-data"));
18
17
  const fs_1 = require("fs");
19
18
  const app_bundle_files_1 = __importDefault(require("../../../services/app-bundle-files"));
20
19
  const app_bundles_1 = __importDefault(require("../../../services/app-bundles"));
@@ -53,6 +52,10 @@ exports.default = (0, citty_1.defineCommand)({
53
52
  type: 'string',
54
53
  description: 'Channel to associate the bundle with.',
55
54
  },
55
+ expiresInDays: {
56
+ type: 'string',
57
+ description: 'The number of days until the bundle is automatically deleted.',
58
+ },
56
59
  iosMax: {
57
60
  type: 'string',
58
61
  description: 'The maximum iOS bundle version (`CFBundleVersion`) that the bundle supports.',
@@ -90,12 +93,25 @@ exports.default = (0, citty_1.defineCommand)({
90
93
  ? ctx.args.artifactType
91
94
  : 'zip';
92
95
  let channelName = ctx.args.channel;
96
+ let expiresInDays = ctx.args.expiresInDays;
93
97
  let iosMax = ctx.args.iosMax;
94
98
  let iosMin = ctx.args.iosMin;
95
99
  let path = ctx.args.path;
96
100
  let privateKey = ctx.args.privateKey;
97
101
  let rollout = ctx.args.rollout;
98
102
  let url = ctx.args.url;
103
+ // Validate the expiration days
104
+ let expiresAt;
105
+ if (expiresInDays) {
106
+ const expiresInDaysAsNumber = parseInt(expiresInDays, 10);
107
+ if (isNaN(expiresInDaysAsNumber) || expiresInDaysAsNumber < 1) {
108
+ consola_1.default.error('Expires in days must be a number greater than 0.');
109
+ return;
110
+ }
111
+ const expiresAtDate = new Date();
112
+ expiresAtDate.setDate(expiresAtDate.getDate() + expiresInDaysAsNumber);
113
+ expiresAt = expiresAtDate.toISOString();
114
+ }
99
115
  if (!path && !url) {
100
116
  path = yield (0, prompt_1.prompt)('Enter the path to the app bundle:', {
101
117
  type: 'text',
@@ -166,35 +182,6 @@ exports.default = (0, citty_1.defineCommand)({
166
182
  return;
167
183
  }
168
184
  }
169
- // Create form data
170
- const formData = new form_data_1.default();
171
- formData.append('artifactType', artifactType || 'zip');
172
- if (url) {
173
- formData.append('url', url);
174
- }
175
- if (channelName) {
176
- formData.append('channelName', channelName);
177
- }
178
- if (androidMax) {
179
- formData.append('maxAndroidAppVersionCode', androidMax);
180
- }
181
- if (androidMin) {
182
- formData.append('minAndroidAppVersionCode', androidMin);
183
- }
184
- if (rollout) {
185
- const rolloutAsNumber = parseFloat(rollout);
186
- if (isNaN(rolloutAsNumber) || rolloutAsNumber < 0 || rolloutAsNumber > 1) {
187
- consola_1.default.error('Rollout percentage must be a number between 0 and 1 (e.g. 0.5).');
188
- return;
189
- }
190
- formData.append('rolloutPercentage', rolloutAsNumber);
191
- }
192
- if (iosMax) {
193
- formData.append('maxIosAppVersionCode', iosMax);
194
- }
195
- if (iosMin) {
196
- formData.append('minIosAppVersionCode', iosMin);
197
- }
198
185
  let appBundleId;
199
186
  try {
200
187
  // Create the app bundle
@@ -203,6 +190,7 @@ exports.default = (0, citty_1.defineCommand)({
203
190
  appId,
204
191
  artifactType,
205
192
  channelName,
193
+ expiresAt: expiresAt,
206
194
  url,
207
195
  maxAndroidAppVersionCode: androidMax,
208
196
  maxIosAppVersionCode: iosMax,
@@ -59,8 +59,12 @@ exports.default = (0, citty_1.defineCommand)({
59
59
  let token = ctx.args.token;
60
60
  if (token === undefined) {
61
61
  consola_1.default.warn('If you have signed up via an OAuth provider, please sign in using the `--token` argument.');
62
- const email = yield (0, prompt_1.prompt)('Enter your email:', { type: 'text' });
63
- const password = yield (0, prompt_1.passwordPrompt)('Enter your password:');
62
+ const email = (yield (0, prompt_1.prompt)('Enter your email:', { type: 'text' }));
63
+ const password = (yield (0, prompt_1.passwordPrompt)('Enter your password:'));
64
+ if (!email || !password) {
65
+ consola_1.default.error('Invalid email or password.');
66
+ return;
67
+ }
64
68
  consola_1.default.start('Logging in...');
65
69
  let sessionId;
66
70
  try {
@@ -26,6 +26,9 @@ class AppBundlesServiceImpl {
26
26
  if (dto.channelName) {
27
27
  formData.append('channelName', dto.channelName);
28
28
  }
29
+ if (dto.expiresAt) {
30
+ formData.append('expiresAt', dto.expiresAt);
31
+ }
29
32
  if (dto.url) {
30
33
  formData.append('url', dto.url);
31
34
  }
@@ -14,6 +14,7 @@ const config_1 = require("../config");
14
14
  const buffer_1 = require("./buffer");
15
15
  const file_1 = require("./file");
16
16
  const hash_1 = require("./hash");
17
+ const ignoreFiles = ['.DS_Store', config_1.MANIFEST_JSON_FILE_NAME];
17
18
  const generateManifestJson = (path) => __awaiter(void 0, void 0, void 0, function* () {
18
19
  const manifestItems = [];
19
20
  // Get all files
@@ -24,8 +25,8 @@ const generateManifestJson = (path) => __awaiter(void 0, void 0, void 0, functio
24
25
  const checksum = yield (0, hash_1.createHash)(fileBuffer);
25
26
  const sizeInBytes = fileBuffer.byteLength;
26
27
  const href = file.path.replace(path + '/', '');
27
- // Do NOT include the manifest file itself
28
- if (href === config_1.MANIFEST_JSON_FILE_NAME) {
28
+ // Skip ignored files
29
+ if (ignoreFiles.includes(file.name)) {
29
30
  continue;
30
31
  }
31
32
  manifestItems.push({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capawesome/cli",
3
- "version": "0.0.16",
3
+ "version": "1.0.0",
4
4
  "description": "The Capawesome Cloud Command Line Interface (CLI) to manage Live Updates and more.",
5
5
  "scripts": {
6
6
  "build": "rimraf ./dist && tsc",
@@ -42,22 +42,22 @@
42
42
  "dependencies": {
43
43
  "@clack/prompts": "0.7.0",
44
44
  "archiver": "7.0.1",
45
- "axios": "1.6.8",
45
+ "axios": "1.7.7",
46
46
  "citty": "0.1.6",
47
47
  "consola": "3.2.3",
48
- "form-data": "4.0.0",
49
- "rc9": "2.1.1",
48
+ "form-data": "4.0.1",
49
+ "rc9": "2.1.2",
50
50
  "semver": "7.6.3"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@ionic/prettier-config": "4.0.0",
54
- "@types/archiver": "6.0.2",
54
+ "@types/archiver": "6.0.3",
55
55
  "@types/node": "20.11.30",
56
56
  "@types/semver": "7.5.8",
57
- "commit-and-tag-version": "12.4.0",
58
- "prettier": "3.2.5",
59
- "rimraf": "5.0.5",
60
- "typescript": "5.4.3"
57
+ "commit-and-tag-version": "12.5.0",
58
+ "prettier": "3.3.3",
59
+ "rimraf": "6.0.1",
60
+ "typescript": "5.6.3"
61
61
  },
62
62
  "prettier": "@ionic/prettier-config"
63
63
  }