generator-verdaccio-plugin 6.0.1 → 7.0.0
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.
- package/README.md +107 -13
- package/generators/app/index.js +28 -32
- package/generators/app/templates/auth/_package.json +3 -3
- package/generators/app/templates/auth/src/auth-plugin.ts +10 -9
- package/generators/app/templates/auth/src/index.ts +1 -1
- package/generators/app/templates/auth/types/index.ts +1 -1
- package/generators/app/templates/filter/_package.json +33 -0
- package/generators/app/templates/filter/src/filter-plugin.ts +33 -0
- package/generators/app/templates/filter/src/index.ts +5 -0
- package/generators/app/templates/filter/types/index.ts +5 -0
- package/generators/app/templates/middleware/_package.json +2 -2
- package/generators/app/templates/middleware/src/index.ts +2 -2
- package/generators/app/templates/middleware/src/middleware-plugin.ts +9 -8
- package/generators/app/templates/middleware/types/index.ts +1 -1
- package/generators/app/templates/storage/_package.json +2 -2
- package/generators/app/templates/storage/src/index.ts +1 -1
- package/generators/app/templates/storage/src/storage-plugin.ts +4 -4
- package/generators/app/templates/storage/types/index.ts +1 -1
- package/package.json +26 -26
package/README.md
CHANGED
|
@@ -5,33 +5,127 @@
|
|
|
5
5
|
[](https://opencollective.com/verdaccio)
|
|
6
6
|
[](http://chat.verdaccio.org/)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
A [Yeoman](http://yeoman.io) generator that scaffolds [Verdaccio](https://verdaccio.org) plugins with TypeScript and a ready-to-use project structure — so you can focus on writing plugin logic instead of boilerplate.
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Requirements
|
|
11
|
+
|
|
12
|
+
- [Node.js](https://nodejs.org/) >= 20
|
|
13
|
+
- [Yeoman](http://yeoman.io) (`yo`)
|
|
11
14
|
|
|
12
|
-
|
|
15
|
+
## Installation
|
|
13
16
|
|
|
14
17
|
```bash
|
|
15
|
-
npm install -g yo
|
|
16
|
-
npm install -g generator-verdaccio-plugin
|
|
18
|
+
npm install -g yo generator-verdaccio-plugin
|
|
17
19
|
```
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
## Quick Start
|
|
20
22
|
|
|
21
23
|
```bash
|
|
22
24
|
yo verdaccio-plugin
|
|
23
25
|
```
|
|
24
26
|
|
|
25
|
-
|
|
27
|
+
The generator walks you through a short set of prompts and creates a `verdaccio-<name>/` directory with everything you need.
|
|
28
|
+
|
|
29
|
+
## Interactive Prompts
|
|
30
|
+
|
|
31
|
+
| Prompt | Description |
|
|
32
|
+
| --------------------- | --------------------------------------------------------------------------- |
|
|
33
|
+
| Plugin type | `auth`, `storage`, `middleware`, or `filter` (see below) |
|
|
34
|
+
| Plugin name | Suffix after `verdaccio-` — e.g. `my-plugin` produces `verdaccio-my-plugin` |
|
|
35
|
+
| Description | Short description added to `package.json` |
|
|
36
|
+
| GitHub username / org | Populates the `repository` field in `package.json` |
|
|
37
|
+
| Author name & email | Stored locally and reused in future runs |
|
|
38
|
+
| Keywords | Comma-separated; `verdaccio` is always appended automatically |
|
|
39
|
+
|
|
40
|
+
## Plugin Types
|
|
41
|
+
|
|
42
|
+
| Type | Implements | Use when you want to… |
|
|
43
|
+
| ------------ | ----------------------------------------------- | ----------------------------------------------------------------- |
|
|
44
|
+
| `auth` | `authenticate`, `allow_access`, `allow_publish` | Control who can log in and access packages |
|
|
45
|
+
| `storage` | Custom storage backend | Store packages somewhere other than the local filesystem |
|
|
46
|
+
| `middleware` | Express middleware | Add custom HTTP routes or request/response processing |
|
|
47
|
+
| `filter` | `filter_metadata` | Transform or filter package metadata before it reaches the client |
|
|
48
|
+
|
|
49
|
+
### Registering your plugin in `verdaccio.yaml`
|
|
50
|
+
|
|
51
|
+
**Auth**
|
|
52
|
+
|
|
53
|
+
```yaml
|
|
54
|
+
auth:
|
|
55
|
+
verdaccio-my-plugin:
|
|
56
|
+
# your custom config
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Storage**
|
|
60
|
+
|
|
61
|
+
```yaml
|
|
62
|
+
store:
|
|
63
|
+
verdaccio-my-plugin:
|
|
64
|
+
# your custom config
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**Middleware**
|
|
68
|
+
|
|
69
|
+
```yaml
|
|
70
|
+
middlewares:
|
|
71
|
+
verdaccio-my-plugin:
|
|
72
|
+
enabled: true
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**Filter**
|
|
76
|
+
|
|
77
|
+
```yaml
|
|
78
|
+
filters:
|
|
79
|
+
verdaccio-my-plugin:
|
|
80
|
+
# your custom config
|
|
81
|
+
```
|
|
26
82
|
|
|
27
|
-
|
|
28
|
-
- Storage
|
|
29
|
-
- Middleware
|
|
83
|
+
## Generated Project Structure
|
|
30
84
|
|
|
31
|
-
|
|
85
|
+
```
|
|
86
|
+
verdaccio-<name>/
|
|
87
|
+
├── src/
|
|
88
|
+
│ ├── index.ts # Re-exports the plugin class
|
|
89
|
+
│ └── *-plugin.ts # Main plugin implementation
|
|
90
|
+
├── types/
|
|
91
|
+
│ └── index.d.ts # Custom configuration types
|
|
92
|
+
├── .editorconfig
|
|
93
|
+
├── .gitignore
|
|
94
|
+
├── .npmignore
|
|
95
|
+
├── .nvmrc
|
|
96
|
+
├── package.json
|
|
97
|
+
├── README.md
|
|
98
|
+
└── tsconfig.json
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
After scaffolding, build the plugin and link it for local testing:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
cd verdaccio-<name>
|
|
105
|
+
npm install
|
|
106
|
+
npm run build
|
|
107
|
+
npm link
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Then add the plugin name to your `verdaccio.yaml` and run Verdaccio.
|
|
111
|
+
|
|
112
|
+
## Contributing
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
# Install dependencies
|
|
116
|
+
pnpm install
|
|
117
|
+
|
|
118
|
+
# Build the generator
|
|
119
|
+
pnpm build
|
|
120
|
+
|
|
121
|
+
# Run tests
|
|
122
|
+
pnpm test
|
|
123
|
+
|
|
124
|
+
# Run tests with coverage
|
|
125
|
+
pnpm test:coverage
|
|
126
|
+
```
|
|
32
127
|
|
|
33
|
-
|
|
34
|
-
- [Juan Picado](https://github.com/juanpicado)
|
|
128
|
+
See the [Verdaccio contributing guide](https://github.com/verdaccio/verdaccio/blob/master/CONTRIBUTING.md) for broader contribution guidelines.
|
|
35
129
|
|
|
36
130
|
## License
|
|
37
131
|
|
package/generators/app/index.js
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const node_path_1 = require("node:path");
|
|
9
|
-
const yeoman_generator_1 = __importDefault(require("yeoman-generator"));
|
|
10
|
-
const yosay_1 = __importDefault(require("yosay"));
|
|
11
|
-
const package_json_1 = __importDefault(require("../../package.json"));
|
|
12
|
-
class PluginGenerator extends yeoman_generator_1.default {
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import _ from 'lodash';
|
|
3
|
+
import { resolve } from 'node:path';
|
|
4
|
+
import Generator from 'yeoman-generator';
|
|
5
|
+
import yosay from 'yosay';
|
|
6
|
+
import rootPackageJSON from '../../package.json' with { type: 'json' };
|
|
7
|
+
export default class PluginGenerator extends Generator {
|
|
13
8
|
props = {};
|
|
14
9
|
projectName = 'verdaccio-';
|
|
15
10
|
destinationPathName = '';
|
|
@@ -17,7 +12,7 @@ class PluginGenerator extends yeoman_generator_1.default {
|
|
|
17
12
|
super(args, opts);
|
|
18
13
|
}
|
|
19
14
|
async prompting() {
|
|
20
|
-
this.log((
|
|
15
|
+
this.log(yosay(`Welcome to ${chalk.red('generator-verdaccio-plugin')} plugin generator!`));
|
|
21
16
|
const answers = await this.prompt([
|
|
22
17
|
{
|
|
23
18
|
type: 'list',
|
|
@@ -28,12 +23,13 @@ class PluginGenerator extends yeoman_generator_1.default {
|
|
|
28
23
|
{ name: 'Auth', value: 'auth' },
|
|
29
24
|
{ name: 'Storage', value: 'storage' },
|
|
30
25
|
{ name: 'Middleware', value: 'middleware' },
|
|
26
|
+
{ name: 'Filter', value: 'filter' },
|
|
31
27
|
],
|
|
32
28
|
},
|
|
33
29
|
{
|
|
34
30
|
type: 'input',
|
|
35
31
|
name: 'name',
|
|
36
|
-
message:
|
|
32
|
+
message: "What's the plugin name? The prefix (verdaccio-xxx) will be added automatically",
|
|
37
33
|
default: process.env.PLUGIN_NAME ?? 'my-plugin',
|
|
38
34
|
validate: (input) => {
|
|
39
35
|
if (!input) {
|
|
@@ -60,20 +56,20 @@ class PluginGenerator extends yeoman_generator_1.default {
|
|
|
60
56
|
{
|
|
61
57
|
type: 'input',
|
|
62
58
|
name: 'authorName',
|
|
63
|
-
message:
|
|
59
|
+
message: "Author's Name",
|
|
64
60
|
store: true,
|
|
65
61
|
},
|
|
66
62
|
{
|
|
67
63
|
type: 'input',
|
|
68
64
|
name: 'authorEmail',
|
|
69
|
-
message:
|
|
65
|
+
message: "Author's Email",
|
|
70
66
|
store: true,
|
|
71
67
|
},
|
|
72
68
|
{
|
|
73
69
|
type: 'input',
|
|
74
70
|
name: 'keywords',
|
|
75
71
|
message: 'Type your keywords (comma separated)',
|
|
76
|
-
filter: (keywords) =>
|
|
72
|
+
filter: (keywords) => _.uniq(_.words(keywords).concat(['verdaccio'])),
|
|
77
73
|
},
|
|
78
74
|
]);
|
|
79
75
|
this.props = {
|
|
@@ -81,7 +77,7 @@ class PluginGenerator extends yeoman_generator_1.default {
|
|
|
81
77
|
license: 'MIT',
|
|
82
78
|
};
|
|
83
79
|
this.projectName = `verdaccio-${answers.name}`;
|
|
84
|
-
this.destinationPathName =
|
|
80
|
+
this.destinationPathName = resolve(this.projectName);
|
|
85
81
|
this.props.name = this.projectName;
|
|
86
82
|
if (answers.githubUsername) {
|
|
87
83
|
this.props.repository = `${answers.githubUsername}/${answers.name}`;
|
|
@@ -95,28 +91,29 @@ class PluginGenerator extends yeoman_generator_1.default {
|
|
|
95
91
|
}
|
|
96
92
|
const pkg = this.fs.readJSON(this.templatePath(`${pluginType}/_package.json`));
|
|
97
93
|
// devDependencies
|
|
98
|
-
pkg.devDependencies['@types/node'] =
|
|
99
|
-
pkg.devDependencies['@types/express'] =
|
|
100
|
-
pkg.devDependencies['@types/debug'] =
|
|
101
|
-
pkg.devDependencies['typescript'] =
|
|
102
|
-
pkg.devDependencies['@verdaccio/types'] =
|
|
94
|
+
pkg.devDependencies['@types/node'] = rootPackageJSON.devDependencies['@types/node'];
|
|
95
|
+
pkg.devDependencies['@types/express'] = rootPackageJSON.devDependencies['@types/express'];
|
|
96
|
+
pkg.devDependencies['@types/debug'] = rootPackageJSON.devDependencies['@types/debug'];
|
|
97
|
+
pkg.devDependencies['typescript'] = rootPackageJSON.devDependencies['typescript'];
|
|
98
|
+
pkg.devDependencies['@verdaccio/types'] = rootPackageJSON.devDependencies['@verdaccio/types'];
|
|
103
99
|
// required by verdaccio types
|
|
104
|
-
pkg.devDependencies['@types/jsonwebtoken'] =
|
|
100
|
+
pkg.devDependencies['@types/jsonwebtoken'] =
|
|
101
|
+
rootPackageJSON.devDependencies['@types/jsonwebtoken'];
|
|
105
102
|
// dependencies
|
|
106
|
-
pkg.dependencies['@verdaccio/core'] =
|
|
107
|
-
pkg.dependencies['@verdaccio/config'] =
|
|
108
|
-
pkg.dependencies['debug'] =
|
|
103
|
+
pkg.dependencies['@verdaccio/core'] = rootPackageJSON.dependencies['@verdaccio/core'];
|
|
104
|
+
pkg.dependencies['@verdaccio/config'] = rootPackageJSON.dependencies['@verdaccio/config'];
|
|
105
|
+
pkg.dependencies['debug'] = rootPackageJSON.dependencies['debug'];
|
|
109
106
|
if (pluginType === 'auth') {
|
|
110
|
-
pkg.devDependencies['@verdaccio/auth'] =
|
|
107
|
+
pkg.devDependencies['@verdaccio/auth'] = rootPackageJSON.devDependencies['@verdaccio/auth'];
|
|
111
108
|
}
|
|
112
109
|
else if (pluginType === 'middleware') {
|
|
113
|
-
pkg.dependencies['express'] =
|
|
110
|
+
pkg.dependencies['express'] = rootPackageJSON.dependencies['express'];
|
|
114
111
|
}
|
|
115
112
|
this.fs.writeJSON(this.templatePath(`${pluginType}/_package.json`), pkg);
|
|
116
|
-
this.fs.copyTpl(this.templatePath(`${pluginType}/_package.json`), this.destinationPath(
|
|
113
|
+
this.fs.copyTpl(this.templatePath(`${pluginType}/_package.json`), this.destinationPath(resolve(this.destinationPathName, 'package.json')), this.props);
|
|
117
114
|
}
|
|
118
115
|
writing() {
|
|
119
|
-
const dest = (path) => this.destinationPath(
|
|
116
|
+
const dest = (path) => this.destinationPath(resolve(this.destinationPathName, path));
|
|
120
117
|
this.fs.copy(this.templatePath('common/gitignore'), dest('.gitignore'));
|
|
121
118
|
this.fs.copy(this.templatePath('common/npmignore'), dest('.npmignore'));
|
|
122
119
|
this.fs.copy(this.templatePath('common/nvmrc'), dest('.nvmrc'));
|
|
@@ -131,4 +128,3 @@ class PluginGenerator extends yeoman_generator_1.default {
|
|
|
131
128
|
this.destinationRoot(this.projectName);
|
|
132
129
|
}
|
|
133
130
|
}
|
|
134
|
-
exports.default = PluginGenerator;
|
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
"debug": "4.4.3"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@types/node": "25.0.
|
|
17
|
-
"@types/express": "4.17.
|
|
16
|
+
"@types/node": "25.0.9",
|
|
17
|
+
"@types/express": "4.17.25",
|
|
18
18
|
"@types/debug": "4.1.12",
|
|
19
19
|
"typescript": "5.9.3",
|
|
20
20
|
"@verdaccio/types": "13.0.0-next-8.10",
|
|
21
21
|
"@types/jsonwebtoken": "9.0.10",
|
|
22
|
-
"@verdaccio/auth": "8.0.0-next-8.
|
|
22
|
+
"@verdaccio/auth": "8.0.0-next-8.29"
|
|
23
23
|
},
|
|
24
24
|
"keywords": [
|
|
25
25
|
"<%= keywords %>]"
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import debugCore from 'debug';
|
|
2
2
|
|
|
3
|
-
import {API_ERROR, errorUtils, pluginUtils} from '@verdaccio/core';
|
|
4
|
-
import {Config, Logger, PackageAccess, RemoteUser} from '@verdaccio/types';
|
|
3
|
+
import { API_ERROR, errorUtils, pluginUtils } from '@verdaccio/core';
|
|
4
|
+
import { Config, Logger, PackageAccess, RemoteUser } from '@verdaccio/types';
|
|
5
5
|
|
|
6
|
-
import {CustomConfig} from '../types/index';
|
|
6
|
+
import { CustomConfig } from '../types/index';
|
|
7
7
|
|
|
8
|
-
const {Plugin} = pluginUtils;
|
|
8
|
+
const { Plugin } = pluginUtils;
|
|
9
9
|
|
|
10
10
|
// Initialize debug logging
|
|
11
11
|
// Replace 'custom-auth-plugin' with your plugin name
|
|
@@ -17,7 +17,8 @@ const debug = debugCore('verdaccio:plugin:custom-auth-plugin');
|
|
|
17
17
|
*/
|
|
18
18
|
export default class AuthCustomPlugin
|
|
19
19
|
extends Plugin<CustomConfig>
|
|
20
|
-
implements pluginUtils.Auth<CustomConfig>
|
|
20
|
+
implements pluginUtils.Auth<CustomConfig>
|
|
21
|
+
{
|
|
21
22
|
private _logger: Logger;
|
|
22
23
|
private _config: {};
|
|
23
24
|
private _app_config: Config;
|
|
@@ -44,7 +45,7 @@ export default class AuthCustomPlugin
|
|
|
44
45
|
// TODO: replace this code with your own authentication logic
|
|
45
46
|
if (password === 'verdaccio') {
|
|
46
47
|
this._logger.info(`User @{user} authenticated successfully`);
|
|
47
|
-
debug('User @{user} authenticated successfully', {user});
|
|
48
|
+
debug('User @{user} authenticated successfully', { user });
|
|
48
49
|
return cb(null, [user]);
|
|
49
50
|
} else {
|
|
50
51
|
this._logger.error(`User @{user} authentication failed`);
|
|
@@ -76,9 +77,9 @@ export default class AuthCustomPlugin
|
|
|
76
77
|
}
|
|
77
78
|
|
|
78
79
|
public allow_publish(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
user: RemoteUser,
|
|
81
|
+
pkg: PackageAccess,
|
|
82
|
+
cb: pluginUtils.AuthAccessCallback
|
|
82
83
|
): void {
|
|
83
84
|
// TODO: replace this code with your own publish logic
|
|
84
85
|
// TODO: replace this code with your own publish logic
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "<%= name %>",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "<%= description %>",
|
|
5
|
+
"main": "lib/src/index.js",
|
|
6
|
+
"types": "lib/src/index.d.ts",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=18"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@verdaccio/core": "6.0.0-6-next.76",
|
|
12
|
+
"@verdaccio/config": "6.0.0-6-next.76",
|
|
13
|
+
"debug": "4.4.3"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@types/node": "25.0.9",
|
|
17
|
+
"@types/express": "4.17.25",
|
|
18
|
+
"@types/debug": "4.1.12",
|
|
19
|
+
"typescript": "5.9.3",
|
|
20
|
+
"@verdaccio/types": "13.0.0-next-8.10",
|
|
21
|
+
"@types/jsonwebtoken": "9.0.10"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"<%= keywords %>"
|
|
25
|
+
],
|
|
26
|
+
"license": "<%= license %>",
|
|
27
|
+
"repository": "<%= repository %>",
|
|
28
|
+
"author": "<%= authorName %> <<%= authorEmail %>>",
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "tsc",
|
|
31
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import debugCore from 'debug';
|
|
2
|
+
|
|
3
|
+
import { pluginUtils } from '@verdaccio/core';
|
|
4
|
+
import { Config, Logger, Manifest } from '@verdaccio/types';
|
|
5
|
+
|
|
6
|
+
import { CustomConfig } from '../types';
|
|
7
|
+
|
|
8
|
+
const debug = debugCore('verdaccio:plugin:filter');
|
|
9
|
+
|
|
10
|
+
export default class FilterPlugin
|
|
11
|
+
extends pluginUtils.Plugin<CustomConfig>
|
|
12
|
+
implements pluginUtils.ManifestFilter<CustomConfig>
|
|
13
|
+
{
|
|
14
|
+
private _logger: Logger;
|
|
15
|
+
private _config: {};
|
|
16
|
+
private _app_config: Config;
|
|
17
|
+
public constructor(config: CustomConfig, appOptions: pluginUtils.PluginOptions) {
|
|
18
|
+
super(config, appOptions);
|
|
19
|
+
this._config = config;
|
|
20
|
+
this._logger = appOptions.logger;
|
|
21
|
+
this._app_config = appOptions.config;
|
|
22
|
+
debug('FilterPlugin config: %o', this._config);
|
|
23
|
+
debug('App Config: %o', this._app_config);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
public async filter_metadata(packageInfo: Readonly<Manifest>): Promise<Manifest> {
|
|
27
|
+
const newPackage: Manifest = { ...packageInfo };
|
|
28
|
+
this._logger.info(`Filtering package metadata for package: ${packageInfo.name}`);
|
|
29
|
+
debug('Original package metadata: %o', packageInfo);
|
|
30
|
+
// TODO: do some filtering based on config
|
|
31
|
+
return Promise.resolve(newPackage);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"debug": "4.4.3"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@types/node": "25.0.
|
|
17
|
-
"@types/express": "4.17.
|
|
16
|
+
"@types/node": "25.0.9",
|
|
17
|
+
"@types/express": "4.17.25",
|
|
18
18
|
"@types/debug": "4.1.12",
|
|
19
19
|
"typescript": "5.9.3",
|
|
20
20
|
"@verdaccio/types": "13.0.0-next-8.10",
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
-
import express, {type Express, type Request, type Response} from 'express';
|
|
2
|
+
import express, { type Express, type Request, type Response } from 'express';
|
|
3
3
|
|
|
4
|
-
import type {Auth} from '@verdaccio/auth';
|
|
5
|
-
import {pluginUtils} from '@verdaccio/core';
|
|
6
|
-
import {Logger} from '@verdaccio/types';
|
|
4
|
+
import type { Auth } from '@verdaccio/auth';
|
|
5
|
+
import { pluginUtils } from '@verdaccio/core';
|
|
6
|
+
import { Logger } from '@verdaccio/types';
|
|
7
7
|
|
|
8
|
-
import {CustomConfig} from '../types';
|
|
8
|
+
import { CustomConfig } from '../types';
|
|
9
9
|
|
|
10
10
|
export default class ProxyAudit
|
|
11
11
|
extends pluginUtils.Plugin<CustomConfig>
|
|
12
|
-
implements pluginUtils.ExpressMiddleware<CustomConfig, {}, Auth>
|
|
12
|
+
implements pluginUtils.ExpressMiddleware<CustomConfig, {}, Auth>
|
|
13
|
+
{
|
|
13
14
|
readonly logger: Logger;
|
|
14
15
|
public constructor(config: CustomConfig, options: pluginUtils.PluginOptions) {
|
|
15
16
|
super(config, options);
|
|
@@ -25,8 +26,8 @@ export default class ProxyAudit
|
|
|
25
26
|
const router = express.Router();
|
|
26
27
|
/* eslint new-cap:off */
|
|
27
28
|
|
|
28
|
-
router.post('/custom-endpoint', express.json({limit: '10mb'}), (req, res, next) => {
|
|
29
|
-
this.logger.info({method: req.method, url: req.url}, 'middleware-demo: incoming request');
|
|
29
|
+
router.post('/custom-endpoint', express.json({ limit: '10mb' }), (req, res, next) => {
|
|
30
|
+
this.logger.info({ method: req.method, url: req.url }, 'middleware-demo: incoming request');
|
|
30
31
|
res.setHeader('x-verdaccio-middleware', 'demo');
|
|
31
32
|
next();
|
|
32
33
|
});
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"debug": "4.4.3"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"@types/node": "25.0.
|
|
18
|
-
"@types/express": "4.17.
|
|
17
|
+
"@types/node": "25.0.9",
|
|
18
|
+
"@types/express": "4.17.25",
|
|
19
19
|
"@types/debug": "4.1.12",
|
|
20
20
|
"typescript": "5.9.3",
|
|
21
21
|
"@verdaccio/types": "13.0.0-next-8.10",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
2
|
import debugCore from 'debug';
|
|
3
3
|
|
|
4
|
-
import {errorUtils, searchUtils} from '@verdaccio/core';
|
|
5
|
-
import {Callback, Config, Logger} from '@verdaccio/types';
|
|
4
|
+
import { errorUtils, searchUtils } from '@verdaccio/core';
|
|
5
|
+
import { Callback, Config, Logger } from '@verdaccio/types';
|
|
6
6
|
|
|
7
7
|
// Initialize debug logging
|
|
8
8
|
// Replace 'custom-auth-plugin' with your plugin name
|
|
@@ -36,8 +36,8 @@ class LocalDatabase {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
public async filterByQuery(
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
_results: searchUtils.SearchItemPkg[],
|
|
40
|
+
_query: searchUtils.SearchQuery
|
|
41
41
|
): Promise<searchUtils.SearchItemPkg[]> {
|
|
42
42
|
throw errorUtils.getServiceUnavailable();
|
|
43
43
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "generator-verdaccio-plugin",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "plugin generator for verdaccio",
|
|
5
5
|
"homepage": "https://github.com/verdaccio",
|
|
6
6
|
"author": {
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"email": "juanpicado19@gmail.com",
|
|
9
9
|
"url": "https://github.com/verdaccio/generator-verdaccio-plugin"
|
|
10
10
|
},
|
|
11
|
+
"type": "module",
|
|
11
12
|
"files": [
|
|
12
13
|
"generators"
|
|
13
14
|
],
|
|
@@ -20,40 +21,35 @@
|
|
|
20
21
|
"@verdaccio/core": "6.0.0-6-next.76",
|
|
21
22
|
"chalk": "4.1.2",
|
|
22
23
|
"debug": "4.4.3",
|
|
23
|
-
"lodash": "4.17.
|
|
24
|
+
"lodash": "4.17.23",
|
|
24
25
|
"yeoman-environment": "5.1.2",
|
|
25
26
|
"yeoman-generator": "7.5.1",
|
|
26
|
-
"yosay": "
|
|
27
|
+
"yosay": "3.0.0"
|
|
27
28
|
},
|
|
28
29
|
"devDependencies": {
|
|
29
|
-
"@changesets/changelog-github": "0.
|
|
30
|
-
"@changesets/cli": "2.
|
|
30
|
+
"@changesets/changelog-github": "0.5.2",
|
|
31
|
+
"@changesets/cli": "2.29.8",
|
|
31
32
|
"@changesets/get-dependents-graph": "1.3.5",
|
|
32
|
-
"@trivago/prettier-plugin-sort-imports": "4.
|
|
33
|
-
"@types/chalk": "2.2.
|
|
33
|
+
"@trivago/prettier-plugin-sort-imports": "4.3.0",
|
|
34
|
+
"@types/chalk": "2.2.4",
|
|
34
35
|
"@types/debug": "4.1.12",
|
|
35
|
-
"@types/express": "4.17.
|
|
36
|
+
"@types/express": "4.17.25",
|
|
36
37
|
"@types/jsonwebtoken": "9.0.10",
|
|
37
38
|
"@types/lodash": "4.14.195",
|
|
38
|
-
"@types/mocha": "10.0.
|
|
39
|
-
"@types/node": "25.0.
|
|
40
|
-
"@
|
|
41
|
-
"@
|
|
42
|
-
"@verdaccio/auth": "8.0.0-next-8.28",
|
|
39
|
+
"@types/mocha": "10.0.10",
|
|
40
|
+
"@types/node": "25.0.9",
|
|
41
|
+
"@verdaccio/auth": "8.0.0-next-8.29",
|
|
42
|
+
"@verdaccio/eslint-config": "12.0.0",
|
|
43
43
|
"@verdaccio/types": "13.0.0-next-8.10",
|
|
44
|
-
"@vitest/coverage-v8": "4.0.
|
|
45
|
-
"eslint": "
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"eslint-plugin-prettier": "5.5.4",
|
|
51
|
-
"eslint-plugin-simple-import-sort": "12.1.1",
|
|
52
|
-
"eslint-plugin-vitest-globals": "1.5.0",
|
|
53
|
-
"express": "4.18.2",
|
|
54
|
-
"prettier": "3.4.2",
|
|
44
|
+
"@vitest/coverage-v8": "4.0.18",
|
|
45
|
+
"eslint": "10.0.2",
|
|
46
|
+
"express": "4.22.1",
|
|
47
|
+
"prettier": "3.8.1",
|
|
48
|
+
"typedoc": "0.28.17",
|
|
49
|
+
"typedoc-plugin-markdown": "4.10.0",
|
|
55
50
|
"typescript": "5.9.3",
|
|
56
|
-
"
|
|
51
|
+
"vitepress": "1.6.4",
|
|
52
|
+
"vitest": "4.0.18",
|
|
57
53
|
"yeoman-test": "11.2.0"
|
|
58
54
|
},
|
|
59
55
|
"engines": {
|
|
@@ -77,6 +73,10 @@
|
|
|
77
73
|
"ci:version:changeset": "changeset version",
|
|
78
74
|
"ci:version": "npm run ci:version:changeset && npm run ci:version:install",
|
|
79
75
|
"ci:version:install": "pnpm install --frozen-lockfile=false",
|
|
80
|
-
"ci:publish": "changeset publish"
|
|
76
|
+
"ci:publish": "changeset publish",
|
|
77
|
+
"docs:api": "typedoc",
|
|
78
|
+
"docs:dev": "pnpm docs:api && vitepress dev docs",
|
|
79
|
+
"docs:build": "pnpm docs:api && vitepress build docs",
|
|
80
|
+
"docs:preview": "vitepress preview docs"
|
|
81
81
|
}
|
|
82
82
|
}
|