@youcan/cli-kit 2.1.4 → 2.3.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.
Files changed (57) hide show
  1. package/dist/common/string.d.ts +2 -2
  2. package/dist/common/string.js +11 -11
  3. package/dist/index.d.ts +19 -17
  4. package/dist/index.js +4 -0
  5. package/dist/internal/node/constants.d.ts +5 -5
  6. package/dist/internal/node/constants.js +10 -10
  7. package/dist/internal/node/ui.d.ts +11 -11
  8. package/dist/internal/node/ui.js +41 -40
  9. package/dist/node/callback.d.ts +5 -5
  10. package/dist/node/callback.js +53 -53
  11. package/dist/node/cli.d.ts +25 -21
  12. package/dist/node/cli.js +97 -62
  13. package/dist/node/config.d.ts +20 -20
  14. package/dist/node/config.js +20 -22
  15. package/dist/node/context/helpers.d.ts +1 -1
  16. package/dist/node/context/helpers.js +5 -5
  17. package/dist/node/context/local.d.ts +2 -2
  18. package/dist/node/context/local.js +2 -2
  19. package/dist/node/crypto.d.ts +12 -9
  20. package/dist/node/crypto.js +23 -23
  21. package/dist/node/env.d.ts +5 -6
  22. package/dist/node/env.js +36 -47
  23. package/dist/node/filesystem.d.ts +34 -29
  24. package/dist/node/filesystem.js +112 -82
  25. package/dist/node/form.d.ts +9 -9
  26. package/dist/node/form.js +39 -39
  27. package/dist/node/git.d.ts +10 -10
  28. package/dist/node/git.js +46 -46
  29. package/dist/node/github.d.ts +6 -6
  30. package/dist/node/github.js +8 -8
  31. package/dist/node/http.d.ts +4 -4
  32. package/dist/node/http.js +37 -34
  33. package/dist/node/path.d.ts +5 -5
  34. package/dist/node/path.js +14 -14
  35. package/dist/node/session.d.ts +8 -8
  36. package/dist/node/session.js +92 -78
  37. package/dist/node/system.d.ts +26 -21
  38. package/dist/node/system.js +87 -60
  39. package/dist/node/tasks.d.ts +8 -7
  40. package/dist/node/tasks.js +33 -25
  41. package/dist/node/worker.d.ts +16 -19
  42. package/dist/node/worker.js +43 -30
  43. package/dist/services/cloudflared.d.ts +12 -0
  44. package/dist/services/cloudflared.js +206 -0
  45. package/dist/services/index.d.ts +1 -0
  46. package/dist/services/index.js +1 -0
  47. package/dist/ui/components/DevOutput.d.ts +27 -0
  48. package/dist/ui/components/DevOutput.js +60 -0
  49. package/dist/ui/components/Error.d.ts +6 -0
  50. package/dist/ui/components/Error.js +18 -0
  51. package/dist/ui/components/HotKeys.d.ts +12 -0
  52. package/dist/ui/components/HotKeys.js +25 -0
  53. package/dist/ui/components/utils/symbols.d.ts +3 -0
  54. package/dist/ui/components/utils/symbols.js +7 -0
  55. package/dist/ui/index.d.ts +3 -0
  56. package/dist/ui/index.js +3 -0
  57. package/package.json +7 -2
@@ -0,0 +1,6 @@
1
+ type ErrorPropsType = {
2
+ message: string;
3
+ suggestions?: string[];
4
+ };
5
+ export declare const renderError: (props: ErrorPropsType) => import("ink").Instance;
6
+ export {};
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { render, Newline, Box, Text } from 'ink';
3
+
4
+ const Error = ({ message, suggestions = [] }) => {
5
+ return (React.createElement(React.Fragment, null,
6
+ React.createElement(Newline, null),
7
+ React.createElement(Box, { flexDirection: 'column', borderStyle: 'round', borderColor: 'red', paddingLeft: 1 },
8
+ React.createElement(Text, { color: 'redBright' }, "Error"),
9
+ React.createElement(Text, { color: 'white' }, message),
10
+ suggestions.length > 0 && (React.createElement(Box, { marginTop: 1, flexDirection: 'column' },
11
+ React.createElement(Text, { color: 'yellow' }, "Suggestions:"),
12
+ suggestions.map((suggestion, index) => (React.createElement(Text, { key: index },
13
+ " - ",
14
+ suggestion))))))));
15
+ };
16
+ const renderError = (props) => render(React.createElement(Error, { ...props }));
17
+
18
+ export { renderError };
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ type KeyType = {
3
+ keyboardKey: string;
4
+ description: string;
5
+ handler: () => void;
6
+ };
7
+ export type HotKeysPropsType = {
8
+ hotKeys: KeyType[];
9
+ };
10
+ export declare const HotKeys: ({ hotKeys }: HotKeysPropsType) => React.JSX.Element;
11
+ export declare const renderHotKeys: (props: HotKeysPropsType) => import("ink").Instance;
12
+ export {};
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import { RightChevron, VerticalDivider } from './utils/symbols.js';
3
+ import { Box, render, useInput, Text } from 'ink';
4
+
5
+ const HotKey = ({ keyboardKey, description, handler }) => {
6
+ useInput((input) => {
7
+ if (input === keyboardKey)
8
+ handler();
9
+ });
10
+ return (React.createElement(Box, { flexDirection: 'column' },
11
+ React.createElement(Text, null,
12
+ React.createElement(RightChevron, null),
13
+ " Press ",
14
+ React.createElement(Text, { dimColor: true }, keyboardKey),
15
+ " ",
16
+ React.createElement(VerticalDivider, null),
17
+ " ",
18
+ description)));
19
+ };
20
+ const HotKeys = ({ hotKeys }) => {
21
+ return (React.createElement(Box, { flexDirection: 'column' }, hotKeys.map((hotKey) => React.createElement(HotKey, { key: hotKey.keyboardKey, ...hotKey }))));
22
+ };
23
+ const renderHotKeys = (props) => render(React.createElement(HotKeys, { ...props }), { exitOnCtrlC: false });
24
+
25
+ export { HotKeys, renderHotKeys };
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ export declare const VerticalDivider: () => React.JSX.Element;
3
+ export declare const RightChevron: () => React.JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { Text } from 'ink';
2
+ import React from 'react';
3
+
4
+ const VerticalDivider = () => React.createElement(Text, null, "\u2502");
5
+ const RightChevron = () => React.createElement(Text, null, "\u203A");
6
+
7
+ export { RightChevron, VerticalDivider };
@@ -0,0 +1,3 @@
1
+ export { renderDevOutput } from './components/DevOutput';
2
+ export { renderHotKeys } from './components/HotKeys';
3
+ export { renderError } from './components/Error';
@@ -0,0 +1,3 @@
1
+ export { renderDevOutput } from './components/DevOutput.js';
2
+ export { renderHotKeys } from './components/HotKeys.js';
3
+ export { renderError } from './components/Error.js';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@youcan/cli-kit",
3
3
  "type": "module",
4
- "version": "2.1.4",
4
+ "version": "2.3.0",
5
5
  "description": "Utilities for the YouCan CLI",
6
6
  "author": "YouCan <contact@youcan.shop> (https://youcan.shop)",
7
7
  "license": "MIT",
@@ -28,16 +28,20 @@
28
28
  "env-paths": "^3.0.0",
29
29
  "execa": "^6.1.0",
30
30
  "find-process": "^1.4.7",
31
- "formdata-node": "^5.0.1",
31
+ "formdata-node": "^6.0.3",
32
32
  "fs-extra": "^11.1.1",
33
33
  "glob": "^11.0.0",
34
+ "ink": "^5.1.0",
34
35
  "kill-port-process": "^3.2.0",
35
36
  "kleur": "^4.1.5",
36
37
  "node-fetch": "^3.3.2",
37
38
  "open": "^9.1.0",
38
39
  "prompts": "^2.4.2",
39
40
  "ramda": "^0.28.0",
41
+ "react": "^18.3.1",
42
+ "rxjs": "^7.8.1",
40
43
  "simple-git": "^3.20.0",
44
+ "tar": "^7.4.3",
41
45
  "tcp-port-used": "^1.0.2",
42
46
  "tempy": "^3.1.0",
43
47
  "worker": "^0.4.0"
@@ -48,6 +52,7 @@
48
52
  "@types/node": "^18.18.0",
49
53
  "@types/prompts": "^2.4.5",
50
54
  "@types/ramda": "^0.28.25",
55
+ "@types/react": "^18.3.12",
51
56
  "@types/tcp-port-used": "^1.0.2",
52
57
  "shx": "^0.3.4"
53
58
  },