eas-cli 0.42.4 → 0.43.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 +13 -787
- package/bin/dev +17 -0
- package/bin/dev.cmd +3 -0
- package/bin/run +4 -3
- 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.js +30 -25
- package/build/commands/build/inspect.d.ts +1 -0
- package/build/commands/build/inspect.js +23 -16
- 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/update/configure.js +1 -1
- package/build/commands/update/delete.js +9 -4
- package/build/commands/update/index.js +5 -1
- package/build/commands/update/view.js +22 -17
- package/build/graphql/generated.d.ts +33 -0
- package/oclif.manifest.json +1 -1
- package/package.json +6 -4
package/bin/dev
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const oclif = require('@oclif/core');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
const project = path.join(__dirname, '..', 'tsconfig.json');
|
|
7
|
+
|
|
8
|
+
// In dev mode -> use ts-node and dev plugins
|
|
9
|
+
process.env.NODE_ENV = 'development';
|
|
10
|
+
|
|
11
|
+
require('ts-node').register({ project });
|
|
12
|
+
|
|
13
|
+
// In dev mode, always show stack traces
|
|
14
|
+
oclif.settings.disableJsonFlag = true
|
|
15
|
+
|
|
16
|
+
// Start the CLI
|
|
17
|
+
oclif.run().then(oclif.flush).catch(oclif.Errors.handle);
|
package/bin/dev.cmd
ADDED
package/bin/run
CHANGED
|
@@ -11,6 +11,7 @@ const client_1 = require("../../graphql/client");
|
|
|
11
11
|
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
|
+
const json_1 = require("../../utils/json");
|
|
14
15
|
const vcs_1 = require("../../vcs");
|
|
15
16
|
async function createUpdateBranchOnAppAsync({ appId, name, }) {
|
|
16
17
|
const result = await (0, client_1.withErrorHandlingAsync)(client_1.graphqlClient
|
|
@@ -38,6 +39,9 @@ exports.createUpdateBranchOnAppAsync = createUpdateBranchOnAppAsync;
|
|
|
38
39
|
class BranchCreate extends EasCommand_1.default {
|
|
39
40
|
async runAsync() {
|
|
40
41
|
let { args: { name }, flags, } = await this.parse(BranchCreate);
|
|
42
|
+
if (flags.json) {
|
|
43
|
+
(0, json_1.enableJsonOutput)();
|
|
44
|
+
}
|
|
41
45
|
const projectDir = await (0, projectUtils_1.findProjectRootAsync)();
|
|
42
46
|
const { exp } = (0, config_1.getConfig)(projectDir, { skipSDKVersionRequirement: true });
|
|
43
47
|
const fullName = await (0, projectUtils_1.getProjectFullNameAsync)(exp);
|
|
@@ -58,10 +62,11 @@ class BranchCreate extends EasCommand_1.default {
|
|
|
58
62
|
}
|
|
59
63
|
const newBranch = await createUpdateBranchOnAppAsync({ appId: projectId, name });
|
|
60
64
|
if (flags.json) {
|
|
61
|
-
|
|
62
|
-
|
|
65
|
+
(0, json_1.printJsonOnlyOutput)(newBranch);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
log_1.default.withTick(`️Created a new branch: ${chalk_1.default.bold(newBranch.name)} on project ${chalk_1.default.bold(fullName)}.`);
|
|
63
69
|
}
|
|
64
|
-
log_1.default.withTick(`️Created a new branch: ${chalk_1.default.bold(newBranch.name)} on project ${chalk_1.default.bold(fullName)}.`);
|
|
65
70
|
}
|
|
66
71
|
}
|
|
67
72
|
exports.default = BranchCreate;
|
|
@@ -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 getBranchInfoAsync({ appId, name, }) {
|
|
14
15
|
const data = await (0, client_1.withErrorHandlingAsync)(client_1.graphqlClient
|
|
15
16
|
.query((0, graphql_tag_1.default) `
|
|
@@ -51,6 +52,9 @@ class BranchDelete extends EasCommand_1.default {
|
|
|
51
52
|
async runAsync() {
|
|
52
53
|
var _a, _b;
|
|
53
54
|
let { args: { name }, flags: { json: jsonFlag }, } = await this.parse(BranchDelete);
|
|
55
|
+
if (jsonFlag) {
|
|
56
|
+
(0, json_1.enableJsonOutput)();
|
|
57
|
+
}
|
|
54
58
|
const projectDir = await (0, projectUtils_1.findProjectRootAsync)();
|
|
55
59
|
const { exp } = (0, config_1.getConfig)(projectDir, { skipSDKVersionRequirement: true });
|
|
56
60
|
const fullName = await (0, projectUtils_1.getProjectFullNameAsync)(exp);
|
|
@@ -87,9 +91,11 @@ class BranchDelete extends EasCommand_1.default {
|
|
|
87
91
|
branchId,
|
|
88
92
|
});
|
|
89
93
|
if (jsonFlag) {
|
|
90
|
-
|
|
94
|
+
(0, json_1.printJsonOnlyOutput)(deletionResult);
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
log_1.default.withTick(`️Deleted branch "${name}" and all of its updates on project ${chalk_1.default.bold(fullName)}.`);
|
|
91
98
|
}
|
|
92
|
-
log_1.default.withTick(`️Deleted branch "${name}" and all of its updates on project ${chalk_1.default.bold(fullName)}.`);
|
|
93
99
|
}
|
|
94
100
|
}
|
|
95
101
|
exports.default = BranchDelete;
|
|
@@ -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;
|
|
@@ -15,6 +15,7 @@ const prompts_1 = require("../../prompts");
|
|
|
15
15
|
const utils_1 = require("../../update/utils");
|
|
16
16
|
const groupBy_1 = (0, tslib_1.__importDefault)(require("../../utils/expodash/groupBy"));
|
|
17
17
|
const formatFields_1 = (0, tslib_1.__importDefault)(require("../../utils/formatFields"));
|
|
18
|
+
const json_1 = require("../../utils/json");
|
|
18
19
|
const PAGE_LIMIT = 10000;
|
|
19
20
|
async function viewUpdateBranchAsync({ appId, name, }) {
|
|
20
21
|
const data = await (0, client_1.withErrorHandlingAsync)(client_1.graphqlClient
|
|
@@ -60,6 +61,9 @@ exports.viewUpdateBranchAsync = viewUpdateBranchAsync;
|
|
|
60
61
|
class BranchView extends EasCommand_1.default {
|
|
61
62
|
async runAsync() {
|
|
62
63
|
let { args: { name }, flags: { json: jsonFlag }, } = await this.parse(BranchView);
|
|
64
|
+
if (jsonFlag) {
|
|
65
|
+
(0, json_1.enableJsonOutput)();
|
|
66
|
+
}
|
|
63
67
|
const projectDir = await (0, projectUtils_1.findProjectRootAsync)();
|
|
64
68
|
const { exp } = (0, config_1.getConfig)(projectDir, { skipSDKVersionRequirement: true });
|
|
65
69
|
const projectId = await (0, projectUtils_1.getProjectIdAsync)(exp);
|
|
@@ -85,33 +89,34 @@ class BranchView extends EasCommand_1.default {
|
|
|
85
89
|
}
|
|
86
90
|
const updates = Object.values((0, groupBy_1.default)(UpdateBranch.updates, u => u.group)).map(group => group[0]);
|
|
87
91
|
if (jsonFlag) {
|
|
88
|
-
|
|
89
|
-
return;
|
|
92
|
+
(0, json_1.printJsonOnlyOutput)({ ...UpdateBranch, updates });
|
|
90
93
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
94
|
+
else {
|
|
95
|
+
const groupTable = new cli_table3_1.default({
|
|
96
|
+
head: utils_1.UPDATE_COLUMNS,
|
|
97
|
+
wordWrap: true,
|
|
98
|
+
});
|
|
99
|
+
for (const update of updates) {
|
|
100
|
+
groupTable.push([
|
|
101
|
+
(0, utils_1.formatUpdate)(update),
|
|
102
|
+
update.runtimeVersion,
|
|
103
|
+
update.group,
|
|
104
|
+
(0, utils_1.getPlatformsForGroup)({
|
|
105
|
+
updates: UpdateBranch.updates,
|
|
106
|
+
group: update.group,
|
|
107
|
+
}),
|
|
108
|
+
]);
|
|
109
|
+
}
|
|
110
|
+
log_1.default.addNewLineIfNone();
|
|
111
|
+
log_1.default.log(chalk_1.default.bold('Branch:'));
|
|
112
|
+
log_1.default.log((0, formatFields_1.default)([
|
|
113
|
+
{ label: 'Name', value: UpdateBranch.name },
|
|
114
|
+
{ label: 'ID', value: UpdateBranch.id },
|
|
115
|
+
]));
|
|
116
|
+
log_1.default.addNewLineIfNone();
|
|
117
|
+
log_1.default.log(chalk_1.default.bold('Recently published update groups:'));
|
|
118
|
+
log_1.default.log(groupTable.toString());
|
|
105
119
|
}
|
|
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
120
|
}
|
|
116
121
|
}
|
|
117
122
|
exports.default = BranchView;
|
|
@@ -28,16 +28,19 @@ 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
46
|
skipProjectConfiguration: false,
|
|
@@ -68,19 +71,7 @@ class BuildInspect extends EasCommand_1.default {
|
|
|
68
71
|
}
|
|
69
72
|
}
|
|
70
73
|
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
|
-
}
|
|
74
|
+
await this.copyToOutputDirAsync(path_1.default.join(tmpWorkingdir, 'build'), outputDirectory);
|
|
84
75
|
}
|
|
85
76
|
}
|
|
86
77
|
}
|
|
@@ -95,6 +86,20 @@ class BuildInspect extends EasCommand_1.default {
|
|
|
95
86
|
}
|
|
96
87
|
await fs_extra_1.default.mkdirp(outputDir);
|
|
97
88
|
}
|
|
89
|
+
async copyToOutputDirAsync(src, dst) {
|
|
90
|
+
const spinner = (0, ora_1.ora)().start(`Copying project directory to ${dst}`);
|
|
91
|
+
try {
|
|
92
|
+
if (await fs_extra_1.default.pathExists(src)) {
|
|
93
|
+
await fs_extra_1.default.copy(src, dst);
|
|
94
|
+
}
|
|
95
|
+
await fs_extra_1.default.remove(src);
|
|
96
|
+
spinner.succeed(`Project directory saved to ${dst}`);
|
|
97
|
+
}
|
|
98
|
+
catch (err) {
|
|
99
|
+
spinner.fail();
|
|
100
|
+
throw err;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
98
103
|
}
|
|
99
104
|
exports.default = BuildInspect;
|
|
100
105
|
BuildInspect.description = 'Inspect the state of the project at specific build stages. Useful for troubleshooting.';
|
|
@@ -115,6 +120,7 @@ BuildInspect.flags = {
|
|
|
115
120
|
required: true,
|
|
116
121
|
}),
|
|
117
122
|
output: core_1.Flags.string({
|
|
123
|
+
char: 'o',
|
|
118
124
|
description: 'Output directory.',
|
|
119
125
|
required: true,
|
|
120
126
|
helpValue: 'OUTPUT_DIRECTORY',
|
|
@@ -124,6 +130,7 @@ BuildInspect.flags = {
|
|
|
124
130
|
default: false,
|
|
125
131
|
}),
|
|
126
132
|
verbose: core_1.Flags.boolean({
|
|
133
|
+
char: 'v',
|
|
127
134
|
default: false,
|
|
128
135
|
}),
|
|
129
136
|
};
|
|
@@ -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
|
+
}
|
|
@@ -11,6 +11,7 @@ const client_1 = require("../../graphql/client");
|
|
|
11
11
|
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
|
+
const json_1 = require("../../utils/json");
|
|
14
15
|
async function getChannelByNameForAppAsync({ appId, channelName, }) {
|
|
15
16
|
var _a;
|
|
16
17
|
const data = await (0, client_1.withErrorHandlingAsync)(client_1.graphqlClient
|
|
@@ -62,6 +63,9 @@ exports.updateChannelBranchMappingAsync = updateChannelBranchMappingAsync;
|
|
|
62
63
|
class ChannelEdit extends EasCommand_1.default {
|
|
63
64
|
async runAsync() {
|
|
64
65
|
let { args: { name: channelName }, flags: { branch: branchName, json: jsonFlag }, } = await this.parse(ChannelEdit);
|
|
66
|
+
if (jsonFlag) {
|
|
67
|
+
(0, json_1.enableJsonOutput)();
|
|
68
|
+
}
|
|
65
69
|
const projectDir = await (0, projectUtils_1.findProjectRootAsync)();
|
|
66
70
|
const { exp } = (0, config_1.getConfig)(projectDir, { skipSDKVersionRequirement: true });
|
|
67
71
|
const projectId = await (0, projectUtils_1.getProjectIdAsync)(exp);
|
|
@@ -103,12 +107,13 @@ class ChannelEdit extends EasCommand_1.default {
|
|
|
103
107
|
}),
|
|
104
108
|
});
|
|
105
109
|
if (jsonFlag) {
|
|
106
|
-
|
|
107
|
-
|
|
110
|
+
(0, json_1.printJsonOnlyOutput)(channel);
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
log_1.default.withTick((0, chalk_1.default) `Channel {bold ${channel.name}} is now set to branch {bold ${branch.name}}.\n`);
|
|
114
|
+
log_1.default.addNewLineIfNone();
|
|
115
|
+
log_1.default.log((0, chalk_1.default) `Users with builds on channel {bold ${channel.name}} will now receive the active update on {bold ${branch.name}}.`);
|
|
108
116
|
}
|
|
109
|
-
log_1.default.withTick((0, chalk_1.default) `Channel {bold ${channel.name}} is now set to branch {bold ${branch.name}}.\n`);
|
|
110
|
-
log_1.default.addNewLineIfNone();
|
|
111
|
-
log_1.default.log((0, chalk_1.default) `Users with builds on channel {bold ${channel.name}} will now receive the active update on {bold ${branch.name}}.`);
|
|
112
117
|
}
|
|
113
118
|
}
|
|
114
119
|
exports.default = ChannelEdit;
|
|
@@ -9,6 +9,7 @@ const client_1 = require("../../graphql/client");
|
|
|
9
9
|
const log_1 = (0, tslib_1.__importDefault)(require("../../log"));
|
|
10
10
|
const projectUtils_1 = require("../../project/projectUtils");
|
|
11
11
|
const formatFields_1 = (0, tslib_1.__importDefault)(require("../../utils/formatFields"));
|
|
12
|
+
const json_1 = require("../../utils/json");
|
|
12
13
|
const view_1 = require("./view");
|
|
13
14
|
const CHANNEL_LIMIT = 10000;
|
|
14
15
|
async function getAllUpdateChannelForAppAsync({ appId, }) {
|
|
@@ -54,6 +55,9 @@ class ChannelList extends EasCommand_1.default {
|
|
|
54
55
|
async runAsync() {
|
|
55
56
|
var _a;
|
|
56
57
|
const { flags: { json: jsonFlag }, } = await this.parse(ChannelList);
|
|
58
|
+
if (jsonFlag) {
|
|
59
|
+
(0, json_1.enableJsonOutput)();
|
|
60
|
+
}
|
|
57
61
|
const projectDir = await (0, projectUtils_1.findProjectRootAsync)();
|
|
58
62
|
const { exp } = (0, config_1.getConfig)(projectDir, { skipSDKVersionRequirement: true });
|
|
59
63
|
const projectId = await (0, projectUtils_1.getProjectIdAsync)(exp);
|
|
@@ -65,16 +69,17 @@ class ChannelList extends EasCommand_1.default {
|
|
|
65
69
|
throw new Error(`Could not find channels on project with id ${projectId}`);
|
|
66
70
|
}
|
|
67
71
|
if (jsonFlag) {
|
|
68
|
-
|
|
69
|
-
return;
|
|
72
|
+
(0, json_1.printJsonOnlyOutput)(channels);
|
|
70
73
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
else {
|
|
75
|
+
for (const channel of channels) {
|
|
76
|
+
log_1.default.addNewLineIfNone();
|
|
77
|
+
log_1.default.log((0, formatFields_1.default)([
|
|
78
|
+
{ label: 'Name', value: channel.name },
|
|
79
|
+
{ label: 'ID', value: channel.id },
|
|
80
|
+
]));
|
|
81
|
+
(0, view_1.logChannelDetails)(channel);
|
|
82
|
+
}
|
|
78
83
|
}
|
|
79
84
|
}
|
|
80
85
|
}
|
|
@@ -8,6 +8,7 @@ const EasCommand_1 = (0, tslib_1.__importDefault)(require("../../commandUtils/Ea
|
|
|
8
8
|
const log_1 = (0, tslib_1.__importDefault)(require("../../log"));
|
|
9
9
|
const projectUtils_1 = require("../../project/projectUtils");
|
|
10
10
|
const prompts_1 = require("../../prompts");
|
|
11
|
+
const json_1 = require("../../utils/json");
|
|
11
12
|
const edit_1 = require("./edit");
|
|
12
13
|
const view_1 = require("./view");
|
|
13
14
|
async function promptForRolloutPercentAsync({ promptMessage, }) {
|
|
@@ -166,6 +167,9 @@ class ChannelRollout extends EasCommand_1.default {
|
|
|
166
167
|
async runAsync() {
|
|
167
168
|
var _a, _b;
|
|
168
169
|
const { args: { channel: channelName }, flags: { json: jsonFlag, end: endFlag, branch: branchName, percent }, } = await this.parse(ChannelRollout);
|
|
170
|
+
if (jsonFlag) {
|
|
171
|
+
(0, json_1.enableJsonOutput)();
|
|
172
|
+
}
|
|
169
173
|
const projectDir = await (0, projectUtils_1.findProjectRootAsync)();
|
|
170
174
|
const { exp } = (0, config_1.getConfig)(projectDir, { skipSDKVersionRequirement: true });
|
|
171
175
|
const fullName = await (0, projectUtils_1.getProjectFullNameAsync)(exp);
|
|
@@ -228,10 +232,11 @@ class ChannelRollout extends EasCommand_1.default {
|
|
|
228
232
|
}
|
|
229
233
|
const { newChannelInfo, logMessage } = rolloutMutationResult;
|
|
230
234
|
if (jsonFlag) {
|
|
231
|
-
|
|
232
|
-
|
|
235
|
+
(0, json_1.printJsonOnlyOutput)(newChannelInfo);
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
log_1.default.withTick(logMessage);
|
|
233
239
|
}
|
|
234
|
-
log_1.default.withTick(logMessage);
|
|
235
240
|
}
|
|
236
241
|
}
|
|
237
242
|
exports.default = ChannelRollout;
|