This repository has been archived by the owner on Jun 16, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4d5eb42
commit 0a5326d
Showing
23 changed files
with
251 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"generator-verdaccio-plugin": major | ||
--- | ||
|
||
fix: broken build | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
coverage/ | ||
build/* | ||
generators/* | ||
src/app/templates/typescript/common/index.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ yarn-error.log | |
.idea/* | ||
generators/* | ||
.pnpm-store/* | ||
.pnpm-debug.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
node_modules | ||
build/* | ||
generators/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"name": "<%= name %>", | ||
"version": "0.0.1", | ||
"description": "<%= description %>", | ||
"main": "lib/index.js", | ||
"types": "lib/index.d.ts", | ||
"files": ["lib/"], | ||
"engines": { | ||
"node": ">=12" | ||
}, | ||
"dependencies": { | ||
"@verdaccio/commons-api": "latest", | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "27.5.1", | ||
"@types/node": "^12.12.5", | ||
"@types/express": "4.17.13", | ||
"@typescript-eslint/eslint-plugin": "5.26.0", | ||
"@typescript-eslint/parser": "5.26.0", | ||
"@verdaccio/types": "latest", | ||
"eslint": "8.16.0", | ||
"jest": "28.1.1", | ||
"typescript": "4.7.3" | ||
}, | ||
"keywords": ["<%= keywords %>]"], | ||
"license": "<%= license %>", | ||
"repository": "<%= repository %>", | ||
"author": "<%= authorName %> <<%= authorEmail %>>", | ||
"scripts": { | ||
"build": "tsc", | ||
"test": "jest .", | ||
"lint": "eslint \"**/*.{js,ts}\"" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
import { | ||
PluginOptions, | ||
AuthAccessCallback, | ||
AuthCallback, | ||
PackageAccess, | ||
IPluginAuth, | ||
RemoteUser, | ||
Logger, | ||
} from '@verdaccio/types'; | ||
|
||
import {CustomConfig} from '../types/index'; | ||
|
||
/** | ||
* Custom Verdaccio Authenticate Plugin. | ||
*/ | ||
export default class AuthCustomPlugin implements IPluginAuth<CustomConfig> { | ||
public logger: Logger; | ||
private foo: string; | ||
public constructor(config: CustomConfig, options: PluginOptions<CustomConfig>) { | ||
this.logger = options.logger; | ||
this.foo = config.foo; | ||
return this; | ||
} | ||
/** | ||
* Authenticate an user. | ||
* @param user user to log | ||
* @param password provided password | ||
* @param cb callback function | ||
*/ | ||
public authenticate(user: string, password: string, cb: AuthCallback): void { | ||
/** | ||
* This code is just an example for demostration purpose | ||
if (this.foo) { | ||
cb(null, ['group-foo', 'group-bar']); | ||
} else { | ||
cb('error, try again', false); | ||
} | ||
*/ | ||
} | ||
|
||
/** | ||
* Triggered on each access request | ||
* @param user | ||
* @param pkg | ||
* @param cb | ||
*/ | ||
public allow_access(user: RemoteUser, pkg: PackageAccess, cb: AuthAccessCallback): void { | ||
/** | ||
* This code is just an example for demostration purpose | ||
if (user.name === this.foo && pkg?.access?.includes[user.name]) { | ||
this.logger.debug({name: user.name}, 'your package has been granted for @{name}'); | ||
cb(null, true) | ||
} else { | ||
this.logger.error({name: user.name}, '@{name} is not allowed to access this package'); | ||
cb('error, try again', false); | ||
} | ||
*/ | ||
} | ||
|
||
/** | ||
* Triggered on each publish request | ||
* @param user | ||
* @param pkg | ||
* @param cb | ||
*/ | ||
public allow_publish(user: RemoteUser, pkg: PackageAccess, cb: AuthAccessCallback): void { | ||
/** | ||
* This code is just an example for demostration purpose | ||
if (user.name === this.foo && pkg?.access?.includes[user.name]) { | ||
this.logger.debug({name: user.name}, '@{name} has been granted to publish'); | ||
cb(null, true) | ||
} else { | ||
this.logger.error({name: user.name}, '@{name} is not allowed to publish this package'); | ||
cb('error, try again', false); | ||
} | ||
*/ | ||
} | ||
|
||
public allow_unpublish(user: RemoteUser, pkg: PackageAccess, cb: AuthAccessCallback): void { | ||
/** | ||
* This code is just an example for demostration purpose | ||
if (user.name === this.foo && pkg?.access?.includes[user.name]) { | ||
this.logger.debug({name: user.name}, '@{name} has been granted to unpublish'); | ||
cb(null, true) | ||
} else { | ||
this.logger.error({name: user.name}, '@{name} is not allowed to publish this package'); | ||
cb('error, try again', false); | ||
} | ||
*/ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import {Config} from '@verdaccio/types'; | ||
|
||
export interface CustomConfig extends Config { | ||
foo: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# <%= name %> | ||
|
||
<%- (description || '').split('\n').map(function (line) { | ||
return '> ' + line | ||
}).join('\n') %> | ||
|
||
--- | ||
|
||
## development | ||
|
||
See the [verdaccio contributing guide](https://github.com/verdaccio/verdaccio/blob/master/CONTRIBUTING.md) for instructions setting up your development environment. | ||
Once you have completed that, use the following npm tasks. | ||
|
||
- `npm run build` | ||
|
||
Build a distributable archive | ||
|
||
- `npm run test` | ||
|
||
Run unit test | ||
|
||
For more information about any of these commands run `npm run ${task} -- --help`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# top-most EditorConfig file | ||
root = true | ||
|
||
# Unix-style newlines with a newline ending every file | ||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
|
||
# 2 space indentation | ||
[{.,}*.{js,yml,yaml}] | ||
indent_style = space | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
lib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"root": true, | ||
"parser": "@typescript-eslint/parser", | ||
"plugins": [ | ||
"@typescript-eslint" | ||
], | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/eslint-recommended", | ||
"plugin:@typescript-eslint/recommended" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
npm-debug.log* | ||
node_modules | ||
/lib/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
"use strict"; | ||
|
||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
|
||
var _index = _interopRequireDefault(require("./lib/index")); | ||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
|
||
var _default = _index.default; | ||
exports.default = _default; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const index_1 = __importDefault(require("./generators/index")); | ||
exports.default = index_1.default; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
name: 'verdaccio-<%= name %>', | ||
preset: 'ts-jest', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
src/ | ||
.eslintrc | ||
test/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "esnext", | ||
"module": "commonjs", | ||
"declaration": true, | ||
"allowJs": false, | ||
"noImplicitAny": false, | ||
"strict": true, | ||
"outDir": "./lib", | ||
"allowSyntheticDefaultImports": true, | ||
"esModuleInterop": true | ||
}, | ||
"include": [ | ||
"src/*.ts", | ||
"types/*.ts" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import {Config} from '@verdaccio/types'; | ||
|
||
export interface CustomConfig extends Config { | ||
foo: string; | ||
} |
This file was deleted.
Oops, something went wrong.