@yahoo/uds 2.1.2 → 2.2.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.
Binary file
|
package/cli/bin/uds-linux-arm64
CHANGED
Binary file
|
Binary file
|
package/cli/cli.ts
CHANGED
@@ -2,14 +2,26 @@
|
|
2
2
|
// Start bluebun to run the correct CLI command
|
3
3
|
import { parseArgs } from 'node:util';
|
4
4
|
|
5
|
-
import { print, red
|
5
|
+
import { cli, print, red } from 'bluebun';
|
6
|
+
import updateNotifier from 'simple-update-notifier';
|
6
7
|
|
8
|
+
import packageJson from '../package.json' assert { type: 'json' };
|
7
9
|
import { getAuthenticatedUser } from './utils/auth';
|
8
10
|
|
11
|
+
const EXEMPT_FROM_AUTH = ['login'];
|
12
|
+
|
9
13
|
async function main() {
|
14
|
+
if (process.env.CI !== '1') {
|
15
|
+
updateNotifier({
|
16
|
+
pkg: packageJson,
|
17
|
+
shouldNotifyInNpmScript: true,
|
18
|
+
alwaysRun: true,
|
19
|
+
});
|
20
|
+
}
|
21
|
+
|
10
22
|
// We need to pass the path from Node to the Bun binaries
|
11
23
|
// because there's an issue where the Bun binaries struggle to resolve
|
12
|
-
const { values
|
24
|
+
const { values } = parseArgs({
|
13
25
|
args: Bun.argv,
|
14
26
|
options: {
|
15
27
|
commandsPath: {
|
@@ -21,10 +33,19 @@ async function main() {
|
|
21
33
|
});
|
22
34
|
|
23
35
|
const cliPath = values.commandsPath!.toString();
|
24
|
-
const isLoginCmd = positionals.includes('login');
|
25
36
|
|
26
|
-
|
37
|
+
const { command, props } = await cli({
|
38
|
+
name: 'uds',
|
39
|
+
cliPath,
|
40
|
+
});
|
41
|
+
|
42
|
+
// Don't require auth when running root `--help`
|
43
|
+
const isRootHelp = command.name === 'uds' && props.options.help;
|
44
|
+
const shouldRequireAuth = !isRootHelp && !EXEMPT_FROM_AUTH.includes(command.name);
|
45
|
+
|
46
|
+
if (shouldRequireAuth) {
|
27
47
|
const user = await getAuthenticatedUser(cliPath);
|
48
|
+
|
28
49
|
if (!user) {
|
29
50
|
print(
|
30
51
|
red(
|
@@ -35,10 +56,7 @@ async function main() {
|
|
35
56
|
}
|
36
57
|
}
|
37
58
|
|
38
|
-
run(
|
39
|
-
name: 'uds',
|
40
|
-
cliPath,
|
41
|
-
});
|
59
|
+
await command.run(props);
|
42
60
|
}
|
43
61
|
|
44
62
|
main();
|