@verdaccio/ui-components 4.0.0-next-8.7 → 4.0.0-next-8.8

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 (551) hide show
  1. package/README.md +1 -1
  2. package/build/AppTest/AppRoute.js.map +1 -0
  3. package/build/AppTest/pages/Front/Home.js.map +1 -0
  4. package/build/AppTest/pages/Front/index.js.map +1 -0
  5. package/build/AppTest/pages/Version/Version.js.map +1 -0
  6. package/build/AppTest/pages/Version/index.js.map +1 -0
  7. package/build/Theme/ResetStyles.js.map +1 -0
  8. package/build/Theme/StyleBaseline.js.map +1 -0
  9. package/build/Theme/ThemeProvider.js.map +1 -0
  10. package/build/Theme/colors.js.map +1 -0
  11. package/build/Theme/index.js.map +1 -0
  12. package/build/Theme/theme.d.ts +1 -1
  13. package/build/Theme/theme.js +1 -1
  14. package/build/Theme/theme.js.map +1 -0
  15. package/build/components/ActionBar/ActionBar.js.map +1 -0
  16. package/build/components/ActionBar/ActionBarAction.js.map +1 -0
  17. package/build/components/ActionBar/index.js.map +1 -0
  18. package/build/components/Author/Author.js.map +1 -0
  19. package/build/components/Author/__snapshots__/Author.test.tsx.snap +257 -0
  20. package/build/components/Author/index.js.map +1 -0
  21. package/build/components/Author/styles.js.map +1 -0
  22. package/build/components/CopyClipboard/CopyToClipBoard.js.map +1 -0
  23. package/build/components/CopyClipboard/index.js.map +1 -0
  24. package/build/components/CopyClipboard/utils.js.map +1 -0
  25. package/build/components/Dependencies/Dependencies.js.map +1 -0
  26. package/build/components/Dependencies/DependencyBlock.js.map +1 -0
  27. package/build/components/Dependencies/index.js.map +1 -0
  28. package/build/components/Dependencies/types.js.map +1 -0
  29. package/build/components/Dependencies/utits.js.map +1 -0
  30. package/build/components/Deprecated/Deprecated.js.map +1 -0
  31. package/build/components/Deprecated/index.js.map +1 -0
  32. package/build/components/Developers/DeveloperType.js.map +1 -0
  33. package/build/components/Developers/Developers.js.map +1 -0
  34. package/build/components/Developers/Title.js.map +1 -0
  35. package/build/components/Developers/__snapshots__/Developers.test.tsx.snap +416 -0
  36. package/build/components/Developers/get-unique-developer-values.js.map +1 -0
  37. package/build/components/Developers/index.js.map +1 -0
  38. package/build/components/Distribution/Dist.js.map +1 -0
  39. package/build/components/Distribution/index.js.map +1 -0
  40. package/build/components/Distribution/styles.js.map +1 -0
  41. package/build/components/Engines/Engines.js.map +1 -0
  42. package/build/components/Engines/index.js.map +1 -0
  43. package/build/components/Engines/styles.js.map +1 -0
  44. package/build/components/ErrorBoundary/ErrorBoundary.js.map +1 -0
  45. package/build/components/ErrorBoundary/index.js.map +1 -0
  46. package/build/components/Forbidden/Forbidden.js.map +1 -0
  47. package/build/components/Forbidden/index.js.map +1 -0
  48. package/build/components/FundButton/FundButton.js.map +1 -0
  49. package/build/components/FundButton/index.js.map +1 -0
  50. package/build/components/HeaderInfoDialog/HeaderInfoDialog.js.map +1 -0
  51. package/build/components/HeaderInfoDialog/index.js.map +1 -0
  52. package/build/components/Heading/Heading.js.map +1 -0
  53. package/build/components/Heading/index.js.map +1 -0
  54. package/build/components/Help/Help.js.map +1 -0
  55. package/build/components/Help/index.js.map +1 -0
  56. package/build/components/Help/styles.js.map +1 -0
  57. package/build/components/Icons/DevsIcons/CommonJS.js.map +1 -0
  58. package/build/components/Icons/DevsIcons/ES6Module.js.map +1 -0
  59. package/build/components/Icons/DevsIcons/Git.js.map +1 -0
  60. package/build/components/Icons/DevsIcons/NodeJS.js.map +1 -0
  61. package/build/components/Icons/DevsIcons/TypeScript.js.map +1 -0
  62. package/build/components/Icons/DevsIcons/index.js.map +1 -0
  63. package/build/components/Icons/Earth.js.map +1 -0
  64. package/build/components/Icons/FileBinary.js.map +1 -0
  65. package/build/components/Icons/Law.js.map +1 -0
  66. package/build/components/Icons/Managers/Npm.js.map +1 -0
  67. package/build/components/Icons/Managers/Pnpm.js.map +1 -0
  68. package/build/components/Icons/Managers/Yarn.js.map +1 -0
  69. package/build/components/Icons/Managers/index.js.map +1 -0
  70. package/build/components/Icons/SvgIcon.js.map +1 -0
  71. package/build/components/Icons/Time.js.map +1 -0
  72. package/build/components/Icons/Version.js.map +1 -0
  73. package/build/components/Icons/index.js.map +1 -0
  74. package/build/components/Install/Install.js.map +1 -0
  75. package/build/components/Install/InstallListItem.js.map +1 -0
  76. package/build/components/Install/__partials__/data.json +5984 -0
  77. package/build/components/Install/index.js.map +1 -0
  78. package/build/components/Keywords/KeywordListItems.js.map +1 -0
  79. package/build/components/Keywords/Keywords.js.map +1 -0
  80. package/build/components/Keywords/index.js.map +1 -0
  81. package/build/components/Label/Label.js.map +1 -0
  82. package/build/components/Label/__snapshots__/Label.test.tsx.snap +9 -0
  83. package/build/components/Label/index.js.map +1 -0
  84. package/build/components/Link/Link.js.map +1 -0
  85. package/build/components/Link/__snapshots__/Link.test.tsx.snap +25 -0
  86. package/build/components/Link/index.js.map +1 -0
  87. package/build/components/LinkExternal/LinkExternal.js.map +1 -0
  88. package/build/components/LinkExternal/__snapshots__/LinkExternal.test.tsx.snap +21 -0
  89. package/build/components/LinkExternal/index.js.map +1 -0
  90. package/build/components/Loading/Loading.js.map +1 -0
  91. package/build/components/Loading/Spinner/Spinner.js.map +1 -0
  92. package/build/components/Loading/Spinner/__snapshots__/Spinner.test.tsx.snap +110 -0
  93. package/build/components/Loading/Spinner/index.js.map +1 -0
  94. package/build/components/Loading/index.js.map +1 -0
  95. package/build/components/Loading/styles.js.map +1 -0
  96. package/build/components/LoginDialog/LoginDialog.js.map +1 -0
  97. package/build/components/LoginDialog/LoginDialogCloseButton.js.map +1 -0
  98. package/build/components/LoginDialog/LoginDialogForm.js.map +1 -0
  99. package/build/components/LoginDialog/LoginDialogFormError.js.map +1 -0
  100. package/build/components/LoginDialog/LoginDialogHeader.js.map +1 -0
  101. package/build/components/LoginDialog/__snapshots__/LoginDialog.test.tsx.snap +3 -0
  102. package/build/components/LoginDialog/index.js.map +1 -0
  103. package/build/components/Logo/Logo.js.map +1 -0
  104. package/build/components/Logo/__snapshots__/Logo.test.tsx.snap +9 -0
  105. package/build/components/Logo/index.js.map +1 -0
  106. package/build/components/MenuItem/MenuItem.js.map +1 -0
  107. package/build/components/MenuItem/index.js.map +1 -0
  108. package/build/components/NoItems/NoItems.js.map +1 -0
  109. package/build/components/NoItems/__snapshots__/Noitems.test.tsx.snap +33 -0
  110. package/build/components/NoItems/index.js.map +1 -0
  111. package/build/components/NotFound/NotFound.js.map +1 -0
  112. package/build/components/NotFound/index.js.map +1 -0
  113. package/build/components/Package/Package.js.map +1 -0
  114. package/build/components/Package/index.js.map +1 -0
  115. package/build/components/Package/styles.js.map +1 -0
  116. package/build/components/PackageList/PackageList.js.map +1 -0
  117. package/build/components/PackageList/index.js.map +1 -0
  118. package/build/components/Person/Person.js.map +1 -0
  119. package/build/components/Person/PersonTooltip.js.map +1 -0
  120. package/build/components/Person/index.js.map +1 -0
  121. package/build/components/Person/utils.js.map +1 -0
  122. package/build/components/RawViewer/RawViewer.js.map +1 -0
  123. package/build/components/RawViewer/index.js.map +1 -0
  124. package/build/components/Readme/index.js.map +1 -0
  125. package/build/components/Readme/types.js.map +1 -0
  126. package/build/components/Readme/utils.js.map +1 -0
  127. package/build/components/RegistryInfoDialog/RegistryInfoDialog.js.map +1 -0
  128. package/build/components/RegistryInfoDialog/index.js.map +1 -0
  129. package/build/components/RegistryInfoDialog/styles.js.map +1 -0
  130. package/build/components/RegistryInfoDialog/types.js.map +1 -0
  131. package/build/components/Repository/Repository.js.map +1 -0
  132. package/build/components/Repository/__partials__/data.json +5984 -0
  133. package/build/components/Repository/__snapshots__/Repository.test.tsx.snap +3 -0
  134. package/build/components/Repository/index.js.map +1 -0
  135. package/build/components/Search/AutoComplete/AutoComplete.js.map +1 -0
  136. package/build/components/Search/AutoComplete/index.js.map +1 -0
  137. package/build/components/Search/AutoComplete/styles.js.map +1 -0
  138. package/build/components/Search/Search.js.map +1 -0
  139. package/build/components/Search/SearchItem.js.map +1 -0
  140. package/build/components/Search/index.js.map +1 -0
  141. package/build/components/Search/styles.js.map +1 -0
  142. package/build/components/Search/utils.js.map +1 -0
  143. package/build/components/SettingsMenu/SettingsMenu.js.map +1 -0
  144. package/build/components/SettingsMenu/index.js.map +1 -0
  145. package/build/components/SideBarTitle/SideBarTitle.js.map +1 -0
  146. package/build/components/SideBarTitle/index.js.map +1 -0
  147. package/build/components/SideBarTitle/utils.js.map +1 -0
  148. package/build/components/TextField/TextField.js.map +1 -0
  149. package/build/components/TextField/__snapshots__/TextField.test.tsx.snap +32 -0
  150. package/build/components/TextField/index.js.map +1 -0
  151. package/build/components/UpLinks/UpLinks.js.map +1 -0
  152. package/build/components/UpLinks/UplinkLink.js.map +1 -0
  153. package/build/components/UpLinks/__snapshots__/UpLinks.test.tsx.snap +315 -0
  154. package/build/components/UpLinks/index.js.map +1 -0
  155. package/build/components/UpLinks/styles.js.map +1 -0
  156. package/build/components/Versions/HistoryList.js.map +1 -0
  157. package/build/components/Versions/TagList.js.map +1 -0
  158. package/build/components/Versions/Versions.js.map +1 -0
  159. package/build/components/Versions/__partials__/data.json +5985 -0
  160. package/build/components/Versions/__partials__/deprecated-versions.json +175 -0
  161. package/build/components/Versions/__partials__/unsorted-versions.json +37 -0
  162. package/build/components/Versions/index.js.map +1 -0
  163. package/build/components/Versions/styles.js.map +1 -0
  164. package/build/components/Versions/types.js.map +1 -0
  165. package/build/hooks/index.js.map +1 -0
  166. package/build/hooks/useLocalStorage.js.map +1 -0
  167. package/build/hooks/useOnClickOutside.js.map +1 -0
  168. package/build/index.js.map +1 -0
  169. package/build/layouts/Version/Version.js.map +1 -0
  170. package/build/layouts/Version/index.js.map +1 -0
  171. package/build/providers/AppConfigurationProvider/AppConfigurationProvider.js.map +1 -0
  172. package/build/providers/AppConfigurationProvider/index.js.map +1 -0
  173. package/build/providers/PersistenceSettingProvider/PersistenceSettingProvider.js.map +1 -0
  174. package/build/providers/PersistenceSettingProvider/index.js.map +1 -0
  175. package/build/providers/TranslatorProvider/TranslatorProvider.js.map +1 -0
  176. package/build/providers/TranslatorProvider/index.js.map +1 -0
  177. package/build/providers/VersionProvider/VersionProvider.js.map +1 -0
  178. package/build/providers/VersionProvider/index.js.map +1 -0
  179. package/build/providers/index.js.map +1 -0
  180. package/build/sections/Detail/ContainerContent.js.map +1 -0
  181. package/build/sections/Detail/Detail.js.map +1 -0
  182. package/build/sections/Detail/ReadmeSection.js.map +1 -0
  183. package/build/sections/Detail/Tabs.js.map +1 -0
  184. package/build/sections/Detail/__snapshots__/Detail.test.tsx.snap +82 -0
  185. package/build/sections/Detail/index.js.map +1 -0
  186. package/build/sections/Footer/Footer.js.map +1 -0
  187. package/build/sections/Footer/index.js.map +1 -0
  188. package/build/sections/Footer/styles.js.map +1 -0
  189. package/build/sections/Header/Header.js.map +1 -0
  190. package/build/sections/Header/HeaderGreetings.js.map +1 -0
  191. package/build/sections/Header/HeaderLeft.js.map +1 -0
  192. package/build/sections/Header/HeaderMenu.js.map +1 -0
  193. package/build/sections/Header/HeaderRight.js.map +1 -0
  194. package/build/sections/Header/HeaderSettingsDialog.js.map +1 -0
  195. package/build/sections/Header/HeaderToolTip.js.map +1 -0
  196. package/build/sections/Header/HeaderToolTipIcon.js.map +1 -0
  197. package/build/sections/Header/LanguageSwitch.js.map +1 -0
  198. package/build/sections/Header/RegistryInfoContent/RegistryInfoContent.js.map +1 -0
  199. package/build/sections/Header/RegistryInfoContent/index.js.map +1 -0
  200. package/build/sections/Header/RegistryInfoContent/styles.js.map +1 -0
  201. package/build/sections/Header/index.js.map +1 -0
  202. package/build/sections/Header/styles.js.map +1 -0
  203. package/build/sections/Home/Home.js.map +1 -0
  204. package/build/sections/Home/index.js.map +1 -0
  205. package/build/sections/SideBar/Sidebar.js.map +1 -0
  206. package/build/sections/SideBar/index.js.map +1 -0
  207. package/build/sections/index.js.map +1 -0
  208. package/build/store/api.js.map +1 -0
  209. package/build/store/index.js.map +1 -0
  210. package/build/store/models/configuration.js.map +1 -0
  211. package/build/store/models/download.js.map +1 -0
  212. package/build/store/models/index.js.map +1 -0
  213. package/build/store/models/login.js.map +1 -0
  214. package/build/store/models/manifest.js.map +1 -0
  215. package/build/store/models/packages.js.map +1 -0
  216. package/build/store/models/routes.js.map +1 -0
  217. package/build/store/models/search.js.map +1 -0
  218. package/build/store/models/utils.js.map +1 -0
  219. package/build/store/storage.js.map +1 -0
  220. package/build/store/store.js.map +1 -0
  221. package/build/test/i18n-config.js.map +1 -0
  222. package/build/test/test-react-testing-library.js.map +1 -0
  223. package/build/types/index.js.map +1 -0
  224. package/build/types/packageMeta.js.map +1 -0
  225. package/build/utils/__partials__/packageMeta.d.ts +235 -0
  226. package/build/utils/__partials__/packageMeta.js +528 -0
  227. package/build/utils/__partials__/packageMeta.js.map +1 -0
  228. package/build/utils/cli-utils.js.map +1 -0
  229. package/build/utils/index.js.map +1 -0
  230. package/build/utils/loadable.js.map +1 -0
  231. package/build/utils/routes.js.map +1 -0
  232. package/build/utils/token-generate.js.map +1 -0
  233. package/build/utils/token.js.map +1 -0
  234. package/build/utils/url.js.map +1 -0
  235. package/build/utils/utils.js.map +1 -0
  236. package/package.json +2 -2
  237. package/.babelrc +0 -16
  238. package/.eslintrc +0 -100
  239. package/CHANGELOG.md +0 -48
  240. package/src/AppTest/App.stories.tsx +0 -89
  241. package/src/AppTest/AppRoute.test.tsx +0 -70
  242. package/src/AppTest/AppRoute.tsx +0 -42
  243. package/src/AppTest/pages/Front/Home.ts +0 -3
  244. package/src/AppTest/pages/Front/index.ts +0 -1
  245. package/src/AppTest/pages/Version/Version.tsx +0 -28
  246. package/src/AppTest/pages/Version/index.ts +0 -1
  247. package/src/Theme/ResetStyles.tsx +0 -44
  248. package/src/Theme/StyleBaseline.tsx +0 -14
  249. package/src/Theme/ThemeProvider.test.tsx +0 -27
  250. package/src/Theme/ThemeProvider.tsx +0 -44
  251. package/src/Theme/colors.ts +0 -1
  252. package/src/Theme/index.ts +0 -5
  253. package/src/Theme/theme.ts +0 -179
  254. package/src/components/ActionBar/ActionBar.stories.tsx +0 -64
  255. package/src/components/ActionBar/ActionBar.test.tsx +0 -152
  256. package/src/components/ActionBar/ActionBar.tsx +0 -63
  257. package/src/components/ActionBar/ActionBarAction.tsx +0 -92
  258. package/src/components/ActionBar/index.ts +0 -1
  259. package/src/components/Author/Author.stories.tsx +0 -53
  260. package/src/components/Author/Author.test.tsx +0 -76
  261. package/src/components/Author/Author.tsx +0 -30
  262. package/src/components/Author/index.ts +0 -1
  263. package/src/components/Author/styles.ts +0 -16
  264. package/src/components/CopyClipboard/CopyToClipBoard.stories.tsx +0 -20
  265. package/src/components/CopyClipboard/CopyToClipBoard.test.tsx +0 -24
  266. package/src/components/CopyClipboard/CopyToClipBoard.tsx +0 -51
  267. package/src/components/CopyClipboard/index.ts +0 -2
  268. package/src/components/CopyClipboard/utils.ts +0 -10
  269. package/src/components/Dependencies/Dependencies.stories.tsx +0 -158
  270. package/src/components/Dependencies/Dependencies.test.tsx +0 -76
  271. package/src/components/Dependencies/Dependencies.tsx +0 -72
  272. package/src/components/Dependencies/DependencyBlock.test.tsx +0 -47
  273. package/src/components/Dependencies/DependencyBlock.tsx +0 -83
  274. package/src/components/Dependencies/index.ts +0 -1
  275. package/src/components/Dependencies/types.ts +0 -7
  276. package/src/components/Dependencies/utits.ts +0 -3
  277. package/src/components/Deprecated/Deprecated.stories.tsx +0 -9
  278. package/src/components/Deprecated/Deprecated.test.tsx +0 -26
  279. package/src/components/Deprecated/Deprecated.tsx +0 -20
  280. package/src/components/Deprecated/index.ts +0 -1
  281. package/src/components/Developers/DeveloperType.tsx +0 -4
  282. package/src/components/Developers/Developers.stories.tsx +0 -60
  283. package/src/components/Developers/Developers.test.tsx +0 -129
  284. package/src/components/Developers/Developers.tsx +0 -82
  285. package/src/components/Developers/Title.tsx +0 -28
  286. package/src/components/Developers/get-unique-developer-values.ts +0 -16
  287. package/src/components/Developers/index.ts +0 -2
  288. package/src/components/Distribution/Dist.stories.tsx +0 -67
  289. package/src/components/Distribution/Dist.test.tsx +0 -99
  290. package/src/components/Distribution/Dist.tsx +0 -56
  291. package/src/components/Distribution/index.ts +0 -1
  292. package/src/components/Distribution/styles.ts +0 -23
  293. package/src/components/Engines/Engines.stories.tsx +0 -71
  294. package/src/components/Engines/Engines.test.tsx +0 -57
  295. package/src/components/Engines/Engines.tsx +0 -99
  296. package/src/components/Engines/index.ts +0 -1
  297. package/src/components/Engines/styles.ts +0 -14
  298. package/src/components/ErrorBoundary/ErrorBoundary.test.tsx +0 -40
  299. package/src/components/ErrorBoundary/ErrorBoundary.tsx +0 -38
  300. package/src/components/ErrorBoundary/index.ts +0 -1
  301. package/src/components/Forbidden/Forbidden.test.tsx +0 -39
  302. package/src/components/Forbidden/Forbidden.tsx +0 -56
  303. package/src/components/Forbidden/index.ts +0 -1
  304. package/src/components/FundButton/FundButton.stories.tsx +0 -56
  305. package/src/components/FundButton/FundButton.test.tsx +0 -84
  306. package/src/components/FundButton/FundButton.tsx +0 -48
  307. package/src/components/FundButton/index.ts +0 -1
  308. package/src/components/HeaderInfoDialog/HeaderInfoDialog.test.tsx +0 -52
  309. package/src/components/HeaderInfoDialog/HeaderInfoDialog.tsx +0 -82
  310. package/src/components/HeaderInfoDialog/index.ts +0 -1
  311. package/src/components/Heading/Heading.test.tsx +0 -20
  312. package/src/components/Heading/Heading.tsx +0 -16
  313. package/src/components/Heading/index.ts +0 -1
  314. package/src/components/Help/Help.stories.tsx +0 -9
  315. package/src/components/Help/Help.test.tsx +0 -18
  316. package/src/components/Help/Help.tsx +0 -54
  317. package/src/components/Help/index.ts +0 -1
  318. package/src/components/Help/styles.ts +0 -7
  319. package/src/components/Icons/.eslintrc +0 -5
  320. package/src/components/Icons/DevsIcons/CommonJS.tsx +0 -7
  321. package/src/components/Icons/DevsIcons/ES6Module.tsx +0 -7
  322. package/src/components/Icons/DevsIcons/Git.tsx +0 -7
  323. package/src/components/Icons/DevsIcons/NodeJS.tsx +0 -7
  324. package/src/components/Icons/DevsIcons/TypeScript.tsx +0 -7
  325. package/src/components/Icons/DevsIcons/commonjs.svg +0 -4
  326. package/src/components/Icons/DevsIcons/es6module.svg +0 -4
  327. package/src/components/Icons/DevsIcons/git.svg +0 -4
  328. package/src/components/Icons/DevsIcons/index.ts +0 -5
  329. package/src/components/Icons/DevsIcons/nodejs.svg +0 -6
  330. package/src/components/Icons/DevsIcons/typescript.svg +0 -4
  331. package/src/components/Icons/Earth.tsx +0 -36
  332. package/src/components/Icons/FileBinary.tsx +0 -21
  333. package/src/components/Icons/Icons.stories.tsx +0 -53
  334. package/src/components/Icons/Icons.test.tsx +0 -70
  335. package/src/components/Icons/Law.tsx +0 -21
  336. package/src/components/Icons/License.tsx +0 -18
  337. package/src/components/Icons/Managers/Npm.tsx +0 -7
  338. package/src/components/Icons/Managers/Pnpm.tsx +0 -7
  339. package/src/components/Icons/Managers/Yarn.tsx +0 -7
  340. package/src/components/Icons/Managers/index.ts +0 -3
  341. package/src/components/Icons/Managers/npm.svg +0 -15
  342. package/src/components/Icons/Managers/pnpm.svg +0 -1
  343. package/src/components/Icons/Managers/yarn.svg +0 -1
  344. package/src/components/Icons/SvgIcon.tsx +0 -39
  345. package/src/components/Icons/Time.tsx +0 -19
  346. package/src/components/Icons/Version.tsx +0 -20
  347. package/src/components/Icons/index.ts +0 -8
  348. package/src/components/Install/Install.stories.tsx +0 -87
  349. package/src/components/Install/Install.test.tsx +0 -117
  350. package/src/components/Install/Install.tsx +0 -79
  351. package/src/components/Install/InstallListItem.tsx +0 -137
  352. package/src/components/Install/index.ts +0 -1
  353. package/src/components/Keywords/KeywordListItems.tsx +0 -22
  354. package/src/components/Keywords/Keywords.stories.tsx +0 -19
  355. package/src/components/Keywords/Keywords.test.tsx +0 -57
  356. package/src/components/Keywords/Keywords.tsx +0 -36
  357. package/src/components/Keywords/index.ts +0 -1
  358. package/src/components/Label/Label.test.tsx +0 -14
  359. package/src/components/Label/Label.tsx +0 -36
  360. package/src/components/Label/index.ts +0 -1
  361. package/src/components/Link/Link.test.tsx +0 -25
  362. package/src/components/Link/Link.tsx +0 -25
  363. package/src/components/Link/index.ts +0 -1
  364. package/src/components/LinkExternal/LinkExternal.test.tsx +0 -18
  365. package/src/components/LinkExternal/LinkExternal.tsx +0 -22
  366. package/src/components/LinkExternal/index.ts +0 -1
  367. package/src/components/Loading/Loading.stories.tsx +0 -14
  368. package/src/components/Loading/Loading.test.tsx +0 -15
  369. package/src/components/Loading/Loading.tsx +0 -16
  370. package/src/components/Loading/Spinner/Spinner.test.tsx +0 -13
  371. package/src/components/Loading/Spinner/Spinner.tsx +0 -34
  372. package/src/components/Loading/Spinner/index.tsx +0 -1
  373. package/src/components/Loading/index.ts +0 -1
  374. package/src/components/Loading/styles.ts +0 -18
  375. package/src/components/LoginDialog/LoginDialog.stories.tsx +0 -20
  376. package/src/components/LoginDialog/LoginDialog.test.tsx +0 -109
  377. package/src/components/LoginDialog/LoginDialog.tsx +0 -88
  378. package/src/components/LoginDialog/LoginDialogCloseButton.tsx +0 -33
  379. package/src/components/LoginDialog/LoginDialogForm.tsx +0 -94
  380. package/src/components/LoginDialog/LoginDialogFormError.tsx +0 -42
  381. package/src/components/LoginDialog/LoginDialogHeader.tsx +0 -48
  382. package/src/components/LoginDialog/index.ts +0 -1
  383. package/src/components/Logo/Logo.stories.tsx +0 -16
  384. package/src/components/Logo/Logo.test.tsx +0 -18
  385. package/src/components/Logo/Logo.tsx +0 -71
  386. package/src/components/Logo/img/logo-black-and-white.svg +0 -1
  387. package/src/components/Logo/img/logo.svg +0 -1
  388. package/src/components/Logo/index.ts +0 -1
  389. package/src/components/MenuItem/MenuItem.tsx +0 -25
  390. package/src/components/MenuItem/index.ts +0 -1
  391. package/src/components/NoItems/NoItems.stories.tsx +0 -11
  392. package/src/components/NoItems/NoItems.tsx +0 -15
  393. package/src/components/NoItems/Noitems.test.tsx +0 -15
  394. package/src/components/NoItems/index.ts +0 -1
  395. package/src/components/NotFound/NotFound.tsx +0 -53
  396. package/src/components/NotFound/Notfound.test.tsx +0 -40
  397. package/src/components/NotFound/img/package.svg +0 -1
  398. package/src/components/NotFound/index.ts +0 -1
  399. package/src/components/Package/Package.test.tsx +0 -96
  400. package/src/components/Package/Package.tsx +0 -266
  401. package/src/components/Package/index.ts +0 -2
  402. package/src/components/Package/styles.ts +0 -93
  403. package/src/components/PackageList/PackageList.tsx +0 -81
  404. package/src/components/PackageList/Packagelist.test.tsx +0 -60
  405. package/src/components/PackageList/index.ts +0 -1
  406. package/src/components/Person/Person.test.tsx +0 -50
  407. package/src/components/Person/Person.tsx +0 -45
  408. package/src/components/Person/PersonTooltip.tsx +0 -26
  409. package/src/components/Person/index.ts +0 -1
  410. package/src/components/Person/utils.ts +0 -20
  411. package/src/components/RawViewer/RawViewer.tsx +0 -73
  412. package/src/components/RawViewer/index.ts +0 -1
  413. package/src/components/Readme/Readme.test.tsx +0 -35
  414. package/src/components/Readme/Readme.tsx +0 -46
  415. package/src/components/Readme/github-markdown.css +0 -1198
  416. package/src/components/Readme/index.ts +0 -1
  417. package/src/components/Readme/types.ts +0 -3
  418. package/src/components/Readme/utils.ts +0 -26
  419. package/src/components/RegistryInfoDialog/RegistryInfoDialog.tsx +0 -31
  420. package/src/components/RegistryInfoDialog/index.ts +0 -1
  421. package/src/components/RegistryInfoDialog/styles.ts +0 -22
  422. package/src/components/RegistryInfoDialog/types.ts +0 -8
  423. package/src/components/Repository/Repository.stories.tsx +0 -70
  424. package/src/components/Repository/Repository.test.tsx +0 -43
  425. package/src/components/Repository/Repository.tsx +0 -81
  426. package/src/components/Repository/index.ts +0 -1
  427. package/src/components/Search/AutoComplete/AutoComplete.tsx +0 -83
  428. package/src/components/Search/AutoComplete/index.ts +0 -1
  429. package/src/components/Search/AutoComplete/styles.ts +0 -7
  430. package/src/components/Search/Search.stories.tsx +0 -52
  431. package/src/components/Search/Search.test.tsx +0 -181
  432. package/src/components/Search/Search.tsx +0 -168
  433. package/src/components/Search/SearchItem.tsx +0 -125
  434. package/src/components/Search/index.ts +0 -1
  435. package/src/components/Search/styles.ts +0 -41
  436. package/src/components/Search/utils.ts +0 -17
  437. package/src/components/SettingsMenu/SettingsMenu.test.tsx +0 -41
  438. package/src/components/SettingsMenu/SettingsMenu.tsx +0 -124
  439. package/src/components/SettingsMenu/index.ts +0 -1
  440. package/src/components/SideBarTitle/SideBarTitle.stories.tsx +0 -81
  441. package/src/components/SideBarTitle/SideBarTitle.tsx +0 -100
  442. package/src/components/SideBarTitle/index.ts +0 -1
  443. package/src/components/SideBarTitle/utils.ts +0 -12
  444. package/src/components/TextField/TextField.test.tsx +0 -15
  445. package/src/components/TextField/TextField.tsx +0 -24
  446. package/src/components/TextField/index.ts +0 -1
  447. package/src/components/UpLinks/UpLinks.test.tsx +0 -54
  448. package/src/components/UpLinks/UpLinks.tsx +0 -64
  449. package/src/components/UpLinks/UplinkLink.tsx +0 -20
  450. package/src/components/UpLinks/Uplinks.stories.tsx +0 -47
  451. package/src/components/UpLinks/index.ts +0 -1
  452. package/src/components/UpLinks/styles.ts +0 -25
  453. package/src/components/Versions/HistoryList.tsx +0 -83
  454. package/src/components/Versions/TagList.tsx +0 -34
  455. package/src/components/Versions/Versions.test.tsx +0 -83
  456. package/src/components/Versions/Versions.tsx +0 -109
  457. package/src/components/Versions/index.ts +0 -1
  458. package/src/components/Versions/styles.ts +0 -20
  459. package/src/components/Versions/types.ts +0 -17
  460. package/src/hooks/index.ts +0 -2
  461. package/src/hooks/useLocalStorage.ts +0 -49
  462. package/src/hooks/useOnClickOutside.ts +0 -33
  463. package/src/index.ts +0 -66
  464. package/src/layouts/Version/Version.stories.tsx +0 -70
  465. package/src/layouts/Version/Version.tsx +0 -19
  466. package/src/layouts/Version/index.ts +0 -1
  467. package/src/providers/AppConfigurationProvider/AppConfigurationProvider.tsx +0 -75
  468. package/src/providers/AppConfigurationProvider/index.ts +0 -1
  469. package/src/providers/PersistenceSettingProvider/PersistenceSettingProvider.tsx +0 -61
  470. package/src/providers/PersistenceSettingProvider/index.ts +0 -1
  471. package/src/providers/TranslatorProvider/TranslatorProvider.test.tsx +0 -53
  472. package/src/providers/TranslatorProvider/TranslatorProvider.tsx +0 -54
  473. package/src/providers/TranslatorProvider/index.ts +0 -2
  474. package/src/providers/VersionProvider/README.md +0 -22
  475. package/src/providers/VersionProvider/VersionProvider.test.tsx +0 -49
  476. package/src/providers/VersionProvider/VersionProvider.tsx +0 -95
  477. package/src/providers/VersionProvider/index.ts +0 -1
  478. package/src/providers/index.ts +0 -3
  479. package/src/sections/Detail/ContainerContent.tsx +0 -46
  480. package/src/sections/Detail/Detail.stories.tsx +0 -70
  481. package/src/sections/Detail/Detail.test.tsx +0 -19
  482. package/src/sections/Detail/Detail.tsx +0 -41
  483. package/src/sections/Detail/ReadmeSection.tsx +0 -17
  484. package/src/sections/Detail/Tabs.tsx +0 -33
  485. package/src/sections/Detail/index.ts +0 -1
  486. package/src/sections/Footer/Footer.test.tsx +0 -20
  487. package/src/sections/Footer/Footer.tsx +0 -126
  488. package/src/sections/Footer/index.ts +0 -1
  489. package/src/sections/Footer/styles.ts +0 -48
  490. package/src/sections/Header/Header.stories.tsx +0 -59
  491. package/src/sections/Header/Header.test.tsx +0 -280
  492. package/src/sections/Header/Header.tsx +0 -79
  493. package/src/sections/Header/HeaderGreetings.tsx +0 -21
  494. package/src/sections/Header/HeaderLeft.tsx +0 -37
  495. package/src/sections/Header/HeaderMenu.tsx +0 -63
  496. package/src/sections/Header/HeaderRight.tsx +0 -142
  497. package/src/sections/Header/HeaderSettingsDialog.tsx +0 -80
  498. package/src/sections/Header/HeaderToolTip.tsx +0 -15
  499. package/src/sections/Header/HeaderToolTipIcon.tsx +0 -87
  500. package/src/sections/Header/LanguageSwitch.tsx +0 -99
  501. package/src/sections/Header/RegistryInfoContent/RegistryInfoContent.test.tsx +0 -26
  502. package/src/sections/Header/RegistryInfoContent/RegistryInfoContent.tsx +0 -191
  503. package/src/sections/Header/RegistryInfoContent/index.ts +0 -1
  504. package/src/sections/Header/RegistryInfoContent/styles.ts +0 -13
  505. package/src/sections/Header/index.ts +0 -1
  506. package/src/sections/Header/styles.ts +0 -88
  507. package/src/sections/Home/Home.stories.tsx +0 -33
  508. package/src/sections/Home/Home.test.tsx +0 -41
  509. package/src/sections/Home/Home.tsx +0 -21
  510. package/src/sections/Home/index.ts +0 -1
  511. package/src/sections/SideBar/Sidebar.stories.tsx +0 -64
  512. package/src/sections/SideBar/Sidebar.test.tsx +0 -75
  513. package/src/sections/SideBar/Sidebar.tsx +0 -69
  514. package/src/sections/SideBar/index.ts +0 -1
  515. package/src/sections/index.ts +0 -2
  516. package/src/store/api.test.ts +0 -157
  517. package/src/store/api.ts +0 -80
  518. package/src/store/index.ts +0 -4
  519. package/src/store/models/configuration.ts +0 -47
  520. package/src/store/models/download.ts +0 -33
  521. package/src/store/models/index.ts +0 -18
  522. package/src/store/models/login.test.ts +0 -48
  523. package/src/store/models/login.ts +0 -104
  524. package/src/store/models/manifest.ts +0 -117
  525. package/src/store/models/packages.ts +0 -42
  526. package/src/store/models/routes.ts +0 -10
  527. package/src/store/models/search.ts +0 -88
  528. package/src/store/models/utils.ts +0 -3
  529. package/src/store/storage.ts +0 -12
  530. package/src/store/store.ts +0 -15
  531. package/src/test/i18n-config.ts +0 -19
  532. package/src/test/test-react-testing-library.tsx +0 -45
  533. package/src/types/external-modules.d.ts +0 -2
  534. package/src/types/index.ts +0 -11
  535. package/src/types/packageMeta.ts +0 -95
  536. package/src/utils/.eslintrc +0 -5
  537. package/src/utils/cli-utils.test.ts +0 -67
  538. package/src/utils/cli-utils.ts +0 -53
  539. package/src/utils/index.ts +0 -11
  540. package/src/utils/loadable.tsx +0 -20
  541. package/src/utils/routes.ts +0 -8
  542. package/src/utils/token-generate.ts +0 -33
  543. package/src/utils/token.test.ts +0 -55
  544. package/src/utils/token.ts +0 -33
  545. package/src/utils/url.test.ts +0 -32
  546. package/src/utils/url.ts +0 -73
  547. package/src/utils/utils.test.ts +0 -146
  548. package/src/utils/utils.ts +0 -135
  549. package/tsconfig.build.json +0 -23
  550. package/tsconfig.json +0 -22
  551. package/vitest.config.mjs +0 -40
@@ -1,53 +0,0 @@
1
- import { SyntheticEvent } from 'react';
2
-
3
- export const copyToClipBoardUtility =
4
- (str: string): ((e: SyntheticEvent<HTMLElement>) => void) =>
5
- (event: SyntheticEvent<HTMLElement>): void => {
6
- event.preventDefault();
7
-
8
- const node = document.createElement('div');
9
- node.innerText = str;
10
- if (document.body) {
11
- document.body.appendChild(node);
12
-
13
- const range = document.createRange();
14
- const selection = window.getSelection() as Selection;
15
- range.selectNodeContents(node);
16
- selection.removeAllRanges();
17
- selection.addRange(range);
18
- document.execCommand('copy');
19
- document.body.removeChild(node);
20
- }
21
- };
22
-
23
- export function getCLISetConfigRegistry(
24
- command: string,
25
- scope: string | undefined,
26
- registryUrl: string
27
- ): string {
28
- // if there is a scope defined there needs to be a ":" separator between the scope and the registry
29
- return `${command} ${scope ? `${scope}:` : ''}registry ${registryUrl}`;
30
- }
31
-
32
- export function getCLISetRegistry(command: string, registryUrl: string): string {
33
- return `${command} --registry ${registryUrl}`;
34
- }
35
-
36
- export function getCLIChangePassword(command: string, registryUrl: string): string {
37
- return `${command} profile set password --registry ${registryUrl}`;
38
- }
39
-
40
- export function getCLISBerryYamlRegistry(scope: string | undefined, registryUrl: string): string {
41
- return !scope
42
- ? `// .yarnrc.yml
43
- npmRegistryServer: "${registryUrl}"
44
- unsafeHttpWhitelist:
45
- - ${new URL(registryUrl).host}`
46
- : `
47
- // .yarnrc.yml
48
- npmRegistryServer: "${registryUrl}"
49
- npmScopes:
50
- ${scope.replace('@', '')}:
51
- npmRegistryServer: ${registryUrl}
52
- npmPublishRegistry: ${registryUrl}`;
53
- }
@@ -1,11 +0,0 @@
1
- export * as url from './url';
2
- export * as utils from './utils';
3
- export {
4
- getCLIChangePassword,
5
- getCLISBerryYamlRegistry,
6
- getCLISetConfigRegistry,
7
- getCLISetRegistry,
8
- } from './cli-utils';
9
- export { default as loadable } from './loadable';
10
- export { Route } from './routes';
11
- export * from './token';
@@ -1,20 +0,0 @@
1
- /* eslint-disable verdaccio/jsx-spread */
2
- import React, { Suspense, lazy } from 'react';
3
-
4
- /**
5
- * With the combination of a bundler, enable to code split a package.
6
- *
7
- * @example
8
- ```jsx
9
- const VersionPage = loadable(() => import(/'../pages/Version'));
10
- ```
11
- @category HOC
12
- */
13
- export default (importCallback: any) => {
14
- const TargetComponent = lazy(importCallback);
15
- return (props: any) => (
16
- <Suspense fallback={null}>
17
- <TargetComponent {...props} />
18
- </Suspense>
19
- );
20
- };
@@ -1,8 +0,0 @@
1
- export enum Route {
2
- ROOT = '/',
3
- DETAIL = '/-/web/detail/',
4
- SCOPE_PACKAGE = '/-/web/detail/@:scope/:package',
5
- SCOPE_PACKAGE_VERSION = '/-/web/detail/@:scope/:package/v/:version',
6
- PACKAGE = '/-/web/detail/:package',
7
- PACKAGE_VERSION = '/-/web/detail/:package/v/:version',
8
- }
@@ -1,33 +0,0 @@
1
- /**
2
- * Token Utility
3
- */
4
- import dayjs from 'dayjs';
5
-
6
- function encodeBase64(string: string) {
7
- return Buffer.from(string).toString('base64');
8
- }
9
-
10
- export function generateTokenWithTimeRange(amount = 0) {
11
- const payload = {
12
- username: 'verdaccio',
13
- exp: Number.parseInt(String(dayjs(new Date()).add(amount, 'hour').valueOf() / 1000), 10),
14
- };
15
- return `xxxxxx.${encodeBase64(JSON.stringify(payload))}.xxxxxx`;
16
- }
17
-
18
- export function generateTokenWithExpirationAsString() {
19
- const payload = { username: 'verdaccio', exp: 'I am not a number' };
20
- return `xxxxxx.${encodeBase64(JSON.stringify(payload))}.xxxxxx`;
21
- }
22
-
23
- export function generateInvalidToken() {
24
- const payload = `invalidtoken`;
25
- return `xxxxxx.${encodeBase64(payload)}.xxxxxx`;
26
- }
27
-
28
- export function generateTokenWithOutExpiration() {
29
- const payload = {
30
- username: 'verdaccio',
31
- };
32
- return `xxxxxx.${encodeBase64(JSON.stringify(payload))}.xxxxxx`;
33
- }
@@ -1,55 +0,0 @@
1
- import { vi } from 'vitest';
2
-
3
- import { isTokenExpire } from './token';
4
- import {
5
- generateInvalidToken,
6
- generateTokenWithExpirationAsString,
7
- generateTokenWithOutExpiration,
8
- generateTokenWithTimeRange,
9
- } from './token-generate';
10
-
11
- /* eslint-disable no-console */
12
- console.error = vi.fn();
13
-
14
- describe('isTokenExpire', (): void => {
15
- test('isTokenExpire - null is not a valid payload', (): void => {
16
- expect(isTokenExpire(null)).toBeTruthy();
17
- });
18
-
19
- test('isTokenExpire - token is not a valid payload', (): void => {
20
- expect(isTokenExpire('not_a_valid_token')).toBeTruthy();
21
- });
22
-
23
- test('isTokenExpire - token should not expire in 24 hrs range', (): void => {
24
- const token = generateTokenWithTimeRange(24);
25
- expect(isTokenExpire(token)).toBeFalsy();
26
- });
27
-
28
- test('isTokenExpire - token should expire for current time', (): void => {
29
- const token = generateTokenWithTimeRange();
30
- expect(isTokenExpire(token)).toBeTruthy();
31
- });
32
-
33
- test('isTokenExpire - token expiration is not available', (): void => {
34
- const token = generateTokenWithOutExpiration();
35
- expect(isTokenExpire(token)).toBeTruthy();
36
- });
37
-
38
- test('isTokenExpire - token is not a valid json token', (): void => {
39
- const NODE_MAJOR_VERSION = +process.versions.node.split('.')[0];
40
- const errorToken = new SyntaxError(
41
- NODE_MAJOR_VERSION >= 20
42
- ? 'Unexpected token \'i\', "invalidtoken" is not valid JSON'
43
- : 'Unexpected token i in JSON at position 0'
44
- );
45
- const token = generateInvalidToken();
46
- const result = ['Invalid token:', errorToken, 'xxxxxx.aW52YWxpZHRva2Vu.xxxxxx'];
47
- expect(isTokenExpire(token)).toBeTruthy();
48
- expect(console.error).toHaveBeenCalledWith(...result);
49
- });
50
-
51
- test('isTokenExpire - token expiration is not a number', (): void => {
52
- const token = generateTokenWithExpirationAsString();
53
- expect(isTokenExpire(token)).toBeTruthy();
54
- });
55
- });
@@ -1,33 +0,0 @@
1
- import { Base64 } from 'js-base64';
2
- import isNumber from 'lodash/isNumber';
3
- import isString from 'lodash/isString';
4
-
5
- export function isTokenExpire(token: string | null): boolean {
6
- if (!isString(token)) {
7
- return true;
8
- }
9
-
10
- const [, payload] = token.split('.');
11
-
12
- if (!payload) {
13
- return true;
14
- }
15
-
16
- let exp: number;
17
- try {
18
- exp = JSON.parse(Base64.decode(payload)).exp;
19
- } catch (error: any) {
20
- // eslint-disable-next-line no-console
21
- console.error('Invalid token:', error, token);
22
- return true;
23
- }
24
-
25
- if (!exp || !isNumber(exp)) {
26
- return true;
27
- }
28
- // Report as expire before (real expire time - 30s)
29
- const jsTimestamp = exp * 1000 - 30000;
30
- const expired = Date.now() >= jsTimestamp;
31
-
32
- return expired;
33
- }
@@ -1,32 +0,0 @@
1
- import { extractFileName, isEmail, isURL } from './url';
2
-
3
- describe('utils', () => {
4
- describe('url', () => {
5
- test('isURL() - should return true for localhost', () => {
6
- expect(isURL('http://localhost:8080/bootstrap/-/bootstrap-4.3.1.tgz')).toBeTruthy();
7
- });
8
-
9
- test('isURL() - should return false when protocol is missing', () => {
10
- expect(isURL('localhost:8080/bootstrap/-/bootstrap-4.3.1.tgz')).toBeFalsy();
11
- });
12
-
13
- test('isEmail() - should return true if valid', () => {
14
- expect(isEmail('email@domain.com')).toBeTruthy();
15
- });
16
- test('isEmail() - should return false if invalid', () => {
17
- expect(isEmail('')).toBeFalsy();
18
- });
19
-
20
- test('git repo is valid', () => {
21
- expect(isURL('git://github.com/verdaccio/ui.git')).toBeTruthy();
22
- });
23
- });
24
-
25
- describe('extractFileName', () => {
26
- test('should return the file name', () => {
27
- expect(extractFileName('http://localhost:4872/juan_test_webpack1/-/test-10.0.0.tgz')).toBe(
28
- 'test-10.0.0.tgz'
29
- );
30
- });
31
- });
32
- });
package/src/utils/url.ts DELETED
@@ -1,73 +0,0 @@
1
- import isEmailValidator from 'validator/lib/isEmail';
2
- import isURLValidator from 'validator/lib/isURL';
3
-
4
- export function isURL(url: string): boolean {
5
- return isURLValidator(url || '', {
6
- protocols: ['http', 'https', 'git+https', 'git'],
7
- require_protocol: true,
8
- require_tld: false,
9
- });
10
- }
11
-
12
- export function isEmail(email: string): boolean {
13
- return isEmailValidator(email || '');
14
- }
15
-
16
- export function extractFileName(url: string): string {
17
- return url.substring(url.lastIndexOf('/') + 1);
18
- }
19
-
20
- function blobToFile(blob: Blob, fileName: string): File {
21
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
- const b: any = blob;
23
- b.lastModified = Date.now();
24
- b.name = fileName;
25
- return b as File;
26
- }
27
-
28
- export function downloadFile(fileStream: Blob, fileName: string): void {
29
- let file: File;
30
- // File constructor is not supported by Edge
31
- // https://developer.mozilla.org/en-US/docs/Web/API/File#Browser_compatibility
32
- // @ts-ignore. Please see: https://github.com/microsoft/TypeScript/issues/33792
33
- if (navigator.msSaveBlob) {
34
- // Detect if Edge
35
- file = blobToFile(new Blob([fileStream], { type: 'application/octet-stream' }), fileName);
36
- } else {
37
- file = new File([fileStream], fileName, {
38
- type: 'application/octet-stream',
39
- lastModified: Date.now(),
40
- });
41
- }
42
-
43
- const objectURL = URL.createObjectURL(file);
44
- const fileLink = document.createElement('a');
45
- fileLink.href = objectURL;
46
- fileLink.download = fileName;
47
-
48
- // Skip actual download in test environment to avoid JSDOM navigation error
49
- // Check if we're in a test environment (JSDOM)
50
- const isTestEnvironment =
51
- (typeof window !== 'undefined' &&
52
- window.navigator &&
53
- window.navigator.userAgent &&
54
- window.navigator.userAgent.includes('Node.js')) ||
55
- window.navigator.userAgent.includes('jsdom');
56
-
57
- if (!isTestEnvironment) {
58
- // Without appending to an HTML Element, download dialog does not show up on Firefox
59
- // https://github.com/verdaccio/ui/issues/119
60
- document.documentElement.appendChild(fileLink);
61
- fileLink.click();
62
- // firefox requires remove the object url
63
- setTimeout(() => {
64
- URL.revokeObjectURL(objectURL);
65
- document.documentElement.removeChild(fileLink);
66
- }, 150);
67
- } else {
68
- // In test environment, just clean up without triggering navigation
69
- setTimeout(() => {
70
- URL.revokeObjectURL(objectURL);
71
- }, 150);
72
- }
73
- }
@@ -1,146 +0,0 @@
1
- import MockDate from 'mockdate';
2
-
3
- import { packageMeta } from './__partials__/packageMeta';
4
- import {
5
- fileSizeSI,
6
- formatDate,
7
- formatDateDistance,
8
- formatLicense,
9
- formatRepository,
10
- getLastUpdatedPackageTime,
11
- getRecentReleases,
12
- getUplink,
13
- } from './utils';
14
-
15
- describe('formatLicense', (): void => {
16
- beforeEach(() => {
17
- MockDate.set(new Date());
18
- });
19
-
20
- afterEach(() => {
21
- MockDate.reset();
22
- });
23
-
24
- test('should check license field different values', (): void => {
25
- expect(formatLicense('MIT')).toEqual('MIT');
26
- });
27
-
28
- test('should check license field for object value', (): void => {
29
- const license = { type: 'ISC', url: 'https://opensource.org/licenses/ISC' };
30
- expect(formatLicense(license)).toEqual('ISC');
31
- });
32
-
33
- test('should check license field for other value', (): void => {
34
- expect(formatLicense(null)).toBeUndefined();
35
- expect(formatLicense({})).toBeUndefined();
36
- expect(formatLicense([])).toBeUndefined();
37
- });
38
- });
39
-
40
- describe('formatRepository', (): void => {
41
- test('should check repository field different values', (): void => {
42
- const repository = 'https://github.com/verdaccio/verdaccio';
43
- expect(formatRepository(repository)).toEqual(repository);
44
- });
45
-
46
- test('should check repository field for object value', (): void => {
47
- const license = {
48
- type: 'git',
49
- url: 'https://github.com/verdaccio/verdaccio',
50
- };
51
- expect(formatRepository(license)).toEqual(license.url);
52
- });
53
-
54
- test('should check repository field for other value', (): void => {
55
- expect(formatRepository(null)).toBeNull();
56
- expect(formatRepository({})).toBeNull();
57
- expect(formatRepository([])).toBeNull();
58
- });
59
- });
60
-
61
- describe('formatDate', (): void => {
62
- test('should format the date', (): void => {
63
- const date = 1532211072138;
64
- expect(formatDate(date)).toEqual('07/21/2018 10:11:12 PM');
65
- });
66
- });
67
-
68
- describe('formatDateDistance', (): void => {
69
- test('should calculate the distance', (): void => {
70
- // https://day.js.org/docs/en/display/from-now#list-of-breakdown-range
71
- const dateYearAgo = () => {
72
- const date = new Date();
73
- date.setDate(date.getDate() - 365);
74
- return date;
75
- };
76
-
77
- const dateTwoMonthsAgo = (): Date => {
78
- const date = new Date();
79
- date.setDate(date.getDate() - 60);
80
- return date;
81
- };
82
-
83
- const date1 = dateYearAgo();
84
- const date2 = dateTwoMonthsAgo();
85
-
86
- expect(formatDateDistance(date1)).toEqual('a year ago');
87
- expect(formatDateDistance(date2)).toEqual('2 months ago');
88
- });
89
- });
90
-
91
- describe('getLastUpdatedPackageTime', (): void => {
92
- test('should get the last update time', (): void => {
93
- const lastUpdated = packageMeta._uplinks;
94
- expect(getLastUpdatedPackageTime(lastUpdated)).toEqual('07/22/2018 10:11:12 PM');
95
- });
96
-
97
- test('should get the last update time for blank uplink', (): void => {
98
- const lastUpdated = {};
99
- expect(getLastUpdatedPackageTime(lastUpdated)).toEqual('');
100
- });
101
- });
102
-
103
- describe('getRecentReleases', (): void => {
104
- test('should get the recent releases', (): void => {
105
- const { time } = packageMeta;
106
- const result = [
107
- { time: '12/14/2017 3:43:27 PM', version: '2.7.1' },
108
- { time: '12/05/2017 11:25:06 PM', version: '2.7.0' },
109
- { time: '11/08/2017 10:47:16 PM', version: '2.6.6' },
110
- ];
111
- expect(getRecentReleases(time)).toEqual(result);
112
- expect(getRecentReleases()).toEqual([]);
113
- });
114
- });
115
-
116
- describe('getUplink', (): void => {
117
- test('getUplink for npmjs', () => {
118
- expect(getUplink('npmjs', 'semver')).toEqual('https://www.npmjs.com/package/semver');
119
- });
120
-
121
- test('getUplink for server1', () => {
122
- expect(getUplink('server1', 'semver')).toEqual(null);
123
- });
124
- });
125
-
126
- describe('fileSizeSI', (): void => {
127
- test('fileSizeSI as number 1234567', () => {
128
- expect(fileSizeSI(1234567)).toEqual('1.2 MB');
129
- });
130
-
131
- test('fileSizeSI as number 9876', () => {
132
- expect(fileSizeSI(9876)).toEqual('9.9 kB');
133
- });
134
-
135
- test('fileSizeSI as number 1000', () => {
136
- expect(fileSizeSI(1000)).toEqual('1.0 kB');
137
- });
138
-
139
- test('fileSizeSI as number 123', () => {
140
- expect(fileSizeSI(123)).toEqual('123 Bytes');
141
- });
142
-
143
- test('fileSizeSI as number 0', () => {
144
- expect(fileSizeSI(0)).toEqual('0 Bytes');
145
- });
146
- });
@@ -1,135 +0,0 @@
1
- import dayjs from 'dayjs';
2
- import localizedFormat from 'dayjs/plugin/localizedFormat';
3
- import relativeTime from 'dayjs/plugin/relativeTime';
4
- import i18next from 'i18next';
5
- import isString from 'lodash/isString';
6
-
7
- import { UpLinks } from '@verdaccio/types';
8
-
9
- import { Time } from '../types/packageMeta';
10
-
11
- export const TIMEFORMAT = 'L LTS';
12
-
13
- dayjs.extend(relativeTime);
14
- dayjs.extend(localizedFormat);
15
-
16
- /**
17
- * Formats license field for webui.
18
- * @see https://docs.npmjs.com/files/package.json#license
19
- */
20
- // License should use type License defined above, but conflicts with the unit test that provide array or empty object
21
- /* eslint-disable @typescript-eslint/no-explicit-any */
22
- export function formatLicense(license: any): string | undefined {
23
- if (isString(license)) {
24
- return license;
25
- }
26
-
27
- if (license?.type) {
28
- return license.type;
29
- }
30
-
31
- return;
32
- }
33
-
34
- export interface Repository {
35
- type: string;
36
- url: string;
37
- }
38
-
39
- /**
40
- * Formats repository field for webui.
41
- * @see https://docs.npmjs.com/files/package.json#repository
42
- */
43
-
44
- // Repository should use type Repository defined above, but conflicts with the unit test that provide array or empty object
45
- /* eslint-disable @typescript-eslint/no-explicit-any */
46
- export function formatRepository(repository: any): string | null {
47
- if (isString(repository)) {
48
- return repository;
49
- }
50
-
51
- if (repository?.url) {
52
- return repository.url;
53
- }
54
-
55
- return null;
56
- }
57
-
58
- export function formatDate(lastUpdate: string | number): string {
59
- return dayjs(new Date(lastUpdate)).format(TIMEFORMAT);
60
- }
61
-
62
- export function formatDateDistance(lastUpdate: Date | string | number): string {
63
- return dayjs(new Date(lastUpdate)).fromNow();
64
- }
65
-
66
- /**
67
- * For <LastSync /> component
68
- * @param {array} uplinks
69
- */
70
- export function getLastUpdatedPackageTime(uplinks: UpLinks = {}): string {
71
- let lastUpdate = 0;
72
- Object.keys(uplinks).forEach(function computeUplink(upLinkName): void {
73
- const status = uplinks[upLinkName];
74
- if (status.fetched > lastUpdate) {
75
- lastUpdate = status.fetched;
76
- }
77
- });
78
-
79
- return lastUpdate ? formatDate(lastUpdate) : '';
80
- }
81
-
82
- /**
83
- * For <LastSync /> component
84
- * @param {Object} time
85
- * @returns {Array} last 3 releases
86
- */
87
- export function getRecentReleases(time: Time = {}): Time[] {
88
- const recent = Object.keys(time).map((version) => ({
89
- version,
90
- time: formatDate(time[version]),
91
- }));
92
-
93
- return recent.slice(recent.length - 3, recent.length).reverse();
94
- }
95
-
96
- export function getAuthorName(authorName?: string): string {
97
- if (!authorName) {
98
- return i18next.t('author-unknown');
99
- }
100
-
101
- if (authorName.toLowerCase() === 'anonymous') {
102
- return i18next.t('author-anonymous');
103
- }
104
-
105
- return authorName;
106
- }
107
-
108
- export function getUplink(upLinkName: string, packageName: string): string | null {
109
- // TODO: make this a config like "uplinks: npmjs: web: https://www.npmjs.com/package/"
110
- switch (upLinkName) {
111
- case 'npmjs':
112
- return `https://www.npmjs.com/package/${packageName}`;
113
- }
114
- return null;
115
- }
116
-
117
- export function fileSizeSI(
118
- a: number,
119
- b?: typeof Math,
120
- c?: (p: number) => number,
121
- d?: number,
122
- e?: number
123
- ): string {
124
- b = Math;
125
- c = b.log;
126
- d = 1e3;
127
- e = (c(a) / c(d)) | 0;
128
- let size = a / b.pow(d, e);
129
- // no decimals for Bytes
130
- if (e === 0) {
131
- return Math.floor(size) + ' Bytes';
132
- } else {
133
- return size.toFixed(1) + ' ' + 'kMGTPEZY'[--e] + 'B';
134
- }
135
- }
@@ -1,23 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.base.json",
3
- "compilerOptions": {
4
- "module": "ESNext",
5
- "moduleResolution": "node",
6
- "allowSyntheticDefaultImports": true,
7
- "resolveJsonModule": true,
8
- "sourceMap": true,
9
- "preserveSymlinks": true,
10
- "rootDir": "./src",
11
- "outDir": "./build",
12
- "skipLibCheck": true,
13
- "jsx": "react",
14
- "types": ["node", "@testing-library/jest-dom"]
15
- },
16
- "include": ["src/**/*"],
17
- "exclude": ["src/**/*.stories.tsx", "src/**/*.test.tsx", "src/**/*.test.ts"],
18
- "typedocOptions": {
19
- "categoryOrder": ["Model", "Component", "Provider", "*"],
20
- "defaultCategory": "Component",
21
- "categorizeByGroup": "false"
22
- }
23
- }
package/tsconfig.json DELETED
@@ -1,22 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.reference.json",
3
- "compilerOptions": {
4
- "module": "ESNext",
5
- "moduleResolution": "node",
6
- "allowSyntheticDefaultImports": true,
7
- "resolveJsonModule": true,
8
- "sourceMap": true,
9
- "rootDir": "./src",
10
- "outDir": "./build",
11
- "preserveSymlinks": true,
12
- "jsx": "react",
13
- "allowJs": true,
14
- "types": ["node", "jest", "@testing-library/jest-dom"]
15
- },
16
- "include": ["src/**/*"],
17
- "references": [
18
- {
19
- "path": "../core/types"
20
- }
21
- ]
22
- }