generator-verdaccio-plugin 3.0.1 → 4.0.0-next.2

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 (50) hide show
  1. package/README.md +2 -5
  2. package/generators/app/index.js +126 -132
  3. package/generators/app/index.js.map +1 -0
  4. package/generators/app/templates/typescript/auth/_package.json +12 -18
  5. package/generators/app/templates/typescript/auth/src/index.ts +1 -1
  6. package/generators/app/templates/typescript/auth/types/index.ts +1 -1
  7. package/generators/app/templates/typescript/common/eslintrc +10 -1
  8. package/generators/app/templates/typescript/common/index.js +13 -0
  9. package/generators/app/templates/typescript/common/index.js~Stashed changes +7 -0
  10. package/generators/app/templates/typescript/common/jest.config.js +1 -7
  11. package/generators/app/templates/typescript/common/npmignore +1 -2
  12. package/generators/app/templates/typescript/common/tsconfig.json +3 -6
  13. package/generators/app/templates/typescript/middleware/_package.json +13 -19
  14. package/generators/app/templates/typescript/middleware/src/index.ts +7 -7
  15. package/generators/app/templates/typescript/middleware/types/index.ts +1 -1
  16. package/generators/app/templates/typescript/storage/_package.json +12 -17
  17. package/generators/app/templates/typescript/storage/src/PackageStorage.ts +17 -17
  18. package/generators/app/templates/typescript/storage/src/index.ts +1 -1
  19. package/generators/app/templates/typescript/storage/src/plugin.ts +8 -8
  20. package/generators/app/templates/typescript/storage/types/index.ts +1 -1
  21. package/package.json +79 -38
  22. package/CHANGELOG.md +0 -106
  23. package/generators/app/index.d.ts +0 -11
  24. package/generators/app/index.ts +0 -215
  25. package/generators/app/templates/.eslintrc +0 -5
  26. package/generators/app/templates/javascript/.eslintrc +0 -5
  27. package/generators/app/templates/javascript/auth/_package.json +0 -33
  28. package/generators/app/templates/javascript/auth/src/index.js +0 -35
  29. package/generators/app/templates/javascript/common/README.md +0 -22
  30. package/generators/app/templates/javascript/common/babelrc +0 -3
  31. package/generators/app/templates/javascript/common/editorconfig +0 -12
  32. package/generators/app/templates/javascript/common/eslintignore +0 -2
  33. package/generators/app/templates/javascript/common/eslintrc +0 -3
  34. package/generators/app/templates/javascript/common/gitignore +0 -3
  35. package/generators/app/templates/javascript/common/index.js +0 -1
  36. package/generators/app/templates/javascript/common/jest.config.js +0 -10
  37. package/generators/app/templates/javascript/common/npmignore +0 -4
  38. package/generators/app/templates/javascript/common/travis.yml +0 -6
  39. package/generators/app/templates/javascript/middleware/_package.json +0 -34
  40. package/generators/app/templates/javascript/middleware/src/index.js +0 -8
  41. package/generators/app/templates/javascript/storage/_package.json +0 -33
  42. package/generators/app/templates/javascript/storage/src/PackageStorage.js +0 -153
  43. package/generators/app/templates/javascript/storage/src/index.js +0 -1
  44. package/generators/app/templates/javascript/storage/src/plugin.js +0 -106
  45. package/generators/app/templates/typescript/common/babelrc +0 -3
  46. package/generators/app/templates/typescript/common/index.ts +0 -3
  47. package/generators/app/templates/typescript/common/travis.yml +0 -6
  48. package/generators/app/types.d.ts +0 -10
  49. package/generators/app/types.js +0 -2
  50. package/generators/app/types.ts +0 -10
@@ -1,35 +0,0 @@
1
- /**
2
- * Custom Verdaccio Authenticate Plugin.
3
- */
4
- class AuthCustomPlugin {
5
- constructor(config, options) {
6
- return this;
7
- }
8
- /**
9
- * Authenticate an user.
10
- * @param user user to log
11
- * @param password provided password
12
- * @param cb callback function
13
- */
14
- authenticate(user, password, cb) {
15
- // here your code
16
- }
17
-
18
- /**
19
- * check grants for such user.
20
- */
21
- allow_access() {
22
- // in case of restrict the access
23
- }
24
-
25
- /**
26
- * check grants to publish
27
- */
28
- allow_publish() {
29
- // in cass to check if has permission to publish
30
- }
31
- }
32
-
33
- module.exports = (config, options) => {
34
- return new AuthCustomPlugin(config, options);
35
- };
@@ -1,22 +0,0 @@
1
- # <%= name %>
2
-
3
- <%- (description || '').split('\n').map(function (line) {
4
- return '> ' + line
5
- }).join('\n') %>
6
-
7
- ---
8
-
9
- ## development
10
-
11
- See the [verdaccio contributing guide](https://github.com/verdaccio/verdaccio/blob/master/CONTRIBUTING.md) for instructions setting up your development environment.
12
- Once you have completed that, use the following npm tasks.
13
-
14
- - `npm run build`
15
-
16
- Build a distributable archive
17
-
18
- - `npm run test`
19
-
20
- Run unit test
21
-
22
- For more information about any of these commands run `npm run ${task} -- --help`.
@@ -1,3 +0,0 @@
1
- {
2
- "presets": ["@verdaccio", {typescript: false} ]
3
- }
@@ -1,12 +0,0 @@
1
- # top-most EditorConfig file
2
- root = true
3
-
4
- # Unix-style newlines with a newline ending every file
5
- [*]
6
- end_of_line = lf
7
- insert_final_newline = true
8
-
9
- # 2 space indentation
10
- [{.,}*.{js,yml,yaml}]
11
- indent_style = space
12
- indent_size = 2
@@ -1,2 +0,0 @@
1
- node_modules
2
- lib
@@ -1,3 +0,0 @@
1
- {
2
- "extends": ["@verdaccio"]
3
- }
@@ -1,3 +0,0 @@
1
- npm-debug.log*
2
- node_modules
3
- /lib/
@@ -1 +0,0 @@
1
- module.exports = require('./lib/index.js');
@@ -1,10 +0,0 @@
1
- module.exports = {
2
- name: 'verdaccio-<%= name %>',
3
- moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
4
- transform: {
5
- '^.+\\.(js|jsx|ts|tsx)$': 'babel-jest',
6
- },
7
- verbose: true,
8
- collectCoverage: true,
9
- coveragePathIgnorePatterns: ['node_modules'],
10
- };
@@ -1,4 +0,0 @@
1
- src/
2
- .eslintrc
3
- .babelrc
4
- test/
@@ -1,6 +0,0 @@
1
- language: node_js
2
- node_js:
3
- - "8"
4
- - "10"
5
- sudo: false
6
- script: npm install . && npm run test
@@ -1,34 +0,0 @@
1
- {
2
- "name": "<%= name %>",
3
- "version": "0.0.1",
4
- "description": "<%= description %>",
5
- "main": "lib/index.js",
6
- "types": "lib/index.d.ts",
7
- "files": ["lib/"],
8
- "engines": {
9
- "node": ">=10"
10
- },
11
- "dependencies": {
12
- "@verdaccio/commons-api": "^9.6.1",
13
- "express": "^4.17.1"
14
- },
15
- "devDependencies": {
16
- "@verdaccio/babel-preset": "^9.6.1",
17
- "@verdaccio/eslint-config": "^9.3.2",
18
- "eslint": "^6.6.0",
19
- "jest": "^26.0.1 ",
20
- "prettier": "^1.19.1",
21
- "standard-version": "^8.0.0"
22
- },
23
- "keywords": "[<%= keywords %>]",
24
- "license": "<%= license %>",
25
- "repository": "<%= repository %>",
26
- "author": "<%= authorName %> <<%= authorEmail %>>",
27
- "scripts": {
28
- "build": "npm run build:types && npm run build:js",
29
- "build:js": "babel src/ --out-dir lib --extensions \".ts,.tsx\"",
30
- "build:types": "tsc --emitDeclarationOnly",
31
- "test": "jest",
32
- "lint": "eslint \"**/*.{js,ts}\""
33
- }
34
- }
@@ -1,8 +0,0 @@
1
- class VerdaccioMiddlewarePlugin {
2
- constructor(config, options) {}
3
- register_middlewares(app, auth, storage) {}
4
- }
5
-
6
- module.exports = (config, options) => {
7
- return new VerdaccioMiddlewarePlugin(config, options);
8
- };
@@ -1,33 +0,0 @@
1
- {
2
- "name": "<%= name %>",
3
- "version": "0.0.1",
4
- "description": "<%= description %>",
5
- "main": "lib/index.js",
6
- "types": "lib/index.d.ts",
7
- "files": ["lib/"],
8
- "engines": {
9
- "node": ">=10"
10
- },
11
- "dependencies": {
12
- "@verdaccio/commons-api": "^9.6.1"
13
- },
14
- "devDependencies": {
15
- "@verdaccio/babel-preset": "^9.6.1",
16
- "@verdaccio/eslint-config": "^9.3.2",
17
- "eslint": "^6.6.0",
18
- "jest": "^26.0.1 ",
19
- "prettier": "^1.19.1",
20
- "standard-version": "^8.0.0"
21
- },
22
- "keywords": "[<%= keywords %>]",
23
- "license": "<%= license %>",
24
- "repository": "<%= repository %>",
25
- "author": "<%= authorName %> <<%= authorEmail %>>",
26
- "scripts": {
27
- "build": "npm run build:types && npm run build:js",
28
- "build:js": "babel src/ --out-dir lib --extensions \".ts,.tsx\"",
29
- "build:types": "tsc --emitDeclarationOnly",
30
- "test": "jest",
31
- "lint": "eslint \"**/*.{js,ts}\""
32
- }
33
- }
@@ -1,153 +0,0 @@
1
- import { UploadTarball, ReadTarball } from "@verdaccio/streams";
2
- import { getNotFound, getConflict, getInternalError } from '@verdaccio/commons-api';
3
-
4
-
5
- export default class StoragePluginManage {
6
- constructor(packageName, helper, config, logger) {
7
- this.logger = logger;
8
- this.packageName = packageName;
9
- this.config = config;
10
- }
11
-
12
- /**
13
- * Handle a metadata update and
14
- * @param name
15
- * @param updateHandler
16
- * @param onWrite
17
- * @param transformPackage
18
- * @param onEnd
19
- */
20
- updatePackage(name, updateHandler, onWrite, transformPackage, onEnd) {
21
- /**
22
- * Example of implementation:
23
- this.customStore.get().then((pkg: Package) => {
24
- updateHandler(pkg, function onUpdateFinish(err) {
25
- if (err) {
26
- onEnd(err);
27
- } else {
28
- onWrite(name, pkg, onEnd);
29
- }
30
- })
31
- });
32
- */
33
- }
34
-
35
- /**
36
- * Delete a specific file (tarball or package.json)
37
- * @param fileName
38
- * @param callback
39
- */
40
- deletePackage(fileName, callback) {
41
- /**
42
- * Example of implementation:
43
- this.customStore.delete(fileName, (err) => {
44
- if (err) {
45
- callback(err);
46
- } else {
47
- callback(null);
48
- }
49
- })
50
- */
51
- }
52
-
53
- /**
54
- * Delete a package (folder, path)
55
- * This happens after all versions ar tarballs have been removed.
56
- * @param callback
57
- */
58
- removePackage(callback) {
59
- /**
60
- * Example of implementation:
61
- this.customStore.removePackage((err) => {
62
- if (err) {
63
- callback(err);
64
- } else {
65
- callback(null);
66
- }
67
- })
68
- */
69
- }
70
-
71
- /**
72
- * Publish a new package (version).
73
- * @param name
74
- * @param data
75
- * @param callback
76
- */
77
- createPackage(name, metadata, cb) {
78
- /**
79
- * Example of implementation:
80
- * this.customStore.create(name, data).then(err => {
81
- if (err.notFound) {
82
- callback(getNotFound());
83
- } else if (err.alreadyExist) {
84
- callback(getConflict());
85
- } else {
86
- callback(null);
87
- }
88
- })
89
- */
90
- }
91
-
92
- /**
93
- * Perform write anobject to the storage.
94
- * Similar to updatePackage but without middleware handlers
95
- * @param pkgName package name
96
- * @param pkg package metadata
97
- * @param callback
98
- */
99
- savePackage(name, value, cb) {
100
- /*
101
- Example of implementation:
102
- this.cumstomStore.write(pkgName, pkgName).then(data => {
103
- callback(null);
104
- }).catch(err => {
105
- callback(getInternalError(err.message));
106
- })
107
- */
108
- }
109
-
110
- /**
111
- * Read a package from storage
112
- * @param pkgName package name
113
- * @param callback
114
- */
115
- readPackage(name, cb) {
116
- /**
117
- * Example of implementation:
118
- * this.customStorage.read(name, (err, pkg: Package) => {
119
- if (err.fooError) {
120
- callback(getInternalError(err))
121
- } else if (err.barError) {
122
- callback(getNotFound());
123
- } else {
124
- callback(null, pkg)
125
- }
126
- });
127
- */
128
- }
129
-
130
- /**
131
- * Create writtable stream (write a tarball)
132
- * @param name
133
- */
134
- writeTarball(name) {
135
- /**
136
- * Example of implementation:
137
- * const stream = new UploadTarball({});
138
- return stream;
139
- */
140
- }
141
-
142
- /**
143
- * Create a readable stream (read a from a tarball)
144
- * @param name
145
- */
146
- readTarball(name) {
147
- /**
148
- * Example of implementation:
149
- * const stream = new ReadTarball({});
150
- return stream;
151
- */
152
- }
153
- };
@@ -1 +0,0 @@
1
- export { default } from './plugin';
@@ -1,106 +0,0 @@
1
- import PackageStorage from './PackageStorage';
2
-
3
- class VerdaccioStoragePlugin {
4
- constructor(config, options) {
5
- this.config = config;
6
- this.logger = options.logger;
7
- }
8
-
9
- async getSecret() {
10
- /**
11
- * return await resolveSecret();
12
- */
13
- }
14
-
15
- async setSecret(secret) {
16
- /**
17
- * return await getYourSecret();
18
- */
19
- }
20
-
21
- /**
22
- * Add a new element.
23
- * @param {*} name
24
- * @return {Error|*}
25
- */
26
- add(name, cb) {}
27
-
28
- search(onPackage, onEnd, validateName) {
29
- /**
30
- * Example of implementation:
31
- * try {
32
- * someApi.getPackages((items) => {
33
- * items.map(() => {
34
- * if (validateName(item.name)) {
35
- * onPackage(item);
36
- * }
37
- * });
38
- * onEnd();
39
- * } catch(err) {
40
- * onEnd(err);
41
- * }
42
- * });
43
- */
44
- }
45
-
46
- /**
47
- * Remove an element from the database.
48
- * @param {*} name
49
- * @return {Error|*}
50
- */
51
- remove(name, callback) {
52
- /**
53
- * Example of implementation
54
- database.getPackage(name, (item, err) => {
55
- if (err) {
56
- callback(getInternalError('your own message here'));
57
- }
58
-
59
- // if all goes well we return nothing
60
- callback(null);
61
- }
62
- */
63
- }
64
-
65
- /**
66
- * Return all database elements.
67
- * @return {Array}
68
- */
69
- get(callback) {
70
- /*
71
- Example of implementation
72
- database.getAll((allItems, err) => {
73
- callback(err, allItems);
74
- })
75
- */
76
- }
77
-
78
- /**
79
- * Create an instance of the `PackageStorage`
80
- * @param packageInfo
81
- */
82
- getPackageStorage(packageInfo) {
83
- return new PackageStorage(this.config, packageInfo, this.logger);
84
- }
85
-
86
- /**
87
- * All methods for npm token support
88
- * more info here https://github.com/verdaccio/verdaccio/pull/1427
89
- */
90
-
91
- saveToken(token) {
92
- throw new Error('Method not implemented.');
93
- }
94
-
95
- deleteToken(user, tokenKey) {
96
- throw new Error('Method not implemented.');
97
- }
98
-
99
- readTokens(filter) {
100
- throw new Error('Method not implemented.');
101
- }
102
- }
103
-
104
- export default (config, options) => {
105
- return new VerdaccioStoragePlugin(config, options);
106
- };
@@ -1,3 +0,0 @@
1
- {
2
- "presets": ["@verdaccio"]
3
- }
@@ -1,3 +0,0 @@
1
- import VerdaccioPlugin from './lib/index';
2
-
3
- export default VerdaccioPlugin;
@@ -1,6 +0,0 @@
1
- language: node_js
2
- node_js:
3
- - "8"
4
- - "10"
5
- sudo: false
6
- script: npm install . && npm run test
@@ -1,10 +0,0 @@
1
- export declare type propsTypes = {
2
- name?: string;
3
- pluginType?: string;
4
- description?: string;
5
- githubUsername?: string;
6
- authorName?: string;
7
- authorEmail?: string;
8
- keywords?: Array<string>;
9
- lang?: string;
10
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,10 +0,0 @@
1
- export type propsTypes = {
2
- name?: string;
3
- pluginType?: string;
4
- description?: string;
5
- githubUsername?: string;
6
- authorName?: string;
7
- authorEmail?: string;
8
- keywords?: Array<string>;
9
- lang?: string;
10
- };