@yahoo/uds 1.7.0 → 1.7.2

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
Binary file
@@ -1,7 +1,6 @@
1
1
  import { type Props } from 'bluebun';
2
2
  import prompts from 'prompts';
3
3
 
4
- import { trackEvent } from '../../utils/analytics';
5
4
  import { getCommandHelp, getSubCommandsChoices } from '../../utils/getCommandHelp';
6
5
  import { getDirChoices } from '../../utils/getDirChoices';
7
6
 
@@ -14,11 +13,6 @@ export default {
14
13
  const isRootCommand = Boolean(!props?.first);
15
14
  const dirChoices = getDirChoices();
16
15
 
17
- const runCodeMod = async (codemod: string, selectedDirs: string[]) => {
18
- const mod = (await import(`./${codemod}`)).default;
19
- return mod.run({ ...props, selectedDirs });
20
- };
21
-
22
16
  if (isRootCommand) {
23
17
  // Prompt the user to setup the codemod runner
24
18
  const { selectedDirs, selectedCodemods, didConfirm } = await prompts([
@@ -55,9 +49,10 @@ export default {
55
49
 
56
50
  // Run each codemod and provide the selectedDirs
57
51
  return Promise.all(
58
- selectedCodemods.map(async (codemod: string) => {
59
- await runCodeMod(codemod, selectedDirs);
60
- return trackEvent('codemod', { codemod });
52
+ selectedCodemods.map(async (selectedCodemod: string[]) => {
53
+ return await import(`./${selectedCodemod}`).then((codemod) =>
54
+ codemod.default.run({ ...props, selectedDirs }),
55
+ );
61
56
  }),
62
57
  );
63
58
  } else if (subCommandIsValid) {
@@ -76,9 +71,11 @@ export default {
76
71
  process.exit(1);
77
72
  }
78
73
 
79
- const codemod = props.first!;
80
- await runCodeMod(codemod, selectedDirs);
81
- return trackEvent('codemod', { codemod });
74
+ // Run the codemod
75
+ return (await import(`./${props.first}`)).default.run({
76
+ ...props,
77
+ selectedDirs,
78
+ });
82
79
  } else {
83
80
  // Throw the help message
84
81
  await getCommandHelp({
@@ -1,6 +1,5 @@
1
1
  import { magenta, print, red } from 'bluebun';
2
2
 
3
- import { trackEvent } from '../utils/analytics';
4
3
  import { login } from '../utils/auth';
5
4
 
6
5
  export default {
@@ -12,7 +11,6 @@ export default {
12
11
  const user = await login();
13
12
  if (user) {
14
13
  print(magenta(`🔒 Logged in as ${user.email}`));
15
- return await trackEvent('login');
16
14
  }
17
15
  } catch (error) {
18
16
  if (error instanceof Error) {
@@ -1,6 +1,5 @@
1
1
  import { magenta, print, red } from 'bluebun';
2
2
 
3
- import { trackEvent } from '../utils/analytics';
4
3
  import { logout } from '../utils/auth';
5
4
 
6
5
  export default {
@@ -8,8 +7,6 @@ export default {
8
7
  description: '👤 Sign out of UDS CLI',
9
8
  run: async () => {
10
9
  try {
11
- // Track logout event before logout is run. Otherwise, there's no user object to track.
12
- await trackEvent('logout');
13
10
  await logout();
14
11
  print(magenta('👋 You have been logged out.'));
15
12
  } catch (error) {
@@ -1,6 +1,5 @@
1
1
  import { Props, spinStart, spinStop } from 'bluebun';
2
2
 
3
- import { trackEvent } from '../utils/analytics';
4
3
  import { purge, PurgeOptions } from '../utils/purgeCSS';
5
4
 
6
5
  interface PurgeProps extends Props {
@@ -16,7 +15,6 @@ export default {
16
15
  try {
17
16
  await purge(props.options);
18
17
  spinStop('✅', 'Purging css done!');
19
- return await trackEvent('purge');
20
18
  } catch (error) {
21
19
  if (error instanceof Error) {
22
20
  spinStop('❌', error.message);
@@ -1,6 +1,5 @@
1
1
  import { magenta, print, Props } from 'bluebun';
2
2
 
3
- import { trackEvent } from '../utils/analytics';
4
3
  import { setupConfigWorker } from '../utils/setupConfigWorker';
5
4
  import { SyncOptions } from '../utils/types';
6
5
 
@@ -32,7 +31,6 @@ export default {
32
31
  }
33
32
  },
34
33
  });
35
- return await trackEvent('sync', { id });
36
34
  } catch {
37
35
  console.error(
38
36
  '❌ An error occurred while syncing. Please reach out to #uds-ask channel for support.',
@@ -1,6 +1,5 @@
1
1
  import { print, type Props, red } from 'bluebun';
2
2
 
3
- import { trackEvent } from '../utils/analytics';
4
3
  import { getAuthenticatedUser } from '../utils/auth';
5
4
  import { getCommandHelp } from '../utils/getCommandHelp';
6
5
 
@@ -10,7 +9,6 @@ export default {
10
9
  run: async (props: Props) => {
11
10
  if (props.first) {
12
11
  print(red(`Unknown command: ${props.first}`));
13
- await trackEvent('unknown_cmd', { cmd: props.first });
14
12
  }
15
13
  const user = await getAuthenticatedUser();
16
14
  const notes = user ? `🔒 Logged in as ${user.email}` : undefined;
@@ -1,13 +1,11 @@
1
1
  import { print } from 'bluebun';
2
2
 
3
3
  import packageJson from '../../package.json';
4
- import { trackEvent } from '../utils/analytics';
5
4
 
6
5
  export default {
7
6
  name: 'version',
8
7
  description: `${packageJson.version}`,
9
8
  run: async () => {
10
9
  print(packageJson.version);
11
- await trackEvent('version', { version: packageJson.version });
12
10
  },
13
11
  };
package/cli/tsconfig.json CHANGED
@@ -18,15 +18,14 @@
18
18
  "strict": true,
19
19
  "types": ["bun-types"],
20
20
  "target": "esnext",
21
- "lib": ["ESNext"],
21
+ "lib": ["esnext"],
22
22
  "module": "esnext",
23
23
  "moduleResolution": "bundler",
24
24
  "paths": {
25
25
  "@yahoo/uds/scripts/*": ["../scripts/*"],
26
26
  "@yahoo/uds/*": ["../src/*"],
27
27
  "@yahoo/uds/tailwind/tsMorph": ["../scripts/utils/tsMorph.ts"],
28
- "analytics/*": ["../../analytics/*"],
29
- "root/*": ["../../*"]
30
- }
31
- }
28
+ "root/*": ["../../*"],
29
+ },
30
+ },
32
31
  }
package/cli/utils/auth.ts CHANGED
@@ -9,11 +9,11 @@ import {
9
9
  getAuth,
10
10
  GoogleAuthProvider,
11
11
  signInWithCredential,
12
+ User as FirebaseUser,
12
13
  } from 'firebase/auth';
13
14
  import { google, oauth2_v2 } from 'googleapis';
14
15
  import http from 'http';
15
16
  import open from 'open';
16
- import { type FirebaseUser } from 'root/database/firebase';
17
17
 
18
18
  import clientSecrets from './client_secrets.json';
19
19
 
@@ -5,7 +5,7 @@ import react__default from 'react';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
  import '@yahoo/uds-icons/types';
7
7
 
8
- type HtmlButtonProps$1 = Omit<react__default.ButtonHTMLAttributes<HTMLButtonElement>, 'color' | 'name'> & Omit<HTMLMotionProps<'button'>, 'color' | 'name'>;
8
+ type HtmlButtonProps$1 = Omit<HTMLMotionProps<'button'>, 'color' | 'name'> & Omit<react__default.ButtonHTMLAttributes<HTMLButtonElement>, 'color'>;
9
9
  interface ButtonProps extends HtmlButtonProps$1, UniversalButtonProps {
10
10
  }
11
11
  /**
@@ -5,7 +5,7 @@ import react__default from 'react';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
  import '@yahoo/uds-icons/types';
7
7
 
8
- type HtmlButtonProps$1 = Omit<react__default.ButtonHTMLAttributes<HTMLButtonElement>, 'color' | 'name'> & Omit<HTMLMotionProps<'button'>, 'color' | 'name'>;
8
+ type HtmlButtonProps$1 = Omit<HTMLMotionProps<'button'>, 'color' | 'name'> & Omit<react__default.ButtonHTMLAttributes<HTMLButtonElement>, 'color'>;
9
9
  interface ButtonProps extends HtmlButtonProps$1, UniversalButtonProps {
10
10
  }
11
11
  /**