diff --git a/.pnp.cjs b/.pnp.cjs index e07c013cd..196b3de6f 100755 --- a/.pnp.cjs +++ b/.pnp.cjs @@ -78,10 +78,9 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["@verdaccio-scope/verdaccio-auth-foo", "npm:0.0.2"],\ ["@verdaccio/commons-api", "npm:10.2.0"],\ ["@verdaccio/local-storage", "npm:10.3.1"],\ - ["@verdaccio/readme", "npm:10.4.2"],\ ["@verdaccio/streams", "npm:10.2.0"],\ ["@verdaccio/types", "npm:10.7.0"],\ - ["@verdaccio/ui-theme", "npm:6.0.0-6-next.50"],\ + ["@verdaccio/ui-theme", "npm:6.0.0-6-next.51"],\ ["JSONStream", "npm:1.3.5"],\ ["all-contributors-cli", "npm:6.20.0"],\ ["async", "npm:3.2.4"],\ @@ -4845,18 +4844,6 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD"\ }]\ ]],\ - ["@verdaccio/readme", [\ - ["npm:10.4.2", {\ - "packageLocation": "./.yarn/cache/@verdaccio-readme-npm-10.4.2-2cca0c072d-73492f1137.zip/node_modules/@verdaccio/readme/",\ - "packageDependencies": [\ - ["@verdaccio/readme", "npm:10.4.2"],\ - ["dompurify", "npm:2.4.0"],\ - ["jsdom", "virtual:2cca0c072d54eb622535386134c131ff0320958b9ce0515b5a1e0aef7ea16a35e036ec0ef2d2625d264420121ebbd88b85bd24e2b5bdc2d4f075f9beaf958114#npm:16.7.0"],\ - ["marked", "npm:4.2.2"]\ - ],\ - "linkType": "HARD"\ - }]\ - ]],\ ["@verdaccio/streams", [\ ["npm:10.2.0", {\ "packageLocation": "./.yarn/cache/@verdaccio-streams-npm-10.2.0-81db112291-2c5fd4953f.zip/node_modules/@verdaccio/streams/",\ @@ -4876,10 +4863,10 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { }]\ ]],\ ["@verdaccio/ui-theme", [\ - ["npm:6.0.0-6-next.50", {\ - "packageLocation": "./.yarn/cache/@verdaccio-ui-theme-npm-6.0.0-6-next.50-635b2acf02-1e7ac1608f.zip/node_modules/@verdaccio/ui-theme/",\ + ["npm:6.0.0-6-next.51", {\ + "packageLocation": "./.yarn/cache/@verdaccio-ui-theme-npm-6.0.0-6-next.51-7dbd590283-b478cb7cd8.zip/node_modules/@verdaccio/ui-theme/",\ "packageDependencies": [\ - ["@verdaccio/ui-theme", "npm:6.0.0-6-next.50"]\ + ["@verdaccio/ui-theme", "npm:6.0.0-6-next.51"]\ ],\ "linkType": "HARD"\ }]\ @@ -7296,15 +7283,6 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD"\ }]\ ]],\ - ["dompurify", [\ - ["npm:2.4.0", {\ - "packageLocation": "./.yarn/cache/dompurify-npm-2.4.0-0ffecf22ef-c93ea73cf8.zip/node_modules/dompurify/",\ - "packageDependencies": [\ - ["dompurify", "npm:2.4.0"]\ - ],\ - "linkType": "HARD"\ - }]\ - ]],\ ["dot-prop", [\ ["npm:5.3.0", {\ "packageLocation": "./.yarn/cache/dot-prop-npm-5.3.0-7bf6ee1eb8-d577579009.zip/node_modules/dot-prop/",\ @@ -10297,7 +10275,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["@types/node", "npm:18.11.9"],\ ["jest-mock", "npm:26.6.2"],\ ["jest-util", "npm:26.6.2"],\ - ["jsdom", "virtual:2cca0c072d54eb622535386134c131ff0320958b9ce0515b5a1e0aef7ea16a35e036ec0ef2d2625d264420121ebbd88b85bd24e2b5bdc2d4f075f9beaf958114#npm:16.7.0"]\ + ["jsdom", "virtual:defa486869c88441047200a53b3aa18d79743b272095f3ee31b5b7b80b2c93d87f722added867470dcb94104504489a1a89040ea8fd89dffb9cfb1864d4bf54e#npm:16.7.0"]\ ],\ "linkType": "HARD"\ }]\ @@ -10706,10 +10684,10 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ],\ "linkType": "SOFT"\ }],\ - ["virtual:2cca0c072d54eb622535386134c131ff0320958b9ce0515b5a1e0aef7ea16a35e036ec0ef2d2625d264420121ebbd88b85bd24e2b5bdc2d4f075f9beaf958114#npm:16.7.0", {\ - "packageLocation": "./.yarn/__virtual__/jsdom-virtual-518970426e/0/cache/jsdom-npm-16.7.0-216c5c4bf9-454b833718.zip/node_modules/jsdom/",\ + ["virtual:defa486869c88441047200a53b3aa18d79743b272095f3ee31b5b7b80b2c93d87f722added867470dcb94104504489a1a89040ea8fd89dffb9cfb1864d4bf54e#npm:16.7.0", {\ + "packageLocation": "./.yarn/__virtual__/jsdom-virtual-d1d747a211/0/cache/jsdom-npm-16.7.0-216c5c4bf9-454b833718.zip/node_modules/jsdom/",\ "packageDependencies": [\ - ["jsdom", "virtual:2cca0c072d54eb622535386134c131ff0320958b9ce0515b5a1e0aef7ea16a35e036ec0ef2d2625d264420121ebbd88b85bd24e2b5bdc2d4f075f9beaf958114#npm:16.7.0"],\ + ["jsdom", "virtual:defa486869c88441047200a53b3aa18d79743b272095f3ee31b5b7b80b2c93d87f722added867470dcb94104504489a1a89040ea8fd89dffb9cfb1864d4bf54e#npm:16.7.0"],\ ["@types/canvas", null],\ ["abab", "npm:2.0.6"],\ ["acorn", "npm:8.8.1"],\ @@ -10737,7 +10715,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["whatwg-encoding", "npm:1.0.5"],\ ["whatwg-mimetype", "npm:2.3.0"],\ ["whatwg-url", "npm:8.7.0"],\ - ["ws", "virtual:518970426e110e331af0e7205d87d1c860793eb156872ced507847acefb38dfa48c3ea74c9df56d29d4234e2bd5eca7283af0febbf0cbaac05abb89f24498f34#npm:7.5.9"],\ + ["ws", "virtual:d1d747a211d62a20e750f460de660a2cab0b8c26eed5e86aa53c81e5d6991bfbf78edfb74d516e5d88a3b849de28b88871ffac8dc80d6c59707fedfeaf750a82#npm:7.5.9"],\ ["xml-name-validator", "npm:3.0.0"]\ ],\ "packagePeers": [\ @@ -15294,10 +15272,9 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["@verdaccio-scope/verdaccio-auth-foo", "npm:0.0.2"],\ ["@verdaccio/commons-api", "npm:10.2.0"],\ ["@verdaccio/local-storage", "npm:10.3.1"],\ - ["@verdaccio/readme", "npm:10.4.2"],\ ["@verdaccio/streams", "npm:10.2.0"],\ ["@verdaccio/types", "npm:10.7.0"],\ - ["@verdaccio/ui-theme", "npm:6.0.0-6-next.50"],\ + ["@verdaccio/ui-theme", "npm:6.0.0-6-next.51"],\ ["JSONStream", "npm:1.3.5"],\ ["all-contributors-cli", "npm:6.20.0"],\ ["async", "npm:3.2.4"],\ @@ -15650,10 +15627,10 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ],\ "linkType": "SOFT"\ }],\ - ["virtual:518970426e110e331af0e7205d87d1c860793eb156872ced507847acefb38dfa48c3ea74c9df56d29d4234e2bd5eca7283af0febbf0cbaac05abb89f24498f34#npm:7.5.9", {\ - "packageLocation": "./.yarn/__virtual__/ws-virtual-9ffc40a239/0/cache/ws-npm-7.5.9-26f12a5ed6-c3c100a181.zip/node_modules/ws/",\ + ["virtual:d1d747a211d62a20e750f460de660a2cab0b8c26eed5e86aa53c81e5d6991bfbf78edfb74d516e5d88a3b849de28b88871ffac8dc80d6c59707fedfeaf750a82#npm:7.5.9", {\ + "packageLocation": "./.yarn/__virtual__/ws-virtual-1d5cf10b03/0/cache/ws-npm-7.5.9-26f12a5ed6-c3c100a181.zip/node_modules/ws/",\ "packageDependencies": [\ - ["ws", "virtual:518970426e110e331af0e7205d87d1c860793eb156872ced507847acefb38dfa48c3ea74c9df56d29d4234e2bd5eca7283af0febbf0cbaac05abb89f24498f34#npm:7.5.9"],\ + ["ws", "virtual:d1d747a211d62a20e750f460de660a2cab0b8c26eed5e86aa53c81e5d6991bfbf78edfb74d516e5d88a3b849de28b88871ffac8dc80d6c59707fedfeaf750a82#npm:7.5.9"],\ ["@types/bufferutil", null],\ ["@types/utf-8-validate", null],\ ["bufferutil", null],\ diff --git a/.yarn/cache/@verdaccio-readme-npm-10.4.2-2cca0c072d-73492f1137.zip b/.yarn/cache/@verdaccio-readme-npm-10.4.2-2cca0c072d-73492f1137.zip deleted file mode 100644 index e4e79e816..000000000 Binary files a/.yarn/cache/@verdaccio-readme-npm-10.4.2-2cca0c072d-73492f1137.zip and /dev/null differ diff --git a/.yarn/cache/@verdaccio-ui-theme-npm-6.0.0-6-next.50-635b2acf02-1e7ac1608f.zip b/.yarn/cache/@verdaccio-ui-theme-npm-6.0.0-6-next.50-635b2acf02-1e7ac1608f.zip deleted file mode 100644 index f3d5dc9d2..000000000 Binary files a/.yarn/cache/@verdaccio-ui-theme-npm-6.0.0-6-next.50-635b2acf02-1e7ac1608f.zip and /dev/null differ diff --git a/.yarn/cache/@verdaccio-ui-theme-npm-6.0.0-6-next.51-7dbd590283-b478cb7cd8.zip b/.yarn/cache/@verdaccio-ui-theme-npm-6.0.0-6-next.51-7dbd590283-b478cb7cd8.zip new file mode 100644 index 000000000..50b4322dc Binary files /dev/null and b/.yarn/cache/@verdaccio-ui-theme-npm-6.0.0-6-next.51-7dbd590283-b478cb7cd8.zip differ diff --git a/.yarn/cache/dompurify-npm-2.4.0-0ffecf22ef-c93ea73cf8.zip b/.yarn/cache/dompurify-npm-2.4.0-0ffecf22ef-c93ea73cf8.zip deleted file mode 100644 index a92551334..000000000 Binary files a/.yarn/cache/dompurify-npm-2.4.0-0ffecf22ef-c93ea73cf8.zip and /dev/null differ diff --git a/Dockerfile b/Dockerfile index 5e4d81fde..98c3972d5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,11 +6,12 @@ ENV NODE_ENV=production \ CI=true \ HUSKY_DEBUG=1 -RUN apk --no-cache add openssl ca-certificates wget && \ +RUN apk add --force-overwrite && \ + apk --no-cache add openssl ca-certificates wget && \ apk --no-cache add g++ gcc libgcc libstdc++ linux-headers make python3 && \ wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub && \ - wget -q https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.29-r0/glibc-2.29-r0.apk && \ - apk add glibc-2.29-r0.apk + wget -q https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.35-r0/glibc-2.35-r0.apk && \ + apk add --force-overwrite glibc-2.35-r0.apk WORKDIR /opt/verdaccio-build COPY . . diff --git a/package.json b/package.json index c01e1483e..7c5a675d3 100644 --- a/package.json +++ b/package.json @@ -20,9 +20,8 @@ "dependencies": { "@verdaccio/commons-api": "10.2.0", "@verdaccio/local-storage": "10.3.1", - "@verdaccio/readme": "10.4.2", "@verdaccio/streams": "10.2.0", - "@verdaccio/ui-theme": "6.0.0-6-next.50", + "@verdaccio/ui-theme": "6.0.0-6-next.51", "JSONStream": "1.3.5", "async": "3.2.4", "body-parser": "1.20.1", diff --git a/src/api/web/endpoint/package.ts b/src/api/web/endpoint/package.ts index b4e21df3f..63a533433 100644 --- a/src/api/web/endpoint/package.ts +++ b/src/api/web/endpoint/package.ts @@ -105,7 +105,7 @@ function addPackageWebApi(storage: IStorageHandler, auth: IAuth, config: Config) res.set(HEADER_TYPE.CONTENT_TYPE, HEADERS.TEXT_PLAIN); const referer = req.get('Referer'); const pathname = referer ? new URL(referer).pathname : undefined; - next(parseReadme(info.name, info.readme, { pathname })); + next(parseReadme(info.name, info.readme)); }, }); }); diff --git a/src/lib/utils.ts b/src/lib/utils.ts index 286dc2d74..268f8beb7 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -11,7 +11,6 @@ import validator from 'validator'; // eslint-disable-next-line max-len import { getBadData, getBadRequest, getCode, getConflict, getForbidden, getInternalError, getNotFound, getServiceUnavailable, getUnauthorized } from '@verdaccio/commons-api'; -import sanitizyReadme from '@verdaccio/readme'; import { Author, Config, Package, Version } from '@verdaccio/types'; import { AuthorAvatar, StringValue } from '../../types'; @@ -494,18 +493,18 @@ export function addGravatarSupport(pkgInfo: Package, online = true): AuthorAvata * parse package readme - markdown/ascii * @param {String} packageName name of package * @param {String} readme package readme - * @param {Object} options sanitizyReadme options + * @return {String} converted html template */ -export function parseReadme(packageName: string, readme: string, options: { pathname?: string | void } = {}): string | void { +export function parseReadme(packageName: string, readme: string): string | void { if (_.isEmpty(readme) === false) { - return sanitizyReadme(readme, options); + return readme; } // logs readme not found error - logger.error({ packageName }, '@{packageName}: No readme found'); + logger.info({ packageName }, '@{packageName}: No readme found'); - return sanitizyReadme('ERROR: No README data found!'); + return 'ERROR: No README data found!'; } export function buildToken(type: string, token: string): string { diff --git a/test/unit/modules/utils/__snapshots__/utils.spec.ts.snap b/test/unit/modules/utils/__snapshots__/utils.spec.ts.snap deleted file mode 100644 index 8491895fe..000000000 --- a/test/unit/modules/utils/__snapshots__/utils.spec.ts.snap +++ /dev/null @@ -1,51 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Utilities parseReadme should parse makrdown text to html template 1`] = ` -"
One Paragraph of project description goes here
-These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
-What things you need to install the software and how to install them
-Give examples
-
-A step by step series of examples that tell you how to get a development env running
-Say what the step will be
-Give the example
-
-And repeat
-until finished
-
-End with an example of getting some data out of the system or using it for a little demo
-Explain how to run the automated tests for this system
-Explain what these tests test and why
-Give an example
-
-Explain what these tests test and why
-Give an example
-
-Add additional notes about how to deploy this on a live system
-Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
-We use SemVer for versioning. For the versions available, see the tags on this repository.
-This project is licensed under the MIT License - see the LICENSE.md file for details
-%%%%%**##==
'); - expect(parseReadme('testPackage', simpleText)).toEqual('simple text
'); - expect(parseReadme('testPackage', randomTextMarkdown)).toEqual('simple text
\nERROR: No README data found!
'); + const spy = jest.spyOn(logger, 'info'); + expect(parseReadme('testPackage', noData)).toEqual('ERROR: No README data found!'); expect(spy).toHaveBeenCalledWith({ packageName: 'testPackage' }, '@{packageName}: No readme found'); }); }); diff --git a/yarn.lock b/yarn.lock index 9bef87ce7..5673b74c2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2978,17 +2978,6 @@ __metadata: languageName: node linkType: hard -"@verdaccio/readme@npm:10.4.2": - version: 10.4.2 - resolution: "@verdaccio/readme@npm:10.4.2" - dependencies: - dompurify: 2.4.0 - jsdom: 16.7.0 - marked: 4.2.2 - checksum: 73492f11378cb2d4047caa693bde9e322b730b1d79c84ecea92098b4fda104b644d6098b016819069c5a7482bff993e28c35fbbc69f98f23ce0a042cc30dbfc4 - languageName: node - linkType: hard - "@verdaccio/streams@npm:10.2.0": version: 10.2.0 resolution: "@verdaccio/streams@npm:10.2.0" @@ -3003,10 +2992,10 @@ __metadata: languageName: node linkType: hard -"@verdaccio/ui-theme@npm:6.0.0-6-next.50": - version: 6.0.0-6-next.50 - resolution: "@verdaccio/ui-theme@npm:6.0.0-6-next.50" - checksum: 1e7ac1608f89cacb058c6b822928ef5828d8797419a5bf8470502f17d4b3af9e48037ed22d19d5efa8d12612131d4fc4eef4bf7aa1b281b5b685cafc30b5583c +"@verdaccio/ui-theme@npm:6.0.0-6-next.51": + version: 6.0.0-6-next.51 + resolution: "@verdaccio/ui-theme@npm:6.0.0-6-next.51" + checksum: b478cb7cd8bef2b6dfe924728d9869765b5f540536df84dfdb2318406c595cef39ab80d5f4a2296795ad476ea427f477830212170f9c10cd01f74dc728fe0481 languageName: node linkType: hard @@ -4994,13 +4983,6 @@ __metadata: languageName: node linkType: hard -"dompurify@npm:2.4.0": - version: 2.4.0 - resolution: "dompurify@npm:2.4.0" - checksum: c93ea73cf8e3ba044588450198563e56ce6902e36d0e16e3699df2fa59e82c4fdd11d4ad04ef5024569ce96a35b46f29d0bbea522516add33cd39a7f56a8a675 - languageName: node - linkType: hard - "dot-prop@npm:^5.1.0": version: 5.3.0 resolution: "dot-prop@npm:5.3.0" @@ -7950,7 +7932,7 @@ __metadata: languageName: node linkType: hard -"jsdom@npm:16.7.0, jsdom@npm:^16.4.0": +"jsdom@npm:^16.4.0": version: 16.7.0 resolution: "jsdom@npm:16.7.0" dependencies: @@ -12115,10 +12097,9 @@ __metadata: "@verdaccio-scope/verdaccio-auth-foo": 0.0.2 "@verdaccio/commons-api": 10.2.0 "@verdaccio/local-storage": 10.3.1 - "@verdaccio/readme": 10.4.2 "@verdaccio/streams": 10.2.0 "@verdaccio/types": 10.7.0 - "@verdaccio/ui-theme": 6.0.0-6-next.50 + "@verdaccio/ui-theme": 6.0.0-6-next.51 JSONStream: 1.3.5 all-contributors-cli: 6.20.0 async: 3.2.4