eas-cli 0.42.4 → 0.45.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 +120 -50
- package/bin/dev +17 -0
- package/bin/dev.cmd +3 -0
- package/bin/run +4 -3
- package/build/build/android/UpdatesModule.d.ts +0 -1
- package/build/build/android/UpdatesModule.js +4 -37
- package/build/build/android/build.js +3 -3
- package/build/build/android/{configure.d.ts → syncProjectConfiguration.d.ts} +2 -3
- package/build/build/android/{configure.js → syncProjectConfiguration.js} +22 -23
- package/build/build/build.d.ts +1 -1
- package/build/build/build.js +6 -8
- package/build/build/configure.d.ts +12 -7
- package/build/build/configure.js +25 -99
- package/build/build/context.d.ts +0 -12
- package/build/build/createContext.d.ts +1 -2
- package/build/build/createContext.js +1 -2
- package/build/build/ios/UpdatesModule.d.ts +0 -1
- package/build/build/ios/UpdatesModule.js +8 -39
- package/build/build/ios/build.js +3 -3
- package/build/build/ios/{configure.d.ts → syncProjectConfiguration.d.ts} +1 -3
- package/build/build/ios/{configure.js → syncProjectConfiguration.js} +3 -18
- package/build/build/local.d.ts +1 -0
- package/build/build/local.js +2 -1
- package/build/build/runBuildAndSubmit.d.ts +0 -1
- package/build/build/runBuildAndSubmit.js +4 -2
- package/build/commands/branch/create.js +8 -3
- package/build/commands/branch/delete.js +8 -2
- package/build/commands/branch/list.js +5 -1
- package/build/commands/branch/rename.js +8 -3
- package/build/commands/branch/view.d.ts +0 -2
- package/build/commands/branch/view.js +32 -71
- package/build/commands/build/configure.js +43 -25
- package/build/commands/build/index.d.ts +1 -0
- package/build/commands/build/index.js +12 -2
- package/build/commands/build/inspect.d.ts +1 -0
- package/build/commands/build/inspect.js +23 -17
- package/build/commands/channel/create.js +21 -16
- package/build/commands/channel/delete.d.ts +15 -0
- package/build/commands/channel/delete.js +124 -0
- package/build/commands/channel/edit.js +10 -5
- package/build/commands/channel/list.js +14 -9
- package/build/commands/channel/rollout.js +8 -3
- package/build/commands/channel/view.js +16 -11
- package/build/commands/device/delete.d.ts +17 -0
- package/build/commands/device/delete.js +181 -0
- package/build/commands/device/list.js +1 -1
- package/build/commands/update/configure.js +1 -1
- package/build/commands/update/delete.js +9 -4
- package/build/commands/update/index.js +7 -3
- package/build/commands/update/list.d.ts +10 -0
- package/build/commands/update/list.js +114 -0
- package/build/commands/update/view.js +22 -17
- package/build/commands/webhook/update.js +1 -1
- package/build/credentials/ios/actions/DeviceUtils.d.ts +1 -0
- package/build/credentials/ios/actions/DeviceUtils.js +16 -1
- package/build/credentials/ios/api/graphql/mutations/AppleDeviceMutation.d.ts +1 -0
- package/build/credentials/ios/api/graphql/mutations/AppleDeviceMutation.js +16 -0
- package/build/credentials/ios/appstore/bundleIdCapabilities.js +0 -2
- package/build/credentials/ios/appstore/ensureAppExists.js +3 -1
- package/build/graphql/generated.d.ts +5848 -3500
- package/build/graphql/generated.js +223 -223
- package/build/graphql/queries/UpdateQuery.d.ts +7 -0
- package/build/graphql/queries/UpdateQuery.js +85 -0
- package/build/submit/ArchiveSource.js +0 -1
- package/build/vcs/local.js +5 -1
- package/oclif.manifest.json +1 -1
- package/package.json +43 -42
|
@@ -14,6 +14,7 @@ const UpdateBranch_1 = require("../../graphql/types/UpdateBranch");
|
|
|
14
14
|
const log_1 = (0, tslib_1.__importDefault)(require("../../log"));
|
|
15
15
|
const projectUtils_1 = require("../../project/projectUtils");
|
|
16
16
|
const utils_1 = require("../../update/utils");
|
|
17
|
+
const json_1 = require("../../utils/json");
|
|
17
18
|
const BRANCHES_LIMIT = 10000;
|
|
18
19
|
async function listBranchesAsync({ projectId, }) {
|
|
19
20
|
var _a, _b;
|
|
@@ -42,12 +43,15 @@ exports.listBranchesAsync = listBranchesAsync;
|
|
|
42
43
|
class BranchList extends EasCommand_1.default {
|
|
43
44
|
async runAsync() {
|
|
44
45
|
const { flags } = await this.parse(BranchList);
|
|
46
|
+
if (flags.json) {
|
|
47
|
+
(0, json_1.enableJsonOutput)();
|
|
48
|
+
}
|
|
45
49
|
const projectDir = await (0, projectUtils_1.findProjectRootAsync)();
|
|
46
50
|
const { exp } = (0, config_1.getConfig)(projectDir, { skipSDKVersionRequirement: true });
|
|
47
51
|
const projectId = await (0, projectUtils_1.getProjectIdAsync)(exp);
|
|
48
52
|
const branches = await listBranchesAsync({ projectId });
|
|
49
53
|
if (flags.json) {
|
|
50
|
-
|
|
54
|
+
(0, json_1.printJsonOnlyOutput)(branches);
|
|
51
55
|
}
|
|
52
56
|
else {
|
|
53
57
|
const table = new cli_table3_1.default({
|
|
@@ -10,6 +10,7 @@ const client_1 = require("../../graphql/client");
|
|
|
10
10
|
const log_1 = (0, tslib_1.__importDefault)(require("../../log"));
|
|
11
11
|
const projectUtils_1 = require("../../project/projectUtils");
|
|
12
12
|
const prompts_1 = require("../../prompts");
|
|
13
|
+
const json_1 = require("../../utils/json");
|
|
13
14
|
async function renameUpdateBranchOnAppAsync({ appId, name, newName, }) {
|
|
14
15
|
const data = await (0, client_1.withErrorHandlingAsync)(client_1.graphqlClient
|
|
15
16
|
.mutation((0, graphql_tag_1.default) `
|
|
@@ -34,6 +35,9 @@ async function renameUpdateBranchOnAppAsync({ appId, name, newName, }) {
|
|
|
34
35
|
class BranchRename extends EasCommand_1.default {
|
|
35
36
|
async runAsync() {
|
|
36
37
|
let { flags: { json: jsonFlag, from: currentName, to: newName }, } = await this.parse(BranchRename);
|
|
38
|
+
if (jsonFlag) {
|
|
39
|
+
(0, json_1.enableJsonOutput)();
|
|
40
|
+
}
|
|
37
41
|
const projectDir = await (0, projectUtils_1.findProjectRootAsync)();
|
|
38
42
|
const { exp } = (0, config_1.getConfig)(projectDir, { skipSDKVersionRequirement: true });
|
|
39
43
|
const fullName = await (0, projectUtils_1.getProjectFullNameAsync)(exp);
|
|
@@ -68,10 +72,11 @@ class BranchRename extends EasCommand_1.default {
|
|
|
68
72
|
newName: newName,
|
|
69
73
|
});
|
|
70
74
|
if (jsonFlag) {
|
|
71
|
-
|
|
72
|
-
|
|
75
|
+
(0, json_1.printJsonOnlyOutput)(editedBranch);
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
log_1.default.withTick(`️Renamed branch from ${currentName} to ${chalk_1.default.bold(editedBranch.name)} on project ${chalk_1.default.bold(fullName)}.`);
|
|
73
79
|
}
|
|
74
|
-
log_1.default.withTick(`️Renamed branch from ${currentName} to ${chalk_1.default.bold(editedBranch.name)} on project ${chalk_1.default.bold(fullName)}.`);
|
|
75
80
|
}
|
|
76
81
|
}
|
|
77
82
|
exports.default = BranchRename;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import EasCommand from '../../commandUtils/EasCommand';
|
|
2
|
-
import { ViewBranchQuery, ViewBranchQueryVariables } from '../../graphql/generated';
|
|
3
|
-
export declare function viewUpdateBranchAsync({ appId, name, }: Pick<ViewBranchQueryVariables, 'appId' | 'name'>): Promise<ViewBranchQuery>;
|
|
4
2
|
export default class BranchView extends EasCommand {
|
|
5
3
|
static description: string;
|
|
6
4
|
static args: {
|
|
@@ -1,65 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.viewUpdateBranchAsync = void 0;
|
|
4
3
|
const tslib_1 = require("tslib");
|
|
5
4
|
const config_1 = require("@expo/config");
|
|
6
5
|
const core_1 = require("@oclif/core");
|
|
7
6
|
const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
|
|
8
7
|
const cli_table3_1 = (0, tslib_1.__importDefault)(require("cli-table3"));
|
|
9
|
-
const graphql_tag_1 = (0, tslib_1.__importDefault)(require("graphql-tag"));
|
|
10
8
|
const EasCommand_1 = (0, tslib_1.__importDefault)(require("../../commandUtils/EasCommand"));
|
|
11
|
-
const
|
|
9
|
+
const UpdateQuery_1 = require("../../graphql/queries/UpdateQuery");
|
|
12
10
|
const log_1 = (0, tslib_1.__importDefault)(require("../../log"));
|
|
13
11
|
const projectUtils_1 = require("../../project/projectUtils");
|
|
14
12
|
const prompts_1 = require("../../prompts");
|
|
15
13
|
const utils_1 = require("../../update/utils");
|
|
16
14
|
const groupBy_1 = (0, tslib_1.__importDefault)(require("../../utils/expodash/groupBy"));
|
|
17
15
|
const formatFields_1 = (0, tslib_1.__importDefault)(require("../../utils/formatFields"));
|
|
18
|
-
const
|
|
19
|
-
async function viewUpdateBranchAsync({ appId, name, }) {
|
|
20
|
-
const data = await (0, client_1.withErrorHandlingAsync)(client_1.graphqlClient
|
|
21
|
-
.query((0, graphql_tag_1.default) `
|
|
22
|
-
query ViewBranch($appId: String!, $name: String!, $limit: Int!) {
|
|
23
|
-
app {
|
|
24
|
-
byId(appId: $appId) {
|
|
25
|
-
id
|
|
26
|
-
updateBranchByName(name: $name) {
|
|
27
|
-
id
|
|
28
|
-
name
|
|
29
|
-
updates(offset: 0, limit: $limit) {
|
|
30
|
-
id
|
|
31
|
-
group
|
|
32
|
-
message
|
|
33
|
-
createdAt
|
|
34
|
-
runtimeVersion
|
|
35
|
-
platform
|
|
36
|
-
manifestFragment
|
|
37
|
-
actor {
|
|
38
|
-
id
|
|
39
|
-
... on User {
|
|
40
|
-
username
|
|
41
|
-
}
|
|
42
|
-
... on Robot {
|
|
43
|
-
firstName
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
`, {
|
|
52
|
-
appId,
|
|
53
|
-
name,
|
|
54
|
-
limit: PAGE_LIMIT,
|
|
55
|
-
}, { additionalTypenames: ['UpdateBranch', 'Update'] })
|
|
56
|
-
.toPromise());
|
|
57
|
-
return data;
|
|
58
|
-
}
|
|
59
|
-
exports.viewUpdateBranchAsync = viewUpdateBranchAsync;
|
|
16
|
+
const json_1 = require("../../utils/json");
|
|
60
17
|
class BranchView extends EasCommand_1.default {
|
|
61
18
|
async runAsync() {
|
|
62
19
|
let { args: { name }, flags: { json: jsonFlag }, } = await this.parse(BranchView);
|
|
20
|
+
if (jsonFlag) {
|
|
21
|
+
(0, json_1.enableJsonOutput)();
|
|
22
|
+
}
|
|
63
23
|
const projectDir = await (0, projectUtils_1.findProjectRootAsync)();
|
|
64
24
|
const { exp } = (0, config_1.getConfig)(projectDir, { skipSDKVersionRequirement: true });
|
|
65
25
|
const projectId = await (0, projectUtils_1.getProjectIdAsync)(exp);
|
|
@@ -75,7 +35,7 @@ class BranchView extends EasCommand_1.default {
|
|
|
75
35
|
validate: value => (value ? true : validationMessage),
|
|
76
36
|
}));
|
|
77
37
|
}
|
|
78
|
-
const { app } = await
|
|
38
|
+
const { app } = await UpdateQuery_1.UpdateQuery.viewBranchAsync({
|
|
79
39
|
appId: projectId,
|
|
80
40
|
name,
|
|
81
41
|
});
|
|
@@ -85,33 +45,34 @@ class BranchView extends EasCommand_1.default {
|
|
|
85
45
|
}
|
|
86
46
|
const updates = Object.values((0, groupBy_1.default)(UpdateBranch.updates, u => u.group)).map(group => group[0]);
|
|
87
47
|
if (jsonFlag) {
|
|
88
|
-
|
|
89
|
-
return;
|
|
48
|
+
(0, json_1.printJsonOnlyOutput)({ ...UpdateBranch, updates });
|
|
90
49
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
50
|
+
else {
|
|
51
|
+
const groupTable = new cli_table3_1.default({
|
|
52
|
+
head: utils_1.UPDATE_COLUMNS,
|
|
53
|
+
wordWrap: true,
|
|
54
|
+
});
|
|
55
|
+
for (const update of updates) {
|
|
56
|
+
groupTable.push([
|
|
57
|
+
(0, utils_1.formatUpdate)(update),
|
|
58
|
+
update.runtimeVersion,
|
|
59
|
+
update.group,
|
|
60
|
+
(0, utils_1.getPlatformsForGroup)({
|
|
61
|
+
updates: UpdateBranch.updates,
|
|
62
|
+
group: update.group,
|
|
63
|
+
}),
|
|
64
|
+
]);
|
|
65
|
+
}
|
|
66
|
+
log_1.default.addNewLineIfNone();
|
|
67
|
+
log_1.default.log(chalk_1.default.bold('Branch:'));
|
|
68
|
+
log_1.default.log((0, formatFields_1.default)([
|
|
69
|
+
{ label: 'Name', value: UpdateBranch.name },
|
|
70
|
+
{ label: 'ID', value: UpdateBranch.id },
|
|
71
|
+
]));
|
|
72
|
+
log_1.default.addNewLineIfNone();
|
|
73
|
+
log_1.default.log(chalk_1.default.bold('Recently published update groups:'));
|
|
74
|
+
log_1.default.log(groupTable.toString());
|
|
105
75
|
}
|
|
106
|
-
log_1.default.addNewLineIfNone();
|
|
107
|
-
log_1.default.log(chalk_1.default.bold('Branch:'));
|
|
108
|
-
log_1.default.log((0, formatFields_1.default)([
|
|
109
|
-
{ label: 'Name', value: UpdateBranch.name },
|
|
110
|
-
{ label: 'ID', value: UpdateBranch.id },
|
|
111
|
-
]));
|
|
112
|
-
log_1.default.addNewLineIfNone();
|
|
113
|
-
log_1.default.log(chalk_1.default.bold('Recently published update groups:'));
|
|
114
|
-
log_1.default.log(groupTable.toString());
|
|
115
76
|
}
|
|
116
77
|
}
|
|
117
78
|
exports.default = BranchView;
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
+
const config_1 = require("@expo/config");
|
|
5
|
+
const eas_build_job_1 = require("@expo/eas-build-job");
|
|
4
6
|
const core_1 = require("@oclif/core");
|
|
5
7
|
const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
|
|
8
|
+
const UpdatesModule_1 = require("../../build/android/UpdatesModule");
|
|
9
|
+
const syncProjectConfiguration_1 = require("../../build/android/syncProjectConfiguration");
|
|
6
10
|
const configure_1 = require("../../build/configure");
|
|
11
|
+
const UpdatesModule_2 = require("../../build/ios/UpdatesModule");
|
|
12
|
+
const updates_1 = require("../../build/utils/updates");
|
|
7
13
|
const EasCommand_1 = (0, tslib_1.__importDefault)(require("../../commandUtils/EasCommand"));
|
|
8
14
|
const log_1 = (0, tslib_1.__importStar)(require("../../log"));
|
|
9
15
|
const platform_1 = require("../../platform");
|
|
10
16
|
const projectUtils_1 = require("../../project/projectUtils");
|
|
17
|
+
const workflow_1 = require("../../project/workflow");
|
|
11
18
|
const prompts_1 = require("../../prompts");
|
|
12
19
|
const vcs_1 = require("../../vcs");
|
|
13
20
|
class BuildConfigure extends EasCommand_1.default {
|
|
@@ -15,15 +22,44 @@ class BuildConfigure extends EasCommand_1.default {
|
|
|
15
22
|
var _a;
|
|
16
23
|
const { flags } = await this.parse(BuildConfigure);
|
|
17
24
|
log_1.default.log('💡 The following process will configure your iOS and/or Android project to be compatible with EAS Build. These changes only apply to your local project files and you can safely revert them at any time.');
|
|
18
|
-
log_1.default.newLine();
|
|
19
25
|
await (0, vcs_1.getVcsClient)().ensureRepoExistsAsync();
|
|
26
|
+
const projectDir = await (0, projectUtils_1.findProjectRootAsync)();
|
|
27
|
+
const expoUpdatesIsInstalled = (0, updates_1.isExpoUpdatesInstalled)(projectDir);
|
|
20
28
|
const platform = (_a = flags.platform) !== null && _a !== void 0 ? _a : (await promptForPlatformAsync());
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
29
|
+
// clean up old Android configuration
|
|
30
|
+
if ([platform_1.RequestedPlatform.Android, platform_1.RequestedPlatform.All].includes(platform)) {
|
|
31
|
+
await (0, syncProjectConfiguration_1.cleanUpOldEasBuildGradleScriptAsync)(projectDir);
|
|
32
|
+
}
|
|
33
|
+
// ensure eas.json exists
|
|
25
34
|
log_1.default.newLine();
|
|
26
|
-
|
|
35
|
+
await (0, configure_1.ensureProjectConfiguredAsync)({
|
|
36
|
+
projectDir,
|
|
37
|
+
nonInteractive: false,
|
|
38
|
+
});
|
|
39
|
+
// configure expo-updates
|
|
40
|
+
if (expoUpdatesIsInstalled) {
|
|
41
|
+
const { exp } = (0, config_1.getConfig)(projectDir, { skipSDKVersionRequirement: true });
|
|
42
|
+
if ([platform_1.RequestedPlatform.Android, platform_1.RequestedPlatform.All].includes(platform)) {
|
|
43
|
+
const workflow = await (0, workflow_1.resolveWorkflowAsync)(projectDir, eas_build_job_1.Platform.ANDROID);
|
|
44
|
+
if (workflow === eas_build_job_1.Workflow.GENERIC) {
|
|
45
|
+
await (0, UpdatesModule_1.syncUpdatesConfigurationAsync)(projectDir, exp);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if ([platform_1.RequestedPlatform.Ios, platform_1.RequestedPlatform.All].includes(platform)) {
|
|
49
|
+
const workflow = await (0, workflow_1.resolveWorkflowAsync)(projectDir, eas_build_job_1.Platform.IOS);
|
|
50
|
+
if (workflow === eas_build_job_1.Workflow.GENERIC) {
|
|
51
|
+
await (0, UpdatesModule_2.syncUpdatesConfigurationAsync)(projectDir, exp);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
log_1.default.addNewLineIfNone();
|
|
56
|
+
log_1.default.log(`🎉 Your project is ready to build.
|
|
57
|
+
|
|
58
|
+
- Run ${chalk_1.default.bold('eas build')} when you are ready to create your first build.
|
|
59
|
+
- Once the build is completed, run ${chalk_1.default.bold('eas submit')} to upload the app to app stores.
|
|
60
|
+
- ${(0, log_1.learnMore)('https://docs.expo.dev/build/introduction', {
|
|
61
|
+
learnMoreMessage: 'Learn more about other capabilities of EAS Build',
|
|
62
|
+
})}`);
|
|
27
63
|
}
|
|
28
64
|
}
|
|
29
65
|
exports.default = BuildConfigure;
|
|
@@ -35,26 +71,8 @@ BuildConfigure.flags = {
|
|
|
35
71
|
options: ['android', 'ios', 'all'],
|
|
36
72
|
}),
|
|
37
73
|
};
|
|
38
|
-
function logSuccess(platform) {
|
|
39
|
-
let platformsText = 'iOS and Android projects are';
|
|
40
|
-
let storesText = 'the Apple App Store or Google Play Store';
|
|
41
|
-
if (platform === 'android') {
|
|
42
|
-
platformsText = 'Android project is';
|
|
43
|
-
storesText = 'the Google Play Store';
|
|
44
|
-
}
|
|
45
|
-
else if (platform === 'ios') {
|
|
46
|
-
platformsText = 'iOS project is';
|
|
47
|
-
storesText = 'the Apple App Store Connect';
|
|
48
|
-
}
|
|
49
|
-
log_1.default.log(`🎉 Your ${platformsText} ready to build.
|
|
50
|
-
|
|
51
|
-
- Run ${chalk_1.default.bold('eas build')} when you are ready to create your first build.
|
|
52
|
-
- Once the build is completed, run ${chalk_1.default.bold('eas submit')} to upload the app to ${storesText}
|
|
53
|
-
- ${(0, log_1.learnMore)('https://docs.expo.dev/build/introduction', {
|
|
54
|
-
learnMoreMessage: 'Learn more about other capabilities of EAS Build',
|
|
55
|
-
})}`);
|
|
56
|
-
}
|
|
57
74
|
async function promptForPlatformAsync() {
|
|
75
|
+
log_1.default.addNewLineIfNone();
|
|
58
76
|
const { platform } = await (0, prompts_1.promptAsync)({
|
|
59
77
|
type: 'select',
|
|
60
78
|
message: 'Which platforms would you like to configure for EAS Build?',
|
|
@@ -9,6 +9,7 @@ export default class Build extends EasCommand {
|
|
|
9
9
|
profile: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
10
10
|
'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
11
|
local: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
output: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
12
13
|
wait: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
13
14
|
'clear-cache': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
14
15
|
'auto-submit': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
@@ -7,6 +7,7 @@ const core_1 = require("@oclif/core");
|
|
|
7
7
|
const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
|
|
8
8
|
const figures_1 = (0, tslib_1.__importDefault)(require("figures"));
|
|
9
9
|
const fs_extra_1 = (0, tslib_1.__importDefault)(require("fs-extra"));
|
|
10
|
+
const path_1 = (0, tslib_1.__importDefault)(require("path"));
|
|
10
11
|
const runBuildAndSubmit_1 = require("../../build/runBuildAndSubmit");
|
|
11
12
|
const repository_1 = require("../../build/utils/repository");
|
|
12
13
|
const EasCommand_1 = (0, tslib_1.__importDefault)(require("../../commandUtils/EasCommand"));
|
|
@@ -32,6 +33,9 @@ class Build extends EasCommand_1.default {
|
|
|
32
33
|
async sanitizeFlagsAsync(flags) {
|
|
33
34
|
var _a;
|
|
34
35
|
const nonInteractive = flags['non-interactive'];
|
|
36
|
+
if (!flags.local && flags.output) {
|
|
37
|
+
core_1.Errors.error('--output is allowed only for local builds', { exit: 1 });
|
|
38
|
+
}
|
|
35
39
|
if (!flags.platform && nonInteractive) {
|
|
36
40
|
core_1.Errors.error('--platform is required when building in non-interactive mode', { exit: 1 });
|
|
37
41
|
}
|
|
@@ -60,11 +64,14 @@ class Build extends EasCommand_1.default {
|
|
|
60
64
|
const profile = flags['profile'];
|
|
61
65
|
return {
|
|
62
66
|
requestedPlatform,
|
|
63
|
-
skipProjectConfiguration: flags['skip-project-configuration'],
|
|
64
67
|
profile,
|
|
65
68
|
nonInteractive,
|
|
66
69
|
localBuildOptions: flags['local']
|
|
67
|
-
? {
|
|
70
|
+
? {
|
|
71
|
+
enable: true,
|
|
72
|
+
verbose: true,
|
|
73
|
+
artifactPath: flags.output && path_1.default.resolve(process.cwd(), flags.output),
|
|
74
|
+
}
|
|
68
75
|
: {
|
|
69
76
|
enable: false,
|
|
70
77
|
},
|
|
@@ -107,6 +114,9 @@ Build.flags = {
|
|
|
107
114
|
default: false,
|
|
108
115
|
description: 'Run build locally [experimental]',
|
|
109
116
|
}),
|
|
117
|
+
output: core_1.Flags.string({
|
|
118
|
+
description: 'Output path for local build',
|
|
119
|
+
}),
|
|
110
120
|
wait: core_1.Flags.boolean({
|
|
111
121
|
default: true,
|
|
112
122
|
allowNo: true,
|
|
@@ -28,19 +28,21 @@ class BuildInspect extends EasCommand_1.default {
|
|
|
28
28
|
async runAsync() {
|
|
29
29
|
const { flags } = await this.parse(BuildInspect);
|
|
30
30
|
const outputDirectory = path_1.default.resolve(process.cwd(), flags.output);
|
|
31
|
+
const tmpWorkingdir = path_1.default.join((0, paths_1.getTmpDirectory)(), (0, uuid_1.v4)());
|
|
32
|
+
if (flags.force && process.cwd().startsWith(outputDirectory)) {
|
|
33
|
+
throw new Error(`This operation is not allowed, it would delete all files in ${outputDirectory} including the current project.`);
|
|
34
|
+
}
|
|
31
35
|
await this.prepareOutputDirAsync(outputDirectory, flags.force);
|
|
32
36
|
if (flags.stage === InspectStage.ARCHIVE) {
|
|
33
37
|
const vcs = (0, vcs_1.getVcsClient)();
|
|
34
38
|
await vcs.ensureRepoExistsAsync();
|
|
35
|
-
await vcs.makeShallowCopyAsync(
|
|
36
|
-
|
|
39
|
+
await vcs.makeShallowCopyAsync(tmpWorkingdir);
|
|
40
|
+
await this.copyToOutputDirAsync(tmpWorkingdir, outputDirectory);
|
|
37
41
|
}
|
|
38
42
|
else {
|
|
39
43
|
const projectDir = await (0, projectUtils_1.findProjectRootAsync)();
|
|
40
|
-
const tmpWorkingdir = path_1.default.join((0, paths_1.getTmpDirectory)(), (0, uuid_1.v4)());
|
|
41
44
|
try {
|
|
42
45
|
await (0, runBuildAndSubmit_1.runBuildAndSubmitAsync)(projectDir, {
|
|
43
|
-
skipProjectConfiguration: false,
|
|
44
46
|
nonInteractive: false,
|
|
45
47
|
wait: true,
|
|
46
48
|
clearCache: false,
|
|
@@ -68,19 +70,7 @@ class BuildInspect extends EasCommand_1.default {
|
|
|
68
70
|
}
|
|
69
71
|
}
|
|
70
72
|
finally {
|
|
71
|
-
|
|
72
|
-
try {
|
|
73
|
-
const tmpBuildDirectory = path_1.default.join(tmpWorkingdir, 'build');
|
|
74
|
-
if (await fs_extra_1.default.pathExists(tmpBuildDirectory)) {
|
|
75
|
-
await fs_extra_1.default.copy(tmpBuildDirectory, outputDirectory);
|
|
76
|
-
}
|
|
77
|
-
await fs_extra_1.default.remove(tmpWorkingdir);
|
|
78
|
-
spinner.succeed(`Project build directory saved to ${outputDirectory}`);
|
|
79
|
-
}
|
|
80
|
-
catch (err) {
|
|
81
|
-
spinner.fail();
|
|
82
|
-
throw err;
|
|
83
|
-
}
|
|
73
|
+
await this.copyToOutputDirAsync(path_1.default.join(tmpWorkingdir, 'build'), outputDirectory);
|
|
84
74
|
}
|
|
85
75
|
}
|
|
86
76
|
}
|
|
@@ -95,6 +85,20 @@ class BuildInspect extends EasCommand_1.default {
|
|
|
95
85
|
}
|
|
96
86
|
await fs_extra_1.default.mkdirp(outputDir);
|
|
97
87
|
}
|
|
88
|
+
async copyToOutputDirAsync(src, dst) {
|
|
89
|
+
const spinner = (0, ora_1.ora)().start(`Copying project directory to ${dst}`);
|
|
90
|
+
try {
|
|
91
|
+
if (await fs_extra_1.default.pathExists(src)) {
|
|
92
|
+
await fs_extra_1.default.copy(src, dst);
|
|
93
|
+
}
|
|
94
|
+
await fs_extra_1.default.remove(src);
|
|
95
|
+
spinner.succeed(`Project directory saved to ${dst}`);
|
|
96
|
+
}
|
|
97
|
+
catch (err) {
|
|
98
|
+
spinner.fail();
|
|
99
|
+
throw err;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
98
102
|
}
|
|
99
103
|
exports.default = BuildInspect;
|
|
100
104
|
BuildInspect.description = 'Inspect the state of the project at specific build stages. Useful for troubleshooting.';
|
|
@@ -115,6 +119,7 @@ BuildInspect.flags = {
|
|
|
115
119
|
required: true,
|
|
116
120
|
}),
|
|
117
121
|
output: core_1.Flags.string({
|
|
122
|
+
char: 'o',
|
|
118
123
|
description: 'Output directory.',
|
|
119
124
|
required: true,
|
|
120
125
|
helpValue: 'OUTPUT_DIRECTORY',
|
|
@@ -124,6 +129,7 @@ BuildInspect.flags = {
|
|
|
124
129
|
default: false,
|
|
125
130
|
}),
|
|
126
131
|
verbose: core_1.Flags.boolean({
|
|
132
|
+
char: 'v',
|
|
127
133
|
default: false,
|
|
128
134
|
}),
|
|
129
135
|
};
|
|
@@ -12,6 +12,7 @@ const log_1 = (0, tslib_1.__importDefault)(require("../../log"));
|
|
|
12
12
|
const projectUtils_1 = require("../../project/projectUtils");
|
|
13
13
|
const prompts_1 = require("../../prompts");
|
|
14
14
|
const formatFields_1 = (0, tslib_1.__importDefault)(require("../../utils/formatFields"));
|
|
15
|
+
const json_1 = require("../../utils/json");
|
|
15
16
|
const create_1 = require("../branch/create");
|
|
16
17
|
async function createUpdateChannelOnAppAsync({ appId, channelName, branchId, }) {
|
|
17
18
|
// Point the new channel at a branch with its same name.
|
|
@@ -41,6 +42,9 @@ exports.createUpdateChannelOnAppAsync = createUpdateChannelOnAppAsync;
|
|
|
41
42
|
class ChannelCreate extends EasCommand_1.default {
|
|
42
43
|
async runAsync() {
|
|
43
44
|
let { args: { name: channelName }, flags: { json: jsonFlag }, } = await this.parse(ChannelCreate);
|
|
45
|
+
if (jsonFlag) {
|
|
46
|
+
(0, json_1.enableJsonOutput)();
|
|
47
|
+
}
|
|
44
48
|
const projectDir = await (0, projectUtils_1.findProjectRootAsync)();
|
|
45
49
|
const { exp } = (0, config_1.getConfig)(projectDir, { skipSDKVersionRequirement: true });
|
|
46
50
|
const projectId = await (0, projectUtils_1.getProjectIdAsync)(exp);
|
|
@@ -83,23 +87,24 @@ class ChannelCreate extends EasCommand_1.default {
|
|
|
83
87
|
throw new Error(`Could not create channel with name ${channelName} on app with id ${projectId}`);
|
|
84
88
|
}
|
|
85
89
|
if (jsonFlag) {
|
|
86
|
-
|
|
87
|
-
|
|
90
|
+
(0, json_1.printJsonOnlyOutput)(newChannel);
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
log_1.default.addNewLineIfNone();
|
|
94
|
+
log_1.default.withTick(`Created a new channel on project ${chalk_1.default.bold(await (0, projectUtils_1.getProjectFullNameAsync)(exp))}`);
|
|
95
|
+
log_1.default.log((0, formatFields_1.default)([
|
|
96
|
+
{ label: 'Name', value: newChannel.name },
|
|
97
|
+
{ label: 'ID', value: newChannel.id },
|
|
98
|
+
]));
|
|
99
|
+
log_1.default.addNewLineIfNone();
|
|
100
|
+
log_1.default.withTick(`${branchMessage} and have pointed the channel at it.`);
|
|
101
|
+
log_1.default.log((0, formatFields_1.default)([
|
|
102
|
+
{ label: 'Name', value: newChannel.name },
|
|
103
|
+
{ label: 'ID', value: branchId },
|
|
104
|
+
]));
|
|
105
|
+
log_1.default.addNewLineIfNone();
|
|
106
|
+
log_1.default.log(chalk_1.default.bold('You can now update your app by publishing!'));
|
|
88
107
|
}
|
|
89
|
-
log_1.default.addNewLineIfNone();
|
|
90
|
-
log_1.default.withTick(`Created a new channel on project ${chalk_1.default.bold(await (0, projectUtils_1.getProjectFullNameAsync)(exp))}`);
|
|
91
|
-
log_1.default.log((0, formatFields_1.default)([
|
|
92
|
-
{ label: 'Name', value: newChannel.name },
|
|
93
|
-
{ label: 'ID', value: newChannel.id },
|
|
94
|
-
]));
|
|
95
|
-
log_1.default.addNewLineIfNone();
|
|
96
|
-
log_1.default.withTick(`${branchMessage} and have pointed the channel at it.`);
|
|
97
|
-
log_1.default.log((0, formatFields_1.default)([
|
|
98
|
-
{ label: 'Name', value: newChannel.name },
|
|
99
|
-
{ label: 'ID', value: branchId },
|
|
100
|
-
]));
|
|
101
|
-
log_1.default.addNewLineIfNone();
|
|
102
|
-
log_1.default.log(chalk_1.default.bold('You can now update your app by publishing!'));
|
|
103
108
|
}
|
|
104
109
|
}
|
|
105
110
|
exports.default = ChannelCreate;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import EasCommand from '../../commandUtils/EasCommand';
|
|
2
|
+
export default class ChannelDelete extends EasCommand {
|
|
3
|
+
static hidden: boolean;
|
|
4
|
+
static description: string;
|
|
5
|
+
static args: {
|
|
6
|
+
name: string;
|
|
7
|
+
required: boolean;
|
|
8
|
+
description: string;
|
|
9
|
+
}[];
|
|
10
|
+
static flags: {
|
|
11
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
};
|
|
14
|
+
runAsync(): Promise<void>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const config_1 = require("@expo/config");
|
|
5
|
+
const core_1 = require("@oclif/core");
|
|
6
|
+
const graphql_tag_1 = (0, tslib_1.__importDefault)(require("graphql-tag"));
|
|
7
|
+
const EasCommand_1 = (0, tslib_1.__importDefault)(require("../../commandUtils/EasCommand"));
|
|
8
|
+
const client_1 = require("../../graphql/client");
|
|
9
|
+
const log_1 = (0, tslib_1.__importDefault)(require("../../log"));
|
|
10
|
+
const projectUtils_1 = require("../../project/projectUtils");
|
|
11
|
+
const prompts_1 = require("../../prompts");
|
|
12
|
+
const json_1 = require("../../utils/json");
|
|
13
|
+
class ChannelDelete extends EasCommand_1.default {
|
|
14
|
+
async runAsync() {
|
|
15
|
+
var _a, _b;
|
|
16
|
+
const { args: { name: nameArg }, flags: { json: jsonFlag, 'non-interactive': nonInteractiveFlag }, } = await this.parse(ChannelDelete);
|
|
17
|
+
if (jsonFlag && !nonInteractiveFlag) {
|
|
18
|
+
throw new Error('--json is allowed only in non-interactive mode');
|
|
19
|
+
}
|
|
20
|
+
if (jsonFlag) {
|
|
21
|
+
(0, json_1.enableJsonOutput)();
|
|
22
|
+
}
|
|
23
|
+
const projectDir = await (0, projectUtils_1.findProjectRootAsync)();
|
|
24
|
+
const { exp } = (0, config_1.getConfig)(projectDir, { skipSDKVersionRequirement: true });
|
|
25
|
+
const fullName = await (0, projectUtils_1.getProjectFullNameAsync)(exp);
|
|
26
|
+
const projectId = await (0, projectUtils_1.getProjectIdAsync)(exp);
|
|
27
|
+
let name;
|
|
28
|
+
if (nameArg) {
|
|
29
|
+
name = nameArg;
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
if (nonInteractiveFlag) {
|
|
33
|
+
throw new Error('Channel name must be set when running in non-interactive mode');
|
|
34
|
+
}
|
|
35
|
+
name = (await (0, prompts_1.promptAsync)({
|
|
36
|
+
type: 'text',
|
|
37
|
+
name: 'name',
|
|
38
|
+
message: 'Please enter the name of the channel to delete:',
|
|
39
|
+
validate: (value) => (value ? true : 'Channel name may not be empty.'),
|
|
40
|
+
})).name;
|
|
41
|
+
}
|
|
42
|
+
const data = await getChannelInfoAsync({ appId: projectId, name });
|
|
43
|
+
const channelId = (_b = (_a = data.app) === null || _a === void 0 ? void 0 : _a.byId.updateChannelByName) === null || _b === void 0 ? void 0 : _b.id;
|
|
44
|
+
if (!channelId) {
|
|
45
|
+
throw new Error(`Could not find channel ${name} on ${fullName}`);
|
|
46
|
+
}
|
|
47
|
+
if (!nonInteractiveFlag) {
|
|
48
|
+
log_1.default.addNewLineIfNone();
|
|
49
|
+
log_1.default.warn(`You are about to permamently delete channel: "${name}".\nThis action is irreversible.`);
|
|
50
|
+
log_1.default.newLine();
|
|
51
|
+
const confirmed = await (0, prompts_1.toggleConfirmAsync)({ message: 'Are you sure you wish to proceed?' });
|
|
52
|
+
if (!confirmed) {
|
|
53
|
+
log_1.default.error(`Canceled deletion of channel: "${name}".`);
|
|
54
|
+
process.exit(1);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const deletionResult = await deleteChannelOnAppAsync({
|
|
58
|
+
channelId,
|
|
59
|
+
});
|
|
60
|
+
if (jsonFlag) {
|
|
61
|
+
(0, json_1.printJsonOnlyOutput)(deletionResult);
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
log_1.default.withTick(`️Deleted channel "${name}".`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.default = ChannelDelete;
|
|
69
|
+
ChannelDelete.hidden = true;
|
|
70
|
+
ChannelDelete.description = 'Delete a channel on the current project';
|
|
71
|
+
ChannelDelete.args = [
|
|
72
|
+
{
|
|
73
|
+
name: 'name',
|
|
74
|
+
required: false,
|
|
75
|
+
description: 'Name of the channel to delete',
|
|
76
|
+
},
|
|
77
|
+
];
|
|
78
|
+
ChannelDelete.flags = {
|
|
79
|
+
json: core_1.Flags.boolean({
|
|
80
|
+
description: `Delete a channel on the current project`,
|
|
81
|
+
default: false,
|
|
82
|
+
}),
|
|
83
|
+
'non-interactive': core_1.Flags.boolean({
|
|
84
|
+
default: false,
|
|
85
|
+
description: 'Run command in non-interactive mode',
|
|
86
|
+
}),
|
|
87
|
+
};
|
|
88
|
+
async function getChannelInfoAsync({ appId, name, }) {
|
|
89
|
+
const data = await (0, client_1.withErrorHandlingAsync)(client_1.graphqlClient
|
|
90
|
+
.query((0, graphql_tag_1.default) `
|
|
91
|
+
query GetChannelInfo($appId: String!, $name: String!) {
|
|
92
|
+
app {
|
|
93
|
+
byId(appId: $appId) {
|
|
94
|
+
id
|
|
95
|
+
updateChannelByName(name: $name) {
|
|
96
|
+
id
|
|
97
|
+
name
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
`, {
|
|
103
|
+
appId,
|
|
104
|
+
name,
|
|
105
|
+
}, { additionalTypenames: ['UpdateChannel'] })
|
|
106
|
+
.toPromise());
|
|
107
|
+
return data;
|
|
108
|
+
}
|
|
109
|
+
async function deleteChannelOnAppAsync({ channelId, }) {
|
|
110
|
+
const data = await (0, client_1.withErrorHandlingAsync)(client_1.graphqlClient
|
|
111
|
+
.mutation((0, graphql_tag_1.default) `
|
|
112
|
+
mutation DeleteUpdateChannel($channelId: ID!) {
|
|
113
|
+
updateChannel {
|
|
114
|
+
deleteUpdateChannel(channelId: $channelId) {
|
|
115
|
+
id
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
`, {
|
|
120
|
+
channelId,
|
|
121
|
+
})
|
|
122
|
+
.toPromise());
|
|
123
|
+
return data.updateChannel.deleteUpdateChannel;
|
|
124
|
+
}
|