generator-verdaccio-plugin 3.0.1 → 4.0.0-next.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 (73) hide show
  1. package/README.md +1 -1
  2. package/build/app/index.js +133 -0
  3. package/build/app/index.js.map +1 -0
  4. package/build/app/templates/typescript/auth/_package.json +34 -0
  5. package/{generators/app/templates/typescript/auth/src/index.ts → build/app/templates/typescript/auth/src/index.js} +21 -20
  6. package/build/app/templates/typescript/auth/src/index.js.map +1 -0
  7. package/build/app/templates/typescript/auth/types/index.js +6 -0
  8. package/build/app/templates/typescript/auth/types/index.js.map +1 -0
  9. package/{generators/app/templates/javascript → build/app/templates/typescript}/common/README.md +0 -0
  10. package/{generators/app/templates/javascript → build/app/templates/typescript}/common/editorconfig +0 -0
  11. package/{generators/app/templates/javascript → build/app/templates/typescript}/common/eslintignore +0 -0
  12. package/build/app/templates/typescript/common/eslintrc +12 -0
  13. package/{generators/app/templates/javascript → build/app/templates/typescript}/common/gitignore +0 -0
  14. package/build/app/templates/typescript/common/index.js +14 -0
  15. package/build/app/templates/typescript/common/index.js.map +1 -0
  16. package/build/app/templates/typescript/common/jest.config.js +4 -0
  17. package/{generators/app/templates/javascript → build/app/templates/typescript}/common/npmignore +1 -2
  18. package/{generators → build}/app/templates/typescript/common/tsconfig.json +2 -1
  19. package/build/app/templates/typescript/middleware/_package.json +35 -0
  20. package/build/app/templates/typescript/middleware/src/index.js +36 -0
  21. package/build/app/templates/typescript/middleware/src/index.js.map +1 -0
  22. package/build/app/templates/typescript/middleware/types/index.js +6 -0
  23. package/build/app/templates/typescript/middleware/types/index.js.map +1 -0
  24. package/build/app/templates/typescript/storage/_package.json +35 -0
  25. package/{generators/app/templates/javascript → build/app/templates/typescript}/storage/src/PackageStorage.js +35 -20
  26. package/build/app/templates/typescript/storage/src/PackageStorage.js.map +1 -0
  27. package/build/app/templates/typescript/storage/src/index.js +16 -0
  28. package/build/app/templates/typescript/storage/src/index.js.map +1 -0
  29. package/{generators/app/templates/javascript → build/app/templates/typescript}/storage/src/plugin.js +41 -18
  30. package/build/app/templates/typescript/storage/src/plugin.js.map +1 -0
  31. package/build/app/templates/typescript/storage/types/index.js +6 -0
  32. package/build/app/templates/typescript/storage/types/index.js.map +1 -0
  33. package/package.json +81 -39
  34. package/CHANGELOG.md +0 -106
  35. package/generators/app/index.d.ts +0 -11
  36. package/generators/app/index.js +0 -134
  37. package/generators/app/index.ts +0 -215
  38. package/generators/app/templates/.eslintrc +0 -5
  39. package/generators/app/templates/javascript/.eslintrc +0 -5
  40. package/generators/app/templates/javascript/auth/_package.json +0 -33
  41. package/generators/app/templates/javascript/auth/src/index.js +0 -35
  42. package/generators/app/templates/javascript/common/babelrc +0 -3
  43. package/generators/app/templates/javascript/common/eslintrc +0 -3
  44. package/generators/app/templates/javascript/common/index.js +0 -1
  45. package/generators/app/templates/javascript/common/jest.config.js +0 -10
  46. package/generators/app/templates/javascript/common/travis.yml +0 -6
  47. package/generators/app/templates/javascript/middleware/_package.json +0 -34
  48. package/generators/app/templates/javascript/middleware/src/index.js +0 -8
  49. package/generators/app/templates/javascript/storage/_package.json +0 -33
  50. package/generators/app/templates/javascript/storage/src/index.js +0 -1
  51. package/generators/app/templates/typescript/auth/_package.json +0 -40
  52. package/generators/app/templates/typescript/auth/types/index.ts +0 -5
  53. package/generators/app/templates/typescript/common/README.md +0 -22
  54. package/generators/app/templates/typescript/common/babelrc +0 -3
  55. package/generators/app/templates/typescript/common/editorconfig +0 -12
  56. package/generators/app/templates/typescript/common/eslintignore +0 -2
  57. package/generators/app/templates/typescript/common/eslintrc +0 -3
  58. package/generators/app/templates/typescript/common/gitignore +0 -3
  59. package/generators/app/templates/typescript/common/index.ts +0 -3
  60. package/generators/app/templates/typescript/common/jest.config.js +0 -10
  61. package/generators/app/templates/typescript/common/npmignore +0 -4
  62. package/generators/app/templates/typescript/common/travis.yml +0 -6
  63. package/generators/app/templates/typescript/middleware/_package.json +0 -41
  64. package/generators/app/templates/typescript/middleware/src/index.ts +0 -35
  65. package/generators/app/templates/typescript/middleware/types/index.ts +0 -5
  66. package/generators/app/templates/typescript/storage/_package.json +0 -40
  67. package/generators/app/templates/typescript/storage/src/PackageStorage.ts +0 -183
  68. package/generators/app/templates/typescript/storage/src/index.ts +0 -1
  69. package/generators/app/templates/typescript/storage/src/plugin.ts +0 -140
  70. package/generators/app/templates/typescript/storage/types/index.ts +0 -5
  71. package/generators/app/types.d.ts +0 -10
  72. package/generators/app/types.js +0 -2
  73. package/generators/app/types.ts +0 -10
package/README.md CHANGED
@@ -47,4 +47,4 @@ MIT © [Juan Picado <@jotadeveloper>]()
47
47
  [npm-image]: https://badge.fury.io/js/generator-verdaccio-plugin.svg
48
48
  [npm-url]: https://npmjs.org/package/generator-verdaccio-plugin
49
49
  [daviddm-image]: https://david-dm.org/verdaccio/generator-verdaccio-plugin.svg?theme=shields.io
50
- [daviddm-url]: https://david-dm.org/verdaccio/generator-verdaccio-plugin
50
+ [daviddm-url]: https://david-dm.org/verdaccio/generator-verdaccio-plugin
@@ -0,0 +1,133 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _path = require("path");
9
+
10
+ var _yeomanGenerator = _interopRequireDefault(require("yeoman-generator"));
11
+
12
+ var _chalk = _interopRequireDefault(require("chalk"));
13
+
14
+ var _lodash = _interopRequireDefault(require("lodash"));
15
+
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+
18
+ const yosay = require('yosay');
19
+
20
+ class VerdaccioPluginGenerator extends _yeomanGenerator.default {
21
+ projectName = 'verdaccio-';
22
+ destinationPathName = 'verdaccio-';
23
+
24
+ constructor(args, opts) {
25
+ super(args, opts);
26
+ this.props = {};
27
+ }
28
+
29
+ prompting() {
30
+ this.log(yosay('Welcome to ' + _chalk.default.red('generator-verdaccio-plugin') + ' plugin generator!'));
31
+ const prompts = [{
32
+ type: 'input',
33
+ name: 'name',
34
+ require: true,
35
+ message: 'What is the name of your plugin?',
36
+ default: 'customname',
37
+ validate: function (input) {
38
+ return input !== '';
39
+ }
40
+ }, {
41
+ type: 'list',
42
+ name: 'pluginType',
43
+ require: true,
44
+ message: 'What kind of plugin you want to create?',
45
+ store: true,
46
+ choices: [{
47
+ value: 'auth'
48
+ }, {
49
+ value: 'storage'
50
+ }, {
51
+ value: 'middleware'
52
+ }]
53
+ }, {
54
+ type: 'input',
55
+ name: 'description',
56
+ message: 'Please, describe your plugin',
57
+ default: 'An amazing verdaccio plugin'
58
+ }, {
59
+ name: 'githubUsername',
60
+ message: 'GitHub username or Organization',
61
+ validate: function (input) {
62
+ return input !== '';
63
+ }
64
+ }, {
65
+ name: 'authorName',
66
+ message: 'Author\'s Name',
67
+ store: true
68
+ }, {
69
+ name: 'authorEmail',
70
+ message: 'Author\'s Email',
71
+ store: true
72
+ }, {
73
+ name: 'keywords',
74
+ message: 'Key your keywords (comma to split)',
75
+ filter: function (keywords) {
76
+ return _lodash.default.uniq(_lodash.default.words(keywords).concat(['verdaccio-']));
77
+ }
78
+ }];
79
+ return this.prompt(prompts).then(function (_props) {
80
+ // To access props later use this.props.someAnswer;
81
+ // @ts-ignore
82
+ this.props = _props;
83
+ const {
84
+ name,
85
+ githubUsername
86
+ } = _props; // @ts-ignore
87
+
88
+ this.props.license = 'MIT';
89
+
90
+ if (githubUsername) {
91
+ // @ts-ignore
92
+ this.props.repository = githubUsername + '/' + name;
93
+ } // @ts-ignore
94
+
95
+
96
+ this.projectName = `verdaccio-${name}`; // @ts-ignore
97
+
98
+ this.destinationPathName = (0, _path.resolve)(this.projectName); // @ts-ignore
99
+
100
+ this.props.name = this.projectName;
101
+ }.bind(this));
102
+ }
103
+
104
+ packageJSON() {
105
+ const {
106
+ pluginType
107
+ } = this.props;
108
+ const pkgJsonLocation = `typescript/${pluginType}/_package.json`;
109
+ this.fs.copyTpl(this.templatePath(pkgJsonLocation), this.destinationPath((0, _path.resolve)(this.destinationPathName, 'package.json')), this.props);
110
+ }
111
+
112
+ writing() {
113
+ this.fs.copy(this.templatePath(`typescript/common/gitignore`), this.destinationPath((0, _path.resolve)(this.destinationPathName, '.gitignore')));
114
+ this.fs.copy(this.templatePath(`typescript/common/npmignore`), this.destinationPath((0, _path.resolve)(this.destinationPathName, '.npmignore')));
115
+ this.fs.copy(this.templatePath(`typescript/common/jest.config.js`), this.destinationPath((0, _path.resolve)(this.destinationPathName, 'jest.config.js')));
116
+ this.fs.copyTpl(this.templatePath(`typescript/common/README.md`), this.destinationPath((0, _path.resolve)(this.destinationPathName, 'README.md')), this.props);
117
+ this.fs.copyTpl(this.templatePath(`typescript/common/eslintrc`), this.destinationPath((0, _path.resolve)(this.destinationPathName, '.eslintrc')), this.props);
118
+ this.fs.copyTpl(this.templatePath(`typescript/common/eslintignore`), this.destinationPath((0, _path.resolve)(this.destinationPathName, '.eslintignore')), this.props);
119
+ this.fs.copy(this.templatePath(`typescript/${this.props.pluginType}/src`), this.destinationPath((0, _path.resolve)(this.destinationPathName, 'src')));
120
+ this.fs.copy(this.templatePath(`typescript/common/index.ts`), this.destinationPath((0, _path.resolve)(this.destinationPathName, `index.ts`)));
121
+ this.fs.copy(this.templatePath(`typescript/common/tsconfig.json`), this.destinationPath((0, _path.resolve)(this.destinationPathName, 'tsconfig.json')));
122
+ this.fs.copy(this.templatePath(`typescript/${this.props.pluginType}/types`), this.destinationPath((0, _path.resolve)(this.destinationPathName, 'types')));
123
+ this.fs.copy(this.templatePath(`typescript/common/editorconfig`), this.destinationPath((0, _path.resolve)(this.destinationPathName, '.editorconfig')));
124
+ }
125
+
126
+ install() {
127
+ process.chdir(this.projectName); // this.installDependencies({ npm: true, bower: false });
128
+ }
129
+
130
+ }
131
+
132
+ exports.default = VerdaccioPluginGenerator;
133
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["yosay","require","VerdaccioPluginGenerator","Generator","projectName","destinationPathName","constructor","args","opts","props","prompting","log","chalk","red","prompts","type","name","message","default","validate","input","store","choices","value","filter","keywords","_","uniq","words","concat","prompt","then","_props","githubUsername","license","repository","resolve","bind","packageJSON","pluginType","pkgJsonLocation","fs","copyTpl","templatePath","destinationPath","writing","copy","install","process","chdir"],"sources":["../../generators/app/index.ts"],"sourcesContent":["import {resolve} from 'path';\n\nimport Generator from 'yeoman-generator';\nimport chalk from 'chalk';\nimport _ from 'lodash';\n\ntype propsTypes = {\n name?: string;\n pluginType?: string;\n description?: string;\n githubUsername?: string;\n authorName?: string;\n authorEmail?: string;\n keywords?: string[];\n};\n\nconst yosay = require('yosay');\n\nexport default class VerdaccioPluginGenerator extends Generator {\n private props: propsTypes;\n private projectName = 'verdaccio-';\n private destinationPathName = 'verdaccio-';\n constructor(args, opts) {\n super(args, opts);\n this.props = {};\n }\n\n prompting() {\n this.log(\n yosay(\n 'Welcome to ' +\n chalk.red('generator-verdaccio-plugin') +\n ' plugin generator!',\n ),\n );\n\n const prompts = [\n {\n type: 'input',\n name: 'name',\n require: true,\n message: 'What is the name of your plugin?',\n default: 'customname',\n validate: function(input) {\n return input !== '';\n },\n },\n {\n type: 'list',\n name: 'pluginType',\n require: true,\n message: 'What kind of plugin you want to create?',\n store: true,\n choices: [\n {value: 'auth'},\n {value: 'storage'},\n {value: 'middleware'},\n ],\n },\n {\n type: 'input',\n name: 'description',\n message: 'Please, describe your plugin',\n default: 'An amazing verdaccio plugin',\n },\n {\n name: 'githubUsername',\n message: 'GitHub username or Organization',\n validate: function(input) {\n return input !== '';\n },\n },\n {\n name: 'authorName',\n message: 'Author\\'s Name',\n store: true,\n },\n {\n name: 'authorEmail',\n message: 'Author\\'s Email',\n store: true,\n },\n {\n name: 'keywords',\n message: 'Key your keywords (comma to split)',\n filter: function(keywords) {\n return _.uniq(_.words(keywords).concat(['verdaccio-']));\n },\n },\n ];\n\n return this.prompt(prompts).then(\n function(_props) {\n // To access props later use this.props.someAnswer;\n // @ts-ignore\n this.props = _props;\n const {name, githubUsername} = _props;\n // @ts-ignore\n this.props.license = 'MIT';\n if (githubUsername) {\n // @ts-ignore\n this.props.repository = githubUsername + '/' + name;\n }\n\n // @ts-ignore\n this.projectName = `verdaccio-${name}`;\n\n // @ts-ignore\n this.destinationPathName = resolve(this.projectName);\n // @ts-ignore\n this.props.name = this.projectName;\n }.bind(this),\n );\n }\n\n packageJSON() {\n const {pluginType} = this.props;\n const pkgJsonLocation = `typescript/${pluginType}/_package.json`;\n this.fs.copyTpl(\n this.templatePath(pkgJsonLocation),\n this.destinationPath(resolve(this.destinationPathName, 'package.json')),\n this.props,\n );\n }\n\n writing() {\n this.fs.copy(\n this.templatePath(`typescript/common/gitignore`),\n this.destinationPath(resolve(this.destinationPathName, '.gitignore')),\n );\n this.fs.copy(\n this.templatePath(`typescript/common/npmignore`),\n this.destinationPath(resolve(this.destinationPathName, '.npmignore')),\n );\n this.fs.copy(\n this.templatePath(`typescript/common/jest.config.js`),\n this.destinationPath(resolve(this.destinationPathName, 'jest.config.js')),\n );\n this.fs.copyTpl(\n this.templatePath(`typescript/common/README.md`),\n this.destinationPath(resolve(this.destinationPathName, 'README.md')),\n this.props,\n );\n this.fs.copyTpl(\n this.templatePath(`typescript/common/eslintrc`),\n this.destinationPath(resolve(this.destinationPathName, '.eslintrc')),\n this.props,\n );\n this.fs.copyTpl(\n this.templatePath(`typescript/common/eslintignore`),\n this.destinationPath(resolve(this.destinationPathName, '.eslintignore')),\n this.props,\n );\n\n this.fs.copy(\n this.templatePath(`typescript/${this.props.pluginType}/src`),\n this.destinationPath(resolve(this.destinationPathName, 'src')),\n );\n\n this.fs.copy(\n this.templatePath(\n `typescript/common/index.ts`,\n ),\n this.destinationPath(\n resolve(\n this.destinationPathName,\n `index.ts`,\n ),\n ),\n );\n\n this.fs.copy(\n this.templatePath(`typescript/common/tsconfig.json`),\n this.destinationPath(\n resolve(this.destinationPathName, 'tsconfig.json'),\n ),\n );\n this.fs.copy(\n this.templatePath(`typescript/${this.props.pluginType}/types`),\n this.destinationPath(resolve(this.destinationPathName, 'types')),\n );\n\n this.fs.copy(\n this.templatePath(`typescript/common/editorconfig`),\n this.destinationPath(resolve(this.destinationPathName, '.editorconfig')),\n );\n }\n\n install() {\n process.chdir(this.projectName);\n // this.installDependencies({ npm: true, bower: false });\n }\n}\n"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AACA;;;;AAYA,MAAMA,KAAK,GAAGC,OAAO,CAAC,OAAD,CAArB;;AAEe,MAAMC,wBAAN,SAAuCC,wBAAvC,CAAiD;EAEtDC,WAAW,GAAG,YAAH;EACXC,mBAAmB,GAAG,YAAH;;EAC3BC,WAAW,CAACC,IAAD,EAAOC,IAAP,EAAa;IACtB,MAAMD,IAAN,EAAYC,IAAZ;IACA,KAAKC,KAAL,GAAa,EAAb;EACD;;EAEDC,SAAS,GAAG;IACV,KAAKC,GAAL,CACIX,KAAK,CACD,gBACFY,cAAA,CAAMC,GAAN,CAAU,4BAAV,CADE,GAEF,oBAHG,CADT;IAQA,MAAMC,OAAO,GAAG,CACd;MACEC,IAAI,EAAE,OADR;MAEEC,IAAI,EAAE,MAFR;MAGEf,OAAO,EAAE,IAHX;MAIEgB,OAAO,EAAE,kCAJX;MAKEC,OAAO,EAAE,YALX;MAMEC,QAAQ,EAAE,UAASC,KAAT,EAAgB;QACxB,OAAOA,KAAK,KAAK,EAAjB;MACD;IARH,CADc,EAWd;MACEL,IAAI,EAAE,MADR;MAEEC,IAAI,EAAE,YAFR;MAGEf,OAAO,EAAE,IAHX;MAIEgB,OAAO,EAAE,yCAJX;MAKEI,KAAK,EAAE,IALT;MAMEC,OAAO,EAAE,CACP;QAACC,KAAK,EAAE;MAAR,CADO,EAEP;QAACA,KAAK,EAAE;MAAR,CAFO,EAGP;QAACA,KAAK,EAAE;MAAR,CAHO;IANX,CAXc,EAuBd;MACER,IAAI,EAAE,OADR;MAEEC,IAAI,EAAE,aAFR;MAGEC,OAAO,EAAE,8BAHX;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": ["lib/"],
8
+ "engines": {
9
+ "node": ">=12"
10
+ },
11
+ "dependencies": {
12
+ "@verdaccio/commons-api": "latest",
13
+ },
14
+ "devDependencies": {
15
+ "@types/jest": "27.5.1",
16
+ "@types/node": "^12.12.5",
17
+ "@types/express": "4.17.13",
18
+ "@typescript-eslint/eslint-plugin": "5.26.0",
19
+ "@typescript-eslint/parser": "5.26.0",
20
+ "@verdaccio/types": "latest",
21
+ "eslint": "8.16.0",
22
+ "jest": "28.1.1",
23
+ "typescript": "4.7.3"
24
+ },
25
+ "keywords": ["<%= keywords %>]"],
26
+ "license": "<%= license %>",
27
+ "repository": "<%= repository %>",
28
+ "author": "<%= authorName %> <<%= authorEmail %>>",
29
+ "scripts": {
30
+ "build": "tsc",
31
+ "test": "jest .",
32
+ "lint": "eslint \"**/*.{js,ts}\""
33
+ }
34
+ }
@@ -1,22 +1,15 @@
1
- import {
2
- PluginOptions,
3
- AuthAccessCallback,
4
- AuthCallback,
5
- PackageAccess,
6
- IPluginAuth,
7
- RemoteUser,
8
- Logger,
9
- } from '@verdaccio/types';
1
+ "use strict";
10
2
 
11
- import { CustomConfig } from '../types/index';
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
12
7
 
13
8
  /**
14
9
  * Custom Verdaccio Authenticate Plugin.
15
10
  */
16
- export default class AuthCustomPlugin implements IPluginAuth<CustomConfig> {
17
- public logger: Logger;
18
- private foo: string;
19
- public constructor(config: CustomConfig, options: PluginOptions<CustomConfig>) {
11
+ class AuthCustomPlugin {
12
+ constructor(config, options) {
20
13
  this.logger = options.logger;
21
14
  this.foo = config.foo;
22
15
  return this;
@@ -27,7 +20,9 @@ export default class AuthCustomPlugin implements IPluginAuth<CustomConfig> {
27
20
  * @param password provided password
28
21
  * @param cb callback function
29
22
  */
30
- public authenticate(user: string, password: string, cb: AuthCallback): void {
23
+
24
+
25
+ authenticate(user, password, cb) {
31
26
  /**
32
27
  * This code is just an example for demostration purpose
33
28
  if (this.foo) {
@@ -37,14 +32,15 @@ export default class AuthCustomPlugin implements IPluginAuth<CustomConfig> {
37
32
  }
38
33
  */
39
34
  }
40
-
41
35
  /**
42
36
  * Triggered on each access request
43
37
  * @param user
44
38
  * @param pkg
45
39
  * @param cb
46
40
  */
47
- public allow_access(user: RemoteUser, pkg: PackageAccess, cb: AuthAccessCallback): void {
41
+
42
+
43
+ allow_access(user, pkg, cb) {
48
44
  /**
49
45
  * This code is just an example for demostration purpose
50
46
  if (user.name === this.foo && pkg?.access?.includes[user.name]) {
@@ -56,14 +52,15 @@ export default class AuthCustomPlugin implements IPluginAuth<CustomConfig> {
56
52
  }
57
53
  */
58
54
  }
59
-
60
55
  /**
61
56
  * Triggered on each publish request
62
57
  * @param user
63
58
  * @param pkg
64
59
  * @param cb
65
60
  */
66
- public allow_publish(user: RemoteUser, pkg: PackageAccess, cb: AuthAccessCallback): void {
61
+
62
+
63
+ allow_publish(user, pkg, cb) {
67
64
  /**
68
65
  * This code is just an example for demostration purpose
69
66
  if (user.name === this.foo && pkg?.access?.includes[user.name]) {
@@ -76,7 +73,7 @@ export default class AuthCustomPlugin implements IPluginAuth<CustomConfig> {
76
73
  */
77
74
  }
78
75
 
79
- public allow_unpublish(user: RemoteUser, pkg: PackageAccess, cb: AuthAccessCallback): void {
76
+ allow_unpublish(user, pkg, cb) {
80
77
  /**
81
78
  * This code is just an example for demostration purpose
82
79
  if (user.name === this.foo && pkg?.access?.includes[user.name]) {
@@ -88,4 +85,8 @@ export default class AuthCustomPlugin implements IPluginAuth<CustomConfig> {
88
85
  }
89
86
  */
90
87
  }
88
+
91
89
  }
90
+
91
+ exports.default = AuthCustomPlugin;
92
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["AuthCustomPlugin","constructor","config","options","logger","foo","authenticate","user","password","cb","allow_access","pkg","allow_publish","allow_unpublish"],"sources":["../../../../../../generators/app/templates/typescript/auth/src/index.ts"],"sourcesContent":["import {\n PluginOptions,\n AuthAccessCallback,\n AuthCallback,\n PackageAccess,\n IPluginAuth,\n RemoteUser,\n Logger,\n} from '@verdaccio/types';\n\nimport {CustomConfig} from '../types/index';\n\n/**\n * Custom Verdaccio Authenticate Plugin.\n */\nexport default class AuthCustomPlugin implements IPluginAuth<CustomConfig> {\n public logger: Logger;\n private foo: string;\n public constructor(config: CustomConfig, options: PluginOptions<CustomConfig>) {\n this.logger = options.logger;\n this.foo = config.foo;\n return this;\n }\n /**\n * Authenticate an user.\n * @param user user to log\n * @param password provided password\n * @param cb callback function\n */\n public authenticate(user: string, password: string, cb: AuthCallback): void {\n /**\n * This code is just an example for demostration purpose\n if (this.foo) {\n cb(null, ['group-foo', 'group-bar']);\n } else {\n cb('error, try again', false);\n }\n */\n }\n\n /**\n * Triggered on each access request\n * @param user\n * @param pkg\n * @param cb\n */\n public allow_access(user: RemoteUser, pkg: PackageAccess, cb: AuthAccessCallback): void {\n /**\n * This code is just an example for demostration purpose\n if (user.name === this.foo && pkg?.access?.includes[user.name]) {\n this.logger.debug({name: user.name}, 'your package has been granted for @{name}');\n cb(null, true)\n } else {\n this.logger.error({name: user.name}, '@{name} is not allowed to access this package');\n cb('error, try again', false);\n }\n */\n }\n\n /**\n * Triggered on each publish request\n * @param user\n * @param pkg\n * @param cb\n */\n public allow_publish(user: RemoteUser, pkg: PackageAccess, cb: AuthAccessCallback): void {\n /**\n * This code is just an example for demostration purpose\n if (user.name === this.foo && pkg?.access?.includes[user.name]) {\n this.logger.debug({name: user.name}, '@{name} has been granted to publish');\n cb(null, true)\n } else {\n this.logger.error({name: user.name}, '@{name} is not allowed to publish this package');\n cb('error, try again', false);\n }\n */\n }\n\n public allow_unpublish(user: RemoteUser, pkg: PackageAccess, cb: AuthAccessCallback): void {\n /**\n * This code is just an example for demostration purpose\n if (user.name === this.foo && pkg?.access?.includes[user.name]) {\n this.logger.debug({name: user.name}, '@{name} has been granted to unpublish');\n cb(null, true)\n } else {\n this.logger.error({name: user.name}, '@{name} is not allowed to publish this package');\n cb('error, try again', false);\n }\n */\n }\n}\n"],"mappings":";;;;;;;AAYA;AACA;AACA;AACe,MAAMA,gBAAN,CAA4D;EAGlEC,WAAW,CAACC,MAAD,EAAuBC,OAAvB,EAA6D;IAC7E,KAAKC,MAAL,GAAcD,OAAO,CAACC,MAAtB;IACA,KAAKC,GAAL,GAAWH,MAAM,CAACG,GAAlB;IACA,OAAO,IAAP;EACD;EACD;AACF;AACA;AACA;AACA;AACA;;;EACSC,YAAY,CAACC,IAAD,EAAeC,QAAf,EAAiCC,EAAjC,EAAyD;IAC1E;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;EACG;EAED;AACF;AACA;AACA;AACA;AACA;;;EACSC,YAAY,CAACH,IAAD,EAAmBI,GAAnB,EAAuCF,EAAvC,EAAqE;IACtF;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACG;EAED;AACF;AACA;AACA;AACA;AACA;;;EACSG,aAAa,CAACL,IAAD,EAAmBI,GAAnB,EAAuCF,EAAvC,EAAqE;IACvF;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACG;;EAEMI,eAAe,CAACN,IAAD,EAAmBI,GAAnB,EAAuCF,EAAvC,EAAqE;IACzF;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACG;;AA1EwE"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../../../generators/app/templates/typescript/auth/types/index.ts"],"sourcesContent":["import {Config} from '@verdaccio/types';\n\nexport interface CustomConfig extends Config {\n foo: string;\n}\n"],"mappings":""}
@@ -0,0 +1,12 @@
1
+ {
2
+ "root": true,
3
+ "parser": "@typescript-eslint/parser",
4
+ "plugins": [
5
+ "@typescript-eslint"
6
+ ],
7
+ "extends": [
8
+ "eslint:recommended",
9
+ "plugin:@typescript-eslint/eslint-recommended",
10
+ "plugin:@typescript-eslint/recommended"
11
+ ]
12
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _index = _interopRequireDefault(require("./lib/index"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ var _default = _index.default;
13
+ exports.default = _default;
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["VerdaccioPlugin"],"sources":["../../../../../generators/app/templates/typescript/common/index.ts"],"sourcesContent":["import VerdaccioPlugin from './lib/index';\n\nexport default VerdaccioPlugin;\n"],"mappings":";;;;;;;AAAA;;;;eAEeA,c"}
@@ -0,0 +1,4 @@
1
+ module.exports = {
2
+ name: 'verdaccio-<%= name %>',
3
+ preset: 'ts-jest',
4
+ };
@@ -1,4 +1,3 @@
1
1
  src/
2
2
  .eslintrc
3
- .babelrc
4
- test/
3
+ test/
@@ -3,9 +3,10 @@
3
3
  "target": "esnext",
4
4
  "module": "commonjs",
5
5
  "declaration": true,
6
+ "allowJs": false,
6
7
  "noImplicitAny": false,
7
8
  "strict": true,
8
- "outDir": "lib",
9
+ "outDir": "./lib",
9
10
  "allowSyntheticDefaultImports": true,
10
11
  "esModuleInterop": true,
11
12
  "typeRoots": [
@@ -0,0 +1,35 @@
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": ">=12"
10
+ },
11
+ "dependencies": {
12
+ "@verdaccio/commons-api": "latest",
13
+ "express": "4.18.1"
14
+ },
15
+ "devDependencies": {
16
+ "@types/jest": "27.5.1",
17
+ "@types/node": "^12.12.5",
18
+ "@types/express": "4.17.13",
19
+ "@typescript-eslint/eslint-plugin": "5.26.0",
20
+ "@typescript-eslint/parser": "5.26.0",
21
+ "@verdaccio/types": "latest",
22
+ "eslint": "8.16.0",
23
+ "jest": "28.1.1",
24
+ "typescript": "4.7.3"
25
+ },
26
+ "keywords": ["<%= keywords %>"],
27
+ "license": "<%= license %>",
28
+ "repository": "<%= repository %>",
29
+ "author": "<%= authorName %> <<%= authorEmail %>>",
30
+ "scripts": {
31
+ "build": "tsc",
32
+ "test": "jest .",
33
+ "lint": "eslint \"**/*.{js,ts}\""
34
+ }
35
+ }
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ class VerdaccioMiddlewarePlugin {
9
+ constructor(config, options) {
10
+ this.foo = config.foo !== undefined ? config.strict_ssl : true;
11
+ this.logger = options.logger;
12
+ }
13
+
14
+ register_middlewares(app, auth,
15
+ /* eslint @typescript-eslint/no-unused-vars: off */
16
+ _storage) {
17
+ /**
18
+ * This is just an example of implementation
19
+ // eslint new-cap:off
20
+ const router = Router();
21
+ router.post(
22
+ '/custom-endpoint',
23
+ (req: Request, res: Response & { report_error?: Function }, next: NextFunction): void => {
24
+ const encryptedString = auth.aesEncrypt(Buffer.from(this.foo, 'utf8'));
25
+ res.setHeader('X-Verdaccio-Token-Plugin', encryptedString.toString());
26
+ next();
27
+ }
28
+ );
29
+ app.use('/-/npm/something-new', router);
30
+ */
31
+ }
32
+
33
+ }
34
+
35
+ exports.default = VerdaccioMiddlewarePlugin;
36
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["VerdaccioMiddlewarePlugin","constructor","config","options","foo","undefined","strict_ssl","logger","register_middlewares","app","auth","_storage"],"sources":["../../../../../../generators/app/templates/typescript/middleware/src/index.ts"],"sourcesContent":["import {Logger, IPluginMiddleware, IBasicAuth, IStorageManager, PluginOptions} from '@verdaccio/types';\nimport {Router, Request, Response, NextFunction, Application} from 'express';\n\nimport {CustomConfig} from '../types/index';\n\nexport default class VerdaccioMiddlewarePlugin implements IPluginMiddleware<CustomConfig> {\n public logger: Logger;\n public foo: string;\n public constructor(config: CustomConfig, options: PluginOptions<CustomConfig>) {\n this.foo = config.foo !== undefined ? config.strict_ssl : true;\n this.logger = options.logger;\n }\n\n public register_middlewares(\n app: Application,\n auth: IBasicAuth<CustomConfig>,\n /* eslint @typescript-eslint/no-unused-vars: off */\n _storage: IStorageManager<CustomConfig>,\n ): void {\n /**\n * This is just an example of implementation\n // eslint new-cap:off\n const router = Router();\n router.post(\n '/custom-endpoint',\n (req: Request, res: Response & { report_error?: Function }, next: NextFunction): void => {\n const encryptedString = auth.aesEncrypt(Buffer.from(this.foo, 'utf8'));\n res.setHeader('X-Verdaccio-Token-Plugin', encryptedString.toString());\n next();\n }\n );\n app.use('/-/npm/something-new', router);\n */\n }\n}\n"],"mappings":";;;;;;;AAKe,MAAMA,yBAAN,CAA2E;EAGjFC,WAAW,CAACC,MAAD,EAAuBC,OAAvB,EAA6D;IAC7E,KAAKC,GAAL,GAAWF,MAAM,CAACE,GAAP,KAAeC,SAAf,GAA2BH,MAAM,CAACI,UAAlC,GAA+C,IAA1D;IACA,KAAKC,MAAL,GAAcJ,OAAO,CAACI,MAAtB;EACD;;EAEMC,oBAAoB,CACvBC,GADuB,EAEvBC,IAFuB;EAGvB;EACAC,QAJuB,EAKnB;IACN;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACG;;AA5BuF"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../../../generators/app/templates/typescript/middleware/types/index.ts"],"sourcesContent":["import {Config} from '@verdaccio/types';\n\nexport interface CustomConfig extends Config {\n foo: string;\n}\n"],"mappings":""}
@@ -0,0 +1,35 @@
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": "latest",
13
+ "@verdaccio/streams": "latest"
14
+ },
15
+ "devDependencies": {
16
+ "@types/jest": "27.5.1",
17
+ "@types/node": "^12.12.5",
18
+ "@types/express": "4.17.13",
19
+ "@typescript-eslint/eslint-plugin": "5.26.0",
20
+ "@typescript-eslint/parser": "5.26.0",
21
+ "@verdaccio/types": "latest",
22
+ "eslint": "8.16.0",
23
+ "jest": "28.1.1",
24
+ "typescript": "4.7.3"
25
+ },
26
+ "keywords": ["<%= keywords %>"],
27
+ "license": "<%= license %>",
28
+ "repository": "<%= repository %>",
29
+ "author": "<%= authorName %> <<%= authorEmail %>>",
30
+ "scripts": {
31
+ "build": "tsc",
32
+ "test": "jest .",
33
+ "lint": "eslint \"**/*.{js,ts}\""
34
+ }
35
+ }