Skip to content

Commit b76c7aa

Browse files
Merge branch 'master' into remove-pad-zero
2 parents d175d95 + 2b9ba3f commit b76c7aa

16 files changed

+144
-193
lines changed

package-lock.json

Lines changed: 82 additions & 131 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,38 +55,38 @@
5555
"@types/express": "4.17.13",
5656
"@types/fs-extra": "9.0.13",
5757
"@types/livereload": "0.9.1",
58-
"@types/lodash": "4.14.175",
58+
"@types/lodash": "4.14.176",
5959
"@types/morgan": "1.9.3",
6060
"@types/multer": "1.4.7",
61-
"@types/node": "16.10.3",
61+
"@types/node": "16.11.3",
6262
"@types/parse-author": "2.0.1",
6363
"@types/read": "0.0.29",
6464
"@types/response-time": "2.3.5",
65-
"@types/semver": "7.3.8",
65+
"@types/semver": "7.3.9",
6666
"@types/targz": "1.0.1",
67-
"@types/yargs": "17.0.3",
68-
"@typescript-eslint/eslint-plugin": "5.0.0",
69-
"@typescript-eslint/parser": "5.0.0",
67+
"@types/yargs": "17.0.4",
68+
"@typescript-eslint/eslint-plugin": "5.1.0",
69+
"@typescript-eslint/parser": "5.1.0",
7070
"chai": "4.3.4",
7171
"chalk": "4.1.2",
72-
"eslint": "8.0.0",
72+
"eslint": "8.0.1",
7373
"eslint-config-prettier": "8.3.0",
7474
"eslint-plugin-prettier": "4.0.0",
7575
"glob": "7.2.0",
76-
"husky": "7.0.2",
76+
"husky": "7.0.4",
7777
"injectr": "0.5.1",
7878
"lint-staged": "11.2.3",
7979
"minimist": "1.2.5",
80-
"mocha": "9.1.2",
80+
"mocha": "9.1.3",
8181
"node-emoji": "1.11.0",
8282
"prettier": "2.4.1",
83-
"rimraf": "^3.0.2",
83+
"rimraf": "3.0.2",
8484
"semver-sort": "0.0.4",
85-
"simple-git": "2.46.0",
85+
"simple-git": "2.47.0",
8686
"sinon": "11.1.2",
87-
"ts-node": "10.3.0",
88-
"type-fest": "^2.5.0",
89-
"typescript": "4.4.3"
87+
"ts-node": "10.3.1",
88+
"type-fest": "2.5.1",
89+
"typescript": "4.4.4"
9090
},
9191
"dependencies": {
9292
"accept-language-parser": "1.5.0",
@@ -108,7 +108,7 @@
108108
"morgan": "1.10.0",
109109
"multer": "1.4.3",
110110
"nice-cache": "0.0.5",
111-
"oc-client": "4.0.0",
111+
"oc-client": "4.0.1",
112112
"oc-client-browser": "1.5.4",
113113
"oc-empty-response-handler": "1.0.2",
114114
"oc-get-unix-utc-timestamp": "1.0.5",

src/cli/logger.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,21 @@ const logFns = {
1818
write: (msg: string) => process.stdout.write(msg.toString())
1919
};
2020

21-
const log = (msg: string, color: Color | null, newLine: boolean) =>
22-
logFns[newLine ? 'writeLn' : 'write'](color ? colors[color](msg) : msg);
21+
const log = (msg: string, color: Color | null, keepLine: boolean) =>
22+
logFns[keepLine ? 'write' : 'writeLn'](color ? colors[color](msg) : msg);
2323

2424
export interface Logger {
25-
err: (msg: string, noNewLine?: boolean) => void;
26-
log: (msg: string, noNewLine?: boolean) => void;
27-
ok: (msg: string, noNewLine?: boolean) => void;
28-
warn: (msg: string, noNewLine?: boolean) => void;
25+
err: (msg: string, keepLine?: boolean) => void;
26+
log: (msg: string, keepLine?: boolean) => void;
27+
ok: (msg: string, keepLine?: boolean) => void;
28+
warn: (msg: string, keepLine?: boolean) => void;
2929
}
3030

3131
const logger: Logger = {
32-
err: (msg: string, noNewLine?: boolean) => log(msg, 'red', !noNewLine),
33-
log: (msg: string, noNewLine?: boolean) => log(msg, null, !noNewLine),
34-
ok: (msg: string, noNewLine?: boolean) => log(msg, 'green', !noNewLine),
35-
warn: (msg: string, noNewLine?: boolean) => log(msg, 'yellow', !noNewLine)
32+
err: (msg: string, keepLine?: boolean) => log(msg, 'red', !!keepLine),
33+
log: (msg: string, keepLine?: boolean) => log(msg, null, !!keepLine),
34+
ok: (msg: string, keepLine?: boolean) => log(msg, 'green', !!keepLine),
35+
warn: (msg: string, keepLine?: boolean) => log(msg, 'yellow', !!keepLine)
3636
};
3737

3838
export default logger;

src/registry/app-start.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export default function appStart(
2828

2929
logger.log(
3030
colors.yellow(
31-
`Connecting to library: ${options.storage.options.bucket}/${options.storage.options.componentsDir}`
31+
`Connecting to library: ${options.storage.options['bucket']}/${options.storage.options.componentsDir}`
3232
)
3333
);
3434

src/registry/domain/options-sanitiser.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export default function optionsSanitiser(input: Input): Config {
6868
options.customHeadersToSkipOnWeakVersion || []
6969
).map(s => s.toLowerCase());
7070

71-
options.port = Number(process.env.PORT || options.port);
71+
options.port = Number(process.env['PORT'] || options.port);
7272
options.timeout = options.timeout || 1000 * 60 * 2;
7373
options.keepAliveTimeout =
7474
options.keepAliveTimeout || DEFAULT_NODE_KEEPALIVE_MS;
@@ -85,22 +85,22 @@ export default function optionsSanitiser(input: Input): Config {
8585
}
8686

8787
if (options.refreshInterval && options.storage) {
88-
options.storage.options.refreshInterval = options.refreshInterval;
88+
options.storage.options['refreshInterval'] = options.refreshInterval;
8989
}
9090

9191
if (options.verbosity && options.storage) {
92-
options.storage.options.verbosity = options.verbosity;
92+
options.storage.options['verbosity'] = options.verbosity;
9393
}
9494

9595
if (
9696
options.storage &&
9797
options.storage.options &&
98-
options.storage.options.path
98+
options.storage.options['path']
9999
) {
100-
options.storage.options.path =
101-
options.storage.options.path.indexOf('http') === 0
102-
? options.storage.options.path
103-
: `https:${options.storage.options.path}`;
100+
options.storage.options['path'] =
101+
options.storage.options['path'].indexOf('http') === 0
102+
? options.storage.options['path']
103+
: `https:${options.storage.options['path']}`;
104104
}
105105

106106
if (!options.env) {

src/registry/domain/repository.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ export default function repository(conf: Config): Repository {
225225
getComponentPath(componentName: string, componentVersion: string) {
226226
const prefix = conf.local
227227
? conf.baseUrl
228-
: `${options!.path}${options!.componentsDir}/`;
228+
: `${options!['path']}${options!.componentsDir}/`;
229229
return `${prefix}${componentName}/${componentVersion}/`;
230230
},
231231
getComponents(callback: Callback<string[]>) {
@@ -284,14 +284,14 @@ export default function repository(conf: Config): Repository {
284284
);
285285
},
286286
getStaticClientPath: () =>
287-
`${options!.path}${getFilePath(
287+
`${options!['path']}${getFilePath(
288288
'oc-client',
289289
packageInfo.version,
290290
'src/oc-client.min.js'
291291
)}`,
292292

293293
getStaticClientMapPath: () =>
294-
`${options!.path}${getFilePath(
294+
`${options!['path']}${getFilePath(
295295
'oc-client',
296296
packageInfo.version,
297297
'src/oc-client.min.map'

src/registry/domain/validators/registry-configuration.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,10 @@ export default function registryConfiguration(
105105
const cdn = conf.storage.adapter(conf.storage.options);
106106
if (cdn.adapterType === 's3') {
107107
if (
108-
!conf.storage.options.bucket ||
109-
!conf.storage.options.region ||
110-
(conf.storage.options.key && !conf.storage.options.secret) ||
111-
(!conf.storage.options.key && conf.storage.options.secret)
108+
!conf.storage.options['bucket'] ||
109+
!conf.storage.options['region'] ||
110+
(conf.storage.options['key'] && !conf.storage.options['secret']) ||
111+
(!conf.storage.options['key'] && conf.storage.options['secret'])
112112
) {
113113
return returnError(
114114
strings.errors.registry.CONFIGURATION_STORAGE_NOT_VALID(

src/registry/routes/component-info.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ function componentInfo(
8383
} else {
8484
res.status(200).json(
8585
Object.assign(component, {
86-
requestVersion: req.params.componentVersion || ''
86+
requestVersion: req.params['componentVersion'] || ''
8787
})
8888
);
8989
}
@@ -95,8 +95,8 @@ export default function componentInfoRoute(
9595
) {
9696
return function (req: Request, res: Response): void {
9797
repository.getComponent(
98-
req.params.componentName,
99-
req.params.componentVersion,
98+
req.params['componentName'],
99+
req.params['componentVersion'],
100100
(registryError, component) => {
101101
if (registryError && conf.fallbackRegistryUrl) {
102102
return getComponentFallback.getComponentInfo(

src/registry/routes/component-preview.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function componentPreview(
3838
} else {
3939
res.status(200).json(
4040
Object.assign(component, {
41-
requestVersion: req.params.componentVersion || ''
41+
requestVersion: req.params['componentVersion'] || ''
4242
})
4343
);
4444
}
@@ -50,8 +50,8 @@ export default function componentPreviewRoute(
5050
) {
5151
return (req: Request, res: Response): void => {
5252
repository.getComponent(
53-
req.params.componentName,
54-
req.params.componentVersion,
53+
req.params['componentName'],
54+
req.params['componentVersion'],
5555
(registryError, component) => {
5656
if (registryError && conf.fallbackRegistryUrl) {
5757
return getComponentFallback.getComponentPreview(

src/registry/routes/component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ export default function component(
1818
conf: res.conf,
1919
headers: req.headers,
2020
ip: req.ip,
21-
name: req.params.componentName,
21+
name: req.params['componentName'],
2222
parameters: req.query as any,
23-
version: req.params.componentVersion
23+
version: req.params['componentVersion']
2424
},
2525
result => {
2626
if (result.response.error) {

0 commit comments

Comments
 (0)