@capawesome/cli 0.0.17 → 1.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 CHANGED
@@ -2,6 +2,27 @@
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.1](https://github.com/capawesome-team/cli/compare/v1.0.0...v1.0.1) (2024-11-01)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **apps:** `--ios-min` option was ignored ([d2de664](https://github.com/capawesome-team/cli/commit/d2de66481f7b54e44fc52eac6d1c868e82499160))
11
+ * **apps:** `--rollout` option was ignored ([5f1b2d8](https://github.com/capawesome-team/cli/commit/5f1b2d85a77d6a99e123dc690d947a740e864d6e))
12
+
13
+ ## [1.0.0](https://github.com/capawesome-team/cli/compare/v0.0.17...v1.0.0) (2024-11-01)
14
+
15
+
16
+ ### Features
17
+
18
+ * **apps:** add new `--expires-in-days` option to `apps:bundles:create` ([5e83d14](https://github.com/capawesome-team/cli/commit/5e83d1422f927c7202cde0f57d47e790aeaf02c1))
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * **login:** log error if email or password are not provided ([844acc4](https://github.com/capawesome-team/cli/commit/844acc4952886cfed83573b18961c482eae6f410))
24
+ * **manifests:** ignore `.DS_Store` file ([5e7ef8e](https://github.com/capawesome-team/cli/commit/5e7ef8ed9ec95bb48f3c4508648fe35f9d6090e8))
25
+
5
26
  ## [0.0.17](https://github.com/capawesome-team/cli/compare/v0.0.16...v0.0.17) (2024-10-24)
6
27
 
7
28
  ## [0.0.16](https://github.com/capawesome-team/cli/compare/v0.0.15...v0.0.16) (2024-10-20)
@@ -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,35 @@ 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
- let rollout = ctx.args.rollout;
101
+ let rolloutAsString = 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
+ }
115
+ // Validate the rollout percentage
116
+ let rolloutPercentage = 1;
117
+ if (rolloutAsString) {
118
+ const rolloutAsNumber = parseFloat(rolloutAsString);
119
+ if (isNaN(rolloutAsNumber) || rolloutAsNumber < 0 || rolloutAsNumber > 1) {
120
+ consola_1.default.error('Rollout percentage must be a number between 0 and 1.');
121
+ return;
122
+ }
123
+ rolloutPercentage = rolloutAsNumber;
124
+ }
99
125
  if (!path && !url) {
100
126
  path = yield (0, prompt_1.prompt)('Enter the path to the app bundle:', {
101
127
  type: 'text',
@@ -166,35 +192,6 @@ exports.default = (0, citty_1.defineCommand)({
166
192
  return;
167
193
  }
168
194
  }
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
195
  let appBundleId;
199
196
  try {
200
197
  // Create the app bundle
@@ -203,11 +200,13 @@ exports.default = (0, citty_1.defineCommand)({
203
200
  appId,
204
201
  artifactType,
205
202
  channelName,
203
+ expiresAt: expiresAt,
206
204
  url,
207
205
  maxAndroidAppVersionCode: androidMax,
208
206
  maxIosAppVersionCode: iosMax,
209
207
  minAndroidAppVersionCode: androidMin,
210
- minIosAppVersionCode: androidMin,
208
+ minIosAppVersionCode: iosMin,
209
+ rolloutPercentage,
211
210
  });
212
211
  appBundleId = response.id;
213
212
  if (path) {
@@ -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.17",
3
+ "version": "1.0.1",
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",