generator-verdaccio-plugin 6.0.1 → 6.1.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.
@@ -28,12 +28,13 @@ class PluginGenerator extends yeoman_generator_1.default {
28
28
  { name: 'Auth', value: 'auth' },
29
29
  { name: 'Storage', value: 'storage' },
30
30
  { name: 'Middleware', value: 'middleware' },
31
+ { name: 'Filter', value: 'filter' },
31
32
  ],
32
33
  },
33
34
  {
34
35
  type: 'input',
35
36
  name: 'name',
36
- message: 'What\'s the plugin name? The prefix (verdaccio-xxx) will be added automatically',
37
+ message: "What's the plugin name? The prefix (verdaccio-xxx) will be added automatically",
37
38
  default: process.env.PLUGIN_NAME ?? 'my-plugin',
38
39
  validate: (input) => {
39
40
  if (!input) {
@@ -60,13 +61,13 @@ class PluginGenerator extends yeoman_generator_1.default {
60
61
  {
61
62
  type: 'input',
62
63
  name: 'authorName',
63
- message: 'Author\'s Name',
64
+ message: "Author's Name",
64
65
  store: true,
65
66
  },
66
67
  {
67
68
  type: 'input',
68
69
  name: 'authorEmail',
69
- message: 'Author\'s Email',
70
+ message: "Author's Email",
70
71
  store: true,
71
72
  },
72
73
  {
@@ -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
- user: RemoteUser,
80
- pkg: PackageAccess,
81
- cb: pluginUtils.AuthAccessCallback,
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
@@ -1,5 +1,5 @@
1
1
  import AuthPlugin from './auth-plugin';
2
2
 
3
- export {AuthPlugin};
3
+ export { AuthPlugin };
4
4
 
5
5
  export default AuthPlugin;
@@ -1,4 +1,4 @@
1
- import {Config} from '@verdaccio/types';
1
+ import { Config } from '@verdaccio/types';
2
2
 
3
3
  export interface CustomConfig extends Config {
4
4
  foo: string;
@@ -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.3",
17
+ "@types/express": "4.17.13",
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,29 @@
1
+ import { Config, Logger, Manifest } from '@verdaccio/types';
2
+
3
+ import debugCore from 'debug';
4
+ const debug = debugCore('verdaccio:plugin:filter');
5
+
6
+ import { CustomConfig } from '../types';
7
+ import { pluginUtils } from '@verdaccio/core';
8
+
9
+ export default class FilterPlugin extends pluginUtils.Plugin<CustomConfig> implements pluginUtils.ManifestFilter<CustomConfig> {
10
+ private _logger: Logger;
11
+ private _config: {};
12
+ private _app_config: Config;
13
+ public constructor(config: CustomConfig, appOptions: pluginUtils.PluginOptions) {
14
+ super(config, appOptions);
15
+ this._config = config;
16
+ this._logger = appOptions.logger;
17
+ this._app_config = appOptions.config;
18
+ debug('FilterPlugin config: %o', this._config);
19
+ debug('App Config: %o', this._app_config);
20
+ }
21
+
22
+ public async filter_metadata(packageInfo: Readonly<Manifest>): Promise<Manifest> {
23
+ const newPackage: Manifest = { ...packageInfo };
24
+ this._logger.info(`Filtering package metadata for package: ${packageInfo.name}`);
25
+ debug('Original package metadata: %o', packageInfo);
26
+ // TODO: do some filtering based on config
27
+ return Promise.resolve(newPackage);
28
+ }
29
+ }
@@ -0,0 +1,5 @@
1
+ import FilterPlugin from './filter-plugin';
2
+
3
+ export { FilterPlugin };
4
+
5
+ export default FilterPlugin;
@@ -0,0 +1,5 @@
1
+ import { Config } from '@verdaccio/types';
2
+
3
+ export interface CustomConfig extends Config {
4
+ foo: string;
5
+ }
@@ -1,5 +1,5 @@
1
1
  import MiddlewarePlugin from './middleware-plugin';
2
2
 
3
- export {MiddlewarePlugin};
3
+ export { MiddlewarePlugin };
4
4
 
5
- export default MiddlewarePlugin;
5
+ export default MiddlewarePlugin;
@@ -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
  });
@@ -1,4 +1,4 @@
1
- import {Config} from '@verdaccio/types';
1
+ import { Config } from '@verdaccio/types';
2
2
 
3
3
  export interface CustomConfig extends Config {
4
4
  foo: string;
@@ -1,5 +1,5 @@
1
1
  import StoragePlugin from './storage-plugin';
2
2
 
3
- export {StoragePlugin};
3
+ export { StoragePlugin };
4
4
 
5
5
  export default StoragePlugin;
@@ -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
- _results: searchUtils.SearchItemPkg[],
40
- _query: searchUtils.SearchQuery,
39
+ _results: searchUtils.SearchItemPkg[],
40
+ _query: searchUtils.SearchQuery
41
41
  ): Promise<searchUtils.SearchItemPkg[]> {
42
42
  throw errorUtils.getServiceUnavailable();
43
43
  }
@@ -1,4 +1,4 @@
1
- import {Config} from '@verdaccio/types';
1
+ import { Config } from '@verdaccio/types';
2
2
 
3
3
  export interface CustomConfig extends Config {
4
4
  foo: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generator-verdaccio-plugin",
3
- "version": "6.0.1",
3
+ "version": "6.1.0",
4
4
  "description": "plugin generator for verdaccio",
5
5
  "homepage": "https://github.com/verdaccio",
6
6
  "author": {
@@ -37,19 +37,11 @@
37
37
  "@types/lodash": "4.14.195",
38
38
  "@types/mocha": "10.0.1",
39
39
  "@types/node": "25.0.3",
40
- "@typescript-eslint/eslint-plugin": "6.21.0",
41
- "@typescript-eslint/parser": "6.21.0",
42
40
  "@verdaccio/auth": "8.0.0-next-8.28",
41
+ "@verdaccio/eslint-config": "11.0.1",
43
42
  "@verdaccio/types": "13.0.0-next-8.10",
44
43
  "@vitest/coverage-v8": "4.0.16",
45
44
  "eslint": "8.57.1",
46
- "eslint-config-google": "0.14.0",
47
- "eslint-config-prettier": "10.1.8",
48
- "eslint-plugin-babel": "5.3.1",
49
- "eslint-plugin-import": "2.32.0",
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
45
  "express": "4.18.2",
54
46
  "prettier": "3.4.2",
55
47
  "typescript": "5.9.3",