@verdaccio/ui-theme 3.1.0 → 6.0.0-6-next.11

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 (381) hide show
  1. package/.babelrc +33 -0
  2. package/.eslintrc +115 -0
  3. package/.stylelintrc +40 -0
  4. package/CHANGELOG.md +152 -554
  5. package/LICENSE +1 -1
  6. package/README.md +22 -95
  7. package/config/env.js +9 -0
  8. package/jest/api/packages.json +42 -0
  9. package/jest/identity.js +29 -0
  10. package/jest/jest.config.js +39 -0
  11. package/jest/jestEnvironment.js +1 -0
  12. package/jest/server-handlers.ts +9 -0
  13. package/jest/server.ts +6 -0
  14. package/jest/setup-env.ts +15 -0
  15. package/jest/setup.ts +31 -0
  16. package/jest/unit/components/__mocks__/api.ts +47 -0
  17. package/jest/unit/components/__mocks__/token.ts +31 -0
  18. package/jest/unit/components/store/login.ts +23 -0
  19. package/jest/unit/components/store/logo.ts +7 -0
  20. package/jest/unit/components/store/package.ts +174 -0
  21. package/jest/unit/components/store/packageMeta.ts +592 -0
  22. package/jest/unit/empty.ts +1 -0
  23. package/lib/constants.ts +9 -0
  24. package/package.json +153 -228
  25. package/src/App/App.test.tsx +123 -0
  26. package/src/App/App.tsx +54 -0
  27. package/src/App/AppError.tsx +38 -0
  28. package/src/App/AppRoute.tsx +63 -0
  29. package/src/App/Footer/Footer.test.tsx +20 -0
  30. package/src/App/Footer/Footer.tsx +111 -0
  31. package/src/App/Footer/__snapshots__/Footer.test.tsx.snap +456 -0
  32. package/src/App/Footer/index.ts +1 -0
  33. package/src/App/Footer/styles.ts +44 -0
  34. package/src/App/Header/Header.test.tsx +152 -0
  35. package/src/App/Header/Header.tsx +74 -0
  36. package/src/App/Header/HeaderGreetings.tsx +22 -0
  37. package/src/App/Header/HeaderInfoDialog.tsx +19 -0
  38. package/src/App/Header/HeaderLeft.tsx +31 -0
  39. package/src/App/Header/HeaderMenu.tsx +65 -0
  40. package/src/App/Header/HeaderRight.tsx +118 -0
  41. package/src/App/Header/HeaderToolTip.tsx +19 -0
  42. package/src/App/Header/HeaderToolTipIcon.tsx +75 -0
  43. package/src/App/Header/LanguageSwitch.tsx +125 -0
  44. package/src/App/Header/LoginDialog/LoginDialog.test.tsx +112 -0
  45. package/src/App/Header/LoginDialog/LoginDialog.tsx +81 -0
  46. package/src/App/Header/LoginDialog/LoginDialogCloseButton.tsx +32 -0
  47. package/src/App/Header/LoginDialog/LoginDialogForm.tsx +97 -0
  48. package/src/App/Header/LoginDialog/LoginDialogFormError.tsx +43 -0
  49. package/src/App/Header/LoginDialog/LoginDialogHeader.tsx +48 -0
  50. package/src/App/Header/LoginDialog/__snapshots__/LoginDialog.test.tsx.snap +3 -0
  51. package/src/App/Header/LoginDialog/index.ts +1 -0
  52. package/src/App/Header/RegistryInfoContent/RegistryInfoContent.test.tsx +27 -0
  53. package/src/App/Header/RegistryInfoContent/RegistryInfoContent.tsx +155 -0
  54. package/src/App/Header/RegistryInfoContent/index.ts +1 -0
  55. package/src/App/Header/RegistryInfoDialog/RegistryInfoDialog.tsx +30 -0
  56. package/src/App/Header/RegistryInfoDialog/index.ts +1 -0
  57. package/src/App/Header/RegistryInfoDialog/styles.ts +16 -0
  58. package/src/App/Header/RegistryInfoDialog/types.ts +7 -0
  59. package/src/App/Header/Search/Search.test.tsx +168 -0
  60. package/src/App/Header/Search/Search.tsx +127 -0
  61. package/src/App/Header/Search/SearchAdornment.tsx +18 -0
  62. package/src/App/Header/Search/__snapshots__/Search.test.tsx.snap +101 -0
  63. package/src/App/Header/Search/index.ts +1 -0
  64. package/src/App/Header/index.ts +1 -0
  65. package/src/App/Header/styles.ts +89 -0
  66. package/src/App/index.ts +1 -0
  67. package/src/App/utils/loadable.tsx +10 -0
  68. package/src/components/.eslintrc +7 -0
  69. package/src/components/ActionBar/ActionBar.test.tsx +91 -0
  70. package/src/components/ActionBar/ActionBar.tsx +45 -0
  71. package/src/components/ActionBar/ActionBarAction.tsx +75 -0
  72. package/src/components/ActionBar/__snapshots__/ActionBar.test.tsx.snap +122 -0
  73. package/src/components/ActionBar/index.ts +1 -0
  74. package/src/components/AppBar.tsx +10 -0
  75. package/src/components/Author/Author.test.tsx +75 -0
  76. package/src/components/Author/Author.tsx +47 -0
  77. package/src/components/Author/__snapshots__/Author.test.tsx.snap +353 -0
  78. package/src/components/Author/index.ts +1 -0
  79. package/src/components/Author/styles.ts +23 -0
  80. package/src/components/AutoComplete/AutoComplete.tsx +179 -0
  81. package/src/components/AutoComplete/AutoCompleteV2.tsx +296 -0
  82. package/src/components/AutoComplete/index.ts +1 -0
  83. package/src/components/AutoComplete/styles.tsx +58 -0
  84. package/src/components/AutoComplete/useAutoComplete.tsx +61 -0
  85. package/src/components/Avatar.tsx +3 -0
  86. package/src/components/Box.tsx +8 -0
  87. package/src/components/Button.tsx +10 -0
  88. package/src/components/Card.tsx +10 -0
  89. package/src/components/CardActions.tsx +13 -0
  90. package/src/components/CardContent.tsx +10 -0
  91. package/src/components/Chip.tsx +10 -0
  92. package/src/components/CircularProgress.tsx +15 -0
  93. package/src/components/CopyToClipBoard.tsx +45 -0
  94. package/src/components/Dialog.tsx +10 -0
  95. package/src/components/DialogActions.tsx +16 -0
  96. package/src/components/DialogContent.tsx +16 -0
  97. package/src/components/DialogTitle.tsx +10 -0
  98. package/src/components/Divider.tsx +10 -0
  99. package/src/components/FloatingActionButton.tsx +12 -0
  100. package/src/components/FormControl.tsx +10 -0
  101. package/src/components/FormHelperText.tsx +16 -0
  102. package/src/components/Grid.tsx +10 -0
  103. package/src/components/Heading.tsx +15 -0
  104. package/src/components/IconButton.tsx +10 -0
  105. package/src/components/Icons/.eslintrc +5 -0
  106. package/src/components/Icons/Earth.tsx +36 -0
  107. package/src/components/Icons/FileBinary.tsx +20 -0
  108. package/src/components/Icons/Law.tsx +20 -0
  109. package/src/components/Icons/License.tsx +18 -0
  110. package/src/components/Icons/Time.tsx +19 -0
  111. package/src/components/Icons/Version.tsx +20 -0
  112. package/src/components/Icons/index.ts +5 -0
  113. package/src/components/Input.tsx +10 -0
  114. package/src/components/InputAdornment/InputAdornment.tsx +16 -0
  115. package/src/components/InputAdornment/index.ts +1 -0
  116. package/src/components/InputLabel.tsx +10 -0
  117. package/src/components/Label/Label.test.tsx +15 -0
  118. package/src/components/Label/Label.tsx +35 -0
  119. package/src/components/Label/__snapshots__/Label.test.tsx.snap +14 -0
  120. package/src/components/Label/index.ts +1 -0
  121. package/src/components/Link.tsx +39 -0
  122. package/src/components/List.tsx +10 -0
  123. package/src/components/ListItem.tsx +23 -0
  124. package/src/components/ListItemText.tsx +16 -0
  125. package/src/components/Loading/Loading.test.tsx +12 -0
  126. package/src/components/Loading/Loading.tsx +17 -0
  127. package/src/components/Loading/Spinner/Spinner.test.tsx +14 -0
  128. package/src/components/Loading/Spinner/Spinner.tsx +35 -0
  129. package/src/components/Loading/Spinner/__snapshots__/Spinner.test.tsx.snap +148 -0
  130. package/src/components/Loading/Spinner/index.tsx +1 -0
  131. package/src/components/Loading/__snapshots__/Loading.test.tsx.snap +86 -0
  132. package/src/components/Loading/index.ts +1 -0
  133. package/src/components/Loading/styles.ts +17 -0
  134. package/src/components/Logo/Logo.test.tsx +12 -0
  135. package/src/components/Logo/Logo.tsx +55 -0
  136. package/src/components/Logo/__snapshots__/Logo.test.tsx.snap +19 -0
  137. package/src/components/Logo/img/logo-black-and-white.svg +1 -0
  138. package/src/components/Logo/img/logo.svg +1 -0
  139. package/src/components/Logo/index.ts +1 -0
  140. package/src/components/Menu.tsx +10 -0
  141. package/src/components/MenuItem.tsx +25 -0
  142. package/src/components/NotFound/NotFound.tsx +52 -0
  143. package/src/components/NotFound/Notfound.test.tsx +37 -0
  144. package/src/components/NotFound/__snapshots__/Notfound.test.tsx.snap +44 -0
  145. package/src/components/NotFound/img/package.svg +1 -0
  146. package/src/components/NotFound/index.ts +1 -0
  147. package/src/components/NotFound/styles.ts +40 -0
  148. package/src/components/Paper.tsx +10 -0
  149. package/src/components/SnackbarContent.tsx +15 -0
  150. package/src/components/SvgIcon.tsx +38 -0
  151. package/src/components/Tab.tsx +10 -0
  152. package/src/components/Tabs.tsx +14 -0
  153. package/src/components/Text/Text.tsx +17 -0
  154. package/src/components/Text/TextConfig.ts +7 -0
  155. package/src/components/Text/index.ts +2 -0
  156. package/src/components/TextField/TextField.test.tsx +16 -0
  157. package/src/components/TextField/TextField.tsx +23 -0
  158. package/src/components/TextField/__snapshots__/TextField.test.tsx.snap +19 -0
  159. package/src/components/TextField/index.ts +1 -0
  160. package/src/components/Toolbar.tsx +10 -0
  161. package/src/components/Tooltip.tsx +25 -0
  162. package/src/design-tokens/ResetStyles.tsx +44 -0
  163. package/src/design-tokens/StyleBaseline.tsx +14 -0
  164. package/src/design-tokens/ThemeContext.ts +13 -0
  165. package/src/design-tokens/ThemeProvider.tsx +44 -0
  166. package/src/design-tokens/emotion.ts +5 -0
  167. package/src/design-tokens/load-dayjs-locale.ts +98 -0
  168. package/src/design-tokens/theme.ts +159 -0
  169. package/src/design-tokens/useLocalStorage.ts +40 -0
  170. package/src/design-tokens/useOnClickOutside.ts +28 -0
  171. package/src/design-tokens/useTheme.ts +7 -0
  172. package/src/i18n/ABOUT_TRANSLATIONS.md +13 -0
  173. package/src/i18n/config.ts +52 -0
  174. package/src/i18n/crowdin/ui.json +170 -0
  175. package/src/i18n/deprecated_translations_dont_use/cs-CZ.json +168 -0
  176. package/src/i18n/deprecated_translations_dont_use/de-DE.json +168 -0
  177. package/src/i18n/deprecated_translations_dont_use/en-US.json +170 -0
  178. package/src/i18n/deprecated_translations_dont_use/es-ES.json +168 -0
  179. package/src/i18n/deprecated_translations_dont_use/fr-FR.json +168 -0
  180. package/src/i18n/deprecated_translations_dont_use/ja-JP.json +168 -0
  181. package/src/i18n/deprecated_translations_dont_use/km-KH.json +168 -0
  182. package/src/i18n/deprecated_translations_dont_use/pt-BR.json +168 -0
  183. package/src/i18n/deprecated_translations_dont_use/ru-RU.json +168 -0
  184. package/src/i18n/deprecated_translations_dont_use/tr-TR.json +168 -0
  185. package/src/i18n/deprecated_translations_dont_use/uk-UA.json +168 -0
  186. package/src/i18n/deprecated_translations_dont_use/zh-CN.json +168 -0
  187. package/src/i18n/deprecated_translations_dont_use/zh-TW.json +165 -0
  188. package/src/i18n/enabledLanguages.ts +35 -0
  189. package/src/index.tsx +36 -0
  190. package/src/lib/constants.ts +9 -0
  191. package/src/pages/Version/DetailContainer/Dependencies/Dependencies.test.tsx +93 -0
  192. package/src/pages/Version/DetailContainer/Dependencies/Dependencies.tsx +100 -0
  193. package/src/pages/Version/DetailContainer/Dependencies/index.ts +1 -0
  194. package/src/pages/Version/DetailContainer/Dependencies/styles.ts +26 -0
  195. package/src/pages/Version/DetailContainer/Dependencies/types.ts +7 -0
  196. package/src/pages/Version/DetailContainer/Deprecated/Deprecated.test.tsx +34 -0
  197. package/src/pages/Version/DetailContainer/Deprecated/Deprecated.tsx +31 -0
  198. package/src/pages/Version/DetailContainer/Deprecated/index.ts +1 -0
  199. package/src/pages/Version/DetailContainer/DetailContainer.test.tsx +13 -0
  200. package/src/pages/Version/DetailContainer/DetailContainer.tsx +37 -0
  201. package/src/pages/Version/DetailContainer/DetailContainerContent.tsx +41 -0
  202. package/src/pages/Version/DetailContainer/DetailContainerContentReadme.tsx +19 -0
  203. package/src/pages/Version/DetailContainer/DetailContainerTabs.tsx +36 -0
  204. package/src/pages/Version/DetailContainer/NoItems/NoItems.tsx +16 -0
  205. package/src/pages/Version/DetailContainer/NoItems/Noitems.test.tsx +16 -0
  206. package/src/pages/Version/DetailContainer/NoItems/__snapshots__/Noitems.test.tsx.snap +9 -0
  207. package/src/pages/Version/DetailContainer/NoItems/index.ts +1 -0
  208. package/src/pages/Version/DetailContainer/Readme/Readme.spec.tsx +19 -0
  209. package/src/pages/Version/DetailContainer/Readme/Readme.tsx +22 -0
  210. package/src/pages/Version/DetailContainer/Readme/__snapshots__/Readme.spec.tsx.snap +94 -0
  211. package/src/pages/Version/DetailContainer/Readme/index.ts +1 -0
  212. package/src/pages/Version/DetailContainer/Readme/types.ts +3 -0
  213. package/src/pages/Version/DetailContainer/UpLinks/UpLinks.test.tsx +58 -0
  214. package/src/pages/Version/DetailContainer/UpLinks/UpLinks.tsx +45 -0
  215. package/src/pages/Version/DetailContainer/UpLinks/__snapshots__/UpLinks.test.tsx.snap +247 -0
  216. package/src/pages/Version/DetailContainer/UpLinks/index.ts +1 -0
  217. package/src/pages/Version/DetailContainer/UpLinks/styles.ts +24 -0
  218. package/src/pages/Version/DetailContainer/Versions/Versions.test.tsx +60 -0
  219. package/src/pages/Version/DetailContainer/Versions/Versions.tsx +41 -0
  220. package/src/pages/Version/DetailContainer/Versions/VersionsHistoryList.tsx +40 -0
  221. package/src/pages/Version/DetailContainer/Versions/VersionsTagList.tsx +28 -0
  222. package/src/pages/Version/DetailContainer/Versions/__partials__/data.json +5984 -0
  223. package/src/pages/Version/DetailContainer/Versions/__snapshots__/Versions.test.tsx.snap +3 -0
  224. package/src/pages/Version/DetailContainer/Versions/index.ts +1 -0
  225. package/src/pages/Version/DetailContainer/Versions/styles.ts +30 -0
  226. package/src/pages/Version/DetailContainer/__snapshots__/DetailContainer.test.tsx.snap +103 -0
  227. package/src/pages/Version/DetailContainer/index.ts +1 -0
  228. package/src/pages/Version/DetailSidebar/DetailSidebar.tsx +55 -0
  229. package/src/pages/Version/DetailSidebar/DetailSidebarFundButton.test.tsx +111 -0
  230. package/src/pages/Version/DetailSidebar/DetailSidebarFundButton.tsx +53 -0
  231. package/src/pages/Version/DetailSidebar/DetailSidebarTitle.tsx +40 -0
  232. package/src/pages/Version/DetailSidebar/Developers/Developers.test.tsx +117 -0
  233. package/src/pages/Version/DetailSidebar/Developers/Developers.tsx +90 -0
  234. package/src/pages/Version/DetailSidebar/Developers/DevelopersTitle.tsx +32 -0
  235. package/src/pages/Version/DetailSidebar/Developers/__snapshots__/Developers.test.tsx.snap +380 -0
  236. package/src/pages/Version/DetailSidebar/Developers/get-unique-developer-values.ts +16 -0
  237. package/src/pages/Version/DetailSidebar/Developers/index.ts +1 -0
  238. package/src/pages/Version/DetailSidebar/Developers/styles.ts +31 -0
  239. package/src/pages/Version/DetailSidebar/Dist/Dist.test.tsx +78 -0
  240. package/src/pages/Version/DetailSidebar/Dist/Dist.tsx +49 -0
  241. package/src/pages/Version/DetailSidebar/Dist/__snapshots__/Dist.test.tsx.snap +602 -0
  242. package/src/pages/Version/DetailSidebar/Dist/index.ts +1 -0
  243. package/src/pages/Version/DetailSidebar/Dist/styles.ts +27 -0
  244. package/src/pages/Version/DetailSidebar/Engines/Engines.test.tsx +71 -0
  245. package/src/pages/Version/DetailSidebar/Engines/Engines.tsx +58 -0
  246. package/src/pages/Version/DetailSidebar/Engines/img/node.png +0 -0
  247. package/src/pages/Version/DetailSidebar/Engines/index.ts +1 -0
  248. package/src/pages/Version/DetailSidebar/Engines/styles.ts +14 -0
  249. package/src/pages/Version/DetailSidebar/Install/Install.test.tsx +64 -0
  250. package/src/pages/Version/DetailSidebar/Install/Install.tsx +52 -0
  251. package/src/pages/Version/DetailSidebar/Install/InstallListItem.tsx +97 -0
  252. package/src/pages/Version/DetailSidebar/Install/__partials__/data.json +5984 -0
  253. package/src/pages/Version/DetailSidebar/Install/img/npm.svg +15 -0
  254. package/src/pages/Version/DetailSidebar/Install/img/pnpm.svg +1 -0
  255. package/src/pages/Version/DetailSidebar/Install/img/yarn.svg +1 -0
  256. package/src/pages/Version/DetailSidebar/Install/index.ts +1 -0
  257. package/src/pages/Version/DetailSidebar/Repository/Repository.test.tsx +78 -0
  258. package/src/pages/Version/DetailSidebar/Repository/Repository.tsx +93 -0
  259. package/src/pages/Version/DetailSidebar/Repository/__partials__/data.json +5984 -0
  260. package/src/pages/Version/DetailSidebar/Repository/__snapshots__/Repository.test.tsx.snap +3 -0
  261. package/src/pages/Version/DetailSidebar/Repository/img/git.png +0 -0
  262. package/src/pages/Version/DetailSidebar/Repository/index.ts +1 -0
  263. package/src/pages/Version/DetailSidebar/index.ts +1 -0
  264. package/src/pages/Version/Version.test.tsx +68 -0
  265. package/src/pages/Version/Version.tsx +41 -0
  266. package/src/pages/Version/VersionContextProvider.tsx +43 -0
  267. package/src/pages/Version/VersionLayout.tsx +20 -0
  268. package/src/pages/Version/__partials__/data.json +5984 -0
  269. package/src/pages/Version/context.ts +10 -0
  270. package/src/pages/Version/get-route-package-name.ts +9 -0
  271. package/src/pages/Version/index.ts +4 -0
  272. package/src/pages/Version/version-config.ts +19 -0
  273. package/src/pages/home/Home.tsx +25 -0
  274. package/src/pages/home/PackageList/Help/Help.test.tsx +12 -0
  275. package/src/pages/home/PackageList/Help/Help.tsx +56 -0
  276. package/src/pages/home/PackageList/Help/__snapshots__/Help.test.tsx.snap +159 -0
  277. package/src/pages/home/PackageList/Help/index.ts +1 -0
  278. package/src/pages/home/PackageList/Help/styles.ts +13 -0
  279. package/src/pages/home/PackageList/Package/Package.test.tsx +56 -0
  280. package/src/pages/home/PackageList/Package/Package.tsx +253 -0
  281. package/src/pages/home/PackageList/Package/Tag/Tag.test.tsx +16 -0
  282. package/src/pages/home/PackageList/Package/Tag/Tag.tsx +11 -0
  283. package/src/pages/home/PackageList/Package/Tag/__snapshots__/Tag.test.tsx.snap +21 -0
  284. package/src/pages/home/PackageList/Package/Tag/index.ts +1 -0
  285. package/src/pages/home/PackageList/Package/Tag/styles.ts +11 -0
  286. package/src/pages/home/PackageList/Package/index.ts +1 -0
  287. package/src/pages/home/PackageList/Package/styles.ts +112 -0
  288. package/src/pages/home/PackageList/PackageList.tsx +81 -0
  289. package/src/pages/home/PackageList/Packagelist.test.tsx +60 -0
  290. package/src/pages/home/PackageList/index.ts +1 -0
  291. package/src/pages/home/index.ts +1 -0
  292. package/src/providers/API/api.test.ts +136 -0
  293. package/src/providers/API/api.ts +73 -0
  294. package/src/providers/API/storage.ts +12 -0
  295. package/src/providers/config/AppConfigurationProvider.tsx +57 -0
  296. package/src/providers/config/index.ts +1 -0
  297. package/src/store/index.ts +1 -0
  298. package/src/store/models/configuration.ts +42 -0
  299. package/src/store/models/download.ts +31 -0
  300. package/src/store/models/index.ts +17 -0
  301. package/src/store/models/login.ts +90 -0
  302. package/src/store/models/manifest.ts +91 -0
  303. package/src/store/models/packages.ts +36 -0
  304. package/src/store/models/search.ts +81 -0
  305. package/src/store/store.ts +15 -0
  306. package/src/template/favicon.ico +0 -0
  307. package/src/template/index.html +21 -0
  308. package/src/utils/.eslintrc +5 -0
  309. package/src/utils/cli-utils.test.ts +66 -0
  310. package/src/utils/cli-utils.ts +38 -0
  311. package/src/utils/colors.ts +1 -0
  312. package/src/utils/constants.ts +5 -0
  313. package/src/utils/file-size.ts +13 -0
  314. package/src/utils/i18nForTests.ts +25 -0
  315. package/src/utils/login.test.ts +71 -0
  316. package/src/utils/login.ts +44 -0
  317. package/src/utils/package.test.ts +101 -0
  318. package/src/utils/package.ts +105 -0
  319. package/src/utils/sec-utils.ts +15 -0
  320. package/src/utils/storage.ts +12 -0
  321. package/src/utils/test-react-testing-library.tsx +38 -0
  322. package/src/utils/url.test.ts +28 -0
  323. package/src/utils/url.ts +58 -0
  324. package/src/utils/windows.ts +3 -0
  325. package/static/favicon.ico +0 -0
  326. package/static/index.html +21 -0
  327. package/static/main.c57129036f278d0c7acf.js +2 -0
  328. package/static/main.c57129036f278d0c7acf.js.LICENSE.txt +1456 -0
  329. package/static/manifest.json +5 -17
  330. package/static/runtime.c57129036f278d0c7acf.js +2 -0
  331. package/static/{runtime.f6e570dfe38870a45bf5.js.LICENSE.txt → runtime.c57129036f278d0c7acf.js.LICENSE.txt} +2 -2
  332. package/static/vendors.c57129036f278d0c7acf.js +2 -0
  333. package/static/vendors.c57129036f278d0c7acf.js.LICENSE.txt +2932 -0
  334. package/tools/.eslintrc +14 -0
  335. package/tools/_verdaccio.config.yaml +59 -0
  336. package/tools/dev.server.js +48 -0
  337. package/tools/getPackageJson.js +25 -0
  338. package/tools/verdaccio.js +31 -0
  339. package/tools/webpack.config.js +82 -0
  340. package/tools/webpack.dev.config.babel.js +60 -0
  341. package/tools/webpack.prod.config.babel.js +81 -0
  342. package/tsconfig.build.json +24 -0
  343. package/tsconfig.json +27 -0
  344. package/types/custom.d.ts +9 -0
  345. package/types/files.d.ts +9 -0
  346. package/types/index.ts +12 -0
  347. package/types/jest-dom.d.ts +1 -0
  348. package/types/packageMeta.ts +82 -0
  349. package/static/238.f6e570dfe38870a45bf5.js +0 -2
  350. package/static/238.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
  351. package/static/718.f6e570dfe38870a45bf5.js +0 -2
  352. package/static/718.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
  353. package/static/73.f6e570dfe38870a45bf5.js +0 -2
  354. package/static/73.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
  355. package/static/Dependencies.f6e570dfe38870a45bf5.js +0 -2
  356. package/static/Dependencies.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
  357. package/static/Dist.f6e570dfe38870a45bf5.js +0 -2
  358. package/static/Dist.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
  359. package/static/Engines.f6e570dfe38870a45bf5.js +0 -2
  360. package/static/Engines.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
  361. package/static/Home.f6e570dfe38870a45bf5.js +0 -2
  362. package/static/Home.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
  363. package/static/Install.f6e570dfe38870a45bf5.js +0 -2
  364. package/static/Install.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
  365. package/static/NotFound.f6e570dfe38870a45bf5.js +0 -2
  366. package/static/NotFound.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
  367. package/static/Provider.f6e570dfe38870a45bf5.js +0 -2
  368. package/static/Provider.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
  369. package/static/Repository.f6e570dfe38870a45bf5.js +0 -2
  370. package/static/Repository.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
  371. package/static/UpLinks.f6e570dfe38870a45bf5.js +0 -2
  372. package/static/UpLinks.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
  373. package/static/Version.f6e570dfe38870a45bf5.js +0 -2
  374. package/static/Version.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
  375. package/static/Versions.f6e570dfe38870a45bf5.js +0 -2
  376. package/static/Versions.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
  377. package/static/main.f6e570dfe38870a45bf5.js +0 -2
  378. package/static/main.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
  379. package/static/runtime.f6e570dfe38870a45bf5.js +0 -2
  380. package/static/vendors.f6e570dfe38870a45bf5.js +0 -2
  381. package/static/vendors.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -98
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2018 Verdaccio community
3
+ Copyright (c) 2021 Verdaccio contributors
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,11 +1,9 @@
1
-
2
1
  ![verdaccio gif](https://user-images.githubusercontent.com/558752/52916111-fa4ba980-32db-11e9-8a64-f4e06eb920b3.png)
3
2
 
4
- # Version 4 UI Theme
3
+ # @verdaccio/ui-theme
5
4
 
6
5
  [Verdaccio](https://verdaccio.org/) UI is a [theme plugin](https://verdaccio.org/docs/en/dev-plugins#theme-plugin) build in React, Typescript and Emotion. It uses Jest and Testing Library for Unit testing.
7
6
 
8
-
9
7
  [![verdaccio (latest)](https://img.shields.io/npm/v/@verdaccio/ui-theme/latest.svg)](https://www.npmjs.com/package/@verdaccio/ui-theme)
10
8
  [![docker pulls](https://img.shields.io/docker/pulls/verdaccio/verdaccio.svg?maxAge=43200)](https://verdaccio.org/docs/en/docker.html)
11
9
  [![backers](https://opencollective.com/verdaccio/tiers/backer/badge.svg?label=Backer&color=brightgreen)](https://opencollective.com/verdaccio)
@@ -16,57 +14,9 @@
16
14
  [![Crowdin](https://d322cqt584bo4o.cloudfront.net/verdaccio/localized.svg)](https://crowdin.com/project/verdaccio)
17
15
  [![codecov](https://codecov.io/gh/verdaccio/ui/branch/master/graph/badge.svg)](https://codecov.io/gh/verdaccio/ui)
18
16
 
19
-
20
17
  [![Twitter followers](https://img.shields.io/twitter/follow/verdaccio_npm.svg?style=social&label=Follow)](https://twitter.com/verdaccio_npm)
21
18
  [![Github](https://img.shields.io/github/stars/verdaccio/verdaccio.svg?style=social&label=Stars)](https://github.com/verdaccio/verdaccio/stargazers)
22
19
 
23
- ## Contributing
24
-
25
- > If you are willing to ship an improvement for Verdaccio 5.x, here is the repo where you must contribute, but remember, if you are willing your feature persist in next major releases, you also need to PR [here](https://github.com/verdaccio/verdaccio/tree/master/packages/plugins/ui-theme) since this repo is intended to be archived after Verdaccio 5 is being deprecated in the future.
26
-
27
- We use `>=yarn`, keep in mind that we use lockfiles and use at least Node `v14` to be able to build the project.
28
-
29
- Install dependencies
30
-
31
- ```
32
- yarn
33
- ```
34
-
35
- For development run the following command, it will execute `webpack` and `verdaccio` to
36
-
37
- ```bash
38
- yarn dev
39
- ```
40
- The configuration file is located on `tools/_config.yaml`.
41
-
42
- Run linting tooling and test to check your code is clean before commit.
43
-
44
- > ⚠️ The development mode just emulate interaction of the UI development with a real verdaccio server, but it is not the real integration. UI is just a theme plugin dependency in the [Verdaccio project](https://github.com/verdaccio/verdaccio).
45
-
46
- ### Before commit
47
-
48
- Don't forget run the following commands before commit and push your code, it will save you time.
49
-
50
- ```bash
51
- yarn lint && yarn test
52
- ```
53
-
54
- #### Commits
55
-
56
- Remember we follow the [the Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0-beta.4/).
57
-
58
- 🤓 Feel free to participate in code reviews, let us know if you want to participate in this plugin.
59
-
60
- ### End to End Testing
61
-
62
- Additionally, we recommend run E2E testing before push and verify your changes do not break anything. These command will run in our CI anyway.
63
-
64
- ```bash
65
- yarn build && yarn test:e2e
66
- ```
67
-
68
- > `yarn build` will build with webpack the production files.
69
-
70
20
  ## Special Thanks
71
21
 
72
22
  Thanks to the following companies to help us to achieve our goals providing free open source licenses.
@@ -106,64 +56,41 @@ This project exists thanks to all the people who contribute.
106
56
 
107
57
  If you have any issue you can try the following options, do no desist to ask or check our issues database, perhaps someone has asked already what you are looking for.
108
58
 
109
- * [Blog](https://medium.com/verdaccio)
110
- * [Donations](https://opencollective.com/verdaccio)
111
- * [Roadmaps](https://github.com/verdaccio/ui/projects)
112
- * [Reporting an issue](https://github.com/verdaccio/verdaccio/blob/master/CONTRIBUTING.md#reporting-a-bug)
113
- * [Running discussions](https://github.com/verdaccio/verdaccio/issues?q=is%3Aissue+is%3Aopen+label%3Adiscuss)
114
- * [Chat](http://chat.verdaccio.org/)
115
- * [Logos](https://verdaccio.org/docs/en/logo)
116
- * [FAQ](https://github.com/verdaccio/verdaccio/issues?utf8=%E2%9C%93&q=is%3Aissue%20label%3Aquestion%20)
117
- * [Docker Examples](https://github.com/verdaccio/docker-examples)
59
+ - [Blog](https://medium.com/verdaccio)
60
+ - [Donations](https://opencollective.com/verdaccio)
61
+ - [Roadmaps](https://github.com/verdaccio/ui/projects)
62
+ - [Reporting an issue](https://github.com/verdaccio/verdaccio/blob/master/CONTRIBUTING.md#reporting-a-bug)
63
+ - [Running discussions](https://github.com/verdaccio/verdaccio/issues?q=is%3Aissue+is%3Aopen+label%3Adiscuss)
64
+ - [Chat](http://chat.verdaccio.org/)
65
+ - [Logos](https://verdaccio.org/docs/en/logo)
66
+ - [FAQ](https://github.com/verdaccio/verdaccio/issues?utf8=%E2%9C%93&q=is%3Aissue%20label%3Aquestion%20)
67
+ - [Docker Examples](https://github.com/verdaccio/docker-examples)
118
68
 
119
69
  ### Translations
120
70
 
121
- Translations are handled locally. I18n files can be found in the folder ```i18n/translations/*``` of this repository. We would love to provide translations from other languages, embracing all our users, but unfortunately we cannot do this without your help. Would you like to help us? Please feel **super welcome** to add a locale by opening a pull request.
71
+ Translations are handled locally. I18n files can be found in the folder `i18n/translations/*` of this repository. We would love to provide translations from other languages, embracing all our users, but unfortunately we cannot do this without your help. Would you like to help us? Please feel **super welcome** to add a locale by opening a pull request.
122
72
 
123
73
  Your PR should contain:
124
74
 
125
- 1 - A json file in the folder ```i18n/translations/*``` with the translations. The file must be named according to the new added language
75
+ 1 - A json file in the folder `i18n/translations/*` with the translations. The file must be named according to the new added language
126
76
 
127
- 2 - The files ```i18n/config.ts``` and ```LanguageSwitch.tsx``` updated with the new language. Please see the current structure
77
+ 2 - The files `i18n/config.ts` and `LanguageSwitch.tsx` updated with the new language. Please see the current structure
128
78
 
129
79
  3 - The other translations containing the new language in the language of the file. Example:
130
80
 
131
- New language: ```cs_CZ ```
132
-
133
- The file ```pt-BR ``` should contain:
134
- ```
135
- "lng": {
136
- ...,
137
- "czech": "Tcheco"
138
- }
139
- ```
81
+ New language: `cs_CZ `
140
82
 
141
- 4 - A SVG flag of the new translated language in the the folder ```src/components/Icon/img/*```. You maybe want to compress the svg file using https://jakearchibald.github.io/svgomg/
83
+ The file `pt-BR ` should contain:
142
84
 
85
+ ```
86
+ "lng": {
87
+ ...,
88
+ "czech": "Tcheco"
89
+ }
90
+ ```
143
91
 
92
+ 4 - A SVG flag of the new translated language in the the folder `src/components/Icon/img/*`. You maybe want to compress the svg file using https://jakearchibald.github.io/svgomg/
144
93
 
145
94
  ### License
146
95
 
147
96
  Verdaccio is [MIT licensed](https://github.com/verdaccio/verdaccio/blob/master/LICENSE)
148
-
149
-
150
- ### Contributors
151
-
152
- <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
153
- <!-- prettier-ignore-start -->
154
- <!-- markdownlint-disable -->
155
- <table>
156
- <tr>
157
- <td align="center"><a href="https://www.linkedin.com/in/jotadeveloper/"><img src="https://avatars0.githubusercontent.com/u/558752?v=4" width="100px;" alt=""/><br /><sub><b>Juan Picado</b></sub></a><br /><a href="https://github.com/verdaccio/ui/commits?author=juanpicado" title="Documentation">📖</a> <a href="https://github.com/verdaccio/ui/commits?author=juanpicado" title="Code">💻</a> <a href="#infra-juanpicado" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#eventOrganizing-juanpicado" title="Event Organizing">📋</a> <a href="#blog-juanpicado" title="Blogposts">📝</a> <a href="#maintenance-juanpicado" title="Maintenance">🚧</a></td>
158
- <td align="center"><a href="https://github.com/sergiohgz"><img src="https://avatars3.githubusercontent.com/u/14012309?v=4" width="100px;" alt=""/><br /><sub><b>Sergio Herrera</b></sub></a><br /><a href="#infra-sergiohgz" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#maintenance-sergiohgz" title="Maintenance">🚧</a></td>
159
- <td align="center"><a href="https://daniel-ruf.de/"><img src="https://avatars1.githubusercontent.com/u/827205?v=4" width="100px;" alt=""/><br /><sub><b>Daniel Ruf</b></sub></a><br /><a href="#security-DanielRuf" title="Security">🛡️</a> <a href="#infra-DanielRuf" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#maintenance-DanielRuf" title="Maintenance">🚧</a></td>
160
- <td align="center"><a href="https://priscilawebdev.github.io/priscilaoliveira/"><img src="https://avatars1.githubusercontent.com/u/29228205?v=4" width="100px;" alt=""/><br /><sub><b>Priscila Oliveira</b></sub></a><br /><a href="#design-priscilawebdev" title="Design">🎨</a> <a href="https://github.com/verdaccio/ui/commits?author=priscilawebdev" title="Code">💻</a> <a href="#maintenance-priscilawebdev" title="Maintenance">🚧</a></td>
161
- <td align="center"><a href="https://github.com/VentyCZ"><img src="https://avatars1.githubusercontent.com/u/3247664?v=4" width="100px;" alt=""/><br /><sub><b>Jiří Michel</b></sub></a><br /><a href="https://github.com/verdaccio/ui/commits?author=VentyCZ" title="Code">💻</a> <a href="#maintenance-VentyCZ" title="Maintenance">🚧</a></td>
162
- <td align="center"><a href="https://github.com/tso1158687"><img src="https://avatars2.githubusercontent.com/u/9198263?v=4" width="100px;" alt=""/><br /><sub><b>jason</b></sub></a><br /><a href="#translation-tso1158687" title="Translation">🌍</a> <a href="https://github.com/verdaccio/ui/commits?author=tso1158687" title="Code">💻</a></td>
163
- <td align="center"><a href="http://ayusharma.github.io"><img src="https://avatars0.githubusercontent.com/u/6918450?v=4" width="100px;" alt=""/><br /><sub><b>Ayush Sharma</b></sub></a><br /><a href="#maintenance-ayusharma" title="Maintenance">🚧</a> <a href="https://github.com/verdaccio/ui/commits?author=ayusharma" title="Code">💻</a></td>
164
- </tr>
165
- </table>
166
-
167
- <!-- markdownlint-enable -->
168
- <!-- prettier-ignore-end -->
169
- <!-- ALL-CONTRIBUTORS-LIST:END -->
package/config/env.js ADDED
@@ -0,0 +1,9 @@
1
+ const path = require('path');
2
+
3
+ const APP_ROOT = path.resolve(__dirname, '../');
4
+
5
+ module.exports = {
6
+ APP_ROOT,
7
+ SRC_ROOT: path.resolve(APP_ROOT, 'src/'),
8
+ DIST_PATH: path.resolve(APP_ROOT, 'static/'),
9
+ };
@@ -0,0 +1,42 @@
1
+ [
2
+ {
3
+ "name": "test",
4
+ "version": "1.0.22",
5
+ "description": "test",
6
+ "main": "src/index.js",
7
+ "scripts": {
8
+ "test": "echo \"Error: no test specified\" && exit 1"
9
+ },
10
+ "repository": {
11
+ "type": "http",
12
+ "url": "git+https://github.com/test/test.git"
13
+ },
14
+ "keywords": [],
15
+ "author": {
16
+ "name": "",
17
+ "email": "",
18
+ "url": "",
19
+ "avatar": "data:image/svg+xml;utf8,%3Csvg%20height%3D%22100%22%20viewBox%3D%22-27%2024%20100%20100%22%20width%3D%22100%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%3E%3Cdefs%3E%3Ccircle%20cx%3D%2223%22%20cy%3D%2274%22%20id%3D%22a%22%20r%3D%2250%22%2F%3E%3C%2Fdefs%3E%3Cuse%20fill%3D%22%23F5EEE5%22%20overflow%3D%22visible%22%20xlink%3Ahref%3D%22%23a%22%2F%3E%3CclipPath%20id%3D%22b%22%3E%3Cuse%20overflow%3D%22visible%22%20xlink%3Ahref%3D%22%23a%22%2F%3E%3C%2FclipPath%3E%3Cg%20clip-path%3D%22url(%23b)%22%3E%3Cdefs%3E%3Cpath%20d%3D%22M36%2095.9c0%204%204.7%205.2%207.1%205.8%207.6%202%2022.8%205.9%2022.8%205.9%203.2%201.1%205.7%203.5%207.1%206.6v9.8H-27v-9.8c1.3-3.1%203.9-5.5%207.1-6.6%200%200%2015.2-3.9%2022.8-5.9%202.4-.6%207.1-1.8%207.1-5.8V85h26v10.9z%22%20id%3D%22c%22%2F%3E%3C%2Fdefs%3E%3Cuse%20fill%3D%22%23E6C19C%22%20overflow%3D%22visible%22%20xlink%3Ahref%3D%22%23c%22%2F%3E%3CclipPath%20id%3D%22d%22%3E%3Cuse%20overflow%3D%22visible%22%20xlink%3Ahref%3D%22%23c%22%2F%3E%3C%2FclipPath%3E%3Cpath%20clip-path%3D%22url(%23d)%22%20d%3D%22M23.2%2035h.2c3.3%200%208.2.2%2011.4%202%203.3%201.9%207.3%205.6%208.5%2012.1%202.4%2013.7-2.1%2035.4-6.3%2042.4-4%206.7-9.8%209.2-13.5%209.4H23h-.1c-3.7-.2-9.5-2.7-13.5-9.4-4.2-7-8.7-28.7-6.3-42.4%201.2-6.5%205.2-10.2%208.5-12.1%203.2-1.8%208.1-2%2011.4-2h.2z%22%20fill%3D%22%23D4B08C%22%2F%3E%3C%2Fg%3E%3Cpath%20d%3D%22M22.6%2040c19.1%200%2020.7%2013.8%2020.8%2015.1%201.1%2011.9-3%2028.1-6.8%2033.7-4%205.9-9.8%208.1-13.5%208.3h-.5c-3.8-.3-9.6-2.5-13.6-8.4-3.8-5.6-7.9-21.8-6.8-33.8C2.3%2053.7%203.5%2040%2022.6%2040z%22%20fill%3D%22%23F2CEA5%22%2F%3E%3C%2Fsvg%3E"
20
+ },
21
+ "license": "ISC",
22
+ "dependencies": {
23
+ "lodash": "^4.17.21"
24
+ },
25
+ "readmeFilename": "README.md",
26
+ "bugs": {
27
+ "url": "https://github.com/test/test/issues"
28
+ },
29
+ "homepage": "https://github.com/test/test#readme",
30
+ "_id": "test@1.0.22",
31
+ "_nodeVersion": "14.17.4",
32
+ "_npmVersion": "7.20.5",
33
+ "dist": {
34
+ "integrity": "sha512-2IDD0lLzGUL7YJ+17Oh9VtbOwdKLqBLS+ZFATDXi5R22TL2hZ9LBFE10bzsDovNc4xtgwZAk1/K+5LHTye4ztg==",
35
+ "shasum": "c9152f57636bce762ccb5a83113c42a5831579bc",
36
+ "tarball": "http://localhost:4873/test/-/test-1.0.22.tgz"
37
+ },
38
+ "contributors": [],
39
+ "time": "2021-08-14T20:15:19.336Z",
40
+ "users": {}
41
+ }
42
+ ]
@@ -0,0 +1,29 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-vars */
2
+ let Reflect;
3
+ let idObj;
4
+
5
+ function checkIsNodeV6OrAbove() {
6
+ if (typeof process === 'undefined') {
7
+ return false;
8
+ }
9
+
10
+ return parseInt(process.versions.node.split('.')[0], 10) >= 6;
11
+ }
12
+
13
+ if (!checkIsNodeV6OrAbove()) {
14
+ Reflect = require('harmony-reflect');
15
+ }
16
+
17
+ idObj = new Proxy(
18
+ {},
19
+ {
20
+ get: function getter(target, key) {
21
+ if (key === '__esModule') {
22
+ return false;
23
+ }
24
+ return key;
25
+ },
26
+ }
27
+ );
28
+
29
+ module.exports = idObj;
@@ -0,0 +1,39 @@
1
+ const config = require('../../../../jest/config');
2
+
3
+ module.exports = Object.assign({}, config, {
4
+ name: 'verdaccio-ui-jest',
5
+ verbose: true,
6
+ automock: false,
7
+ collectCoverage: true,
8
+ testEnvironment: 'jest-environment-jsdom-global',
9
+ transform: {
10
+ '^.+\\.(js|ts|tsx)$': 'babel-jest',
11
+ },
12
+ moduleFileExtensions: ['js', 'ts', 'tsx'],
13
+ testURL: 'http://localhost:9000/',
14
+ rootDir: '..',
15
+ setupFilesAfterEnv: ['@testing-library/jest-dom/extend-expect', '<rootDir>/jest/setup-env.ts'],
16
+ setupFiles: ['<rootDir>/jest/setup.ts'],
17
+ transformIgnorePatterns: ['<rootDir>/node_modules/(?!react-syntax-highlighter)'],
18
+ modulePathIgnorePatterns: [
19
+ '<rootDir>/coverage',
20
+ '<rootDir>/scripts',
21
+ '<rootDir>/.circleci',
22
+ '<rootDir>/tools',
23
+ '<rootDir>/build',
24
+ '<rootDir>/.vscode/',
25
+ '<rootDir>/test/e2e/',
26
+ ],
27
+ snapshotSerializers: ['@emotion/jest/serializer'],
28
+ moduleNameMapper: {
29
+ '\\.(s?css)$': '<rootDir>/jest/identity.js',
30
+ '\\.(png)$': '<rootDir>/jest/identity.js',
31
+ '\\.(svg)$': '<rootDir>/jest/unit/empty.ts',
32
+ 'github-markdown-css': '<rootDir>/jest/identity.js',
33
+ // note: this section has to be on sync with webpack configuration
34
+ 'verdaccio-ui/components/(.*)': '<rootDir>/src/components/$1',
35
+ 'verdaccio-ui/utils/(.*)': '<rootDir>/src/utils/$1',
36
+ 'verdaccio-ui/providers/(.*)': '<rootDir>/src/providers/$1',
37
+ 'verdaccio-ui/design-tokens/(.*)': '<rootDir>/src/design-tokens/$1',
38
+ },
39
+ });
@@ -0,0 +1 @@
1
+ jest.requireActual('babel/polyfill');
@@ -0,0 +1,9 @@
1
+ import { rest } from 'msw';
2
+
3
+ const packagesPayload = require('./api/packages.json');
4
+
5
+ export const handlers = [
6
+ rest.get('http://localhost:9000/-/verdaccio/packages', (req, res, ctx) => {
7
+ return res(ctx.json(packagesPayload));
8
+ }),
9
+ ];
package/jest/server.ts ADDED
@@ -0,0 +1,6 @@
1
+ import { setupServer } from 'msw/node';
2
+
3
+ import { handlers } from './server-handlers';
4
+
5
+ const server = setupServer(...handlers);
6
+ export { server };
@@ -0,0 +1,15 @@
1
+ import '@testing-library/jest-dom/extend-expect';
2
+ import 'whatwg-fetch';
3
+ import '@testing-library/jest-dom';
4
+
5
+ import { server } from './server';
6
+
7
+ beforeAll(() => {
8
+ server.listen({
9
+ onUnhandledRequest: 'warn',
10
+ });
11
+ });
12
+ afterEach(() => server.resetHandlers());
13
+ afterAll(() => {
14
+ server.close();
15
+ });
package/jest/setup.ts ADDED
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Setup configuration for Jest
3
+ * This file includes global settings for the JEST environment.
4
+ */
5
+ import 'mutationobserver-shim';
6
+
7
+ // @ts-ignore : Property '__VERDACCIO_BASENAME_UI_OPTIONS' does not exist on type 'Global'.
8
+ global.__VERDACCIO_BASENAME_UI_OPTIONS = {
9
+ base: 'http://localhost:9000/',
10
+ protocol: 'http',
11
+ host: 'localhost',
12
+ primaryColor: '#4b5e40',
13
+ url_prefix: '',
14
+ darkMode: false,
15
+ language: 'en-US',
16
+ uri: 'http://localhost:9000/',
17
+ pkgManagers: ['pnpm', 'yarn', 'npm'],
18
+ title: 'Verdaccio Dev UI',
19
+ scope: '',
20
+ version: 'v1.0.0',
21
+ };
22
+
23
+ // mocking few DOM methods
24
+ // @ts-ignore : Property 'document' does not exist on type 'Global'.
25
+ if (global.document) {
26
+ // @ts-ignore : Type 'Mock<{ selectNodeContents: () => void; }, []>' is not assignable to type '() => Range'.
27
+ document.createRange = jest.fn((): void => ({
28
+ selectNodeContents: (): void => {},
29
+ }));
30
+ document.execCommand = jest.fn();
31
+ }
@@ -0,0 +1,47 @@
1
+ /**
2
+ * API Mocks for WebUI
3
+ */
4
+ import login from '../store/login';
5
+ import logo from '../store/logo';
6
+ import { packageInformation } from '../store/package';
7
+ import { packageMeta } from '../store/packageMeta';
8
+
9
+ /**
10
+ * Register mock api endpoints
11
+ * @param {string} endpoint
12
+ * @returns {Promise}
13
+ */
14
+ const register = (url, method = 'get', options = {}) => {
15
+ if (url === 'login' && method.toLocaleLowerCase() === 'post') {
16
+ return login(options);
17
+ }
18
+
19
+ if (url === 'logo' && method.toLocaleLowerCase() === 'get') {
20
+ return logo();
21
+ }
22
+
23
+ if (url === 'sidebar/verdaccio' && method.toLocaleLowerCase() === 'get') {
24
+ return new Promise(function (resolve) {
25
+ resolve(packageMeta);
26
+ });
27
+ }
28
+
29
+ if (url === 'packages' && method.toLocaleLowerCase() === 'get') {
30
+ return new Promise(function (resolve) {
31
+ resolve(packageInformation);
32
+ });
33
+ }
34
+
35
+ throw Error(`URL not found: ${url}`);
36
+ };
37
+
38
+ /**
39
+ * Bind API methods
40
+ */
41
+ class API {
42
+ public request(...rest) {
43
+ return register.call(null, ...rest);
44
+ }
45
+ }
46
+
47
+ export default new API();
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Token Utility
3
+ */
4
+
5
+ import dayjs from 'dayjs';
6
+ import { Base64 } from 'js-base64';
7
+
8
+ export function generateTokenWithTimeRange(amount = 0) {
9
+ const payload = {
10
+ username: 'verdaccio',
11
+ exp: Number.parseInt(String(dayjs(new Date()).add(amount, 'hour').valueOf() / 1000), 10),
12
+ };
13
+ return `xxxxxx.${Base64.encode(JSON.stringify(payload))}.xxxxxx`;
14
+ }
15
+
16
+ export function generateTokenWithExpirationAsString() {
17
+ const payload = { username: 'verdaccio', exp: 'I am not a number' };
18
+ return `xxxxxx.${Base64.encode(JSON.stringify(payload))}.xxxxxx`;
19
+ }
20
+
21
+ export function generateInvalidToken() {
22
+ const payload = `invalidtoken`;
23
+ return `xxxxxx.${Base64.encode(payload)}.xxxxxx`;
24
+ }
25
+
26
+ export function generateTokenWithOutExpiration() {
27
+ const payload = {
28
+ username: 'verdaccio',
29
+ };
30
+ return `xxxxxx.${Base64.encode(JSON.stringify(payload))}.xxxxxx`;
31
+ }
@@ -0,0 +1,23 @@
1
+ import { API_ERROR } from '../../../../lib/constants';
2
+ /**
3
+ * API mock for login endpoint
4
+ * @param {object} config configuration of api call
5
+ * @returns {promise}
6
+ */
7
+ export default function login(config): Promise<unknown> {
8
+ return new Promise(function loginCallbackPromise(resolve, reject): void {
9
+ const body = JSON.parse(config.body);
10
+ if (body.username === 'sam' && body.password === '1234') {
11
+ resolve({
12
+ username: 'sam',
13
+ token: 'TEST_TOKEN',
14
+ });
15
+ } else {
16
+ // perhaps we should rethink this reject regarding the eslint rule
17
+ /* eslint-disable prefer-promise-reject-errors */
18
+ reject({
19
+ error: API_ERROR.BAD_USERNAME_PASSWORD,
20
+ });
21
+ }
22
+ });
23
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Mock response for logo api
3
+ * @returns {promise}
4
+ */
5
+ export default function <T>(): Promise<T> {
6
+ return Promise.resolve('http://localhost/-/static/logo.png');
7
+ }
@@ -0,0 +1,174 @@
1
+ export const packageInformation = [
2
+ {
3
+ name: 'jquery',
4
+ title: 'jQuery',
5
+ description: 'JavaScript library for DOM operations',
6
+ version: '3.3.2-pre',
7
+ main: 'dist/jquery.js',
8
+ homepage: 'https://jquery.com',
9
+ author: {
10
+ name: 'JS Foundation and other contributors',
11
+ url: 'https://github.com/jquery/jquery/blob/master/AUTHORS.txt',
12
+ avatar: '',
13
+ },
14
+ repository: {
15
+ type: 'git',
16
+ url: 'https://github.com/jquery/jquery.git',
17
+ },
18
+ keywords: ['jquery', 'javascript', 'browser', 'library'],
19
+ bugs: {
20
+ url: 'https://github.com/jquery/jquery/issues',
21
+ },
22
+ license: 'MIT',
23
+ dependencies: {},
24
+ devDependencies: {
25
+ 'babel-core': '7.0.0-beta.0',
26
+ 'babel-plugin-transform-es2015-for-of': '7.0.0-beta.0',
27
+ commitplease: '3.2.0',
28
+ 'core-js': '2.5.7',
29
+ 'eslint-config-jquery': '1.0.1',
30
+ grunt: '1.0.3',
31
+ 'grunt-babel': '7.0.0',
32
+ 'grunt-cli': '1.2.0',
33
+ 'grunt-compare-size': '0.4.2',
34
+ 'grunt-contrib-uglify': '3.3.0',
35
+ 'grunt-contrib-watch': '1.1.0',
36
+ 'grunt-eslint': '20.2.0',
37
+ 'grunt-git-authors': '3.2.0',
38
+ 'grunt-jsonlint': '1.1.0',
39
+ 'grunt-karma': '2.0.0',
40
+ 'grunt-newer': '1.3.0',
41
+ 'grunt-npmcopy': '0.1.0',
42
+ 'gzip-js': '0.3.2',
43
+ husky: '0.14.3',
44
+ insight: '0.10.1',
45
+ jsdom: '5.6.1',
46
+ karma: '2.0.3',
47
+ 'karma-browserstack-launcher': '1.3.0',
48
+ 'karma-chrome-launcher': '2.2.0',
49
+ 'karma-firefox-launcher': '1.1.0',
50
+ 'karma-qunit': '1.2.1',
51
+ 'load-grunt-tasks': '4.0.0',
52
+ 'native-promise-only': '0.8.1',
53
+ 'promises-aplus-tests': '2.1.2',
54
+ q: '1.5.1',
55
+ 'qunit-assert-step': '1.1.1',
56
+ qunitjs: '1.23.1',
57
+ 'raw-body': '2.3.3',
58
+ requirejs: '2.3.5',
59
+ sinon: '2.3.7',
60
+ sizzle: '2.3.3',
61
+ 'strip-json-comments': '2.0.1',
62
+ testswarm: '1.1.0',
63
+ 'uglify-js': '3.4.0',
64
+ },
65
+ scripts: {
66
+ build: 'npm install && grunt',
67
+ start: 'grunt watch',
68
+ 'test:browserless': 'grunt && grunt test:slow',
69
+ 'test:browser': 'grunt && grunt karma:main',
70
+ test: 'grunt && grunt test:slow && grunt karma:main',
71
+ jenkins: 'npm run test:browserless',
72
+ precommit: 'grunt lint:newer qunit_fixture',
73
+ commitmsg: 'node node_modules/commitplease',
74
+ },
75
+ commitplease: {
76
+ nohook: true,
77
+ components: [
78
+ 'Docs',
79
+ 'Tests',
80
+ 'Build',
81
+ 'Support',
82
+ 'Release',
83
+ 'Core',
84
+ 'Ajax',
85
+ 'Attributes',
86
+ 'Callbacks',
87
+ 'CSS',
88
+ 'Data',
89
+ 'Deferred',
90
+ 'Deprecated',
91
+ 'Dimensions',
92
+ 'Effects',
93
+ 'Event',
94
+ 'Manipulation',
95
+ 'Offset',
96
+ 'Queue',
97
+ 'Selector',
98
+ 'Serialize',
99
+ 'Traversing',
100
+ 'Wrap',
101
+ ],
102
+ markerPattern: '^((clos|fix|resolv)(e[sd]|ing))|^(refs?)',
103
+ ticketPattern: '^((Closes|Fixes) ([a-zA-Z]{2,}-)[0-9]+)|^(Refs? [^#])',
104
+ },
105
+ },
106
+ {
107
+ name: 'lodash',
108
+ version: '4.17.4',
109
+ license: 'MIT',
110
+ private: true,
111
+ main: 'lodash.js',
112
+ author: {
113
+ name: 'John david dalton',
114
+ url: 'test url',
115
+ avatar: 'test avatar',
116
+ },
117
+ engines: {
118
+ node: '>=4.0.0',
119
+ },
120
+ sideEffects: false,
121
+ scripts: {
122
+ build: 'npm run build:main && npm run build:fp',
123
+ 'build:fp': 'node lib/fp/build-dist.js',
124
+ 'build:fp-modules': 'node lib/fp/build-modules.js',
125
+ 'build:main': 'node lib/main/build-dist.js',
126
+ 'build:main-modules': 'node lib/main/build-modules.js',
127
+ doc: 'node lib/main/build-doc github && npm run test:doc',
128
+ 'doc:fp': 'node lib/fp/build-doc',
129
+ 'doc:site': 'node lib/main/build-doc site',
130
+ 'doc:sitehtml':
131
+ 'optional-dev-dependency marky-markdown@^9.0.1 && npm run doc:site && node lib/main/build-site',
132
+ pretest: 'npm run build',
133
+ style: 'eslint *.js .internal/**/*.js',
134
+ test: 'npm run test:main && npm run test:fp',
135
+ 'test:doc': 'markdown-doctest doc/*.md',
136
+ 'test:fp': 'node test/test-fp',
137
+ 'test:main': 'node test/test',
138
+ validate: 'npm run style && npm run test',
139
+ },
140
+ devDependencies: {
141
+ async: '^2.1.4',
142
+ benchmark: '^2.1.3',
143
+ chalk: '^1.1.3',
144
+ cheerio: '^0.22.0',
145
+ 'codecov.io': '~0.1.6',
146
+ coveralls: '^2.11.15',
147
+ 'curl-amd': '~0.8.12',
148
+ docdown: '~0.7.2',
149
+ dojo: '^1.12.1',
150
+ ecstatic: '^2.1.0',
151
+ eslint: '^3.15.0',
152
+ 'eslint-plugin-import': '^2.2.0',
153
+ 'fs-extra': '~1.0.0',
154
+ glob: '^7.1.1',
155
+ istanbul: '0.4.5',
156
+ jquery: '^3.1.1',
157
+ lodash: '4.17.3',
158
+ 'lodash-doc-globals': '^0.1.1',
159
+ 'markdown-doctest': '^0.9.1',
160
+ 'optional-dev-dependency': '^2.0.0',
161
+ platform: '^1.3.3',
162
+ 'qunit-extras': '^3.0.0',
163
+ qunitjs: '^2.1.0',
164
+ request: '^2.79.0',
165
+ requirejs: '^2.3.2',
166
+ 'sauce-tunnel': '^2.5.0',
167
+ 'uglify-js': '2.7.5',
168
+ webpack: '^1.14.0',
169
+ },
170
+ greenkeeper: {
171
+ ignore: ['lodash'],
172
+ },
173
+ },
174
+ ];