eas-cli 16.22.0 → 16.23.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/README.md +208 -207
- package/build/build/android/graphql.js +1 -2
- package/build/build/evaluateConfigWithEnvVarsAsync.js +5 -11
- package/build/build/ios/graphql.js +1 -2
- package/build/build/utils/environment.d.ts +1 -4
- package/build/build/utils/environment.js +7 -24
- package/build/commandUtils/EasCommand.d.ts +1 -2
- package/build/commandUtils/context/ContextField.d.ts +1 -2
- package/build/commandUtils/context/contextUtils/loadServerSideEnvironmentVariablesAsync.d.ts +1 -2
- package/build/commandUtils/context/contextUtils/loadServerSideEnvironmentVariablesAsync.js +3 -8
- package/build/commandUtils/flags.d.ts +3 -5
- package/build/commandUtils/flags.js +8 -22
- package/build/commandUtils/new/commands.d.ts +4 -0
- package/build/commandUtils/new/commands.js +61 -0
- package/build/commandUtils/new/configs.d.ts +25 -0
- package/build/commandUtils/new/configs.js +136 -0
- package/build/commandUtils/new/projectFiles.d.ts +8 -0
- package/build/commandUtils/new/projectFiles.js +167 -0
- package/build/commandUtils/new/templates/.eas/workflows/create-development-builds.yml +21 -0
- package/build/commandUtils/new/templates/.eas/workflows/deploy-to-production.yml +68 -0
- package/build/commandUtils/new/templates/.eas/workflows/publish-preview-update.yml +12 -0
- package/build/commandUtils/new/templates/readme-additions.md +36 -0
- package/build/commands/build/resign.d.ts +2 -3
- package/build/commands/deploy/index.d.ts +1 -2
- package/build/commands/env/create.d.ts +1 -2
- package/build/commands/env/create.js +12 -14
- package/build/commands/env/delete.d.ts +1 -2
- package/build/commands/env/delete.js +2 -6
- package/build/commands/env/exec.js +6 -7
- package/build/commands/env/get.d.ts +1 -2
- package/build/commands/env/get.js +4 -6
- package/build/commands/env/list.d.ts +1 -2
- package/build/commands/env/list.js +8 -6
- package/build/commands/env/pull.d.ts +1 -1
- package/build/commands/env/pull.js +8 -8
- package/build/commands/env/push.d.ts +6 -4
- package/build/commands/env/push.js +42 -30
- package/build/commands/env/update.d.ts +2 -3
- package/build/commands/env/update.js +7 -8
- package/build/commands/fingerprint/compare.d.ts +1 -2
- package/build/commands/fingerprint/compare.js +1 -1
- package/build/commands/fingerprint/generate.d.ts +1 -2
- package/build/commands/fingerprint/generate.js +1 -1
- package/build/commands/project/new.d.ts +21 -17
- package/build/commands/project/new.js +62 -291
- package/build/commands/update/configure.d.ts +1 -1
- package/build/commands/update/configure.js +1 -1
- package/build/commands/update/index.d.ts +1 -2
- package/build/commands/update/index.js +1 -1
- package/build/graphql/generated.d.ts +14 -0
- package/build/graphql/queries/EnvironmentVariablesQuery.d.ts +6 -6
- package/build/graphql/queries/EnvironmentVariablesQuery.js +15 -0
- package/build/onboarding/installDependencies.d.ts +4 -2
- package/build/onboarding/installDependencies.js +5 -7
- package/build/onboarding/runCommand.d.ts +2 -1
- package/build/onboarding/runCommand.js +24 -22
- package/build/utils/prompts.d.ts +8 -5
- package/build/utils/prompts.js +69 -10
- package/build/utils/variableUtils.d.ts +1 -3
- package/build/utils/variableUtils.js +1 -6
- package/build/worker/assets.d.ts +1 -2
- package/oclif.manifest.json +58 -114
- package/package.json +7 -6
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateReadmeAsync = exports.copyProjectTemplatesAsync = exports.updatePackageJsonAsync = exports.generateEasConfigAsync = exports.generateAppConfigAsync = exports.cleanAndPrefix = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const eas_json_1 = require("@expo/eas-json");
|
|
6
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
7
|
+
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
8
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
9
|
+
const ts_deepmerge_1 = tslib_1.__importDefault(require("ts-deepmerge"));
|
|
10
|
+
const api_1 = require("../../api");
|
|
11
|
+
const log_1 = tslib_1.__importStar(require("../../log"));
|
|
12
|
+
const easCli_1 = require("../../utils/easCli");
|
|
13
|
+
// Android package names must start with a lowercase letter
|
|
14
|
+
// schemes must start with a lowercase letter and can only contain lowercase letters, digits, "+", "." or "-"
|
|
15
|
+
function cleanAndPrefix(_string, type) {
|
|
16
|
+
let string = _string;
|
|
17
|
+
let pattern = /[^A-Za-z0-9]/g;
|
|
18
|
+
if (type === 'scheme') {
|
|
19
|
+
string = _string.toLowerCase();
|
|
20
|
+
pattern = /[^a-z0-9+.-]/g;
|
|
21
|
+
}
|
|
22
|
+
const prefix = /^[^a-z]/.test(string) ? type : '';
|
|
23
|
+
const cleaned = string.replaceAll(pattern, '');
|
|
24
|
+
return prefix + cleaned;
|
|
25
|
+
}
|
|
26
|
+
exports.cleanAndPrefix = cleanAndPrefix;
|
|
27
|
+
async function generateAppConfigAsync(projectDir, app) {
|
|
28
|
+
const user = cleanAndPrefix(app.ownerAccount.name, 'user');
|
|
29
|
+
const slug = cleanAndPrefix(app.slug, 'app');
|
|
30
|
+
const scheme = cleanAndPrefix(app.name ?? app.slug, 'scheme');
|
|
31
|
+
const bundleIdentifier = `com.${user}.${slug}`;
|
|
32
|
+
const updateUrl = (0, api_1.getEASUpdateURL)(app.id, /* manifestHostOverride */ null);
|
|
33
|
+
const { expo: baseExpoConfig } = await fs_extra_1.default.readJson(path_1.default.join(projectDir, 'app.json'));
|
|
34
|
+
const expoConfig = {
|
|
35
|
+
name: app.name ?? app.slug,
|
|
36
|
+
slug: app.slug,
|
|
37
|
+
scheme,
|
|
38
|
+
extra: {
|
|
39
|
+
eas: {
|
|
40
|
+
projectId: app.id,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
owner: app.ownerAccount.name,
|
|
44
|
+
updates: {
|
|
45
|
+
url: updateUrl,
|
|
46
|
+
},
|
|
47
|
+
runtimeVersion: {
|
|
48
|
+
policy: 'appVersion',
|
|
49
|
+
},
|
|
50
|
+
ios: {
|
|
51
|
+
bundleIdentifier,
|
|
52
|
+
},
|
|
53
|
+
android: {
|
|
54
|
+
package: bundleIdentifier,
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
const mergedConfig = (0, ts_deepmerge_1.default)(baseExpoConfig, expoConfig);
|
|
58
|
+
const appJsonPath = path_1.default.join(projectDir, 'app.json');
|
|
59
|
+
await fs_extra_1.default.writeJson(appJsonPath, { expo: mergedConfig }, { spaces: 2 });
|
|
60
|
+
log_1.default.withTick(`Generated ${chalk_1.default.bold('app.json')}. ${(0, log_1.learnMore)('https://docs.expo.dev/versions/latest/config/app/')}`);
|
|
61
|
+
log_1.default.log();
|
|
62
|
+
}
|
|
63
|
+
exports.generateAppConfigAsync = generateAppConfigAsync;
|
|
64
|
+
async function generateEasConfigAsync(projectDir) {
|
|
65
|
+
const easBuildGitHubConfig = {
|
|
66
|
+
android: {
|
|
67
|
+
image: 'latest',
|
|
68
|
+
},
|
|
69
|
+
ios: {
|
|
70
|
+
image: 'latest',
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
const easJson = {
|
|
74
|
+
cli: {
|
|
75
|
+
version: `>= ${easCli_1.easCliVersion}`,
|
|
76
|
+
appVersionSource: eas_json_1.AppVersionSource.REMOTE,
|
|
77
|
+
},
|
|
78
|
+
build: {
|
|
79
|
+
development: {
|
|
80
|
+
developmentClient: true,
|
|
81
|
+
distribution: 'internal',
|
|
82
|
+
...easBuildGitHubConfig,
|
|
83
|
+
},
|
|
84
|
+
'development-simulator': {
|
|
85
|
+
extends: 'development',
|
|
86
|
+
ios: {
|
|
87
|
+
simulator: true,
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
preview: {
|
|
91
|
+
distribution: 'internal',
|
|
92
|
+
channel: 'main',
|
|
93
|
+
...easBuildGitHubConfig,
|
|
94
|
+
},
|
|
95
|
+
production: {
|
|
96
|
+
channel: 'production',
|
|
97
|
+
autoIncrement: true,
|
|
98
|
+
...easBuildGitHubConfig,
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
submit: {
|
|
102
|
+
production: {},
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
const easJsonPath = path_1.default.join(projectDir, 'eas.json');
|
|
106
|
+
await fs_extra_1.default.writeJson(easJsonPath, easJson, { spaces: 2 });
|
|
107
|
+
log_1.default.withTick(`Generated ${chalk_1.default.bold('eas.json')}. ${(0, log_1.learnMore)('https://docs.expo.dev/build-reference/eas-json/')}`);
|
|
108
|
+
log_1.default.log();
|
|
109
|
+
}
|
|
110
|
+
exports.generateEasConfigAsync = generateEasConfigAsync;
|
|
111
|
+
async function updatePackageJsonAsync(projectDir) {
|
|
112
|
+
const packageJsonPath = path_1.default.join(projectDir, 'package.json');
|
|
113
|
+
const packageJson = await fs_extra_1.default.readJson(packageJsonPath);
|
|
114
|
+
if (!packageJson.scripts) {
|
|
115
|
+
packageJson.scripts = {};
|
|
116
|
+
}
|
|
117
|
+
packageJson.scripts.preview = 'npx eas-cli@latest workflow:run publish-preview-update.yml';
|
|
118
|
+
packageJson.scripts['development-builds'] =
|
|
119
|
+
'npx eas-cli@latest workflow:run create-development-builds.yml';
|
|
120
|
+
packageJson.scripts.deploy = 'npx eas-cli@latest workflow:run deploy-to-production.yml';
|
|
121
|
+
await fs_extra_1.default.writeJson(packageJsonPath, packageJson, { spaces: 2 });
|
|
122
|
+
log_1.default.withTick('Updated package.json with scripts');
|
|
123
|
+
log_1.default.log();
|
|
124
|
+
}
|
|
125
|
+
exports.updatePackageJsonAsync = updatePackageJsonAsync;
|
|
126
|
+
async function copyProjectTemplatesAsync(projectDir) {
|
|
127
|
+
const templatesSourceDir = path_1.default.join(__dirname, 'templates', '.eas', 'workflows');
|
|
128
|
+
const easWorkflowsTargetDir = path_1.default.join(projectDir, '.eas', 'workflows');
|
|
129
|
+
await fs_extra_1.default.copy(templatesSourceDir, easWorkflowsTargetDir, {
|
|
130
|
+
overwrite: true,
|
|
131
|
+
errorOnExist: false,
|
|
132
|
+
});
|
|
133
|
+
log_1.default.withTick('Created EAS workflow files');
|
|
134
|
+
log_1.default.log();
|
|
135
|
+
}
|
|
136
|
+
exports.copyProjectTemplatesAsync = copyProjectTemplatesAsync;
|
|
137
|
+
async function updateReadmeAsync(projectDir, packageManager) {
|
|
138
|
+
const readmeTemplatePath = path_1.default.join(__dirname, 'templates', 'readme-additions.md');
|
|
139
|
+
const projectReadmePath = path_1.default.join(projectDir, 'README.md');
|
|
140
|
+
const readmeAdditions = await fs_extra_1.default.readFile(readmeTemplatePath, 'utf8');
|
|
141
|
+
const existingReadme = await fs_extra_1.default.readFile(projectReadmePath, 'utf8');
|
|
142
|
+
const targetSection = '## Get started';
|
|
143
|
+
const sectionIndex = existingReadme.indexOf(targetSection);
|
|
144
|
+
let mergedReadme;
|
|
145
|
+
if (sectionIndex !== -1) {
|
|
146
|
+
// Find the next ## section after "## Get started"
|
|
147
|
+
const afterTargetSection = existingReadme.substring(sectionIndex);
|
|
148
|
+
const nextSectionMatch = afterTargetSection.match(/\n## /);
|
|
149
|
+
let endIndex = existingReadme.length;
|
|
150
|
+
if (nextSectionMatch?.index !== undefined) {
|
|
151
|
+
// Replace from "## Get started" to the next "##" section
|
|
152
|
+
endIndex = sectionIndex + nextSectionMatch.index;
|
|
153
|
+
}
|
|
154
|
+
const beforeSection = existingReadme.substring(0, sectionIndex).trim();
|
|
155
|
+
const afterSection = existingReadme.substring(endIndex);
|
|
156
|
+
mergedReadme = beforeSection + '\n\n' + readmeAdditions.trim() + '\n\n' + afterSection;
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
// No "Get started" section found, append the template to the existing README
|
|
160
|
+
mergedReadme = existingReadme.trim() + '\n\n' + readmeAdditions.trim();
|
|
161
|
+
}
|
|
162
|
+
mergedReadme = mergedReadme.replaceAll('npm run', `${packageManager} run`);
|
|
163
|
+
await fs_extra_1.default.writeFile(projectReadmePath, mergedReadme);
|
|
164
|
+
log_1.default.withTick('Updated README.md with EAS configuration details');
|
|
165
|
+
log_1.default.log();
|
|
166
|
+
}
|
|
167
|
+
exports.updateReadmeAsync = updateReadmeAsync;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
name: Create development builds
|
|
2
|
+
|
|
3
|
+
jobs:
|
|
4
|
+
android_development_build:
|
|
5
|
+
name: Build Android
|
|
6
|
+
type: build
|
|
7
|
+
params:
|
|
8
|
+
platform: android
|
|
9
|
+
profile: development
|
|
10
|
+
ios_device_development_build:
|
|
11
|
+
name: Build iOS device
|
|
12
|
+
type: build
|
|
13
|
+
params:
|
|
14
|
+
platform: ios
|
|
15
|
+
profile: development
|
|
16
|
+
ios_simulator_development_build:
|
|
17
|
+
name: Build iOS simulator
|
|
18
|
+
type: build
|
|
19
|
+
params:
|
|
20
|
+
platform: ios
|
|
21
|
+
profile: development-simulator
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
name: Deploy to production
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: ['main']
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
fingerprint:
|
|
9
|
+
name: Fingerprint
|
|
10
|
+
type: fingerprint
|
|
11
|
+
get_android_build:
|
|
12
|
+
name: Check for existing android build
|
|
13
|
+
needs: [fingerprint]
|
|
14
|
+
type: get-build
|
|
15
|
+
params:
|
|
16
|
+
fingerprint_hash: ${{ needs.fingerprint.outputs.android_fingerprint_hash }}
|
|
17
|
+
profile: production
|
|
18
|
+
get_ios_build:
|
|
19
|
+
name: Check for existing ios build
|
|
20
|
+
needs: [fingerprint]
|
|
21
|
+
type: get-build
|
|
22
|
+
params:
|
|
23
|
+
fingerprint_hash: ${{ needs.fingerprint.outputs.ios_fingerprint_hash }}
|
|
24
|
+
profile: production
|
|
25
|
+
build_android:
|
|
26
|
+
name: Build Android
|
|
27
|
+
needs: [get_android_build]
|
|
28
|
+
if: ${{ !needs.get_android_build.outputs.build_id }}
|
|
29
|
+
type: build
|
|
30
|
+
params:
|
|
31
|
+
platform: android
|
|
32
|
+
profile: production
|
|
33
|
+
build_ios:
|
|
34
|
+
name: Build iOS
|
|
35
|
+
needs: [get_ios_build]
|
|
36
|
+
if: ${{ !needs.get_ios_build.outputs.build_id }}
|
|
37
|
+
type: build
|
|
38
|
+
params:
|
|
39
|
+
platform: ios
|
|
40
|
+
profile: production
|
|
41
|
+
submit_android_build:
|
|
42
|
+
name: Submit Android Build
|
|
43
|
+
needs: [build_android]
|
|
44
|
+
type: submit
|
|
45
|
+
params:
|
|
46
|
+
build_id: ${{ needs.build_android.outputs.build_id }}
|
|
47
|
+
submit_ios_build:
|
|
48
|
+
name: Submit iOS Build
|
|
49
|
+
needs: [build_ios]
|
|
50
|
+
type: submit
|
|
51
|
+
params:
|
|
52
|
+
build_id: ${{ needs.build_ios.outputs.build_id }}
|
|
53
|
+
publish_android_update:
|
|
54
|
+
name: Publish Android update
|
|
55
|
+
needs: [get_android_build]
|
|
56
|
+
if: ${{ needs.get_android_build.outputs.build_id }}
|
|
57
|
+
type: update
|
|
58
|
+
params:
|
|
59
|
+
branch: production
|
|
60
|
+
platform: android
|
|
61
|
+
publish_ios_update:
|
|
62
|
+
name: Publish iOS update
|
|
63
|
+
needs: [get_ios_build]
|
|
64
|
+
if: ${{ needs.get_ios_build.outputs.build_id }}
|
|
65
|
+
type: update
|
|
66
|
+
params:
|
|
67
|
+
branch: production
|
|
68
|
+
platform: ios
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
## Get started
|
|
2
|
+
|
|
3
|
+
To start the app, in your terminal run:
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm run start
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
In the output, you'll find options to open the app in:
|
|
10
|
+
|
|
11
|
+
- [a development build](https://docs.expo.dev/develop/development-builds/introduction/)
|
|
12
|
+
- [an Android emulator](https://docs.expo.dev/workflow/android-studio-emulator/)
|
|
13
|
+
- [an iOS simulator](https://docs.expo.dev/workflow/ios-simulator/)
|
|
14
|
+
- [Expo Go](https://expo.dev/go), a limited sandbox for trying out app development with Expo
|
|
15
|
+
|
|
16
|
+
You can start developing by editing the files inside the **app** directory. This project uses [file-based routing](https://docs.expo.dev/router/introduction).
|
|
17
|
+
|
|
18
|
+
## Workflows
|
|
19
|
+
|
|
20
|
+
This project is configured to use [EAS Workflows](https://docs.expo.dev/eas/workflows/get-started/) to automate some development and release processes. These commands are set up in [`package.json`](./package.json) and can be run using NPM scripts in your terminal.
|
|
21
|
+
|
|
22
|
+
### Previews
|
|
23
|
+
|
|
24
|
+
Run `npm run preview` to [publish a preview update](https://docs.expo.dev/eas/workflows/examples/publish-preview-update/) of your project, which can be viewed in Expo Go or in a development build.
|
|
25
|
+
|
|
26
|
+
### Development Builds
|
|
27
|
+
|
|
28
|
+
Run `npm run development-builds` to [create a development build](https://docs.expo.dev/eas/workflows/examples/create-development-builds/). Note - you'll need to follow the [Prerequisites](https://docs.expo.dev/eas/workflows/examples/create-development-builds/#prerequisites) to ensure you have the correct emulator setup on your machine.
|
|
29
|
+
|
|
30
|
+
### Production Deployments
|
|
31
|
+
|
|
32
|
+
Run `npm run deploy` to [deploy to production](https://docs.expo.dev/eas/workflows/examples/deploy-to-production/). Note - you'll need to follow the [Prerequisites](https://docs.expo.dev/eas/workflows/examples/deploy-to-production/#prerequisites) to ensure you're set up to submit to the Apple and Google stores.
|
|
33
|
+
|
|
34
|
+
## Hosting
|
|
35
|
+
|
|
36
|
+
Expo offers hosting for websites and API functions via EAS Hosting. See the [Getting Started](https://docs.expo.dev/eas/hosting/get-started/) guide to learn more.
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Platform } from '@expo/eas-build-job';
|
|
2
|
-
import { EnvironmentVariableEnvironment } from '../../build/utils/environment';
|
|
3
2
|
import EasCommand from '../../commandUtils/EasCommand';
|
|
4
3
|
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
|
|
5
4
|
import { BuildFragment } from '../../graphql/generated';
|
|
@@ -13,7 +12,7 @@ interface BuildResignFlags {
|
|
|
13
12
|
sourceProfile?: string;
|
|
14
13
|
maybeBuildId?: string;
|
|
15
14
|
wait: boolean;
|
|
16
|
-
environment?:
|
|
15
|
+
environment?: string;
|
|
17
16
|
}
|
|
18
17
|
interface RawBuildResignFlags {
|
|
19
18
|
json: boolean;
|
|
@@ -25,7 +24,7 @@ interface RawBuildResignFlags {
|
|
|
25
24
|
'source-profile': string | undefined;
|
|
26
25
|
wait: boolean;
|
|
27
26
|
id: string | undefined;
|
|
28
|
-
environment:
|
|
27
|
+
environment: string | undefined;
|
|
29
28
|
}
|
|
30
29
|
export default class BuildResign extends EasCommand {
|
|
31
30
|
static description: string;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { EnvironmentVariableEnvironment } from '../../build/utils/environment';
|
|
2
1
|
import EasCommand from '../../commandUtils/EasCommand';
|
|
3
2
|
export default class WorkerDeploy extends EasCommand {
|
|
4
3
|
static description: string;
|
|
@@ -8,7 +7,7 @@ export default class WorkerDeploy extends EasCommand {
|
|
|
8
7
|
static flags: {
|
|
9
8
|
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
10
9
|
'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
|
-
environment: import("@oclif/core/lib/interfaces").OptionFlag<
|
|
10
|
+
environment: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
12
11
|
prod: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
13
12
|
alias: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
14
13
|
id: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { EnvironmentVariableEnvironment } from '../../build/utils/environment';
|
|
2
1
|
import EasCommand from '../../commandUtils/EasCommand';
|
|
3
2
|
import { EASEnvironmentVariableScopeFlagValue } from '../../commandUtils/flags';
|
|
4
3
|
export default class EnvCreate extends EasCommand {
|
|
@@ -10,7 +9,7 @@ export default class EnvCreate extends EasCommand {
|
|
|
10
9
|
}[];
|
|
11
10
|
static flags: {
|
|
12
11
|
'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
13
|
-
environment: import("@oclif/core/lib/interfaces").OptionFlag<
|
|
12
|
+
environment: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined>;
|
|
14
13
|
scope: import("@oclif/core/lib/interfaces").OptionFlag<EASEnvironmentVariableScopeFlagValue>;
|
|
15
14
|
visibility: import("@oclif/core/lib/interfaces").OptionFlag<"plaintext" | "sensitive" | "secret" | undefined>;
|
|
16
15
|
name: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
@@ -14,13 +14,12 @@ const log_1 = tslib_1.__importDefault(require("../../log"));
|
|
|
14
14
|
const projectUtils_1 = require("../../project/projectUtils");
|
|
15
15
|
const prompts_1 = require("../../prompts");
|
|
16
16
|
const prompts_2 = require("../../utils/prompts");
|
|
17
|
-
const variableUtils_1 = require("../../utils/variableUtils");
|
|
18
17
|
class EnvCreate extends EasCommand_1.default {
|
|
19
18
|
static description = 'create an environment variable for the current project or account';
|
|
20
19
|
static args = [
|
|
21
20
|
{
|
|
22
21
|
name: 'environment',
|
|
23
|
-
description: "Environment to create the variable in.
|
|
22
|
+
description: "Environment to create the variable in. Default environments are 'production', 'preview', and 'development'.",
|
|
24
23
|
required: false,
|
|
25
24
|
},
|
|
26
25
|
];
|
|
@@ -52,10 +51,10 @@ class EnvCreate extends EasCommand_1.default {
|
|
|
52
51
|
async runAsync() {
|
|
53
52
|
const { args, flags } = await this.parse(EnvCreate);
|
|
54
53
|
const validatedFlags = this.sanitizeFlags(flags);
|
|
55
|
-
const { name, value, scope, 'non-interactive': nonInteractive, environment: environments, visibility, force, type, fileName, } = await this.promptForMissingFlagsAsync(validatedFlags, args);
|
|
56
54
|
const { projectId, loggedIn: { graphqlClient }, } = await this.getContextAsync(EnvCreate, {
|
|
57
|
-
nonInteractive,
|
|
55
|
+
nonInteractive: validatedFlags['non-interactive'],
|
|
58
56
|
});
|
|
57
|
+
const { name, value, scope, 'non-interactive': nonInteractive, environment: environments, visibility, force, type, fileName, } = await this.promptForMissingFlagsAsync(validatedFlags, args, { graphqlClient, projectId });
|
|
59
58
|
const [projectDisplayName, ownerAccount] = await Promise.all([
|
|
60
59
|
(0, projectUtils_1.getDisplayNameForProjectIdAsync)(graphqlClient, projectId),
|
|
61
60
|
(0, projectUtils_1.getOwnerAccountForProjectIdAsync)(graphqlClient, projectId),
|
|
@@ -152,7 +151,7 @@ class EnvCreate extends EasCommand_1.default {
|
|
|
152
151
|
throw new Error(`${message} Use --force to overwrite it.`);
|
|
153
152
|
}
|
|
154
153
|
}
|
|
155
|
-
async promptForMissingFlagsAsync({ name, value, environment: environments, visibility, 'non-interactive': nonInteractive, type, ...rest }, { environment }) {
|
|
154
|
+
async promptForMissingFlagsAsync({ name, value, environment: environments, visibility, 'non-interactive': nonInteractive, type, ...rest }, { environment }, { graphqlClient, projectId }) {
|
|
156
155
|
if (!name) {
|
|
157
156
|
name = await (0, prompts_2.promptVariableNameAsync)(nonInteractive);
|
|
158
157
|
}
|
|
@@ -187,16 +186,15 @@ class EnvCreate extends EasCommand_1.default {
|
|
|
187
186
|
fileName = path_1.default.basename(environmentFilePath);
|
|
188
187
|
}
|
|
189
188
|
value = environmentFilePath ? await fs_extra_1.default.readFile(environmentFilePath, 'base64') : value;
|
|
190
|
-
|
|
191
|
-
throw new Error("Invalid environment. Use one of 'production', 'preview', or 'development'.");
|
|
192
|
-
}
|
|
193
|
-
let newEnvironments = environments
|
|
194
|
-
? environments
|
|
195
|
-
: environment
|
|
196
|
-
? [environment.toLowerCase()]
|
|
197
|
-
: undefined;
|
|
189
|
+
let newEnvironments = environments ? environments : environment ? [environment] : undefined;
|
|
198
190
|
if (!newEnvironments) {
|
|
199
|
-
newEnvironments = await (0, prompts_2.promptVariableEnvironmentAsync)({
|
|
191
|
+
newEnvironments = await (0, prompts_2.promptVariableEnvironmentAsync)({
|
|
192
|
+
nonInteractive,
|
|
193
|
+
multiple: true,
|
|
194
|
+
canEnterCustomEnvironment: true,
|
|
195
|
+
graphqlClient,
|
|
196
|
+
projectId,
|
|
197
|
+
});
|
|
200
198
|
if (!newEnvironments || newEnvironments.length === 0) {
|
|
201
199
|
throw new Error('No environments selected');
|
|
202
200
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { EnvironmentVariableEnvironment } from '../../build/utils/environment';
|
|
2
1
|
import EasCommand from '../../commandUtils/EasCommand';
|
|
3
2
|
import { EASEnvironmentVariableScopeFlagValue } from '../../commandUtils/flags';
|
|
4
3
|
export default class EnvDelete extends EasCommand {
|
|
@@ -7,7 +6,7 @@ export default class EnvDelete extends EasCommand {
|
|
|
7
6
|
'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
8
7
|
scope: import("@oclif/core/lib/interfaces").OptionFlag<EASEnvironmentVariableScopeFlagValue>;
|
|
9
8
|
'variable-name': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
10
|
-
'variable-environment': import("@oclif/core/lib/interfaces").OptionFlag<
|
|
9
|
+
'variable-environment': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
11
10
|
};
|
|
12
11
|
static args: {
|
|
13
12
|
name: string;
|
|
@@ -18,7 +18,7 @@ class EnvDelete extends EasCommand_1.default {
|
|
|
18
18
|
'variable-name': core_1.Flags.string({
|
|
19
19
|
description: 'Name of the variable to delete',
|
|
20
20
|
}),
|
|
21
|
-
'variable-environment': core_1.Flags.
|
|
21
|
+
'variable-environment': core_1.Flags.string({
|
|
22
22
|
...flags_1.EasEnvironmentFlagParameters,
|
|
23
23
|
description: 'Current environment of the variable to delete',
|
|
24
24
|
}),
|
|
@@ -28,7 +28,7 @@ class EnvDelete extends EasCommand_1.default {
|
|
|
28
28
|
static args = [
|
|
29
29
|
{
|
|
30
30
|
name: 'environment',
|
|
31
|
-
description: "Current environment of the variable to delete.
|
|
31
|
+
description: "Current environment of the variable to delete. Default environments are 'production', 'preview', and 'development'.",
|
|
32
32
|
required: false,
|
|
33
33
|
},
|
|
34
34
|
];
|
|
@@ -108,10 +108,6 @@ class EnvDelete extends EasCommand_1.default {
|
|
|
108
108
|
? generated_1.EnvironmentVariableScope.Shared
|
|
109
109
|
: generated_1.EnvironmentVariableScope.Project;
|
|
110
110
|
if (environment) {
|
|
111
|
-
environment = environment.toLowerCase();
|
|
112
|
-
if (!(0, variableUtils_1.isEnvironment)(environment)) {
|
|
113
|
-
throw new Error("Invalid environment. Use one of 'production', 'preview', or 'development'.");
|
|
114
|
-
}
|
|
115
111
|
return { ...flags, 'variable-environment': environment, scope };
|
|
116
112
|
}
|
|
117
113
|
return { ...flags, scope };
|
|
@@ -8,7 +8,6 @@ const flags_1 = require("../../commandUtils/flags");
|
|
|
8
8
|
const EnvironmentVariablesQuery_1 = require("../../graphql/queries/EnvironmentVariablesQuery");
|
|
9
9
|
const log_1 = tslib_1.__importDefault(require("../../log"));
|
|
10
10
|
const prompts_1 = require("../../utils/prompts");
|
|
11
|
-
const variableUtils_1 = require("../../utils/variableUtils");
|
|
12
11
|
class EnvExec extends EasCommand_1.default {
|
|
13
12
|
static description = 'execute a command with environment variables from the selected environment';
|
|
14
13
|
static contextDefinition = {
|
|
@@ -22,7 +21,7 @@ class EnvExec extends EasCommand_1.default {
|
|
|
22
21
|
{
|
|
23
22
|
name: 'environment',
|
|
24
23
|
required: true,
|
|
25
|
-
description: "Environment to execute the command in.
|
|
24
|
+
description: "Environment to execute the command in. Default environments are 'production', 'preview', and 'development'.",
|
|
26
25
|
},
|
|
27
26
|
{
|
|
28
27
|
name: 'bash_command',
|
|
@@ -39,7 +38,11 @@ class EnvExec extends EasCommand_1.default {
|
|
|
39
38
|
});
|
|
40
39
|
this.isNonInteractive = parsedFlags.nonInteractive;
|
|
41
40
|
const environment = parsedFlags.environment ??
|
|
42
|
-
(await (0, prompts_1.promptVariableEnvironmentAsync)({
|
|
41
|
+
(await (0, prompts_1.promptVariableEnvironmentAsync)({
|
|
42
|
+
nonInteractive: parsedFlags.nonInteractive,
|
|
43
|
+
graphqlClient,
|
|
44
|
+
projectId,
|
|
45
|
+
}));
|
|
43
46
|
const environmentVariables = await this.loadEnvironmentVariablesAsync({
|
|
44
47
|
graphqlClient,
|
|
45
48
|
projectId,
|
|
@@ -63,10 +66,6 @@ class EnvExec extends EasCommand_1.default {
|
|
|
63
66
|
if (rawFlags['non-interactive'] && (!bash_command || !environment)) {
|
|
64
67
|
throw new Error("You must specify both environment and bash command when running in non-interactive mode. Run command as `eas env:exec ENVIRONMENT 'bash command'`.");
|
|
65
68
|
}
|
|
66
|
-
environment = environment?.toLowerCase();
|
|
67
|
-
if (!(0, variableUtils_1.isEnvironment)(environment)) {
|
|
68
|
-
throw new Error("Invalid environment. Use one of 'production', 'preview', or 'development'.");
|
|
69
|
-
}
|
|
70
69
|
const firstChar = bash_command[0];
|
|
71
70
|
const lastChar = bash_command[bash_command.length - 1];
|
|
72
71
|
const cleanCommand = (firstChar === '"' && lastChar === '"') || (firstChar === "'" && lastChar === "'")
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { EnvironmentVariableEnvironment } from '../../build/utils/environment';
|
|
2
1
|
import EasCommand from '../../commandUtils/EasCommand';
|
|
3
2
|
import { EASEnvironmentVariableScopeFlagValue } from '../../commandUtils/flags';
|
|
4
3
|
export default class EnvGet extends EasCommand {
|
|
@@ -17,7 +16,7 @@ export default class EnvGet extends EasCommand {
|
|
|
17
16
|
scope: import("@oclif/core/lib/interfaces").OptionFlag<EASEnvironmentVariableScopeFlagValue>;
|
|
18
17
|
format: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
19
18
|
'variable-name': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
20
|
-
'variable-environment': import("@oclif/core/lib/interfaces").OptionFlag<
|
|
19
|
+
'variable-environment': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
21
20
|
};
|
|
22
21
|
runAsync(): Promise<void>;
|
|
23
22
|
private sanitizeInputs;
|
|
@@ -19,7 +19,7 @@ class EnvGet extends EasCommand_1.default {
|
|
|
19
19
|
static args = [
|
|
20
20
|
{
|
|
21
21
|
name: 'environment',
|
|
22
|
-
description: "Current environment of the variable.
|
|
22
|
+
description: "Current environment of the variable. Default environments are 'production', 'preview', and 'development'.",
|
|
23
23
|
required: false,
|
|
24
24
|
},
|
|
25
25
|
];
|
|
@@ -27,7 +27,7 @@ class EnvGet extends EasCommand_1.default {
|
|
|
27
27
|
'variable-name': core_1.Flags.string({
|
|
28
28
|
description: 'Name of the variable',
|
|
29
29
|
}),
|
|
30
|
-
'variable-environment': core_1.Flags.
|
|
30
|
+
'variable-environment': core_1.Flags.string({
|
|
31
31
|
...flags_1.EasEnvironmentFlagParameters,
|
|
32
32
|
description: 'Current environment of the variable',
|
|
33
33
|
}),
|
|
@@ -48,6 +48,8 @@ class EnvGet extends EasCommand_1.default {
|
|
|
48
48
|
environment = await (0, prompts_1.promptVariableEnvironmentAsync)({
|
|
49
49
|
nonInteractive,
|
|
50
50
|
multiple: false,
|
|
51
|
+
graphqlClient,
|
|
52
|
+
projectId,
|
|
51
53
|
});
|
|
52
54
|
}
|
|
53
55
|
const variables = await getVariablesAsync(graphqlClient, scope, projectId, name, environment);
|
|
@@ -95,10 +97,6 @@ class EnvGet extends EasCommand_1.default {
|
|
|
95
97
|
? generated_1.EnvironmentVariableScope.Shared
|
|
96
98
|
: generated_1.EnvironmentVariableScope.Project;
|
|
97
99
|
if (environment) {
|
|
98
|
-
environment = environment.toLowerCase();
|
|
99
|
-
if (!(0, variableUtils_1.isEnvironment)(environment)) {
|
|
100
|
-
throw new Error("Invalid environment. Use one of 'production', 'preview', or 'development'.");
|
|
101
|
-
}
|
|
102
100
|
return {
|
|
103
101
|
...flags,
|
|
104
102
|
'variable-environment': environment,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { EnvironmentVariableEnvironment } from '../../build/utils/environment';
|
|
2
1
|
import EasCommand from '../../commandUtils/EasCommand';
|
|
3
2
|
import { EASEnvironmentVariableScopeFlagValue } from '../../commandUtils/flags';
|
|
4
3
|
export default class EnvList extends EasCommand {
|
|
@@ -10,7 +9,7 @@ export default class EnvList extends EasCommand {
|
|
|
10
9
|
static flags: {
|
|
11
10
|
scope: import("@oclif/core/lib/interfaces").OptionFlag<EASEnvironmentVariableScopeFlagValue>;
|
|
12
11
|
format: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
13
|
-
environment: import("@oclif/core/lib/interfaces").OptionFlag<
|
|
12
|
+
environment: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined>;
|
|
14
13
|
'include-sensitive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
15
14
|
'include-file-content': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
16
15
|
};
|
|
@@ -59,7 +59,7 @@ class EnvList extends EasCommand_1.default {
|
|
|
59
59
|
static args = [
|
|
60
60
|
{
|
|
61
61
|
name: 'environment',
|
|
62
|
-
description: "Environment to list the variables from.
|
|
62
|
+
description: "Environment to list the variables from. Default environments are 'production', 'preview', and 'development'.",
|
|
63
63
|
required: false,
|
|
64
64
|
},
|
|
65
65
|
];
|
|
@@ -70,7 +70,12 @@ class EnvList extends EasCommand_1.default {
|
|
|
70
70
|
nonInteractive: true,
|
|
71
71
|
});
|
|
72
72
|
if (!environments) {
|
|
73
|
-
environments = await (0, prompts_1.promptVariableEnvironmentAsync)({
|
|
73
|
+
environments = await (0, prompts_1.promptVariableEnvironmentAsync)({
|
|
74
|
+
nonInteractive,
|
|
75
|
+
multiple: true,
|
|
76
|
+
graphqlClient,
|
|
77
|
+
projectId,
|
|
78
|
+
});
|
|
74
79
|
}
|
|
75
80
|
await (0, variableUtils_1.performForEnvironmentsAsync)(environments, async (environment) => {
|
|
76
81
|
const variables = await getVariablesForScopeAsync(graphqlClient, {
|
|
@@ -105,13 +110,10 @@ class EnvList extends EasCommand_1.default {
|
|
|
105
110
|
});
|
|
106
111
|
}
|
|
107
112
|
sanitizeInputs(flags, { environment }) {
|
|
108
|
-
if (environment && !(0, variableUtils_1.isEnvironment)(environment.toLowerCase())) {
|
|
109
|
-
throw new Error("Invalid environment. Use one of 'production', 'preview', or 'development'.");
|
|
110
|
-
}
|
|
111
113
|
const environments = flags.environment
|
|
112
114
|
? flags.environment
|
|
113
115
|
: environment
|
|
114
|
-
? [environment
|
|
116
|
+
? [environment]
|
|
115
117
|
: undefined;
|
|
116
118
|
return {
|
|
117
119
|
...flags,
|
|
@@ -13,7 +13,7 @@ export default class EnvPull extends EasCommand {
|
|
|
13
13
|
}[];
|
|
14
14
|
static flags: {
|
|
15
15
|
path: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
16
|
-
environment: import("@oclif/core/lib/interfaces").OptionFlag<
|
|
16
|
+
environment: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
17
17
|
'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
18
18
|
};
|
|
19
19
|
runAsync(): Promise<void>;
|