eas-cli 12.5.1 → 12.5.2

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.
Files changed (41) hide show
  1. package/README.md +66 -62
  2. package/build/build/build.js +4 -4
  3. package/build/commandUtils/flags.d.ts +10 -0
  4. package/build/commandUtils/flags.js +15 -8
  5. package/build/commands/env/create.d.ts +3 -1
  6. package/build/commands/env/create.js +106 -74
  7. package/build/commands/env/delete.d.ts +2 -2
  8. package/build/commands/env/delete.js +37 -26
  9. package/build/commands/env/exec.js +2 -1
  10. package/build/commands/env/get.d.ts +2 -2
  11. package/build/commands/env/get.js +40 -26
  12. package/build/commands/env/link.d.ts +4 -2
  13. package/build/commands/env/link.js +53 -14
  14. package/build/commands/env/list.d.ts +1 -2
  15. package/build/commands/env/list.js +49 -42
  16. package/build/commands/env/pull.js +1 -1
  17. package/build/commands/env/unlink.d.ts +3 -2
  18. package/build/commands/env/unlink.js +48 -21
  19. package/build/commands/env/update.d.ts +4 -2
  20. package/build/commands/env/update.js +68 -66
  21. package/build/commands/update/index.js +0 -1
  22. package/build/commands/worker/deploy.js +31 -11
  23. package/build/graphql/generated.d.ts +87 -15
  24. package/build/graphql/mutations/EnvironmentVariableMutation.d.ts +13 -22
  25. package/build/graphql/mutations/EnvironmentVariableMutation.js +18 -2
  26. package/build/graphql/queries/EnvironmentVariablesQuery.d.ts +13 -7
  27. package/build/graphql/queries/EnvironmentVariablesQuery.js +21 -9
  28. package/build/graphql/types/EnvironmentVariable.js +2 -1
  29. package/build/update/republish.js +1 -0
  30. package/build/utils/prompts.d.ts +15 -3
  31. package/build/utils/prompts.js +33 -8
  32. package/build/utils/variableUtils.d.ts +4 -0
  33. package/build/utils/variableUtils.js +31 -0
  34. package/build/worker/assets.d.ts +6 -1
  35. package/build/worker/assets.js +1 -2
  36. package/build/worker/upload.d.ts +1 -0
  37. package/build/worker/upload.js +25 -1
  38. package/oclif.manifest.json +70 -41
  39. package/package.json +3 -3
  40. package/build/utils/formatVariable.d.ts +0 -2
  41. package/build/utils/formatVariable.js +0 -16
@@ -1,19 +1,43 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.promptVariableNameAsync = exports.promptVariableValueAsync = exports.promptVariableEnvironmentAsync = void 0;
3
+ exports.promptVariableNameAsync = exports.promptVariableValueAsync = exports.promptVariableEnvironmentAsync = exports.promptVariableVisibilityAsync = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
6
+ const capitalize_1 = tslib_1.__importDefault(require("./expodash/capitalize"));
6
7
  const generated_1 = require("../graphql/generated");
7
8
  const prompts_1 = require("../prompts");
8
- async function promptVariableEnvironmentAsync(nonInteractive) {
9
+ async function promptVariableVisibilityAsync(nonInteractive, selectedVisibility) {
10
+ if (nonInteractive) {
11
+ throw new Error('The `--visibility` flag must be set when running in `--non-interactive` mode.');
12
+ }
13
+ return await (0, prompts_1.selectAsync)('Select visibility:', Object.values(generated_1.EnvironmentVariableVisibility).map(visibility => ({
14
+ title: (0, capitalize_1.default)(visibility),
15
+ value: visibility,
16
+ selected: visibility === selectedVisibility,
17
+ })));
18
+ }
19
+ exports.promptVariableVisibilityAsync = promptVariableVisibilityAsync;
20
+ async function promptVariableEnvironmentAsync({ nonInteractive, selectedEnvironments, multiple = false, availableEnvironments, }) {
9
21
  if (nonInteractive) {
10
22
  throw new Error('The `--environment` flag must be set when running in `--non-interactive` mode.');
11
23
  }
12
- return await (0, prompts_1.selectAsync)('Select environment:', [
13
- { title: 'development', value: generated_1.EnvironmentVariableEnvironment.Development },
14
- { title: 'preview', value: generated_1.EnvironmentVariableEnvironment.Preview },
15
- { title: 'production', value: generated_1.EnvironmentVariableEnvironment.Production },
16
- ]);
24
+ if (!multiple) {
25
+ return await (0, prompts_1.selectAsync)('Select environment:', (availableEnvironments ?? Object.values(generated_1.EnvironmentVariableEnvironment)).map(environment => ({
26
+ title: environment,
27
+ value: environment,
28
+ })));
29
+ }
30
+ const { environments } = await (0, prompts_1.promptAsync)({
31
+ message: 'Select environment:',
32
+ name: 'environments',
33
+ type: 'multiselect',
34
+ choices: Object.values(generated_1.EnvironmentVariableEnvironment).map(environment => ({
35
+ title: environment,
36
+ value: environment,
37
+ selected: selectedEnvironments?.includes(environment),
38
+ })),
39
+ });
40
+ return environments;
17
41
  }
18
42
  exports.promptVariableEnvironmentAsync = promptVariableEnvironmentAsync;
19
43
  async function promptVariableValueAsync({ nonInteractive, required = true, hidden = false, initial, }) {
@@ -41,7 +65,7 @@ async function promptVariableValueAsync({ nonInteractive, required = true, hidde
41
65
  return variableValue;
42
66
  }
43
67
  exports.promptVariableValueAsync = promptVariableValueAsync;
44
- async function promptVariableNameAsync(nonInteractive) {
68
+ async function promptVariableNameAsync(nonInteractive, initialValue) {
45
69
  const validationMessage = 'Variable name may not be empty.';
46
70
  if (nonInteractive) {
47
71
  throw new Error(validationMessage);
@@ -50,6 +74,7 @@ async function promptVariableNameAsync(nonInteractive) {
50
74
  type: 'text',
51
75
  name: 'name',
52
76
  message: `Variable name:`,
77
+ initial: initialValue,
53
78
  validate: value => {
54
79
  if (!value) {
55
80
  return validationMessage;
@@ -0,0 +1,4 @@
1
+ import { EnvironmentVariableEnvironment, EnvironmentVariableFragment } from '../graphql/generated';
2
+ export declare function formatVariableName(variable: EnvironmentVariableFragment): string;
3
+ export declare function performForEnvironmentsAsync(environments: EnvironmentVariableEnvironment[] | null, fun: (environment: EnvironmentVariableEnvironment | undefined) => Promise<any>): Promise<any[]>;
4
+ export declare function formatVariable(variable: EnvironmentVariableFragment): string;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatVariable = exports.performForEnvironmentsAsync = exports.formatVariableName = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const dateformat_1 = tslib_1.__importDefault(require("dateformat"));
6
+ const formatFields_1 = tslib_1.__importDefault(require("./formatFields"));
7
+ const generated_1 = require("../graphql/generated");
8
+ function formatVariableName(variable) {
9
+ const name = variable.name;
10
+ const scope = variable.scope === generated_1.EnvironmentVariableScope.Project ? 'project' : 'shared';
11
+ const environments = variable.environments?.join(', ') ?? '';
12
+ const updatedAt = variable.updatedAt ? new Date(variable.updatedAt).toLocaleString() : '';
13
+ return `${name} | ${scope} | ${environments} | Updated at: ${updatedAt}`;
14
+ }
15
+ exports.formatVariableName = formatVariableName;
16
+ async function performForEnvironmentsAsync(environments, fun) {
17
+ const selectedEnvironments = environments ?? [undefined];
18
+ return await Promise.all(selectedEnvironments.map(env => fun(env)));
19
+ }
20
+ exports.performForEnvironmentsAsync = performForEnvironmentsAsync;
21
+ function formatVariable(variable) {
22
+ return (0, formatFields_1.default)([
23
+ { label: 'ID', value: variable.id },
24
+ { label: 'Name', value: variable.name },
25
+ { label: 'Value', value: variable.value ?? '(secret)' },
26
+ { label: 'Scope', value: variable.scope },
27
+ { label: 'Created at', value: (0, dateformat_1.default)(variable.createdAt, 'mmm dd HH:MM:ss') },
28
+ { label: 'Updated at', value: (0, dateformat_1.default)(variable.updatedAt, 'mmm dd HH:MM:ss') },
29
+ ]);
30
+ }
31
+ exports.formatVariable = formatVariable;
@@ -28,8 +28,13 @@ interface WorkerFileEntry {
28
28
  }
29
29
  /** Reads worker files while normalizing sourcemaps and providing normalized paths */
30
30
  declare function listWorkerFilesAsync(workerPath: string): AsyncGenerator<WorkerFileEntry>;
31
+ interface AssetFileEntry {
32
+ normalizedPath: string;
33
+ sha512: string;
34
+ path: string;
35
+ }
31
36
  /** Reads files of an asset maps and enumerates normalized paths and data */
32
- declare function listAssetMapFilesAsync(assetPath: string, assetMap: AssetMap): AsyncGenerator<WorkerFileEntry>;
37
+ declare function listAssetMapFilesAsync(assetPath: string, assetMap: AssetMap): AsyncGenerator<AssetFileEntry>;
33
38
  /** Entry of a normalized (gzip-safe) path and file data */
34
39
  export type FileEntry = readonly [normalizedPath: string, data: Buffer | string];
35
40
  /** Packs file entries into a tar.gz file (path to tgz returned) */
@@ -105,11 +105,10 @@ exports.listWorkerFilesAsync = listWorkerFilesAsync;
105
105
  async function* listAssetMapFilesAsync(assetPath, assetMap) {
106
106
  for (const normalizedPath in assetMap) {
107
107
  const filePath = node_path_1.default.resolve(assetPath, normalizedPath.split('/').join(node_path_1.default.sep));
108
- const data = await node_fs_1.default.promises.readFile(filePath);
109
108
  yield {
110
109
  normalizedPath,
111
110
  path: filePath,
112
- data,
111
+ sha512: assetMap[normalizedPath],
113
112
  };
114
113
  }
115
114
  }
@@ -13,6 +13,7 @@ export interface UploadResult {
13
13
  response: Response;
14
14
  }
15
15
  export declare function uploadAsync(params: UploadParams): Promise<UploadResult>;
16
+ export declare function callUploadApiAsync(url: string | URL, init?: RequestInit): Promise<unknown>;
16
17
  export interface UploadPending {
17
18
  params: UploadParams;
18
19
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.batchUploadAsync = exports.uploadAsync = void 0;
3
+ exports.batchUploadAsync = exports.callUploadApiAsync = exports.uploadAsync = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const https = tslib_1.__importStar(require("https"));
6
6
  const https_proxy_agent_1 = tslib_1.__importDefault(require("https-proxy-agent"));
@@ -112,6 +112,30 @@ async function uploadAsync(params) {
112
112
  });
113
113
  }
114
114
  exports.uploadAsync = uploadAsync;
115
+ async function callUploadApiAsync(url, init) {
116
+ return await (0, promise_retry_1.default)(async (retry) => {
117
+ let response;
118
+ try {
119
+ response = await (0, node_fetch_1.default)(url, {
120
+ ...init,
121
+ agent: getAgent(),
122
+ });
123
+ }
124
+ catch (error) {
125
+ return retry(error);
126
+ }
127
+ if (response.status >= 500 && response.status <= 599) {
128
+ retry(new Error(`Deployment failed: ${response.statusText}`));
129
+ }
130
+ try {
131
+ return await response.json();
132
+ }
133
+ catch (error) {
134
+ retry(error);
135
+ }
136
+ });
137
+ }
138
+ exports.callUploadApiAsync = callUploadApiAsync;
115
139
  async function* batchUploadAsync(uploads) {
116
140
  const controller = new AbortController();
117
141
  const queue = new Set();
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "12.5.1",
2
+ "version": "12.5.2",
3
3
  "commands": {
4
4
  "analytics": {
5
5
  "id": "analytics",
@@ -1913,7 +1913,7 @@
1913
1913
  "type": "option",
1914
1914
  "description": "Environment variable's environment",
1915
1915
  "helpValue": "(development|preview|production)",
1916
- "multiple": false,
1916
+ "multiple": true,
1917
1917
  "options": [
1918
1918
  "development",
1919
1919
  "preview",
@@ -1944,12 +1944,24 @@
1944
1944
  "hidden": true,
1945
1945
  "aliases": [],
1946
1946
  "flags": {
1947
- "name": {
1948
- "name": "name",
1947
+ "variable-name": {
1948
+ "name": "variable-name",
1949
1949
  "type": "option",
1950
1950
  "description": "Name of the variable to delete",
1951
1951
  "multiple": false
1952
1952
  },
1953
+ "variable-environment": {
1954
+ "name": "variable-environment",
1955
+ "type": "option",
1956
+ "description": "Current environment of the variable to delete",
1957
+ "helpValue": "(development|preview|production)",
1958
+ "multiple": false,
1959
+ "options": [
1960
+ "development",
1961
+ "preview",
1962
+ "production"
1963
+ ]
1964
+ },
1953
1965
  "scope": {
1954
1966
  "name": "scope",
1955
1967
  "type": "option",
@@ -1962,18 +1974,6 @@
1962
1974
  ],
1963
1975
  "default": "PROJECT"
1964
1976
  },
1965
- "environment": {
1966
- "name": "environment",
1967
- "type": "option",
1968
- "description": "Environment variable's environment",
1969
- "helpValue": "(development|preview|production)",
1970
- "multiple": false,
1971
- "options": [
1972
- "development",
1973
- "preview",
1974
- "production"
1975
- ]
1976
- },
1977
1977
  "non-interactive": {
1978
1978
  "name": "non-interactive",
1979
1979
  "type": "boolean",
@@ -2038,12 +2038,24 @@
2038
2038
  "hidden": true,
2039
2039
  "aliases": [],
2040
2040
  "flags": {
2041
- "name": {
2042
- "name": "name",
2041
+ "variable-name": {
2042
+ "name": "variable-name",
2043
2043
  "type": "option",
2044
2044
  "description": "Name of the variable",
2045
2045
  "multiple": false
2046
2046
  },
2047
+ "variable-environment": {
2048
+ "name": "variable-environment",
2049
+ "type": "option",
2050
+ "description": "Current environment of the variable",
2051
+ "helpValue": "(development|preview|production)",
2052
+ "multiple": false,
2053
+ "options": [
2054
+ "development",
2055
+ "preview",
2056
+ "production"
2057
+ ]
2058
+ },
2047
2059
  "format": {
2048
2060
  "name": "format",
2049
2061
  "type": "option",
@@ -2073,18 +2085,6 @@
2073
2085
  "type": "boolean",
2074
2086
  "description": "Run the command in non-interactive mode.",
2075
2087
  "allowNo": false
2076
- },
2077
- "environment": {
2078
- "name": "environment",
2079
- "type": "option",
2080
- "description": "Environment variable's environment",
2081
- "helpValue": "(development|preview|production)",
2082
- "multiple": false,
2083
- "options": [
2084
- "development",
2085
- "preview",
2086
- "production"
2087
- ]
2088
2088
  }
2089
2089
  },
2090
2090
  "args": {},
@@ -2103,18 +2103,30 @@
2103
2103
  "hidden": true,
2104
2104
  "aliases": [],
2105
2105
  "flags": {
2106
- "name": {
2107
- "name": "name",
2106
+ "variable-name": {
2107
+ "name": "variable-name",
2108
2108
  "type": "option",
2109
2109
  "description": "Name of the variable",
2110
2110
  "multiple": false
2111
2111
  },
2112
+ "variable-environment": {
2113
+ "name": "variable-environment",
2114
+ "type": "option",
2115
+ "description": "Current environment of the variable to link",
2116
+ "helpValue": "(development|preview|production)",
2117
+ "multiple": false,
2118
+ "options": [
2119
+ "development",
2120
+ "preview",
2121
+ "production"
2122
+ ]
2123
+ },
2112
2124
  "environment": {
2113
2125
  "name": "environment",
2114
2126
  "type": "option",
2115
2127
  "description": "Environment variable's environment",
2116
2128
  "helpValue": "(development|preview|production)",
2117
- "multiple": false,
2129
+ "multiple": true,
2118
2130
  "options": [
2119
2131
  "development",
2120
2132
  "preview",
@@ -2179,7 +2191,7 @@
2179
2191
  "type": "option",
2180
2192
  "description": "Environment variable's environment",
2181
2193
  "helpValue": "(development|preview|production)",
2182
- "multiple": false,
2194
+ "multiple": true,
2183
2195
  "options": [
2184
2196
  "development",
2185
2197
  "preview",
@@ -2281,8 +2293,8 @@
2281
2293
  "hidden": true,
2282
2294
  "aliases": [],
2283
2295
  "flags": {
2284
- "name": {
2285
- "name": "name",
2296
+ "variable-name": {
2297
+ "name": "variable-name",
2286
2298
  "type": "option",
2287
2299
  "description": "Name of the variable",
2288
2300
  "multiple": false
@@ -2292,7 +2304,7 @@
2292
2304
  "type": "option",
2293
2305
  "description": "Environment variable's environment",
2294
2306
  "helpValue": "(development|preview|production)",
2295
- "multiple": false,
2307
+ "multiple": true,
2296
2308
  "options": [
2297
2309
  "development",
2298
2310
  "preview",
@@ -2322,16 +2334,34 @@
2322
2334
  "hidden": true,
2323
2335
  "aliases": [],
2324
2336
  "flags": {
2337
+ "variable-name": {
2338
+ "name": "variable-name",
2339
+ "type": "option",
2340
+ "description": "Current name of the variable",
2341
+ "multiple": false
2342
+ },
2343
+ "variable-environment": {
2344
+ "name": "variable-environment",
2345
+ "type": "option",
2346
+ "description": "Current environment of the variable to update",
2347
+ "helpValue": "(development|preview|production)",
2348
+ "multiple": false,
2349
+ "options": [
2350
+ "development",
2351
+ "preview",
2352
+ "production"
2353
+ ]
2354
+ },
2325
2355
  "name": {
2326
2356
  "name": "name",
2327
2357
  "type": "option",
2328
- "description": "Name of the variable",
2358
+ "description": "New name of the variable",
2329
2359
  "multiple": false
2330
2360
  },
2331
2361
  "value": {
2332
2362
  "name": "value",
2333
2363
  "type": "option",
2334
- "description": "Text value or the variable",
2364
+ "description": "New value or the variable",
2335
2365
  "multiple": false
2336
2366
  },
2337
2367
  "visibility": {
@@ -2363,7 +2393,7 @@
2363
2393
  "type": "option",
2364
2394
  "description": "Environment variable's environment",
2365
2395
  "helpValue": "(development|preview|production)",
2366
- "multiple": false,
2396
+ "multiple": true,
2367
2397
  "options": [
2368
2398
  "development",
2369
2399
  "preview",
@@ -2907,7 +2937,6 @@
2907
2937
  "name": "rollout-percentage",
2908
2938
  "type": "option",
2909
2939
  "description": "Percentage of users this update should be immediately available to. Users not in the rollout will be served the previous latest update on the branch, even if that update is itself being rolled out. The specified number must be an integer between 1 and 100. When not specified, this defaults to 100.",
2910
- "hidden": true,
2911
2940
  "required": false,
2912
2941
  "multiple": false
2913
2942
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "eas-cli",
3
3
  "description": "EAS command line tool",
4
- "version": "12.5.1",
4
+ "version": "12.5.2",
5
5
  "author": "Expo <support@expo.dev>",
6
6
  "bin": {
7
7
  "eas": "./bin/run"
@@ -14,7 +14,7 @@
14
14
  "@expo/config-plugins": "7.8.4",
15
15
  "@expo/config-types": "50.0.0",
16
16
  "@expo/eas-build-job": "1.0.136",
17
- "@expo/eas-json": "12.5.0",
17
+ "@expo/eas-json": "12.5.2",
18
18
  "@expo/env": "^0.3.0",
19
19
  "@expo/json-file": "8.2.37",
20
20
  "@expo/logger": "1.0.117",
@@ -228,5 +228,5 @@
228
228
  "node": "20.11.0",
229
229
  "yarn": "1.22.21"
230
230
  },
231
- "gitHead": "01676a4f8821e46215f236f2a105d820e6df2872"
231
+ "gitHead": "6489ddc6adb71c11999f3bb2df848ef1ce2dd136"
232
232
  }
@@ -1,2 +0,0 @@
1
- import { EnvironmentVariableFragment } from '../graphql/generated';
2
- export declare function formatVariable(variable: EnvironmentVariableFragment): string;
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formatVariable = void 0;
4
- const tslib_1 = require("tslib");
5
- const dateformat_1 = tslib_1.__importDefault(require("dateformat"));
6
- const formatFields_1 = tslib_1.__importDefault(require("./formatFields"));
7
- function formatVariable(variable) {
8
- return (0, formatFields_1.default)([
9
- { label: 'ID', value: variable.id },
10
- { label: 'Name', value: variable.name },
11
- { label: 'Value', value: variable.value ?? '(secret)' },
12
- { label: 'Scope', value: variable.scope },
13
- { label: 'Created at', value: (0, dateformat_1.default)(variable.createdAt, 'mmm dd HH:MM:ss') },
14
- ]);
15
- }
16
- exports.formatVariable = formatVariable;