Skip to content

Commit

Permalink
Merge pull request #175 from balena-io/update-deps
Browse files Browse the repository at this point in the history
Update dependencies
  • Loading branch information
Page- authored Jul 19, 2024
2 parents aee7dbe + 6ab64d1 commit db5aff8
Show file tree
Hide file tree
Showing 7 changed files with 1,454 additions and 697 deletions.
2,098 changes: 1,425 additions & 673 deletions package-lock.json

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"clean": "rimraf dist",
"check": "tsc --pretty --noEmit --diagnostics --project ./tsconfig.json && tsc --noEmit --project ./tsconfig.dev.json",
"lint": "balena-lint -t ./tsconfig.dev.json src tests",
"lint:fix": "balena-lint -t ./tsconfig.dev.json --fix src tests",
"lint-fix": "balena-lint -t ./tsconfig.dev.json --fix src tests",
"test:docker": "mocha --config tests/.mocharc.docker.js",
"test:node": "mocha --config tests/.mocharc.js",
"test:fast": "mocha --config tests/.mocharc.fast.js",
Expand All @@ -19,7 +19,7 @@
"start": "node dist/index.js",
"build": "npm run clean && tsc",
"prepack": "npm run build",
"prepare": "husky install"
"prepare": "node -e \"try { (await import('husky')).default() } catch (e) { if (e.code !== 'ERR_MODULE_NOT_FOUND') throw e }\" --input-type module"
},
"repository": {
"type": "git",
Expand All @@ -40,26 +40,26 @@
"lodash": "^4.17.21"
},
"devDependencies": {
"@balena/lint": "^8.0.1",
"@balena/lint": "^8.2.7",
"@types/auth-header": "^1.0.6",
"@types/chai": "^4.3.14",
"@types/dockerode": "^3.3.28",
"@types/chai": "^4.3.16",
"@types/dockerode": "^3.3.30",
"@types/express": "^4.17.21",
"@types/jsonwebtoken": "^9.0.6",
"@types/lodash": "^4.17.0",
"@types/mocha": "^10.0.6",
"@types/lodash": "^4.17.7",
"@types/mocha": "^10.0.7",
"@types/morgan": "^1.9.9",
"@types/node": "^20.12.7",
"@types/node": "^20.14.11",
"@types/supertest": "^6.0.2",
"chai": "^4.4.1",
"dockerode": "^4.0.2",
"husky": "^9.0.0",
"lint-staged": "^15.2.2",
"mocha": "^10.4.0",
"rimraf": "^5.0.5",
"supertest": "^6.3.4",
"husky": "^9.1.1",
"lint-staged": "^15.2.7",
"mocha": "^10.6.0",
"rimraf": "^6.0.1",
"supertest": "^7.0.0",
"ts-node": "^10.9.2",
"typescript": "^5.4.5"
"typescript": "^5.5.3"
},
"husky": {
"hooks": {
Expand All @@ -72,8 +72,8 @@
]
},
"engines": {
"node": "^21.6.1",
"npm": "^10.4.0"
"node": "^22.2.0",
"npm": "^10.7.0"
},
"versionist": {
"publishedAt": "2024-07-19T13:11:44.571Z"
Expand Down
8 changes: 5 additions & 3 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ function rewriteRepository(

if (matches[4] == null) {
// just a version request, forward it
return next();
next();
return;
}

const version = matches[1];
Expand All @@ -46,7 +47,8 @@ function rewriteRepository(

if (!req.headers['authorization']) {
// we need the authorization header with a JWT to go any further
return next();
next();
return;
}

const auth = authorization.parse(req.headers['authorization']);
Expand Down Expand Up @@ -79,7 +81,7 @@ function rewriteRepository(
method === 'manifests' ? 'latest' : tag,
].join('/');

return next();
next();
}

function registryProxyMiddleware(target: string) {
Expand Down
2 changes: 1 addition & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function optionalVar(
varName: string,
defaultValue?: string,
): string | undefined {
return process.env[varName] || defaultValue;
return process.env[varName] ?? defaultValue;
}

function intVar(varName: string): number;
Expand Down
2 changes: 1 addition & 1 deletion src/errors.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// https://docs.docker.com/registry/spec/api/#errors
function registryError(code: string, message: string, detail: string = '') {
function registryError(code: string, message: string, detail = '') {
return { errors: [{ code, message, detail }] };
}

Expand Down
6 changes: 4 additions & 2 deletions tests/docker/docker.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,16 @@ access.forEach((item) => {
docker.pull(path, options, function (err: any, stream: any) {
if (err) {
console.error(err);
return done(err);
done(err);
return;
}
docker.modem.followProgress(stream, onFinished, onProgress);

function onFinished(error: any, output: any) {
if (error) {
console.error(err);
return done(error);
done(error);
return;
}
expect(output).to.be.a('array');
done();
Expand Down
3 changes: 2 additions & 1 deletion tests/test-lib/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ app.use('/v2/', (req, res) => {
}

if (!req.headers['authorization']) {
return needsAuth();
needsAuth();
return;
}

const auth = authorization.parse(req.headers['authorization']);
Expand Down

0 comments on commit db5aff8

Please sign in to comment.