@apps-in-toss/cli 1.6.2 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/index.cjs +101 -43
- package/dist/index.js +101 -43
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @apps-in-toss/cli
|
|
2
2
|
|
|
3
|
+
## 1.7.1
|
|
4
|
+
|
|
5
|
+
## 1.7.0
|
|
6
|
+
|
|
7
|
+
### Minor Changes
|
|
8
|
+
|
|
9
|
+
[[AIT-3608] npx ait deploy cli 경험 개선](https://github.toss.bz/toss/apps-in-toss-sdk/pull/8)
|
|
10
|
+
|
|
11
|
+
yarn ait deploy의 옵션을 수정하고 추가하여 사용성을 개선합니다.
|
|
12
|
+
|
|
13
|
+
- --scheme-only 옵션 추가를 통해 intoss-private scheme을 파싱하기 쉽도록 변경했습니다.
|
|
14
|
+
- --location 옵션을 추가해 명시적으로 ait 파일의 위치를 지정 가능하게 합니다.
|
|
15
|
+
- --workspace 옵션을 --profile로 변경해 workspace 개념과 혼동하지 않도록 변경합니다.
|
|
16
|
+
|
|
3
17
|
## 1.6.2
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -1022,29 +1022,40 @@ var DeployCommand = class extends import_clipanion.Command {
|
|
|
1022
1022
|
static paths = [["deploy"]];
|
|
1023
1023
|
apiKey = import_clipanion.Option.String("--api-key", {
|
|
1024
1024
|
required: false,
|
|
1025
|
-
description: "\
|
|
1025
|
+
description: "\uBC30\uD3EC\uB97C \uC704\uD55C API \uD0A4\uC785\uB2C8\uB2E4. \uBA85\uC2DC\uC801\uC73C\uB85C \uC774 \uC635\uC158\uC73C\uB85C api key\uB97C \uC9C1\uC811 \uC785\uB825\uD558\uAC70\uB098, --profile \uC635\uC158\uC744 \uC0AC\uC6A9\uD574\uC11C \uD504\uB85C\uD544\uC744 \uC9C0\uC815\uD558\uBA74 \uD504\uB85C\uD544\uC5D0 \uB4F1\uB85D\uB41C api key\uB97C \uC0AC\uC6A9\uD574\uC694."
|
|
1026
1026
|
});
|
|
1027
1027
|
workspace = import_clipanion.Option.String("--workspace", {
|
|
1028
1028
|
required: false,
|
|
1029
|
-
description: "\uD1A0\uD070 \uC6CC\uD06C\uC2A4\uD398\uC774\uC2A4 \uC774\uB984"
|
|
1029
|
+
description: "(deprecated) \uD1A0\uD070 \uC6CC\uD06C\uC2A4\uD398\uC774\uC2A4 \uC774\uB984\uC785\uB2C8\uB2E4. \uC774 \uC635\uC158 \uB300\uC2E0 --profile \uC635\uC158\uC744 \uC0AC\uC6A9\uD574\uC8FC\uC138\uC694."
|
|
1030
|
+
});
|
|
1031
|
+
profile = import_clipanion.Option.String("--profile", {
|
|
1032
|
+
required: false,
|
|
1033
|
+
description: "ait token add \uBA85\uB839\uC5B4\uB97C \uD1B5\uD574 \uB4F1\uB85D\uD55C \uD504\uB85C\uD544\uC774\uC5D0\uC694. \uD504\uB85C\uD544\uC774 \uC5C6\uC73C\uBA74 default \uD504\uB85C\uD544\uC744 \uC0AC\uC6A9\uD574\uC694."
|
|
1030
1034
|
});
|
|
1031
1035
|
baseUrl = import_clipanion.Option.String("--base-url", {
|
|
1032
|
-
description: "API Base URL"
|
|
1036
|
+
description: "API Base URL",
|
|
1037
|
+
required: false
|
|
1038
|
+
});
|
|
1039
|
+
location = import_clipanion.Option.String("--location", {
|
|
1040
|
+
description: "\uC5C5\uB85C\uB4DC\uD560 .ait \uD30C\uC77C\uC758 \uACBD\uB85C\uB97C \uBA85\uC2DC\uC801\uC73C\uB85C \uC9C0\uC815\uD574\uC694. \uAE30\uBCF8\uAC12\uC740 \uD604\uC7AC \uD328\uD0A4\uC9C0 \uB8E8\uD2B8 \uB514\uB809\uD1A0\uB9AC\uC5D0 \uC788\uB294 ait \uD30C\uC77C\uC774\uC5D0\uC694.",
|
|
1041
|
+
required: false
|
|
1042
|
+
});
|
|
1043
|
+
schemeOnly = import_clipanion.Option.Boolean("--scheme-only", {
|
|
1044
|
+
required: false,
|
|
1045
|
+
description: "\uBC30\uD3EC \uACB0\uACFC\uB97C intoss-private scheme\uB9CC \uCD9C\uB825\uD558\uB3C4\uB85D \uC124\uC815\uD574\uC694. \uAE30\uBCF8\uAC12\uC740 false\uC608\uC694."
|
|
1033
1046
|
});
|
|
1034
1047
|
async execute() {
|
|
1035
1048
|
const baseUrl = this.baseUrl;
|
|
1036
|
-
const
|
|
1037
|
-
|
|
1049
|
+
const profile = this.profile || this.workspace || "default";
|
|
1050
|
+
if (this.workspace) {
|
|
1051
|
+
p.log.warn("(deprecated) --workspace \uC635\uC158\uC740 \uC774\uC81C \uC0AC\uC6A9\uD558\uC9C0 \uC54A\uC544\uC694. \uC774 \uC635\uC158 \uB300\uC2E0 --profile \uC635\uC158\uC744 \uC0AC\uC6A9\uD574\uC8FC\uC138\uC694.");
|
|
1052
|
+
}
|
|
1053
|
+
const apiKey = await this.getApiKey(profile);
|
|
1038
1054
|
if (p.isCancel(apiKey)) {
|
|
1039
1055
|
return;
|
|
1040
1056
|
}
|
|
1041
1057
|
try {
|
|
1042
|
-
const
|
|
1043
|
-
const artifactFile = import_fs3.default.readdirSync(packageRoot).find((file) => file.endsWith(".ait"));
|
|
1044
|
-
if (!artifactFile) {
|
|
1045
|
-
throw new Error("\uBC30\uD3EC\uD560 .ait \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.");
|
|
1046
|
-
}
|
|
1047
|
-
const resolvedArtifactPath = import_path2.default.resolve(packageRoot, artifactFile);
|
|
1058
|
+
const resolvedArtifactPath = this.getArtifactPath(this.location);
|
|
1048
1059
|
const { appName, deploymentId } = await (0, import_utils.readZipContent)(resolvedArtifactPath, APP_MANIFEST_NAME).then((rawAppManifest) => {
|
|
1049
1060
|
const appManifest = JSON.parse(rawAppManifest);
|
|
1050
1061
|
const appName2 = appManifest.appName;
|
|
@@ -1056,34 +1067,67 @@ var DeployCommand = class extends import_clipanion.Command {
|
|
|
1056
1067
|
debug3("invalid ait file", error);
|
|
1057
1068
|
throw new Error("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 ait \uD30C\uC77C\uC785\uB2C8\uB2E4");
|
|
1058
1069
|
});
|
|
1059
|
-
const colorAppName =
|
|
1060
|
-
|
|
1061
|
-
{
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1070
|
+
const colorAppName = this.decorate(appName, import_picocolors.default.cyan);
|
|
1071
|
+
if (this.schemeOnly) {
|
|
1072
|
+
await uploadArtifact({
|
|
1073
|
+
artifactPath: resolvedArtifactPath,
|
|
1074
|
+
appName,
|
|
1075
|
+
deploymentId,
|
|
1076
|
+
apiKey,
|
|
1077
|
+
baseUrl
|
|
1078
|
+
});
|
|
1079
|
+
} else {
|
|
1080
|
+
await p.tasks([
|
|
1081
|
+
{
|
|
1082
|
+
title: `${colorAppName} \uC571 \uBC30\uD3EC \uC911...`,
|
|
1083
|
+
task: async () => {
|
|
1084
|
+
await uploadArtifact({
|
|
1085
|
+
artifactPath: resolvedArtifactPath,
|
|
1086
|
+
appName,
|
|
1087
|
+
deploymentId,
|
|
1088
|
+
apiKey,
|
|
1089
|
+
baseUrl
|
|
1090
|
+
});
|
|
1091
|
+
return `${colorAppName} \uBC30\uD3EC\uAC00 \uC644\uB8CC\uB418\uC5C8\uC5B4\uC694`;
|
|
1092
|
+
}
|
|
1072
1093
|
}
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1094
|
+
]);
|
|
1095
|
+
}
|
|
1096
|
+
this.printResult(appName, deploymentId);
|
|
1076
1097
|
} catch (error) {
|
|
1077
1098
|
if (error instanceof Error) {
|
|
1078
|
-
|
|
1099
|
+
this.printError(error);
|
|
1079
1100
|
} else {
|
|
1080
1101
|
console.error(error);
|
|
1081
1102
|
}
|
|
1082
1103
|
process.exit(1);
|
|
1083
1104
|
}
|
|
1084
1105
|
}
|
|
1085
|
-
|
|
1086
|
-
|
|
1106
|
+
decorate(message, color) {
|
|
1107
|
+
if (this.schemeOnly) {
|
|
1108
|
+
return message;
|
|
1109
|
+
}
|
|
1110
|
+
return import_picocolors.default.underline(color(message));
|
|
1111
|
+
}
|
|
1112
|
+
printResult(appName, deploymentId) {
|
|
1113
|
+
const result = `intoss-private://${appName}?_deploymentId=${deploymentId}`;
|
|
1114
|
+
if (this.schemeOnly) {
|
|
1115
|
+
this.context.stdout.write(`${result}
|
|
1116
|
+
`);
|
|
1117
|
+
} else {
|
|
1118
|
+
p.note(this.decorate(result, import_picocolors.default.green));
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
printError(error) {
|
|
1122
|
+
if (this.schemeOnly) {
|
|
1123
|
+
this.context.stdout.write(`${error.message}
|
|
1124
|
+
`);
|
|
1125
|
+
} else {
|
|
1126
|
+
p.log.error(error.message);
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
async getApiKey(profile) {
|
|
1130
|
+
const token = TokenStorage.get(profile) || this.apiKey;
|
|
1087
1131
|
if (token) {
|
|
1088
1132
|
return token;
|
|
1089
1133
|
}
|
|
@@ -1097,6 +1141,20 @@ var DeployCommand = class extends import_clipanion.Command {
|
|
|
1097
1141
|
}
|
|
1098
1142
|
});
|
|
1099
1143
|
}
|
|
1144
|
+
getArtifactPath(location) {
|
|
1145
|
+
if (location) {
|
|
1146
|
+
if (!location.endsWith(".ait")) {
|
|
1147
|
+
throw new Error("\uBC30\uD3EC\uD560 \uD30C\uC77C\uC740 .ait \uD655\uC7A5\uC790\uC5EC\uC57C \uD569\uB2C8\uB2E4.");
|
|
1148
|
+
}
|
|
1149
|
+
return import_path2.default.resolve(location);
|
|
1150
|
+
}
|
|
1151
|
+
const packageRoot = (0, import_utils.getPackageRoot)();
|
|
1152
|
+
const artifactFile = import_fs3.default.readdirSync(packageRoot).find((file) => file.endsWith(".ait"));
|
|
1153
|
+
if (!artifactFile) {
|
|
1154
|
+
throw new Error("\uBC30\uD3EC\uD560 .ait \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.");
|
|
1155
|
+
}
|
|
1156
|
+
return import_path2.default.resolve(packageRoot, artifactFile);
|
|
1157
|
+
}
|
|
1100
1158
|
};
|
|
1101
1159
|
|
|
1102
1160
|
// src/InitCommand.ts
|
|
@@ -1947,8 +2005,8 @@ var TokenCommand = class extends import_clipanion4.Command {
|
|
|
1947
2005
|
static usage = import_clipanion4.Command.Usage({
|
|
1948
2006
|
description: "\uD1A0\uD070 \uAD00\uB828 \uD558\uC704 \uBA85\uB839\uC744 \uAD00\uB9AC\uD569\uB2C8\uB2E4.",
|
|
1949
2007
|
examples: [
|
|
1950
|
-
["\uD1A0\uD070 \uCD94\uAC00", "ait token add <
|
|
1951
|
-
["\uD1A0\uD070 \uC0AD\uC81C", "ait token remove <
|
|
2008
|
+
["\uD1A0\uD070 \uCD94\uAC00", "ait token add <profile?>"],
|
|
2009
|
+
["\uD1A0\uD070 \uC0AD\uC81C", "ait token remove <profile?>"]
|
|
1952
2010
|
]
|
|
1953
2011
|
});
|
|
1954
2012
|
async execute() {
|
|
@@ -1964,10 +2022,10 @@ var TokenAddCommand = class extends import_clipanion4.Command {
|
|
|
1964
2022
|
["\uBCC4\uCE6D\uC744 \uC9C0\uC815\uD558\uC5EC \uD1A0\uD070 \uCD94\uAC00", "ait token add dev"]
|
|
1965
2023
|
]
|
|
1966
2024
|
});
|
|
1967
|
-
|
|
2025
|
+
profile = import_clipanion4.Option.String({ required: false });
|
|
1968
2026
|
apiKey = import_clipanion4.Option.String("--api-key", { required: false });
|
|
1969
2027
|
async execute() {
|
|
1970
|
-
const
|
|
2028
|
+
const profile = this.profile || "default";
|
|
1971
2029
|
const secret = this.apiKey ? this.apiKey : await p3.password({
|
|
1972
2030
|
message: "Enter secret token:",
|
|
1973
2031
|
validate: (value) => {
|
|
@@ -1980,9 +2038,9 @@ var TokenAddCommand = class extends import_clipanion4.Command {
|
|
|
1980
2038
|
if (p3.isCancel(secret)) {
|
|
1981
2039
|
return;
|
|
1982
2040
|
}
|
|
1983
|
-
TokenStorage.set(
|
|
1984
|
-
debug4("token add", {
|
|
1985
|
-
this.context.stdout.write(`${
|
|
2041
|
+
TokenStorage.set(profile, secret);
|
|
2042
|
+
debug4("token add", { profile });
|
|
2043
|
+
this.context.stdout.write(`${profile} \uD504\uB85C\uD544\uB85C\uC758 \uC694\uCCAD\uC740 \uC774\uC81C \uBE44\uBC00 \uD1A0\uD070\uC744 \uC0AC\uC6A9\uD558\uC5EC \uC778\uC99D\uB429\uB2C8\uB2E4.
|
|
1986
2044
|
`);
|
|
1987
2045
|
}
|
|
1988
2046
|
};
|
|
@@ -1995,16 +2053,16 @@ var TokenRemoveCommand = class extends import_clipanion4.Command {
|
|
|
1995
2053
|
["\uBCC4\uCE6D\uC744 \uC9C0\uC815\uD558\uC5EC \uD1A0\uD070 \uC0AD\uC81C", "ait token remove dev"]
|
|
1996
2054
|
]
|
|
1997
2055
|
});
|
|
1998
|
-
|
|
2056
|
+
profile = import_clipanion4.Option.String({ required: false });
|
|
1999
2057
|
async execute() {
|
|
2000
|
-
const
|
|
2001
|
-
const removed = TokenStorage.delete(
|
|
2002
|
-
debug4("token remove", {
|
|
2058
|
+
const profile = this.profile || "default";
|
|
2059
|
+
const removed = TokenStorage.delete(profile);
|
|
2060
|
+
debug4("token remove", { profile });
|
|
2003
2061
|
if (removed) {
|
|
2004
|
-
this.context.stdout.write(`\
|
|
2062
|
+
this.context.stdout.write(`\uD1A0\uD070\uC744 \uC81C\uAC70\uD588\uC2B5\uB2C8\uB2E4: ${profile}.
|
|
2005
2063
|
`);
|
|
2006
2064
|
} else {
|
|
2007
|
-
this.context.stdout.write(`\
|
|
2065
|
+
this.context.stdout.write(`\uD1A0\uD070\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${profile}.
|
|
2008
2066
|
`);
|
|
2009
2067
|
}
|
|
2010
2068
|
}
|
package/dist/index.js
CHANGED
|
@@ -1018,29 +1018,40 @@ var DeployCommand = class extends Command {
|
|
|
1018
1018
|
static paths = [["deploy"]];
|
|
1019
1019
|
apiKey = Option.String("--api-key", {
|
|
1020
1020
|
required: false,
|
|
1021
|
-
description: "\
|
|
1021
|
+
description: "\uBC30\uD3EC\uB97C \uC704\uD55C API \uD0A4\uC785\uB2C8\uB2E4. \uBA85\uC2DC\uC801\uC73C\uB85C \uC774 \uC635\uC158\uC73C\uB85C api key\uB97C \uC9C1\uC811 \uC785\uB825\uD558\uAC70\uB098, --profile \uC635\uC158\uC744 \uC0AC\uC6A9\uD574\uC11C \uD504\uB85C\uD544\uC744 \uC9C0\uC815\uD558\uBA74 \uD504\uB85C\uD544\uC5D0 \uB4F1\uB85D\uB41C api key\uB97C \uC0AC\uC6A9\uD574\uC694."
|
|
1022
1022
|
});
|
|
1023
1023
|
workspace = Option.String("--workspace", {
|
|
1024
1024
|
required: false,
|
|
1025
|
-
description: "\uD1A0\uD070 \uC6CC\uD06C\uC2A4\uD398\uC774\uC2A4 \uC774\uB984"
|
|
1025
|
+
description: "(deprecated) \uD1A0\uD070 \uC6CC\uD06C\uC2A4\uD398\uC774\uC2A4 \uC774\uB984\uC785\uB2C8\uB2E4. \uC774 \uC635\uC158 \uB300\uC2E0 --profile \uC635\uC158\uC744 \uC0AC\uC6A9\uD574\uC8FC\uC138\uC694."
|
|
1026
|
+
});
|
|
1027
|
+
profile = Option.String("--profile", {
|
|
1028
|
+
required: false,
|
|
1029
|
+
description: "ait token add \uBA85\uB839\uC5B4\uB97C \uD1B5\uD574 \uB4F1\uB85D\uD55C \uD504\uB85C\uD544\uC774\uC5D0\uC694. \uD504\uB85C\uD544\uC774 \uC5C6\uC73C\uBA74 default \uD504\uB85C\uD544\uC744 \uC0AC\uC6A9\uD574\uC694."
|
|
1026
1030
|
});
|
|
1027
1031
|
baseUrl = Option.String("--base-url", {
|
|
1028
|
-
description: "API Base URL"
|
|
1032
|
+
description: "API Base URL",
|
|
1033
|
+
required: false
|
|
1034
|
+
});
|
|
1035
|
+
location = Option.String("--location", {
|
|
1036
|
+
description: "\uC5C5\uB85C\uB4DC\uD560 .ait \uD30C\uC77C\uC758 \uACBD\uB85C\uB97C \uBA85\uC2DC\uC801\uC73C\uB85C \uC9C0\uC815\uD574\uC694. \uAE30\uBCF8\uAC12\uC740 \uD604\uC7AC \uD328\uD0A4\uC9C0 \uB8E8\uD2B8 \uB514\uB809\uD1A0\uB9AC\uC5D0 \uC788\uB294 ait \uD30C\uC77C\uC774\uC5D0\uC694.",
|
|
1037
|
+
required: false
|
|
1038
|
+
});
|
|
1039
|
+
schemeOnly = Option.Boolean("--scheme-only", {
|
|
1040
|
+
required: false,
|
|
1041
|
+
description: "\uBC30\uD3EC \uACB0\uACFC\uB97C intoss-private scheme\uB9CC \uCD9C\uB825\uD558\uB3C4\uB85D \uC124\uC815\uD574\uC694. \uAE30\uBCF8\uAC12\uC740 false\uC608\uC694."
|
|
1029
1042
|
});
|
|
1030
1043
|
async execute() {
|
|
1031
1044
|
const baseUrl = this.baseUrl;
|
|
1032
|
-
const
|
|
1033
|
-
|
|
1045
|
+
const profile = this.profile || this.workspace || "default";
|
|
1046
|
+
if (this.workspace) {
|
|
1047
|
+
p.log.warn("(deprecated) --workspace \uC635\uC158\uC740 \uC774\uC81C \uC0AC\uC6A9\uD558\uC9C0 \uC54A\uC544\uC694. \uC774 \uC635\uC158 \uB300\uC2E0 --profile \uC635\uC158\uC744 \uC0AC\uC6A9\uD574\uC8FC\uC138\uC694.");
|
|
1048
|
+
}
|
|
1049
|
+
const apiKey = await this.getApiKey(profile);
|
|
1034
1050
|
if (p.isCancel(apiKey)) {
|
|
1035
1051
|
return;
|
|
1036
1052
|
}
|
|
1037
1053
|
try {
|
|
1038
|
-
const
|
|
1039
|
-
const artifactFile = fs3.readdirSync(packageRoot).find((file) => file.endsWith(".ait"));
|
|
1040
|
-
if (!artifactFile) {
|
|
1041
|
-
throw new Error("\uBC30\uD3EC\uD560 .ait \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.");
|
|
1042
|
-
}
|
|
1043
|
-
const resolvedArtifactPath = path2.resolve(packageRoot, artifactFile);
|
|
1054
|
+
const resolvedArtifactPath = this.getArtifactPath(this.location);
|
|
1044
1055
|
const { appName, deploymentId } = await readZipContent(resolvedArtifactPath, APP_MANIFEST_NAME).then((rawAppManifest) => {
|
|
1045
1056
|
const appManifest = JSON.parse(rawAppManifest);
|
|
1046
1057
|
const appName2 = appManifest.appName;
|
|
@@ -1052,34 +1063,67 @@ var DeployCommand = class extends Command {
|
|
|
1052
1063
|
debug3("invalid ait file", error);
|
|
1053
1064
|
throw new Error("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 ait \uD30C\uC77C\uC785\uB2C8\uB2E4");
|
|
1054
1065
|
});
|
|
1055
|
-
const colorAppName =
|
|
1056
|
-
|
|
1057
|
-
{
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1066
|
+
const colorAppName = this.decorate(appName, import_picocolors.default.cyan);
|
|
1067
|
+
if (this.schemeOnly) {
|
|
1068
|
+
await uploadArtifact({
|
|
1069
|
+
artifactPath: resolvedArtifactPath,
|
|
1070
|
+
appName,
|
|
1071
|
+
deploymentId,
|
|
1072
|
+
apiKey,
|
|
1073
|
+
baseUrl
|
|
1074
|
+
});
|
|
1075
|
+
} else {
|
|
1076
|
+
await p.tasks([
|
|
1077
|
+
{
|
|
1078
|
+
title: `${colorAppName} \uC571 \uBC30\uD3EC \uC911...`,
|
|
1079
|
+
task: async () => {
|
|
1080
|
+
await uploadArtifact({
|
|
1081
|
+
artifactPath: resolvedArtifactPath,
|
|
1082
|
+
appName,
|
|
1083
|
+
deploymentId,
|
|
1084
|
+
apiKey,
|
|
1085
|
+
baseUrl
|
|
1086
|
+
});
|
|
1087
|
+
return `${colorAppName} \uBC30\uD3EC\uAC00 \uC644\uB8CC\uB418\uC5C8\uC5B4\uC694`;
|
|
1088
|
+
}
|
|
1068
1089
|
}
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1090
|
+
]);
|
|
1091
|
+
}
|
|
1092
|
+
this.printResult(appName, deploymentId);
|
|
1072
1093
|
} catch (error) {
|
|
1073
1094
|
if (error instanceof Error) {
|
|
1074
|
-
|
|
1095
|
+
this.printError(error);
|
|
1075
1096
|
} else {
|
|
1076
1097
|
console.error(error);
|
|
1077
1098
|
}
|
|
1078
1099
|
process.exit(1);
|
|
1079
1100
|
}
|
|
1080
1101
|
}
|
|
1081
|
-
|
|
1082
|
-
|
|
1102
|
+
decorate(message, color) {
|
|
1103
|
+
if (this.schemeOnly) {
|
|
1104
|
+
return message;
|
|
1105
|
+
}
|
|
1106
|
+
return import_picocolors.default.underline(color(message));
|
|
1107
|
+
}
|
|
1108
|
+
printResult(appName, deploymentId) {
|
|
1109
|
+
const result = `intoss-private://${appName}?_deploymentId=${deploymentId}`;
|
|
1110
|
+
if (this.schemeOnly) {
|
|
1111
|
+
this.context.stdout.write(`${result}
|
|
1112
|
+
`);
|
|
1113
|
+
} else {
|
|
1114
|
+
p.note(this.decorate(result, import_picocolors.default.green));
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
printError(error) {
|
|
1118
|
+
if (this.schemeOnly) {
|
|
1119
|
+
this.context.stdout.write(`${error.message}
|
|
1120
|
+
`);
|
|
1121
|
+
} else {
|
|
1122
|
+
p.log.error(error.message);
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
async getApiKey(profile) {
|
|
1126
|
+
const token = TokenStorage.get(profile) || this.apiKey;
|
|
1083
1127
|
if (token) {
|
|
1084
1128
|
return token;
|
|
1085
1129
|
}
|
|
@@ -1093,6 +1137,20 @@ var DeployCommand = class extends Command {
|
|
|
1093
1137
|
}
|
|
1094
1138
|
});
|
|
1095
1139
|
}
|
|
1140
|
+
getArtifactPath(location) {
|
|
1141
|
+
if (location) {
|
|
1142
|
+
if (!location.endsWith(".ait")) {
|
|
1143
|
+
throw new Error("\uBC30\uD3EC\uD560 \uD30C\uC77C\uC740 .ait \uD655\uC7A5\uC790\uC5EC\uC57C \uD569\uB2C8\uB2E4.");
|
|
1144
|
+
}
|
|
1145
|
+
return path2.resolve(location);
|
|
1146
|
+
}
|
|
1147
|
+
const packageRoot = getPackageRoot();
|
|
1148
|
+
const artifactFile = fs3.readdirSync(packageRoot).find((file) => file.endsWith(".ait"));
|
|
1149
|
+
if (!artifactFile) {
|
|
1150
|
+
throw new Error("\uBC30\uD3EC\uD560 .ait \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.");
|
|
1151
|
+
}
|
|
1152
|
+
return path2.resolve(packageRoot, artifactFile);
|
|
1153
|
+
}
|
|
1096
1154
|
};
|
|
1097
1155
|
|
|
1098
1156
|
// src/InitCommand.ts
|
|
@@ -1943,8 +2001,8 @@ var TokenCommand = class extends Command4 {
|
|
|
1943
2001
|
static usage = Command4.Usage({
|
|
1944
2002
|
description: "\uD1A0\uD070 \uAD00\uB828 \uD558\uC704 \uBA85\uB839\uC744 \uAD00\uB9AC\uD569\uB2C8\uB2E4.",
|
|
1945
2003
|
examples: [
|
|
1946
|
-
["\uD1A0\uD070 \uCD94\uAC00", "ait token add <
|
|
1947
|
-
["\uD1A0\uD070 \uC0AD\uC81C", "ait token remove <
|
|
2004
|
+
["\uD1A0\uD070 \uCD94\uAC00", "ait token add <profile?>"],
|
|
2005
|
+
["\uD1A0\uD070 \uC0AD\uC81C", "ait token remove <profile?>"]
|
|
1948
2006
|
]
|
|
1949
2007
|
});
|
|
1950
2008
|
async execute() {
|
|
@@ -1960,10 +2018,10 @@ var TokenAddCommand = class extends Command4 {
|
|
|
1960
2018
|
["\uBCC4\uCE6D\uC744 \uC9C0\uC815\uD558\uC5EC \uD1A0\uD070 \uCD94\uAC00", "ait token add dev"]
|
|
1961
2019
|
]
|
|
1962
2020
|
});
|
|
1963
|
-
|
|
2021
|
+
profile = Option4.String({ required: false });
|
|
1964
2022
|
apiKey = Option4.String("--api-key", { required: false });
|
|
1965
2023
|
async execute() {
|
|
1966
|
-
const
|
|
2024
|
+
const profile = this.profile || "default";
|
|
1967
2025
|
const secret = this.apiKey ? this.apiKey : await p3.password({
|
|
1968
2026
|
message: "Enter secret token:",
|
|
1969
2027
|
validate: (value) => {
|
|
@@ -1976,9 +2034,9 @@ var TokenAddCommand = class extends Command4 {
|
|
|
1976
2034
|
if (p3.isCancel(secret)) {
|
|
1977
2035
|
return;
|
|
1978
2036
|
}
|
|
1979
|
-
TokenStorage.set(
|
|
1980
|
-
debug4("token add", {
|
|
1981
|
-
this.context.stdout.write(`${
|
|
2037
|
+
TokenStorage.set(profile, secret);
|
|
2038
|
+
debug4("token add", { profile });
|
|
2039
|
+
this.context.stdout.write(`${profile} \uD504\uB85C\uD544\uB85C\uC758 \uC694\uCCAD\uC740 \uC774\uC81C \uBE44\uBC00 \uD1A0\uD070\uC744 \uC0AC\uC6A9\uD558\uC5EC \uC778\uC99D\uB429\uB2C8\uB2E4.
|
|
1982
2040
|
`);
|
|
1983
2041
|
}
|
|
1984
2042
|
};
|
|
@@ -1991,16 +2049,16 @@ var TokenRemoveCommand = class extends Command4 {
|
|
|
1991
2049
|
["\uBCC4\uCE6D\uC744 \uC9C0\uC815\uD558\uC5EC \uD1A0\uD070 \uC0AD\uC81C", "ait token remove dev"]
|
|
1992
2050
|
]
|
|
1993
2051
|
});
|
|
1994
|
-
|
|
2052
|
+
profile = Option4.String({ required: false });
|
|
1995
2053
|
async execute() {
|
|
1996
|
-
const
|
|
1997
|
-
const removed = TokenStorage.delete(
|
|
1998
|
-
debug4("token remove", {
|
|
2054
|
+
const profile = this.profile || "default";
|
|
2055
|
+
const removed = TokenStorage.delete(profile);
|
|
2056
|
+
debug4("token remove", { profile });
|
|
1999
2057
|
if (removed) {
|
|
2000
|
-
this.context.stdout.write(`\
|
|
2058
|
+
this.context.stdout.write(`\uD1A0\uD070\uC744 \uC81C\uAC70\uD588\uC2B5\uB2C8\uB2E4: ${profile}.
|
|
2001
2059
|
`);
|
|
2002
2060
|
} else {
|
|
2003
|
-
this.context.stdout.write(`\
|
|
2061
|
+
this.context.stdout.write(`\uD1A0\uD070\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${profile}.
|
|
2004
2062
|
`);
|
|
2005
2063
|
}
|
|
2006
2064
|
}
|