eas-cli 13.2.2 → 13.3.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/README.md +126 -63
- package/build/build/evaluateConfigWithEnvVarsAsync.js +2 -11
- package/build/build/utils/url.d.ts +1 -0
- package/build/build/utils/url.js +5 -1
- package/build/commandUtils/context/contextUtils/loadServerSideEnvironmentVariablesAsync.js +2 -8
- package/build/commands/workflow/create.d.ts +18 -0
- package/build/commands/workflow/create.js +100 -0
- package/build/commands/workflow/run.d.ts +0 -2
- package/build/commands/workflow/run.js +25 -6
- package/build/commands/workflow/validate.d.ts +9 -1
- package/build/commands/workflow/validate.js +47 -50
- package/build/graphql/generated.d.ts +59 -2
- package/build/graphql/generated.js +8 -1
- package/build/graphql/mutations/WorkflowRevisionMutation.d.ts +33 -0
- package/build/graphql/mutations/WorkflowRevisionMutation.js +32 -0
- package/build/utils/prompts.js +1 -1
- package/build/utils/workflowFile.d.ts +16 -0
- package/build/utils/workflowFile.js +64 -0
- package/oclif.manifest.json +42 -5
- package/package.json +5 -2
|
@@ -5,3 +5,4 @@ export declare function getArtifactUrl(artifactId: string): string;
|
|
|
5
5
|
export declare function getInternalDistributionInstallUrl(build: BuildFragment): string;
|
|
6
6
|
export declare function getUpdateGroupUrl(accountName: string, projectName: string, updateGroupId: string): string;
|
|
7
7
|
export declare function getWorkflowRunUrl(accountName: string, projectName: string, workflowRunId: string): string;
|
|
8
|
+
export declare function getProjectGitHubSettingsUrl(accountName: string, projectName: string): string;
|
package/build/build/utils/url.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getWorkflowRunUrl = exports.getUpdateGroupUrl = exports.getInternalDistributionInstallUrl = exports.getArtifactUrl = exports.getBuildLogsUrl = exports.getProjectDashboardUrl = void 0;
|
|
3
|
+
exports.getProjectGitHubSettingsUrl = exports.getWorkflowRunUrl = exports.getUpdateGroupUrl = exports.getInternalDistributionInstallUrl = exports.getArtifactUrl = exports.getBuildLogsUrl = exports.getProjectDashboardUrl = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const assert_1 = tslib_1.__importDefault(require("assert"));
|
|
6
6
|
const api_1 = require("../../api");
|
|
@@ -37,3 +37,7 @@ function getWorkflowRunUrl(accountName, projectName, workflowRunId) {
|
|
|
37
37
|
return new URL(`/accounts/${encodeURIComponent(accountName)}/projects/${encodeURIComponent(projectName)}/workflows/${workflowRunId}`, (0, api_1.getExpoWebsiteBaseUrl)()).toString();
|
|
38
38
|
}
|
|
39
39
|
exports.getWorkflowRunUrl = getWorkflowRunUrl;
|
|
40
|
+
function getProjectGitHubSettingsUrl(accountName, projectName) {
|
|
41
|
+
return new URL(`/accounts/${encodeURIComponent(accountName)}/projects/${encodeURIComponent(projectName)}/github`, (0, api_1.getExpoWebsiteBaseUrl)()).toString();
|
|
42
|
+
}
|
|
43
|
+
exports.getProjectGitHubSettingsUrl = getProjectGitHubSettingsUrl;
|
|
@@ -24,16 +24,10 @@ async function loadServerSideEnvironmentVariablesAsync({ environment, projectId,
|
|
|
24
24
|
.filter(({ name, value }) => name && value)
|
|
25
25
|
.map(({ name, value }) => [name, value]));
|
|
26
26
|
if (Object.keys(serverEnvVars).length > 0) {
|
|
27
|
-
log_1.default.log(`Environment variables loaded from the "${environment.toLowerCase()}" environment on EAS servers: ${Object.keys(serverEnvVars).join(', ')}.`);
|
|
27
|
+
log_1.default.log(`Environment variables with visibility "Plain text" and "Sensitive" loaded from the "${environment.toLowerCase()}" environment on EAS servers: ${Object.keys(serverEnvVars).join(', ')}.`);
|
|
28
28
|
}
|
|
29
29
|
else {
|
|
30
|
-
log_1.default.log(`No
|
|
31
|
-
}
|
|
32
|
-
const encryptedEnvVars = environmentVariables.filter(({ name, value }) => name && !value);
|
|
33
|
-
if (encryptedEnvVars.length > 0) {
|
|
34
|
-
log_1.default.warn(`Some environment variables defined in the "${environment.toLowerCase()}" environment on EAS servers are of "encrypted" type and cannot be read outside of the EAS servers (including EAS CLI): ${encryptedEnvVars
|
|
35
|
-
.map(({ name }) => name)
|
|
36
|
-
.join(', ')}. `);
|
|
30
|
+
log_1.default.log(`No environment variables with visibility "Plain text" and "Sensitive" found for the "${environment.toLowerCase()}" environment on EAS servers.`);
|
|
37
31
|
}
|
|
38
32
|
log_1.default.newLine();
|
|
39
33
|
cachedServerSideEnvironmentVariables[environment] = serverEnvVars;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import EasCommand from '../../commandUtils/EasCommand';
|
|
2
|
+
export declare class WorkflowCreate extends EasCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static args: {
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
required: boolean;
|
|
8
|
+
}[];
|
|
9
|
+
static flags: {
|
|
10
|
+
'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
};
|
|
12
|
+
static contextDefinition: {
|
|
13
|
+
projectDir: import("../../commandUtils/context/ProjectDirContextField").default;
|
|
14
|
+
};
|
|
15
|
+
runAsync(): Promise<void>;
|
|
16
|
+
private ensureWorkflowsDirectoryExistsAsync;
|
|
17
|
+
private createWorkflowFileAsync;
|
|
18
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.WorkflowCreate = void 0;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
7
|
+
const promises_1 = tslib_1.__importDefault(require("fs/promises"));
|
|
8
|
+
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
9
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
10
|
+
const prompts_1 = tslib_1.__importDefault(require("prompts"));
|
|
11
|
+
const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
|
|
12
|
+
const flags_1 = require("../../commandUtils/flags");
|
|
13
|
+
const log_1 = tslib_1.__importDefault(require("../../log"));
|
|
14
|
+
const workflowFile_1 = require("../../utils/workflowFile");
|
|
15
|
+
const DEFAULT_WORKFLOW_NAME = 'workflow.yml';
|
|
16
|
+
const HELLO_WORLD_TEMPLATE = `name: Hello World
|
|
17
|
+
|
|
18
|
+
on:
|
|
19
|
+
push:
|
|
20
|
+
branches: ['*']
|
|
21
|
+
|
|
22
|
+
jobs:
|
|
23
|
+
hello_world:
|
|
24
|
+
steps:
|
|
25
|
+
- uses: eas/checkout
|
|
26
|
+
- run: echo "Hello, World"
|
|
27
|
+
`;
|
|
28
|
+
class WorkflowCreate extends EasCommand_1.default {
|
|
29
|
+
async runAsync() {
|
|
30
|
+
const { args: { name: argFileName }, flags, } = await this.parse(_a);
|
|
31
|
+
const { projectDir } = await this.getContextAsync(_a, {
|
|
32
|
+
nonInteractive: flags['non-interactive'],
|
|
33
|
+
});
|
|
34
|
+
let fileName = argFileName;
|
|
35
|
+
if (!fileName) {
|
|
36
|
+
const response = await (0, prompts_1.default)({
|
|
37
|
+
type: 'text',
|
|
38
|
+
name: 'fileName',
|
|
39
|
+
message: 'What would you like to name your workflow file?',
|
|
40
|
+
initial: DEFAULT_WORKFLOW_NAME,
|
|
41
|
+
validate: value => {
|
|
42
|
+
try {
|
|
43
|
+
workflowFile_1.WorkflowFile.validateYamlExtension(value);
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
return error instanceof Error ? error.message : 'Invalid file name';
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
if (!response.fileName) {
|
|
52
|
+
log_1.default.warn('Workflow creation cancelled.');
|
|
53
|
+
process.exit(0);
|
|
54
|
+
}
|
|
55
|
+
fileName = response.fileName;
|
|
56
|
+
}
|
|
57
|
+
try {
|
|
58
|
+
await this.ensureWorkflowsDirectoryExistsAsync({ projectDir });
|
|
59
|
+
await this.createWorkflowFileAsync({ fileName, projectDir });
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
log_1.default.error('Failed to create workflow file.');
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
async ensureWorkflowsDirectoryExistsAsync({ projectDir, }) {
|
|
67
|
+
try {
|
|
68
|
+
await promises_1.default.access(path_1.default.join(projectDir, '.eas', 'workflows'));
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
await promises_1.default.mkdir(path_1.default.join(projectDir, '.eas', 'workflows'), { recursive: true });
|
|
72
|
+
log_1.default.withTick(`Created directory ${chalk_1.default.bold(path_1.default.join(projectDir, '.eas', 'workflows'))}`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
async createWorkflowFileAsync({ fileName, projectDir, }) {
|
|
76
|
+
workflowFile_1.WorkflowFile.validateYamlExtension(fileName);
|
|
77
|
+
const filePath = path_1.default.join(projectDir, '.eas', 'workflows', fileName);
|
|
78
|
+
if (await fs_extra_1.default.pathExists(filePath)) {
|
|
79
|
+
throw new Error(`Workflow file already exists: ${filePath}`);
|
|
80
|
+
}
|
|
81
|
+
await promises_1.default.writeFile(filePath, HELLO_WORLD_TEMPLATE);
|
|
82
|
+
log_1.default.withTick(`Created ${chalk_1.default.bold(filePath)}`);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
exports.WorkflowCreate = WorkflowCreate;
|
|
86
|
+
_a = WorkflowCreate;
|
|
87
|
+
WorkflowCreate.description = 'create a new workflow configuration YAML file';
|
|
88
|
+
WorkflowCreate.args = [
|
|
89
|
+
{
|
|
90
|
+
name: 'name',
|
|
91
|
+
description: 'Name of the workflow file (must end with .yml or .yaml)',
|
|
92
|
+
required: false,
|
|
93
|
+
},
|
|
94
|
+
];
|
|
95
|
+
WorkflowCreate.flags = {
|
|
96
|
+
...flags_1.EASNonInteractiveFlag,
|
|
97
|
+
};
|
|
98
|
+
WorkflowCreate.contextDefinition = {
|
|
99
|
+
..._a.ContextOptions.ProjectDir,
|
|
100
|
+
};
|
|
@@ -2,28 +2,34 @@
|
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
5
|
+
const core_1 = require("@urql/core");
|
|
6
6
|
const path = tslib_1.__importStar(require("node:path"));
|
|
7
7
|
const url_1 = require("../../build/utils/url");
|
|
8
8
|
const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
|
|
9
9
|
const flags_1 = require("../../commandUtils/flags");
|
|
10
10
|
const generated_1 = require("../../graphql/generated");
|
|
11
|
+
const WorkflowRevisionMutation_1 = require("../../graphql/mutations/WorkflowRevisionMutation");
|
|
11
12
|
const WorkflowRunMutation_1 = require("../../graphql/mutations/WorkflowRunMutation");
|
|
12
13
|
const log_1 = tslib_1.__importStar(require("../../log"));
|
|
13
14
|
const projectUtils_1 = require("../../project/projectUtils");
|
|
14
15
|
const uploadAccountScopedEasJsonAsync_1 = require("../../project/uploadAccountScopedEasJsonAsync");
|
|
15
16
|
const uploadAccountScopedProjectSourceAsync_1 = require("../../project/uploadAccountScopedProjectSourceAsync");
|
|
17
|
+
const workflowFile_1 = require("../../utils/workflowFile");
|
|
16
18
|
class WorkflowRun extends EasCommand_1.default {
|
|
17
19
|
async runAsync() {
|
|
18
20
|
const { flags, args } = await this.parse(_a);
|
|
19
|
-
log_1.default.warn('Workflows are in beta and subject to breaking changes.');
|
|
20
21
|
const { getDynamicPrivateProjectConfigAsync, loggedIn: { graphqlClient }, vcsClient, projectDir, } = await this.getContextAsync(_a, {
|
|
21
22
|
nonInteractive: flags['non-interactive'],
|
|
22
23
|
withServerSideEnvironment: null,
|
|
23
24
|
});
|
|
24
25
|
let yamlConfig;
|
|
25
26
|
try {
|
|
26
|
-
|
|
27
|
+
const workflowFileContents = await workflowFile_1.WorkflowFile.readWorkflowFileContentsAsync({
|
|
28
|
+
projectDir,
|
|
29
|
+
filePath: args.file,
|
|
30
|
+
});
|
|
31
|
+
log_1.default.log(`Using workflow file from ${workflowFileContents.filePath}`);
|
|
32
|
+
yamlConfig = workflowFileContents.yamlConfig;
|
|
27
33
|
}
|
|
28
34
|
catch (err) {
|
|
29
35
|
log_1.default.error('Failed to read workflow file.');
|
|
@@ -31,6 +37,22 @@ class WorkflowRun extends EasCommand_1.default {
|
|
|
31
37
|
}
|
|
32
38
|
const { projectId, exp: { slug: projectName }, } = await getDynamicPrivateProjectConfigAsync();
|
|
33
39
|
const account = await (0, projectUtils_1.getOwnerAccountForProjectIdAsync)(graphqlClient, projectId);
|
|
40
|
+
try {
|
|
41
|
+
await WorkflowRevisionMutation_1.WorkflowRevisionMutation.validateWorkflowYamlConfigAsync(graphqlClient, {
|
|
42
|
+
appId: projectId,
|
|
43
|
+
yamlConfig,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
if (error instanceof core_1.CombinedError) {
|
|
48
|
+
workflowFile_1.WorkflowFile.maybePrintWorkflowFileValidationErrors({
|
|
49
|
+
error,
|
|
50
|
+
accountName: account.name,
|
|
51
|
+
projectName,
|
|
52
|
+
});
|
|
53
|
+
throw error;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
34
56
|
let projectArchiveBucketKey;
|
|
35
57
|
let easJsonBucketKey;
|
|
36
58
|
try {
|
|
@@ -75,9 +97,6 @@ class WorkflowRun extends EasCommand_1.default {
|
|
|
75
97
|
}
|
|
76
98
|
_a = WorkflowRun;
|
|
77
99
|
WorkflowRun.description = 'Run an EAS workflow';
|
|
78
|
-
// TODO(@sjchmiela): Keep command hidden until workflows are live
|
|
79
|
-
WorkflowRun.hidden = true;
|
|
80
|
-
WorkflowRun.state = 'beta';
|
|
81
100
|
WorkflowRun.args = [{ name: 'file', description: 'Path to the workflow file to run' }];
|
|
82
101
|
WorkflowRun.flags = {
|
|
83
102
|
...flags_1.EASNonInteractiveFlag,
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
import EasCommand from '../../commandUtils/EasCommand';
|
|
2
2
|
export declare class WorkflowValidate extends EasCommand {
|
|
3
3
|
static description: string;
|
|
4
|
-
static hidden: boolean;
|
|
5
4
|
static args: {
|
|
6
5
|
name: string;
|
|
7
6
|
description: string;
|
|
8
7
|
required: boolean;
|
|
9
8
|
}[];
|
|
9
|
+
static flags: {
|
|
10
|
+
'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
};
|
|
12
|
+
static contextDefinition: {
|
|
13
|
+
loggedIn: import("../../commandUtils/context/LoggedInContextField").default;
|
|
14
|
+
projectDir: import("../../commandUtils/context/ProjectDirContextField").default;
|
|
15
|
+
getDynamicPublicProjectConfigAsync: import("../../commandUtils/context/DynamicProjectConfigContextField").DynamicPublicProjectConfigContextField;
|
|
16
|
+
getDynamicPrivateProjectConfigAsync: import("../../commandUtils/context/DynamicProjectConfigContextField").DynamicPrivateProjectConfigContextField;
|
|
17
|
+
};
|
|
10
18
|
runAsync(): Promise<void>;
|
|
11
19
|
}
|
|
@@ -1,19 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var _a;
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
exports.WorkflowValidate = void 0;
|
|
4
5
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
6
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
6
|
+
const core_1 = require("@urql/core");
|
|
7
7
|
const YAML = tslib_1.__importStar(require("yaml"));
|
|
8
8
|
const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
|
|
9
|
+
const flags_1 = require("../../commandUtils/flags");
|
|
10
|
+
const WorkflowRevisionMutation_1 = require("../../graphql/mutations/WorkflowRevisionMutation");
|
|
9
11
|
const log_1 = tslib_1.__importDefault(require("../../log"));
|
|
10
12
|
const ora_1 = require("../../ora");
|
|
13
|
+
const projectUtils_1 = require("../../project/projectUtils");
|
|
14
|
+
const workflowFile_1 = require("../../utils/workflowFile");
|
|
11
15
|
class WorkflowValidate extends EasCommand_1.default {
|
|
12
16
|
async runAsync() {
|
|
13
|
-
const { args: { path: filePath }, } = await this.parse(
|
|
17
|
+
const { args: { path: filePath }, flags, } = await this.parse(_a);
|
|
18
|
+
const { getDynamicPrivateProjectConfigAsync, loggedIn: { graphqlClient }, projectDir, } = await this.getContextAsync(_a, {
|
|
19
|
+
nonInteractive: flags['non-interactive'],
|
|
20
|
+
withServerSideEnvironment: null,
|
|
21
|
+
});
|
|
22
|
+
const { projectId, exp: { slug: projectName }, } = await getDynamicPrivateProjectConfigAsync();
|
|
23
|
+
const account = await (0, projectUtils_1.getOwnerAccountForProjectIdAsync)(graphqlClient, projectId);
|
|
14
24
|
const spinner = (0, ora_1.ora)().start('Validating the workflow YAML file…');
|
|
15
25
|
try {
|
|
16
|
-
await
|
|
26
|
+
const workflowFileContents = await workflowFile_1.WorkflowFile.readWorkflowFileContentsAsync({
|
|
27
|
+
projectDir,
|
|
28
|
+
filePath,
|
|
29
|
+
});
|
|
30
|
+
log_1.default.log(`Using workflow file from ${workflowFileContents.filePath}`);
|
|
31
|
+
const parsedYaml = YAML.parse(workflowFileContents.yamlConfig);
|
|
32
|
+
// Check if the parsed result is empty or null
|
|
33
|
+
if (parsedYaml === null ||
|
|
34
|
+
parsedYaml === undefined ||
|
|
35
|
+
(typeof parsedYaml === 'object' && Object.keys(parsedYaml).length === 0)) {
|
|
36
|
+
throw new Error('YAML file is empty or contains only comments.');
|
|
37
|
+
}
|
|
38
|
+
await WorkflowRevisionMutation_1.WorkflowRevisionMutation.validateWorkflowYamlConfigAsync(graphqlClient, {
|
|
39
|
+
appId: projectId,
|
|
40
|
+
yamlConfig: workflowFileContents.yamlConfig,
|
|
41
|
+
});
|
|
17
42
|
spinner.succeed('Workflow configuration YAML is valid.');
|
|
18
43
|
}
|
|
19
44
|
catch (error) {
|
|
@@ -21,19 +46,27 @@ class WorkflowValidate extends EasCommand_1.default {
|
|
|
21
46
|
if (error instanceof YAML.YAMLParseError) {
|
|
22
47
|
log_1.default.error(`YAML syntax error: ${error.message}`);
|
|
23
48
|
}
|
|
49
|
+
else if (error instanceof core_1.CombinedError) {
|
|
50
|
+
workflowFile_1.WorkflowFile.maybePrintWorkflowFileValidationErrors({
|
|
51
|
+
error,
|
|
52
|
+
accountName: account.name,
|
|
53
|
+
projectName,
|
|
54
|
+
});
|
|
55
|
+
throw error;
|
|
56
|
+
}
|
|
24
57
|
else if (error instanceof Error) {
|
|
25
58
|
log_1.default.error(error.message);
|
|
26
59
|
}
|
|
27
60
|
else {
|
|
28
61
|
log_1.default.error(`Unexpected error: ${String(error)}`);
|
|
29
62
|
}
|
|
30
|
-
|
|
63
|
+
throw error;
|
|
31
64
|
}
|
|
32
65
|
}
|
|
33
66
|
}
|
|
34
67
|
exports.WorkflowValidate = WorkflowValidate;
|
|
68
|
+
_a = WorkflowValidate;
|
|
35
69
|
WorkflowValidate.description = 'validate a workflow configuration yaml file';
|
|
36
|
-
WorkflowValidate.hidden = true;
|
|
37
70
|
WorkflowValidate.args = [
|
|
38
71
|
{
|
|
39
72
|
name: 'path',
|
|
@@ -41,47 +74,11 @@ WorkflowValidate.args = [
|
|
|
41
74
|
required: true,
|
|
42
75
|
},
|
|
43
76
|
];
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
function checkIfValidYAMLFileExtension(filePath) {
|
|
53
|
-
const fileExtension = path_1.default.extname(filePath).toLowerCase();
|
|
54
|
-
if (fileExtension !== '.yml' && fileExtension !== '.yaml') {
|
|
55
|
-
throw new Error('File must have a .yml or .yaml extension');
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
async function validateYAMLAsync(filePath) {
|
|
59
|
-
await checkIfFileExistsAsync(filePath);
|
|
60
|
-
checkIfValidYAMLFileExtension(filePath);
|
|
61
|
-
try {
|
|
62
|
-
const fileContents = await promises_1.default.readFile(filePath, 'utf8');
|
|
63
|
-
// First check if the file is empty or only contains whitespace
|
|
64
|
-
if (!fileContents.trim()) {
|
|
65
|
-
throw new Error('YAML file is empty or contains only comments.');
|
|
66
|
-
}
|
|
67
|
-
const parsedYaml = YAML.parse(fileContents);
|
|
68
|
-
// Check if the parsed result is empty or null
|
|
69
|
-
if (parsedYaml === null ||
|
|
70
|
-
parsedYaml === undefined ||
|
|
71
|
-
(typeof parsedYaml === 'object' && Object.keys(parsedYaml).length === 0)) {
|
|
72
|
-
throw new Error('YAML file is empty or contains only comments.');
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
catch (error) {
|
|
76
|
-
if (error instanceof Error &&
|
|
77
|
-
error.message === 'YAML file is empty or contains only comments.') {
|
|
78
|
-
throw error;
|
|
79
|
-
}
|
|
80
|
-
if (error instanceof YAML.YAMLParseError || error instanceof Error) {
|
|
81
|
-
throw new Error(`YAML parsing error: ${error.message}`);
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
throw new Error(`YAML parsing error: ${String(error)}`);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
77
|
+
WorkflowValidate.flags = {
|
|
78
|
+
...flags_1.EASNonInteractiveFlag,
|
|
79
|
+
};
|
|
80
|
+
WorkflowValidate.contextDefinition = {
|
|
81
|
+
..._a.ContextOptions.DynamicProjectConfig,
|
|
82
|
+
..._a.ContextOptions.ProjectDir,
|
|
83
|
+
..._a.ContextOptions.LoggedIn,
|
|
84
|
+
};
|
|
@@ -687,7 +687,8 @@ export declare enum ActivityTimelineProjectActivityType {
|
|
|
687
687
|
Build = "BUILD",
|
|
688
688
|
Submission = "SUBMISSION",
|
|
689
689
|
Update = "UPDATE",
|
|
690
|
-
Worker = "WORKER"
|
|
690
|
+
Worker = "WORKER",
|
|
691
|
+
WorkflowRun = "WORKFLOW_RUN"
|
|
691
692
|
}
|
|
692
693
|
/** A regular user, SSO user, or robot that can authenticate with Expo services and be a member of accounts. */
|
|
693
694
|
export type Actor = {
|
|
@@ -3516,6 +3517,24 @@ export declare enum Feature {
|
|
|
3516
3517
|
/** Share access to projects */
|
|
3517
3518
|
Teams = "TEAMS"
|
|
3518
3519
|
}
|
|
3520
|
+
export type Fingerprint = {
|
|
3521
|
+
__typename?: 'Fingerprint';
|
|
3522
|
+
app: App;
|
|
3523
|
+
createdAt: Scalars['DateTime']['output'];
|
|
3524
|
+
debugInfoUrl?: Maybe<Scalars['String']['output']>;
|
|
3525
|
+
hash: Scalars['String']['output'];
|
|
3526
|
+
id: Scalars['ID']['output'];
|
|
3527
|
+
updatedAt: Scalars['DateTime']['output'];
|
|
3528
|
+
};
|
|
3529
|
+
export type FingerprintInfo = {
|
|
3530
|
+
fingerprintHash: Scalars['String']['input'];
|
|
3531
|
+
fingerprintSource: FingerprintSourceInput;
|
|
3532
|
+
};
|
|
3533
|
+
export type FingerprintInfoGroup = {
|
|
3534
|
+
android?: InputMaybe<FingerprintInfo>;
|
|
3535
|
+
ios?: InputMaybe<FingerprintInfo>;
|
|
3536
|
+
web?: InputMaybe<FingerprintInfo>;
|
|
3537
|
+
};
|
|
3519
3538
|
export type FingerprintSourceInput = {
|
|
3520
3539
|
bucketKey?: InputMaybe<Scalars['String']['input']>;
|
|
3521
3540
|
isDebugFingerprint?: InputMaybe<Scalars['Boolean']['input']>;
|
|
@@ -4178,6 +4197,7 @@ export type JobRun = {
|
|
|
4178
4197
|
createdAt: Scalars['DateTime']['output'];
|
|
4179
4198
|
displayName?: Maybe<Scalars['String']['output']>;
|
|
4180
4199
|
endedAt?: Maybe<Scalars['DateTime']['output']>;
|
|
4200
|
+
errors: Array<JobRunError>;
|
|
4181
4201
|
expiresAt: Scalars['DateTime']['output'];
|
|
4182
4202
|
gitCommitHash?: Maybe<Scalars['String']['output']>;
|
|
4183
4203
|
gitCommitMessage?: Maybe<Scalars['String']['output']>;
|
|
@@ -4192,6 +4212,13 @@ export type JobRun = {
|
|
|
4192
4212
|
status: JobRunStatus;
|
|
4193
4213
|
updateGroups: Array<Array<Update>>;
|
|
4194
4214
|
};
|
|
4215
|
+
export type JobRunError = {
|
|
4216
|
+
__typename?: 'JobRunError';
|
|
4217
|
+
buildPhase?: Maybe<Scalars['String']['output']>;
|
|
4218
|
+
docsUrl?: Maybe<Scalars['String']['output']>;
|
|
4219
|
+
errorCode: Scalars['String']['output'];
|
|
4220
|
+
message: Scalars['String']['output'];
|
|
4221
|
+
};
|
|
4195
4222
|
export type JobRunMutation = {
|
|
4196
4223
|
__typename?: 'JobRunMutation';
|
|
4197
4224
|
/** Cancel an EAS Job Run */
|
|
@@ -4585,6 +4612,7 @@ export type PublishUpdateGroupInput = {
|
|
|
4585
4612
|
awaitingCodeSigningInfo?: InputMaybe<Scalars['Boolean']['input']>;
|
|
4586
4613
|
branchId: Scalars['String']['input'];
|
|
4587
4614
|
excludedAssets?: InputMaybe<Array<PartialManifestAsset>>;
|
|
4615
|
+
fingerprintInfoGroup?: InputMaybe<FingerprintInfoGroup>;
|
|
4588
4616
|
gitCommitHash?: InputMaybe<Scalars['String']['input']>;
|
|
4589
4617
|
isGitWorkingTreeDirty?: InputMaybe<Scalars['Boolean']['input']>;
|
|
4590
4618
|
message?: InputMaybe<Scalars['String']['input']>;
|
|
@@ -4824,6 +4852,7 @@ export type RootMutation = {
|
|
|
4824
4852
|
/** Mutations that modify a websiteNotification */
|
|
4825
4853
|
websiteNotifications: WebsiteNotificationMutation;
|
|
4826
4854
|
workflowJob: WorkflowJobMutation;
|
|
4855
|
+
workflowRevision: WorkflowRevisionMutation;
|
|
4827
4856
|
workflowRun: WorkflowRunMutation;
|
|
4828
4857
|
};
|
|
4829
4858
|
export type RootMutationAccountArgs = {
|
|
@@ -5509,6 +5538,7 @@ export type Update = ActivityTimelineProjectActivity & {
|
|
|
5509
5538
|
createdAt: Scalars['DateTime']['output'];
|
|
5510
5539
|
deployments: DeploymentResult;
|
|
5511
5540
|
expoGoSDKVersion?: Maybe<Scalars['String']['output']>;
|
|
5541
|
+
fingerprint?: Maybe<Fingerprint>;
|
|
5512
5542
|
gitCommitHash?: Maybe<Scalars['String']['output']>;
|
|
5513
5543
|
group: Scalars['String']['output'];
|
|
5514
5544
|
id: Scalars['ID']['output'];
|
|
@@ -6421,6 +6451,7 @@ export type WorkerDeployment = ActivityTimelineProjectActivity & {
|
|
|
6421
6451
|
logs?: Maybe<WorkerDeploymentLogs>;
|
|
6422
6452
|
requests?: Maybe<WorkerDeploymentRequests>;
|
|
6423
6453
|
subdomain: Scalars['String']['output'];
|
|
6454
|
+
tier?: Maybe<WorkerDeploymentTier>;
|
|
6424
6455
|
url: Scalars['String']['output'];
|
|
6425
6456
|
};
|
|
6426
6457
|
export type WorkerDeploymentCrashesArgs = {
|
|
@@ -6720,6 +6751,10 @@ export type WorkerDeploymentRequestsTimeseriesEdge = {
|
|
|
6720
6751
|
node?: Maybe<WorkerDeploymentRequestsAggregationNode>;
|
|
6721
6752
|
timestamp: Scalars['DateTime']['output'];
|
|
6722
6753
|
};
|
|
6754
|
+
export declare enum WorkerDeploymentTier {
|
|
6755
|
+
Free = "FREE",
|
|
6756
|
+
Paid = "PAID"
|
|
6757
|
+
}
|
|
6723
6758
|
export type WorkerDeploymentsConnection = {
|
|
6724
6759
|
__typename?: 'WorkerDeploymentsConnection';
|
|
6725
6760
|
edges: Array<WorkerDeploymentEdge>;
|
|
@@ -6806,6 +6841,7 @@ export declare enum WorkflowJobType {
|
|
|
6806
6841
|
AppleDeviceRegistrationRequest = "APPLE_DEVICE_REGISTRATION_REQUEST",
|
|
6807
6842
|
Build = "BUILD",
|
|
6808
6843
|
Custom = "CUSTOM",
|
|
6844
|
+
GetBuild = "GET_BUILD",
|
|
6809
6845
|
MaestroTest = "MAESTRO_TEST",
|
|
6810
6846
|
RequireApproval = "REQUIRE_APPROVAL",
|
|
6811
6847
|
Submission = "SUBMISSION",
|
|
@@ -6846,6 +6882,14 @@ export type WorkflowRevisionInput = {
|
|
|
6846
6882
|
fileName: Scalars['String']['input'];
|
|
6847
6883
|
yamlConfig: Scalars['String']['input'];
|
|
6848
6884
|
};
|
|
6885
|
+
export type WorkflowRevisionMutation = {
|
|
6886
|
+
__typename?: 'WorkflowRevisionMutation';
|
|
6887
|
+
validateWorkflowYamlConfig: Scalars['Boolean']['output'];
|
|
6888
|
+
};
|
|
6889
|
+
export type WorkflowRevisionMutationValidateWorkflowYamlConfigArgs = {
|
|
6890
|
+
appId: Scalars['ID']['input'];
|
|
6891
|
+
yamlConfig: Scalars['String']['input'];
|
|
6892
|
+
};
|
|
6849
6893
|
export type WorkflowRevisionQuery = {
|
|
6850
6894
|
__typename?: 'WorkflowRevisionQuery';
|
|
6851
6895
|
byId: WorkflowRevision;
|
|
@@ -6858,8 +6902,10 @@ export type WorkflowRevisionsConnection = {
|
|
|
6858
6902
|
edges: Array<WorkflowRevisionEdge>;
|
|
6859
6903
|
pageInfo: PageInfo;
|
|
6860
6904
|
};
|
|
6861
|
-
export type WorkflowRun = {
|
|
6905
|
+
export type WorkflowRun = ActivityTimelineProjectActivity & {
|
|
6862
6906
|
__typename?: 'WorkflowRun';
|
|
6907
|
+
activityTimestamp: Scalars['DateTime']['output'];
|
|
6908
|
+
actor?: Maybe<Actor>;
|
|
6863
6909
|
createdAt: Scalars['DateTime']['output'];
|
|
6864
6910
|
gitCommitHash?: Maybe<Scalars['String']['output']>;
|
|
6865
6911
|
gitCommitMessage?: Maybe<Scalars['String']['output']>;
|
|
@@ -11611,6 +11657,17 @@ export type DeleteWebhookMutation = {
|
|
|
11611
11657
|
};
|
|
11612
11658
|
};
|
|
11613
11659
|
};
|
|
11660
|
+
export type ValidateWorkflowYamlConfigMutationVariables = Exact<{
|
|
11661
|
+
appId: Scalars['ID']['input'];
|
|
11662
|
+
yamlConfig: Scalars['String']['input'];
|
|
11663
|
+
}>;
|
|
11664
|
+
export type ValidateWorkflowYamlConfigMutation = {
|
|
11665
|
+
__typename?: 'RootMutation';
|
|
11666
|
+
workflowRevision: {
|
|
11667
|
+
__typename?: 'WorkflowRevisionMutation';
|
|
11668
|
+
validateWorkflowYamlConfig: boolean;
|
|
11669
|
+
};
|
|
11670
|
+
};
|
|
11614
11671
|
export type CreateWorkflowRunMutationVariables = Exact<{
|
|
11615
11672
|
appId: Scalars['ID']['input'];
|
|
11616
11673
|
workflowRevisionInput: WorkflowRevisionInput;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.FingerprintSourceType = exports.Feature = exports.Experiment = exports.EnvironmentVariableVisibility = exports.EnvironmentVariableScope = exports.EnvironmentVariableEnvironment = exports.EnvironmentSecretType = exports.EntityTypeName = exports.EasTotalPlanEnablementUnit = exports.EasServiceMetric = exports.EasService = exports.EasBuildWaiverType = exports.EasBuildDeprecationInfoType = exports.EasBuildBillingResourceClass = exports.DistributionType = exports.CustomDomainStatus = exports.CustomDomainDnsRecordType = exports.CrashSampleFor = exports.ContinentCode = exports.BuildWorkflow = exports.BuildTrigger = exports.BuildStatus = exports.BuildRetryDisabledReason = exports.BuildResourceClass = exports.BuildPriority = exports.BuildPhase = exports.BuildMode = exports.BuildLimitThresholdExceededMetadataType = exports.BuildIosEnterpriseProvisioning = exports.BuildCredentialsSource = exports.BackgroundJobState = exports.BackgroundJobResultType = exports.AuthProviderIdentifier = exports.AuthProtocolType = exports.AuditLogsExportFormat = exports.AssetMetadataStatus = exports.AppsFilter = exports.AppleTeamType = exports.AppleDeviceClass = exports.AppStoreConnectUserRole = exports.AppSort = exports.AppPrivacy = exports.AppPlatform = exports.AppInternalDistributionBuildPrivacy = exports.AndroidKeystoreType = exports.AndroidFcmVersion = exports.AndroidBuildType = exports.ActivityTimelineProjectActivityType = exports.AccountUploadSessionType = exports.AccountAppsSortByField = void 0;
|
|
10
10
|
exports.UsageMetricsGranularity = exports.UsageMetricType = exports.UploadSessionType = exports.TargetEntityMutationType = exports.SubmissionStatus = exports.SubmissionPriority = exports.SubmissionArchiveSourceType = exports.SubmissionAndroidTrack = exports.SubmissionAndroidReleaseStatus = exports.SubmissionAndroidArchiveType = exports.StatuspageServiceStatus = exports.StatuspageServiceName = exports.StatuspageIncidentStatus = exports.StatuspageIncidentImpact = exports.StandardOffer = exports.SecondFactorMethod = exports.Role = exports.ResponseType = exports.ResponseStatusType = exports.ResponseCacheStatus = exports.ResourceClassExperiment = exports.RequestsOrderByField = exports.RequestsOrderByDirection = exports.RequestMethod = exports.ProjectArchiveSourceType = exports.Permission = exports.Order = exports.OnboardingEnvironment = exports.OnboardingDeviceType = exports.OfferType = exports.NotificationType = exports.NotificationEvent = exports.MailchimpTag = exports.MailchimpAudience = exports.JobRunStatus = exports.JobRunPriority = exports.IosSchemeBuildConfiguration = exports.IosManagedBuildType = exports.IosDistributionType = exports.IosBuildType = exports.InvoiceDiscountType = exports.InsightsFilterType = exports.GitHubJobRunTriggerType = exports.GitHubJobRunTriggerRunStatus = exports.GitHubJobRunJobType = exports.GitHubBuildTriggerType = exports.GitHubBuildTriggerRunStatus = exports.GitHubBuildTriggerExecutionBehavior = exports.GitHubAppInstallationStatus = exports.GitHubAppEnvironment = void 0;
|
|
11
|
-
exports.WorkflowRunStatus = exports.WorkflowProjectSourceType = exports.WorkflowJobType = exports.WorkflowJobStatus = exports.WorkerLoggerLevel = exports.WorkerDeploymentLogLevel = exports.WebhookType = exports.UserEntityTypeName = exports.UserAgentOs = exports.UserAgentBrowser = void 0;
|
|
11
|
+
exports.WorkflowRunStatus = exports.WorkflowProjectSourceType = exports.WorkflowJobType = exports.WorkflowJobStatus = exports.WorkerLoggerLevel = exports.WorkerDeploymentTier = exports.WorkerDeploymentLogLevel = exports.WebhookType = exports.UserEntityTypeName = exports.UserAgentOs = exports.UserAgentBrowser = void 0;
|
|
12
12
|
var AccountAppsSortByField;
|
|
13
13
|
(function (AccountAppsSortByField) {
|
|
14
14
|
AccountAppsSortByField["LatestActivityTime"] = "LATEST_ACTIVITY_TIME";
|
|
@@ -28,6 +28,7 @@ var ActivityTimelineProjectActivityType;
|
|
|
28
28
|
ActivityTimelineProjectActivityType["Submission"] = "SUBMISSION";
|
|
29
29
|
ActivityTimelineProjectActivityType["Update"] = "UPDATE";
|
|
30
30
|
ActivityTimelineProjectActivityType["Worker"] = "WORKER";
|
|
31
|
+
ActivityTimelineProjectActivityType["WorkflowRun"] = "WORKFLOW_RUN";
|
|
31
32
|
})(ActivityTimelineProjectActivityType || (exports.ActivityTimelineProjectActivityType = ActivityTimelineProjectActivityType = {}));
|
|
32
33
|
var AndroidBuildType;
|
|
33
34
|
(function (AndroidBuildType) {
|
|
@@ -808,6 +809,11 @@ var WorkerDeploymentLogLevel;
|
|
|
808
809
|
WorkerDeploymentLogLevel["Log"] = "LOG";
|
|
809
810
|
WorkerDeploymentLogLevel["Warn"] = "WARN";
|
|
810
811
|
})(WorkerDeploymentLogLevel || (exports.WorkerDeploymentLogLevel = WorkerDeploymentLogLevel = {}));
|
|
812
|
+
var WorkerDeploymentTier;
|
|
813
|
+
(function (WorkerDeploymentTier) {
|
|
814
|
+
WorkerDeploymentTier["Free"] = "FREE";
|
|
815
|
+
WorkerDeploymentTier["Paid"] = "PAID";
|
|
816
|
+
})(WorkerDeploymentTier || (exports.WorkerDeploymentTier = WorkerDeploymentTier = {}));
|
|
811
817
|
var WorkerLoggerLevel;
|
|
812
818
|
(function (WorkerLoggerLevel) {
|
|
813
819
|
WorkerLoggerLevel["Debug"] = "DEBUG";
|
|
@@ -832,6 +838,7 @@ var WorkflowJobType;
|
|
|
832
838
|
WorkflowJobType["AppleDeviceRegistrationRequest"] = "APPLE_DEVICE_REGISTRATION_REQUEST";
|
|
833
839
|
WorkflowJobType["Build"] = "BUILD";
|
|
834
840
|
WorkflowJobType["Custom"] = "CUSTOM";
|
|
841
|
+
WorkflowJobType["GetBuild"] = "GET_BUILD";
|
|
835
842
|
WorkflowJobType["MaestroTest"] = "MAESTRO_TEST";
|
|
836
843
|
WorkflowJobType["RequireApproval"] = "REQUIRE_APPROVAL";
|
|
837
844
|
WorkflowJobType["Submission"] = "SUBMISSION";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
|
|
3
|
+
export declare namespace WorkflowRevisionMutation {
|
|
4
|
+
const ValidationErrorExtensionZ: z.ZodObject<{
|
|
5
|
+
errorCode: z.ZodLiteral<"VALIDATION_ERROR">;
|
|
6
|
+
metadata: z.ZodObject<{
|
|
7
|
+
formErrors: z.ZodArray<z.ZodString, "many">;
|
|
8
|
+
fieldErrors: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
formErrors: string[];
|
|
11
|
+
fieldErrors: Record<string, string[]>;
|
|
12
|
+
}, {
|
|
13
|
+
formErrors: string[];
|
|
14
|
+
fieldErrors: Record<string, string[]>;
|
|
15
|
+
}>;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
errorCode: "VALIDATION_ERROR";
|
|
18
|
+
metadata: {
|
|
19
|
+
formErrors: string[];
|
|
20
|
+
fieldErrors: Record<string, string[]>;
|
|
21
|
+
};
|
|
22
|
+
}, {
|
|
23
|
+
errorCode: "VALIDATION_ERROR";
|
|
24
|
+
metadata: {
|
|
25
|
+
formErrors: string[];
|
|
26
|
+
fieldErrors: Record<string, string[]>;
|
|
27
|
+
};
|
|
28
|
+
}>;
|
|
29
|
+
function validateWorkflowYamlConfigAsync(graphqlClient: ExpoGraphqlClient, { appId, yamlConfig, }: {
|
|
30
|
+
appId: string;
|
|
31
|
+
yamlConfig: string;
|
|
32
|
+
}): Promise<void>;
|
|
33
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WorkflowRevisionMutation = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const graphql_tag_1 = tslib_1.__importDefault(require("graphql-tag"));
|
|
6
|
+
const zod_1 = require("zod");
|
|
7
|
+
const client_1 = require("../client");
|
|
8
|
+
var WorkflowRevisionMutation;
|
|
9
|
+
(function (WorkflowRevisionMutation) {
|
|
10
|
+
WorkflowRevisionMutation.ValidationErrorExtensionZ = zod_1.z.object({
|
|
11
|
+
errorCode: zod_1.z.literal('VALIDATION_ERROR'),
|
|
12
|
+
metadata: zod_1.z.object({
|
|
13
|
+
formErrors: zod_1.z.array(zod_1.z.string()),
|
|
14
|
+
fieldErrors: zod_1.z.record(zod_1.z.string(), zod_1.z.array(zod_1.z.string())),
|
|
15
|
+
}),
|
|
16
|
+
});
|
|
17
|
+
async function validateWorkflowYamlConfigAsync(graphqlClient, { appId, yamlConfig, }) {
|
|
18
|
+
await (0, client_1.withErrorHandlingAsync)(graphqlClient
|
|
19
|
+
.mutation((0, graphql_tag_1.default) `
|
|
20
|
+
mutation ValidateWorkflowYamlConfig($appId: ID!, $yamlConfig: String!) {
|
|
21
|
+
workflowRevision {
|
|
22
|
+
validateWorkflowYamlConfig(appId: $appId, yamlConfig: $yamlConfig)
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
`, {
|
|
26
|
+
appId,
|
|
27
|
+
yamlConfig,
|
|
28
|
+
})
|
|
29
|
+
.toPromise());
|
|
30
|
+
}
|
|
31
|
+
WorkflowRevisionMutation.validateWorkflowYamlConfigAsync = validateWorkflowYamlConfigAsync;
|
|
32
|
+
})(WorkflowRevisionMutation || (exports.WorkflowRevisionMutation = WorkflowRevisionMutation = {}));
|