Skip to content
This repository has been archived by the owner on Jun 16, 2024. It is now read-only.

Commit

Permalink
fix: improve plugin auth structure
Browse files Browse the repository at this point in the history
  • Loading branch information
juanpicado committed Jun 14, 2022
1 parent 41dde4b commit cb333bb
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 12 deletions.
6 changes: 6 additions & 0 deletions .changeset/forty-keys-suffer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"generator-verdaccio-plugin": minor
---

fix: improve plugin structure auth

1 change: 0 additions & 1 deletion src/app/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ class VerdaccioPluginGenerator extends Generator {
{value: 'auth'},
{value: 'storage'},
{value: 'middleware'},
{value: 'theme'},
],
},
{
Expand Down
4 changes: 2 additions & 2 deletions src/app/templates/typescript/auth/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"name": "<%= name %>",
"version": "0.0.1",
"description": "<%= description %>",
"main": "src/index.js",
"types": "src/index.d.ts",
"main": "lib/src/index.js",
"types": "lib/src/index.d.ts",
"engines": {
"node": ">=12"
},
Expand Down
9 changes: 5 additions & 4 deletions src/app/templates/typescript/auth/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
RemoteUser,
Logger,
} from '@verdaccio/types';
import {getInternalError} from '@verdaccio/commons-api';

import {CustomConfig} from '../types/index';

Expand All @@ -33,7 +34,7 @@ export default class AuthCustomPlugin implements IPluginAuth<CustomConfig> {
if (this.foo) {
cb(null, ['group-foo', 'group-bar']);
} else {
cb('error, try again', false);
cb(getInternalError("error, try again"), false);
}
*/
}
Expand All @@ -52,7 +53,7 @@ export default class AuthCustomPlugin implements IPluginAuth<CustomConfig> {
cb(null, true)
} else {
this.logger.error({name: user.name}, '@{name} is not allowed to access this package');
cb('error, try again', false);
cb(getInternalError("error, try again"), false);
}
*/
}
Expand All @@ -71,7 +72,7 @@ export default class AuthCustomPlugin implements IPluginAuth<CustomConfig> {
cb(null, true)
} else {
this.logger.error({name: user.name}, '@{name} is not allowed to publish this package');
cb('error, try again', false);
cb(getInternalError("error, try again"), false);
}
*/
}
Expand All @@ -84,7 +85,7 @@ export default class AuthCustomPlugin implements IPluginAuth<CustomConfig> {
cb(null, true)
} else {
this.logger.error({name: user.name}, '@{name} is not allowed to publish this package');
cb('error, try again', false);
cb(getInternalError("error, try again"), false);
}
*/
}
Expand Down
1 change: 1 addition & 0 deletions src/app/templates/typescript/common/eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
lib/
2 changes: 1 addition & 1 deletion src/app/templates/typescript/common/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "esnext",
"target": "es6",
"module": "commonjs",
"declaration": true,
"allowJs": false,
Expand Down
4 changes: 2 additions & 2 deletions src/app/templates/typescript/middleware/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"name": "<%= name %>",
"version": "0.0.1",
"description": "<%= description %>",
"main": "src/index.js",
"types": "src/index.d.ts",
"main": "lib/src/index.js",
"types": "lib/src/index.d.ts",
"engines": {
"node": ">=12"
},
Expand Down
4 changes: 2 additions & 2 deletions src/app/templates/typescript/storage/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"name": "<%= name %>",
"version": "0.0.1",
"description": "<%= description %>",
"main": "src/index.js",
"types": "src/index.d.ts",
"main": "lib/src/index.js",
"types": "lib/src/index.d.ts",
"engines": {
"node": ">=12"
},
Expand Down

0 comments on commit cb333bb

Please sign in to comment.