MCPcopy Create free account
hub / github.com/arethetypeswrong/arethetypeswrong.github.io / getPackageInfo

Function getPackageInfo

packages/web/src/main.ts:100–125  ·  view source on GitHub ↗
(prevState?: State)

Source from the content-addressed store, hash-verified

98}
99
100async function getPackageInfo(prevState?: State) {
101 const state = getState();
102 const parsed = state.packageInfo.parsed;
103 if (parsed && (!prevState || !shallowEqual(prevState.packageInfo.parsed, parsed))) {
104 try {
105 const info = await fetchPackageInfo(parsed);
106 updateState((state) => {
107 state.packageInfo.info = info;
108 state.message = {
109 isError: false,
110 text: info.size
111 ? `Checking will stream whatever ${info.size} bytes gzipped is`
112 : "Checking will stream the tarball",
113 };
114 });
115 } catch (error) {
116 updateState((state) => {
117 state.packageInfo.info = undefined;
118 state.message = {
119 isError: true,
120 text: (error as Error).message,
121 };
122 });
123 }
124 }
125}
126
127async function onCheck() {
128 if (!getState().packageInfo.parsed) {

Callers 2

main.tsFile · 0.85
onCheckFunction · 0.85

Calls 4

getStateFunction · 0.90
shallowEqualFunction · 0.90
updateStateFunction · 0.90
fetchPackageInfoFunction · 0.85

Tested by

no test coverage detected