@valbuild/cli 0.113.0 → 0.115.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.
|
@@ -1069,18 +1069,20 @@ function tryGetGitConfig(root) {
|
|
|
1069
1069
|
* Terminal wrapper around the login device flow in `@valbuild/server`.
|
|
1070
1070
|
* The flow itself (polling, token persistence) is shared with
|
|
1071
1071
|
* `@valbuild/language-server`.
|
|
1072
|
+
*
|
|
1073
|
+
* The user code is printed and the device code is not: the code on screen is
|
|
1074
|
+
* the one to compare against the browser, and it cannot be used to collect a
|
|
1075
|
+
* token on its own.
|
|
1072
1076
|
*/
|
|
1073
1077
|
async function login(options) {
|
|
1074
1078
|
try {
|
|
1075
1079
|
console.log(pc__default["default"].cyan("\nStarting login process...\n"));
|
|
1076
|
-
const
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
console.log(pc__default["default"].
|
|
1081
|
-
|
|
1082
|
-
console.log(pc__default["default"].dim("\nWaiting for login confirmation...\n"));
|
|
1083
|
-
const result = await server.awaitValLoginConfirmation(nonce);
|
|
1080
|
+
const authorization = await server.startValLogin();
|
|
1081
|
+
console.log(pc__default["default"].green("Open this URL in your browser to approve the login:"));
|
|
1082
|
+
console.log(pc__default["default"].underline(pc__default["default"].blue(authorization.verificationUriComplete)));
|
|
1083
|
+
console.log(`\nThen check that it shows this code: ${pc__default["default"].bold(pc__default["default"].cyan(authorization.userCode))}`);
|
|
1084
|
+
console.log(pc__default["default"].dim("\nApprove the login in the browser. Waiting for confirmation...\n"));
|
|
1085
|
+
const result = await server.awaitValLoginConfirmation(authorization);
|
|
1084
1086
|
const filePath = server.persistPersonalAccessToken(options.root || process.cwd(), result);
|
|
1085
1087
|
console.log(pc__default["default"].green(`Token for ${pc__default["default"].cyan(result.profile.email)} saved to ${pc__default["default"].cyan(filePath)}`));
|
|
1086
1088
|
} catch (error) {
|
|
@@ -1069,18 +1069,20 @@ function tryGetGitConfig(root) {
|
|
|
1069
1069
|
* Terminal wrapper around the login device flow in `@valbuild/server`.
|
|
1070
1070
|
* The flow itself (polling, token persistence) is shared with
|
|
1071
1071
|
* `@valbuild/language-server`.
|
|
1072
|
+
*
|
|
1073
|
+
* The user code is printed and the device code is not: the code on screen is
|
|
1074
|
+
* the one to compare against the browser, and it cannot be used to collect a
|
|
1075
|
+
* token on its own.
|
|
1072
1076
|
*/
|
|
1073
1077
|
async function login(options) {
|
|
1074
1078
|
try {
|
|
1075
1079
|
console.log(pc__default["default"].cyan("\nStarting login process...\n"));
|
|
1076
|
-
const
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
console.log(pc__default["default"].
|
|
1081
|
-
|
|
1082
|
-
console.log(pc__default["default"].dim("\nWaiting for login confirmation...\n"));
|
|
1083
|
-
const result = await server.awaitValLoginConfirmation(nonce);
|
|
1080
|
+
const authorization = await server.startValLogin();
|
|
1081
|
+
console.log(pc__default["default"].green("Open this URL in your browser to approve the login:"));
|
|
1082
|
+
console.log(pc__default["default"].underline(pc__default["default"].blue(authorization.verificationUriComplete)));
|
|
1083
|
+
console.log(`\nThen check that it shows this code: ${pc__default["default"].bold(pc__default["default"].cyan(authorization.userCode))}`);
|
|
1084
|
+
console.log(pc__default["default"].dim("\nApprove the login in the browser. Waiting for confirmation...\n"));
|
|
1085
|
+
const result = await server.awaitValLoginConfirmation(authorization);
|
|
1084
1086
|
const filePath = server.persistPersonalAccessToken(options.root || process.cwd(), result);
|
|
1085
1087
|
console.log(pc__default["default"].green(`Token for ${pc__default["default"].cyan(result.profile.email)} saved to ${pc__default["default"].cyan(filePath)}`));
|
|
1086
1088
|
} catch (error) {
|
|
@@ -1037,18 +1037,20 @@ function tryGetGitConfig(root) {
|
|
|
1037
1037
|
* Terminal wrapper around the login device flow in `@valbuild/server`.
|
|
1038
1038
|
* The flow itself (polling, token persistence) is shared with
|
|
1039
1039
|
* `@valbuild/language-server`.
|
|
1040
|
+
*
|
|
1041
|
+
* The user code is printed and the device code is not: the code on screen is
|
|
1042
|
+
* the one to compare against the browser, and it cannot be used to collect a
|
|
1043
|
+
* token on its own.
|
|
1040
1044
|
*/
|
|
1041
1045
|
async function login(options) {
|
|
1042
1046
|
try {
|
|
1043
1047
|
console.log(pc.cyan("\nStarting login process...\n"));
|
|
1044
|
-
const
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
console.log(pc.
|
|
1049
|
-
|
|
1050
|
-
console.log(pc.dim("\nWaiting for login confirmation...\n"));
|
|
1051
|
-
const result = await awaitValLoginConfirmation(nonce);
|
|
1048
|
+
const authorization = await startValLogin();
|
|
1049
|
+
console.log(pc.green("Open this URL in your browser to approve the login:"));
|
|
1050
|
+
console.log(pc.underline(pc.blue(authorization.verificationUriComplete)));
|
|
1051
|
+
console.log(`\nThen check that it shows this code: ${pc.bold(pc.cyan(authorization.userCode))}`);
|
|
1052
|
+
console.log(pc.dim("\nApprove the login in the browser. Waiting for confirmation...\n"));
|
|
1053
|
+
const result = await awaitValLoginConfirmation(authorization);
|
|
1052
1054
|
const filePath = persistPersonalAccessToken(options.root || process.cwd(), result);
|
|
1053
1055
|
console.log(pc.green(`Token for ${pc.cyan(result.profile.email)} saved to ${pc.cyan(filePath)}`));
|
|
1054
1056
|
} catch (error) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@valbuild/cli",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.115.0",
|
|
5
5
|
"description": "Val CLI tools",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
"jszip": "^3.10.1",
|
|
25
25
|
"meow": "^9.0.0",
|
|
26
26
|
"picocolors": "^1.1.1",
|
|
27
|
-
"@valbuild/core": "0.111.0",
|
|
28
|
-
"@valbuild/language-server": "0.113.0",
|
|
29
27
|
"@valbuild/eslint-plugin": "0.108.0",
|
|
30
|
-
"@valbuild/server": "0.
|
|
31
|
-
"@valbuild/shared": "0.
|
|
28
|
+
"@valbuild/server": "0.115.0",
|
|
29
|
+
"@valbuild/shared": "0.114.0",
|
|
30
|
+
"@valbuild/language-server": "0.115.0",
|
|
31
|
+
"@valbuild/core": "0.111.0"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"prettier": "*",
|
package/src/login.ts
CHANGED
|
@@ -10,18 +10,33 @@ import {
|
|
|
10
10
|
* Terminal wrapper around the login device flow in `@valbuild/server`.
|
|
11
11
|
* The flow itself (polling, token persistence) is shared with
|
|
12
12
|
* `@valbuild/language-server`.
|
|
13
|
+
*
|
|
14
|
+
* The user code is printed and the device code is not: the code on screen is
|
|
15
|
+
* the one to compare against the browser, and it cannot be used to collect a
|
|
16
|
+
* token on its own.
|
|
13
17
|
*/
|
|
14
18
|
export async function login(options: { root?: string }) {
|
|
15
19
|
try {
|
|
16
20
|
console.log(pc.cyan("\nStarting login process...\n"));
|
|
17
21
|
|
|
18
|
-
const
|
|
22
|
+
const authorization = await startValLogin();
|
|
19
23
|
|
|
20
|
-
console.log(
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
console.log(
|
|
25
|
+
pc.green("Open this URL in your browser to approve the login:"),
|
|
26
|
+
);
|
|
27
|
+
console.log(pc.underline(pc.blue(authorization.verificationUriComplete)));
|
|
28
|
+
console.log(
|
|
29
|
+
`\nThen check that it shows this code: ${pc.bold(
|
|
30
|
+
pc.cyan(authorization.userCode),
|
|
31
|
+
)}`,
|
|
32
|
+
);
|
|
33
|
+
console.log(
|
|
34
|
+
pc.dim(
|
|
35
|
+
"\nApprove the login in the browser. Waiting for confirmation...\n",
|
|
36
|
+
),
|
|
37
|
+
);
|
|
23
38
|
|
|
24
|
-
const result = await awaitValLoginConfirmation(
|
|
39
|
+
const result = await awaitValLoginConfirmation(authorization);
|
|
25
40
|
|
|
26
41
|
const filePath = persistPersonalAccessToken(
|
|
27
42
|
options.root || process.cwd(),
|