generator-verdaccio-plugin 6.0.0-next-8.28 → 6.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.
Files changed (27) hide show
  1. package/LICENSE +6 -6
  2. package/README.md +6 -76
  3. package/generators/app/index.d.ts +11 -0
  4. package/generators/app/index.js +131 -122
  5. package/generators/app/templates/auth/_package.json +3 -16
  6. package/generators/app/templates/auth/src/auth-plugin.ts +102 -0
  7. package/generators/app/templates/auth/src/index.ts +3 -90
  8. package/generators/app/templates/auth/types/index.ts +1 -1
  9. package/generators/app/templates/common/_package.json +26 -0
  10. package/generators/app/templates/common/npmignore +1 -1
  11. package/generators/app/templates/common/nvmrc +1 -0
  12. package/generators/app/templates/middleware/_package.json +3 -17
  13. package/generators/app/templates/middleware/src/index.ts +3 -40
  14. package/generators/app/templates/middleware/src/middleware-plugin.ts +40 -0
  15. package/generators/app/templates/middleware/types/index.ts +1 -1
  16. package/generators/app/templates/storage/_package.json +3 -15
  17. package/generators/app/templates/storage/src/index.ts +5 -1
  18. package/generators/app/templates/storage/src/storage-plugin.ts +70 -0
  19. package/generators/app/templates/storage/types/index.ts +1 -1
  20. package/package.json +50 -26
  21. package/generators/app/index.js.map +0 -1
  22. package/generators/app/templates/common/eslintignore +0 -2
  23. package/generators/app/templates/common/eslintrc +0 -12
  24. package/generators/app/templates/common/index.js +0 -15
  25. package/generators/app/templates/common/jest.config.js +0 -4
  26. package/generators/app/templates/storage/src/PackageStorage.ts +0 -175
  27. package/generators/app/templates/storage/src/plugin.ts +0 -134
@@ -1,134 +0,0 @@
1
- import { getInternalError } from '@verdaccio/commons-api';
2
- import {
3
- Callback,
4
- Config,
5
- IPackageStorage,
6
- IPluginStorage,
7
- Logger,
8
- PluginOptions,
9
- Token,
10
- TokenFilter,
11
- onEndSearchPackage,
12
- onSearchPackage,
13
- onValidatePackage,
14
- } from '@verdaccio/types';
15
-
16
- import { CustomConfig } from '../types/index';
17
- import PackageStorage from './PackageStorage';
18
-
19
- export default class VerdaccioStoragePlugin implements IPluginStorage<CustomConfig> {
20
- config: CustomConfig & Config;
21
- version?: string;
22
- public logger: Logger;
23
- public constructor(config: CustomConfig, options: PluginOptions<CustomConfig>) {
24
- this.config = config;
25
- this.logger = options.logger;
26
- }
27
-
28
- /**
29
- *
30
- */
31
- public async getSecret(): Promise<string> {
32
- /**
33
- * return await resolveSecret();
34
- */
35
- }
36
-
37
- public async setSecret(secret: string): Promise<any> {
38
- /**
39
- * return await getYourSecret();
40
- */
41
- }
42
-
43
- /**
44
- * Add a new element.
45
- * @param {*} name
46
- * @return {Error|*}
47
- */
48
- public add(name: string, callback: Callback): void {}
49
-
50
- /**
51
- * Perform a search in your registry
52
- * @param onPackage
53
- * @param onEnd
54
- * @param validateName
55
- */
56
- public search(
57
- onPackage: onSearchPackage,
58
- onEnd: onEndSearchPackage,
59
- validateName: onValidatePackage
60
- ): void {
61
- /**
62
- * Example of implementation:
63
- * try {
64
- * someApi.getPackages((items) => {
65
- * items.map(() => {
66
- * if (validateName(item.name)) {
67
- * onPackage(item);
68
- * }
69
- * });
70
- * onEnd();
71
- * } catch(err) {
72
- * onEnd(err);
73
- * }
74
- * });
75
- */
76
- }
77
-
78
- /**
79
- * Remove an element from the database.
80
- * @param {*} name
81
- * @return {Error|*}
82
- */
83
- public remove(name: string, callback: Callback): void {
84
- /**
85
- * Example of implementation
86
- database.getPackage(name, (item, err) => {
87
- if (err) {
88
- callback(getInternalError('your own message here'));
89
- }
90
-
91
- // if all goes well we return nothing
92
- callback(null);
93
- }
94
- */
95
- }
96
-
97
- /**
98
- * Return all database elements.
99
- * @return {Array}
100
- */
101
- public get(callback: Callback): void {
102
- /*
103
- Example of implementation
104
- database.getAll((allItems, err) => {
105
- callback(err, allItems);
106
- })
107
- */
108
- }
109
-
110
- /**
111
- * Create an instance of the `PackageStorage`
112
- * @param packageInfo
113
- */
114
- public getPackageStorage(packageInfo: string): IPackageStorage {
115
- return new PackageStorage(this.config, packageInfo, this.logger);
116
- }
117
-
118
- /**
119
- * All methods for npm token support
120
- * more info here https://github.com/verdaccio/verdaccio/pull/1427
121
- */
122
-
123
- public saveToken(token: Token): Promise<any> {
124
- throw new Error('Method not implemented.');
125
- }
126
-
127
- public deleteToken(user: string, tokenKey: string): Promise<any> {
128
- throw new Error('Method not implemented.');
129
- }
130
-
131
- public readTokens(filter: TokenFilter): Promise<Token[]> {
132
- throw new Error('Method not implemented.');
133
- }
134
- }