@verdaccio/middleware 8.0.0-next-8.12 → 8.0.0-next-8.13

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 (66) hide show
  1. package/README.md +30 -24
  2. package/package.json +12 -8
  3. package/.babelrc +0 -14
  4. package/CHANGELOG.md +0 -1324
  5. package/src/index.ts +0 -23
  6. package/src/middlewares/allow.ts +0 -66
  7. package/src/middlewares/antiLoop.ts +0 -41
  8. package/src/middlewares/api_urls.ts +0 -45
  9. package/src/middlewares/encode-pkg.ts +0 -39
  10. package/src/middlewares/error.ts +0 -79
  11. package/src/middlewares/final.ts +0 -71
  12. package/src/middlewares/json.ts +0 -15
  13. package/src/middlewares/log.ts +0 -105
  14. package/src/middlewares/make-url-relative.ts +0 -46
  15. package/src/middlewares/match.ts +0 -16
  16. package/src/middlewares/media.ts +0 -29
  17. package/src/middlewares/rate-limit.ts +0 -8
  18. package/src/middlewares/security-headers.ts +0 -21
  19. package/src/middlewares/user-agent.ts +0 -11
  20. package/src/middlewares/validation.ts +0 -31
  21. package/src/middlewares/web/index.ts +0 -4
  22. package/src/middlewares/web/render-web.ts +0 -107
  23. package/src/middlewares/web/security.ts +0 -13
  24. package/src/middlewares/web/utils/manifest.ts +0 -31
  25. package/src/middlewares/web/utils/renderHTML.ts +0 -157
  26. package/src/middlewares/web/utils/template.ts +0 -50
  27. package/src/middlewares/web/utils/web-utils.ts +0 -18
  28. package/src/middlewares/web/web-api.ts +0 -30
  29. package/src/middlewares/web/web-middleware.ts +0 -16
  30. package/src/middlewares/web/web-urls.ts +0 -25
  31. package/src/types.ts +0 -11
  32. package/test/__snapshots__/template.test.ts.snap +0 -131
  33. package/test/_helper.ts +0 -8
  34. package/test/allow.spec.ts +0 -110
  35. package/test/antiLoop.spec.ts +0 -90
  36. package/test/config/dark-logo.png +0 -0
  37. package/test/config/default-test.yaml +0 -28
  38. package/test/config/favicon.ico +0 -0
  39. package/test/config/file-logo.yaml +0 -26
  40. package/test/config/http-logo.yaml +0 -26
  41. package/test/config/login-disabled.yaml +0 -30
  42. package/test/config/no-logo.yaml +0 -25
  43. package/test/config/web.yaml +0 -24
  44. package/test/config/wrong-logo.yaml +0 -24
  45. package/test/encode.spec.ts +0 -131
  46. package/test/final.spec.ts +0 -62
  47. package/test/helper.ts +0 -14
  48. package/test/json.spec.ts +0 -33
  49. package/test/log.spec.ts +0 -29
  50. package/test/make-url-relative.spec.ts +0 -42
  51. package/test/manifest.test.ts +0 -25
  52. package/test/media.spec.ts +0 -56
  53. package/test/params.spec.ts +0 -38
  54. package/test/partials/htmlParser.ts +0 -1
  55. package/test/partials/manifest/manifest.json +0 -64
  56. package/test/render.spec.ts +0 -156
  57. package/test/security.spec.ts +0 -55
  58. package/test/static/main.js +0 -3
  59. package/test/static/runtime.js +0 -3
  60. package/test/static/vendors.js +0 -3
  61. package/test/template.test.ts +0 -71
  62. package/test/utils.spec.ts +0 -15
  63. package/test/validation.spec.ts +0 -93
  64. package/tsconfig.build.json +0 -9
  65. package/tsconfig.json +0 -26
  66. package/types/custom.d.ts +0 -20
@@ -1,107 +0,0 @@
1
- import buildDebug from 'debug';
2
- import express from 'express';
3
- import fs from 'fs';
4
- import path from 'path';
5
-
6
- import { HTTP_STATUS } from '@verdaccio/core';
7
- import { isURLhasValidProtocol } from '@verdaccio/url';
8
-
9
- import { setSecurityWebHeaders } from './security';
10
- import renderHTML from './utils/renderHTML';
11
- import { WebUrlsNamespace } from './web-urls';
12
-
13
- const debug = buildDebug('verdaccio:web:render');
14
-
15
- const sendFileCallback = (next) => (err) => {
16
- if (!err) {
17
- return;
18
- }
19
- if (err.status === HTTP_STATUS.NOT_FOUND) {
20
- next();
21
- } else {
22
- next(err);
23
- }
24
- };
25
-
26
- export function renderWebMiddleware(config, tokenMiddleware, pluginOptions) {
27
- const { staticPath, manifest, manifestFiles } = pluginOptions;
28
- debug('static path %o', staticPath);
29
-
30
- /* eslint new-cap:off */
31
- const router = express.Router();
32
- if (typeof tokenMiddleware === 'function') {
33
- router.use(tokenMiddleware);
34
- }
35
-
36
- router.use(setSecurityWebHeaders);
37
-
38
- // any match within the static is routed to the file system
39
- router.get(WebUrlsNamespace.static + '*', function (req, res, next) {
40
- const filename = req.params[0];
41
- let file = `${staticPath}/${filename}`;
42
- if (filename === 'favicon.ico' && config?.web?.favicon) {
43
- file = config?.web?.favicon;
44
- if (isURLhasValidProtocol(file)) {
45
- debug('redirect to favicon %s', file);
46
- req.url = file;
47
- return next();
48
- }
49
- }
50
- debug('render static file %o', file);
51
- res.sendFile(file, sendFileCallback(next));
52
- });
53
-
54
- function renderLogo(logo: string | undefined): string | undefined {
55
- // check the origin of the logo
56
- if (logo && !isURLhasValidProtocol(logo)) {
57
- // URI related to a local file
58
- const absoluteLocalFile = path.posix.resolve(logo);
59
- debug('serve local logo %s', absoluteLocalFile);
60
- try {
61
- // TODO: replace existsSync by async alternative
62
- if (
63
- fs.existsSync(absoluteLocalFile) &&
64
- typeof fs.accessSync(absoluteLocalFile, fs.constants.R_OK) === 'undefined'
65
- ) {
66
- // Note: `path.join` will break on Windows, because it transforms `/` to `\`
67
- // Use POSIX version `path.posix.join` instead.
68
- logo = path.posix.join(WebUrlsNamespace.static, path.basename(logo));
69
- router.get(logo, function (_req, res, next) {
70
- // @ts-ignore
71
- debug('serve custom logo web:%s - local:%s', logo, absoluteLocalFile);
72
- res.sendFile(absoluteLocalFile, sendFileCallback(next));
73
- });
74
- debug('enabled custom logo %s', logo);
75
- } else {
76
- logo = undefined;
77
- debug(`web logo is wrong, path ${absoluteLocalFile} does not exist or is not readable`);
78
- }
79
- } catch {
80
- logo = undefined;
81
- debug(`web logo is wrong, path ${absoluteLocalFile} does not exist or is not readable`);
82
- }
83
- }
84
- return logo;
85
- }
86
-
87
- const logo = renderLogo(config?.web?.logo);
88
- if (config?.web?.logo) {
89
- config.web.logo = logo;
90
- }
91
- const logoDark = renderLogo(config?.web?.logoDark);
92
- if (config?.web?.logoDark) {
93
- config.web.logoDark = logoDark;
94
- }
95
-
96
- router.get(WebUrlsNamespace.web + ':section/*', function (req, res) {
97
- renderHTML(config, manifest, manifestFiles, req, res);
98
- debug('render html section');
99
- });
100
-
101
- router.get(WebUrlsNamespace.root, function (req, res) {
102
- renderHTML(config, manifest, manifestFiles, req, res);
103
- debug('render root');
104
- });
105
-
106
- return router;
107
- }
@@ -1,13 +0,0 @@
1
- import { HEADERS } from '@verdaccio/core';
2
-
3
- export function setSecurityWebHeaders(_req, res, next): void {
4
- // disable loading in frames (clickjacking, etc.)
5
- res.header(HEADERS.FRAMES_OPTIONS, 'deny');
6
- // avoid stablish connections outside of domain
7
- res.header(HEADERS.CSP, "connect-src 'self'");
8
- // https://stackoverflow.com/questions/18337630/what-is-x-content-type-options-nosniff
9
- res.header(HEADERS.CTO, 'nosniff');
10
- // https://stackoverflow.com/questions/9090577/what-is-the-http-header-x-xss-protection
11
- res.header(HEADERS.XSS, '1; mode=block');
12
- next();
13
- }
@@ -1,31 +0,0 @@
1
- import buildDebug from 'debug';
2
-
3
- export type Manifest = {
4
- // goes on first place at the header
5
- ico: string;
6
- css: string[];
7
- js: string[];
8
- };
9
-
10
- const debug = buildDebug('verdaccio:middleware:web:render:manifest');
11
-
12
- export function getManifestValue(
13
- manifestItems: string[],
14
- manifest,
15
- basePath: string = ''
16
- ): string[] {
17
- return manifestItems?.map((item) => {
18
- debug('resolve item %o', item);
19
- const resolvedItem = `${stripTrailingSlash(basePath)}/${stripLeadingSlash(manifest[item])}`;
20
- debug('resolved item %o', resolvedItem);
21
- return resolvedItem;
22
- });
23
- }
24
-
25
- function stripTrailingSlash(path: string): string {
26
- return path.replace(/\/$/, '');
27
- }
28
-
29
- function stripLeadingSlash(path: string): string {
30
- return path.replace(/^\//, '');
31
- }
@@ -1,157 +0,0 @@
1
- import buildDebug from 'debug';
2
- import type { Response } from 'express';
3
- import LRU from 'lru-cache';
4
- import path from 'path';
5
- import { URL } from 'url';
6
-
7
- import { WEB_TITLE } from '@verdaccio/config';
8
- import { HEADERS } from '@verdaccio/core';
9
- import { ConfigYaml, TemplateUIOptions } from '@verdaccio/types';
10
- import type { RequestOptions } from '@verdaccio/url';
11
- import { getPublicUrl, isURLhasValidProtocol } from '@verdaccio/url';
12
-
13
- import type { Manifest } from './manifest';
14
- import renderTemplate from './template';
15
- import type { WebpackManifest } from './template';
16
- import { hasLogin, validatePrimaryColor } from './web-utils';
17
-
18
- const DEFAULT_LANGUAGE = 'es-US';
19
- const cache = new LRU({ max: 500, ttl: 1000 * 60 * 60 });
20
-
21
- const debug = buildDebug('verdaccio:web:render');
22
-
23
- const defaultManifestFiles: Manifest = {
24
- js: ['runtime.js', 'vendors.js', 'main.js'],
25
- ico: 'favicon.ico',
26
- css: [],
27
- };
28
-
29
- export function resolveLogo(
30
- logo: string | undefined,
31
- url_prefix: string | undefined,
32
- requestOptions: RequestOptions
33
- ) {
34
- if (typeof logo !== 'string') {
35
- return '';
36
- }
37
- const isLocalFile = logo && !isURLhasValidProtocol(logo);
38
-
39
- if (isLocalFile) {
40
- return `${getPublicUrl(url_prefix, requestOptions)}-/static/${path.basename(logo)}`;
41
- } else if (isURLhasValidProtocol(logo)) {
42
- return logo;
43
- } else {
44
- return '';
45
- }
46
- }
47
-
48
- export default function renderHTML(
49
- config: ConfigYaml,
50
- manifest: WebpackManifest,
51
- manifestFiles: Manifest | null | undefined,
52
- requestOptions: RequestOptions,
53
- res: Response
54
- ) {
55
- const { url_prefix } = config;
56
- const base = getPublicUrl(config?.url_prefix, requestOptions);
57
- const basename = new URL(base).pathname;
58
- const language = config?.i18n?.web ?? DEFAULT_LANGUAGE;
59
- const hideDeprecatedVersions = config?.web?.hideDeprecatedVersions ?? false;
60
- // @ts-ignore
61
- const needHtmlCache = [undefined, null].includes(config?.web?.html_cache)
62
- ? true
63
- : config?.web?.html_cache;
64
- const darkMode = config?.web?.darkMode ?? false;
65
- const title = config?.web?.title ?? WEB_TITLE;
66
- const login = hasLogin(config);
67
- const scope = config?.web?.scope ?? '';
68
- const favicon = resolveLogo(config?.web?.favicon, config?.url_prefix, requestOptions);
69
- const logo = resolveLogo(config?.web?.logo, config?.url_prefix, requestOptions);
70
- const logoDark = resolveLogo(config?.web?.logoDark, config?.url_prefix, requestOptions);
71
- const pkgManagers = config?.web?.pkgManagers ?? ['yarn', 'pnpm', 'npm'];
72
- const version = res.locals.app_version ?? '';
73
- const flags = {
74
- ...config.flags,
75
- // legacy from 5.x
76
- ...config.experiments,
77
- };
78
- const primaryColor =
79
- validatePrimaryColor(config?.web?.primary_color ?? config?.web?.primaryColor) ?? '#4b5e40';
80
- const {
81
- scriptsBodyAfter,
82
- metaScripts,
83
- scriptsbodyBefore,
84
- showInfo,
85
- showSettings,
86
- showThemeSwitch,
87
- showFooter,
88
- showSearch,
89
- showDownloadTarball,
90
- showRaw,
91
- showUplinks,
92
- } = Object.assign(
93
- {},
94
- {
95
- scriptsBodyAfter: [],
96
- bodyBefore: [],
97
- metaScripts: [],
98
- },
99
- config?.web
100
- );
101
- const options: TemplateUIOptions = {
102
- showInfo,
103
- showSettings,
104
- showThemeSwitch,
105
- showFooter,
106
- showSearch,
107
- showDownloadTarball,
108
- showRaw,
109
- showUplinks,
110
- darkMode,
111
- url_prefix,
112
- basename,
113
- base,
114
- primaryColor,
115
- version,
116
- logo,
117
- logoDark,
118
- favicon,
119
- flags,
120
- login,
121
- pkgManagers,
122
- title,
123
- scope,
124
- language,
125
- hideDeprecatedVersions,
126
- };
127
-
128
- let webPage;
129
-
130
- try {
131
- webPage = cache.get('template');
132
- if (!webPage) {
133
- webPage = renderTemplate(
134
- {
135
- manifest: manifestFiles ?? defaultManifestFiles,
136
- options,
137
- scriptsBodyAfter,
138
- metaScripts,
139
- scriptsbodyBefore,
140
- },
141
- manifest
142
- );
143
-
144
- if (needHtmlCache) {
145
- cache.set('template', webPage);
146
- debug('set template cache');
147
- }
148
- } else {
149
- debug('reuse template cache');
150
- }
151
- } catch (error: any) {
152
- throw new Error(`theme could not be load, stack ${error.stack}`);
153
- }
154
- res.setHeader('Content-Type', HEADERS.TEXT_HTML);
155
- res.send(webPage);
156
- debug('web rendered');
157
- }
@@ -1,50 +0,0 @@
1
- import buildDebug from 'debug';
2
-
3
- import { TemplateUIOptions } from '@verdaccio/types';
4
-
5
- import { Manifest, getManifestValue } from './manifest';
6
-
7
- const debug = buildDebug('verdaccio:web:render:template');
8
-
9
- export type Template = {
10
- manifest: Manifest;
11
- options: TemplateUIOptions;
12
- metaScripts?: string[];
13
- scriptsBodyAfter?: string[];
14
- scriptsbodyBefore?: string[];
15
- };
16
-
17
- // the outcome of the Webpack Manifest Plugin
18
- export interface WebpackManifest {
19
- [key: string]: string;
20
- }
21
-
22
- export default function renderTemplate(template: Template, manifest: WebpackManifest) {
23
- debug('template %o', template);
24
- debug('manifest %o', manifest);
25
-
26
- return `
27
- <!DOCTYPE html>
28
- <html lang="en-us">
29
- <head>
30
- <meta charset="utf-8">
31
- <base href="${template?.options.base}">
32
- <title>${template?.options?.title ?? ''}</title>
33
- <link rel="icon" href="${template?.options.base}-/static/favicon.ico"/>
34
- <meta name="viewport" content="width=device-width, initial-scale=1" />
35
- <script>
36
- window.__VERDACCIO_BASENAME_UI_OPTIONS=${JSON.stringify(template.options)}
37
- </script>
38
- ${template?.metaScripts ? template.metaScripts.join('') : ''}
39
- </head>
40
- <body class="body">
41
- ${template?.scriptsbodyBefore ? template.scriptsbodyBefore.join('') : ''}
42
- <div id="root"></div>
43
- ${getManifestValue(template.manifest.js, manifest, template?.options.base)
44
- .map((item) => `<script defer="defer" src="${item}"></script>`)
45
- .join(`\n `)}
46
- ${template?.scriptsBodyAfter ? template.scriptsBodyAfter.join('') : ''}
47
- </body>
48
- </html>
49
- `;
50
- }
@@ -1,18 +0,0 @@
1
- import buildDebug from 'debug';
2
- import _ from 'lodash';
3
-
4
- const debug = buildDebug('verdaccio:web:middlwares');
5
-
6
- export function validatePrimaryColor(primaryColor) {
7
- const isHex = /^#([0-9A-F]{3}){1,2}$/i.test(primaryColor);
8
- if (!isHex) {
9
- debug('invalid primary color %o', primaryColor);
10
- return;
11
- }
12
-
13
- return primaryColor;
14
- }
15
-
16
- export function hasLogin(config: any) {
17
- return _.isNil(config?.web?.login) || config?.web?.login === true;
18
- }
@@ -1,30 +0,0 @@
1
- import express from 'express';
2
- import { RequestHandler, Router } from 'express';
3
-
4
- import { validateName, validatePackage } from '../validation';
5
- import { setSecurityWebHeaders } from './security';
6
-
7
- export function webAPIMiddleware(
8
- tokenMiddleware: RequestHandler,
9
- webEndpointsApi: RequestHandler
10
- ): Router {
11
- // eslint-disable-next-line new-cap
12
- const route = Router();
13
- // validate all of these params as a package name
14
- // this might be too harsh, so ask if it causes trouble=
15
- route.param('package', validatePackage);
16
- route.param('filename', validateName);
17
- route.param('version', validateName);
18
- route.use(express.urlencoded({ extended: false }));
19
- route.use(setSecurityWebHeaders);
20
-
21
- if (typeof tokenMiddleware === 'function') {
22
- route.use(tokenMiddleware);
23
- }
24
-
25
- if (typeof webEndpointsApi === 'function') {
26
- route.use(webEndpointsApi);
27
- }
28
-
29
- return route;
30
- }
@@ -1,16 +0,0 @@
1
- import express from 'express';
2
-
3
- import { renderWebMiddleware } from './render-web';
4
- import { webAPIMiddleware } from './web-api';
5
- import { WebUrlsNamespace } from './web-urls';
6
-
7
- export default (config, middlewares, pluginOptions): any => {
8
- // eslint-disable-next-line new-cap
9
- const router = express.Router();
10
- const { tokenMiddleware, webEndpointsApi } = middlewares;
11
- // render web
12
- router.use(WebUrlsNamespace.root, renderWebMiddleware(config, tokenMiddleware, pluginOptions));
13
- // web endpoints: search, packages, readme, sidebar, etc
14
- router.use(WebUrlsNamespace.endpoints, webAPIMiddleware(tokenMiddleware, webEndpointsApi));
15
- return router;
16
- };
@@ -1,25 +0,0 @@
1
- /**
2
- * Enum for web urls, used on the web middleware
3
- */
4
- export enum WebUrls {
5
- sidebar_scopped_package = '/sidebar/:scope/:package',
6
- sidebar_package = '/sidebar/:package',
7
- readme_package_scoped_version = '/package/readme/:scope/:package/:version?',
8
- readme_package_version = '/package/readme/:package/:version?',
9
- packages_all = '/packages',
10
- user_login = '/login',
11
- search = '/search/:anything',
12
- reset_password = '/reset_password',
13
- }
14
-
15
- /**
16
- * Enum for web urls namespace, used on the web middleware
17
- */
18
- export enum WebUrlsNamespace {
19
- root = '/',
20
- static = '/-/static/',
21
- endpoints = '/-/verdaccio/',
22
- web = '/-/web/',
23
- data = '/data/',
24
- sec = '/sec/',
25
- }
package/src/types.ts DELETED
@@ -1,11 +0,0 @@
1
- import { NextFunction, Request, Response } from 'express';
2
-
3
- import { Logger, RemoteUser } from '@verdaccio/types';
4
-
5
- export type $RequestExtend = Request & { remote_user?: RemoteUser; log: Logger };
6
- export type $ResponseExtend = Response & { cookies?: any };
7
- export type $NextFunctionVer = NextFunction & any;
8
-
9
- export interface MiddlewareError {
10
- error: string;
11
- }
@@ -1,131 +0,0 @@
1
- // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
-
3
- exports[`template > custom body after 1`] = `
4
- "
5
- <!DOCTYPE html>
6
- <html lang="en-us">
7
- <head>
8
- <meta charset="utf-8">
9
- <base href="http://domain.com/">
10
- <title></title>
11
- <link rel="icon" href="http://domain.com/-/static/favicon.ico"/>
12
- <meta name="viewport" content="width=device-width, initial-scale=1" />
13
- <script>
14
- window.__VERDACCIO_BASENAME_UI_OPTIONS={"base":"http://domain.com/"}
15
- </script>
16
-
17
- </head>
18
- <body class="body">
19
-
20
- <div id="root"></div>
21
- <script defer="defer" src="http://domain.com/-/static/runtime.6126058572f989c948b1.js"></script>
22
- <script defer="defer" src="http://domain.com/-/static/main.6126058572f989c948b1.js"></script>
23
- <script src="foo"/>
24
- </body>
25
- </html>
26
- "
27
- `;
28
-
29
- exports[`template > custom body before 1`] = `
30
- "
31
- <!DOCTYPE html>
32
- <html lang="en-us">
33
- <head>
34
- <meta charset="utf-8">
35
- <base href="http://domain.com/">
36
- <title></title>
37
- <link rel="icon" href="http://domain.com/-/static/favicon.ico"/>
38
- <meta name="viewport" content="width=device-width, initial-scale=1" />
39
- <script>
40
- window.__VERDACCIO_BASENAME_UI_OPTIONS={"base":"http://domain.com/"}
41
- </script>
42
-
43
- </head>
44
- <body class="body">
45
- <script src="fooBefore"/><script src="barBefore"/>
46
- <div id="root"></div>
47
- <script defer="defer" src="http://domain.com/-/static/runtime.6126058572f989c948b1.js"></script>
48
- <script defer="defer" src="http://domain.com/-/static/main.6126058572f989c948b1.js"></script>
49
-
50
- </body>
51
- </html>
52
- "
53
- `;
54
-
55
- exports[`template > custom render 1`] = `
56
- "
57
- <!DOCTYPE html>
58
- <html lang="en-us">
59
- <head>
60
- <meta charset="utf-8">
61
- <base href="http://domain.com/">
62
- <title></title>
63
- <link rel="icon" href="http://domain.com/-/static/favicon.ico"/>
64
- <meta name="viewport" content="width=device-width, initial-scale=1" />
65
- <script>
66
- window.__VERDACCIO_BASENAME_UI_OPTIONS={"base":"http://domain.com/"}
67
- </script>
68
-
69
- </head>
70
- <body class="body">
71
-
72
- <div id="root"></div>
73
- <script defer="defer" src="http://domain.com/-/static/runtime.6126058572f989c948b1.js"></script>
74
- <script defer="defer" src="http://domain.com/-/static/main.6126058572f989c948b1.js"></script>
75
-
76
- </body>
77
- </html>
78
- "
79
- `;
80
-
81
- exports[`template > custom title 1`] = `
82
- "
83
- <!DOCTYPE html>
84
- <html lang="en-us">
85
- <head>
86
- <meta charset="utf-8">
87
- <base href="http://domain.com/">
88
- <title>foo title</title>
89
- <link rel="icon" href="http://domain.com/-/static/favicon.ico"/>
90
- <meta name="viewport" content="width=device-width, initial-scale=1" />
91
- <script>
92
- window.__VERDACCIO_BASENAME_UI_OPTIONS={"base":"http://domain.com/","title":"foo title"}
93
- </script>
94
-
95
- </head>
96
- <body class="body">
97
-
98
- <div id="root"></div>
99
- <script defer="defer" src="http://domain.com/-/static/runtime.6126058572f989c948b1.js"></script>
100
- <script defer="defer" src="http://domain.com/-/static/main.6126058572f989c948b1.js"></script>
101
-
102
- </body>
103
- </html>
104
- "
105
- `;
106
-
107
- exports[`template > meta scripts 1`] = `
108
- "
109
- <!DOCTYPE html>
110
- <html lang="en-us">
111
- <head>
112
- <meta charset="utf-8">
113
- <base href="http://domain.com/">
114
- <title></title>
115
- <link rel="icon" href="http://domain.com/-/static/favicon.ico"/>
116
- <meta name="viewport" content="width=device-width, initial-scale=1" />
117
- <script>
118
- window.__VERDACCIO_BASENAME_UI_OPTIONS={"base":"http://domain.com/"}
119
- </script>
120
- <style>.someclass{font-size:10px;}</style>
121
- </head>
122
- <body class="body">
123
-
124
- <div id="root"></div>
125
- <script defer="defer" src="http://domain.com/-/static/runtime.6126058572f989c948b1.js"></script>
126
- <script defer="defer" src="http://domain.com/-/static/main.6126058572f989c948b1.js"></script>
127
-
128
- </body>
129
- </html>
130
- "
131
- `;
package/test/_helper.ts DELETED
@@ -1,8 +0,0 @@
1
- import path from 'path';
2
-
3
- import { parseConfigFile } from '@verdaccio/config';
4
-
5
- export const getConf = (configName: string) => {
6
- const configPath = path.join(__dirname, 'config', configName);
7
- return parseConfigFile(configPath);
8
- };