generator-verdaccio-plugin 4.1.0 → 5.0.0-next-7.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 +5 -5
  3. package/generators/app/index.js +34 -43
  4. package/generators/app/index.js.map +1 -1
  5. package/generators/app/templates/{typescript/auth → auth}/src/index.ts +5 -5
  6. package/generators/app/templates/{typescript/storage → auth}/types/index.ts +1 -1
  7. package/generators/app/templates/{typescript/common → common}/README.md +6 -6
  8. package/generators/app/templates/common/index.js +15 -0
  9. package/generators/app/templates/{typescript/common → common}/tsconfig.json +1 -4
  10. package/generators/app/templates/{typescript/middleware → middleware}/src/index.ts +14 -7
  11. package/generators/app/templates/{typescript/auth → middleware}/types/index.ts +1 -1
  12. package/generators/app/templates/{typescript/storage → storage}/src/PackageStorage.ts +16 -24
  13. package/generators/app/templates/storage/src/index.ts +1 -0
  14. package/generators/app/templates/{typescript/storage → storage}/src/plugin.ts +11 -17
  15. package/generators/app/templates/{typescript/middleware → storage}/types/index.ts +1 -1
  16. package/package.json +12 -68
  17. package/generators/app/templates/typescript/common/index.js +0 -13
  18. package/generators/app/templates/typescript/storage/src/index.ts +0 -1
  19. /package/generators/app/templates/{typescript/auth → auth}/_package.json +0 -0
  20. /package/generators/app/templates/{typescript/common → common}/editorconfig +0 -0
  21. /package/generators/app/templates/{typescript/common → common}/eslintignore +0 -0
  22. /package/generators/app/templates/{typescript/common → common}/eslintrc +0 -0
  23. /package/generators/app/templates/{typescript/common → common}/gitignore +0 -0
  24. /package/generators/app/templates/{typescript/common → common}/jest.config.js +0 -0
  25. /package/generators/app/templates/{typescript/common → common}/npmignore +0 -0
  26. /package/generators/app/templates/{typescript/middleware → middleware}/_package.json +0 -0
  27. /package/generators/app/templates/{typescript/storage → storage}/_package.json +0 -0
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
- The MIT License (MIT)
1
+ MIT License
2
2
 
3
- Copyright (c) 2017 Juan Picado <@jotadeveloper> <juanpicado19@gmail.com>
3
+ Copyright (c) 2024 Verdaccio contributors
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -9,13 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
9
  copies of the Software, and to permit persons to whom the Software is
10
10
  furnished to do so, subject to the following conditions:
11
11
 
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
14
 
15
15
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
16
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
17
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -27,14 +27,14 @@ yo verdaccio-plugin
27
27
 
28
28
  ## Plugin Types Supported
29
29
 
30
- * Authentication
31
- * Storage
32
- * Middleware
30
+ - Authentication
31
+ - Storage
32
+ - Middleware
33
33
 
34
34
  ### Maintainers
35
35
 
36
- * [Anix](https://github.com/anikethsaha)
37
- * [Juan Picado](https://github.com/juanpicado)
36
+ - [Anix](https://github.com/anikethsaha)
37
+ - [Juan Picado](https://github.com/juanpicado)
38
38
 
39
39
  ## License
40
40
 
@@ -1,28 +1,24 @@
1
1
  "use strict";
2
2
 
3
- var _path = require("path");
4
-
5
- var _yeomanGenerator = _interopRequireDefault(require("yeoman-generator"));
6
-
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
7
  var _chalk = _interopRequireDefault(require("chalk"));
8
-
9
8
  var _lodash = _interopRequireDefault(require("lodash"));
10
-
9
+ var _path = require("path");
10
+ var _yeomanGenerator = _interopRequireDefault(require("yeoman-generator"));
11
+ var _yosay = _interopRequireDefault(require("yosay"));
11
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
-
13
- const yosay = require('yosay');
14
-
15
- class VerdaccioPluginGenerator extends _yeomanGenerator.default {
13
+ class PluginGenerator extends _yeomanGenerator.default {
16
14
  projectName = 'verdaccio-';
17
15
  destinationPathName = 'verdaccio-';
18
-
19
16
  constructor(args, opts) {
20
17
  super(args, opts);
21
18
  this.props = {};
22
19
  }
23
-
24
20
  prompting() {
25
- this.log(yosay(`Welcome to ${_chalk.default.red('generator-verdaccio-plugin')} plugin generator!`));
21
+ this.log((0, _yosay.default)(`Welcome to ${_chalk.default.red('generator-verdaccio-plugin')} plugin generator!`));
26
22
  const prompts = [{
27
23
  type: 'list',
28
24
  name: 'pluginType',
@@ -48,7 +44,6 @@ class VerdaccioPluginGenerator extends _yeomanGenerator.default {
48
44
  } else if (input === '') {
49
45
  return false;
50
46
  }
51
-
52
47
  return true;
53
48
  }
54
49
  }, {
@@ -64,11 +59,11 @@ class VerdaccioPluginGenerator extends _yeomanGenerator.default {
64
59
  }
65
60
  }, {
66
61
  name: 'authorName',
67
- message: 'Author\'s Name',
62
+ message: "Author's Name",
68
63
  store: true
69
64
  }, {
70
65
  name: 'authorEmail',
71
- message: 'Author\'s Email',
66
+ message: "Author's Email",
72
67
  store: true
73
68
  }, {
74
69
  name: 'keywords',
@@ -84,51 +79,47 @@ class VerdaccioPluginGenerator extends _yeomanGenerator.default {
84
79
  const {
85
80
  name,
86
81
  githubUsername
87
- } = _props; // @ts-ignore
88
-
82
+ } = _props;
83
+ // @ts-ignore
89
84
  this.props.license = 'MIT';
90
-
91
85
  if (githubUsername) {
92
86
  // @ts-ignore
93
87
  this.props.repository = githubUsername + '/' + name;
94
- } // @ts-ignore
95
-
96
-
97
- this.projectName = `verdaccio-${name}`; // @ts-ignore
88
+ }
98
89
 
99
- this.destinationPathName = (0, _path.resolve)(this.projectName); // @ts-ignore
90
+ // @ts-ignore
91
+ this.projectName = `verdaccio-${name}`;
100
92
 
93
+ // @ts-ignore
94
+ this.destinationPathName = (0, _path.resolve)(this.projectName);
95
+ // @ts-ignore
101
96
  this.props.name = this.projectName;
102
97
  }.bind(this));
103
98
  }
104
-
105
99
  packageJSON() {
106
100
  const {
107
101
  pluginType
108
102
  } = this.props;
109
- const pkgJsonLocation = `typescript/${pluginType}/_package.json`;
103
+ const pkgJsonLocation = `${pluginType}/_package.json`;
110
104
  this.fs.copyTpl(this.templatePath(pkgJsonLocation), this.destinationPath((0, _path.resolve)(this.destinationPathName, 'package.json')), this.props);
111
105
  }
112
-
113
106
  writing() {
114
- this.fs.copy(this.templatePath(`typescript/common/gitignore`), this.destinationPath((0, _path.resolve)(this.destinationPathName, '.gitignore')));
115
- this.fs.copy(this.templatePath(`typescript/common/npmignore`), this.destinationPath((0, _path.resolve)(this.destinationPathName, '.npmignore')));
116
- this.fs.copy(this.templatePath(`typescript/common/jest.config.js`), this.destinationPath((0, _path.resolve)(this.destinationPathName, 'jest.config.js')));
117
- this.fs.copyTpl(this.templatePath(`typescript/common/README.md`), this.destinationPath((0, _path.resolve)(this.destinationPathName, 'README.md')), this.props);
118
- this.fs.copyTpl(this.templatePath(`typescript/common/eslintrc`), this.destinationPath((0, _path.resolve)(this.destinationPathName, '.eslintrc')), this.props);
119
- this.fs.copyTpl(this.templatePath(`typescript/common/eslintignore`), this.destinationPath((0, _path.resolve)(this.destinationPathName, '.eslintignore')), this.props);
120
- this.fs.copy(this.templatePath(`typescript/${this.props.pluginType}/src`), this.destinationPath((0, _path.resolve)(this.destinationPathName, 'src')));
121
- this.fs.copy(this.templatePath(`typescript/common/index.js`), this.destinationPath((0, _path.resolve)(this.destinationPathName, `index.js`)));
122
- this.fs.copy(this.templatePath(`typescript/common/tsconfig.json`), this.destinationPath((0, _path.resolve)(this.destinationPathName, 'tsconfig.json')));
123
- this.fs.copy(this.templatePath(`typescript/${this.props.pluginType}/types`), this.destinationPath((0, _path.resolve)(this.destinationPathName, 'types')));
124
- this.fs.copy(this.templatePath(`typescript/common/editorconfig`), this.destinationPath((0, _path.resolve)(this.destinationPathName, '.editorconfig')));
107
+ this.fs.copy(this.templatePath(`common/gitignore`), this.destinationPath((0, _path.resolve)(this.destinationPathName, '.gitignore')));
108
+ this.fs.copy(this.templatePath(`common/npmignore`), this.destinationPath((0, _path.resolve)(this.destinationPathName, '.npmignore')));
109
+ this.fs.copy(this.templatePath(`common/jest.config.js`), this.destinationPath((0, _path.resolve)(this.destinationPathName, 'jest.config.js')));
110
+ this.fs.copyTpl(this.templatePath(`common/README.md`), this.destinationPath((0, _path.resolve)(this.destinationPathName, 'README.md')), this.props);
111
+ this.fs.copyTpl(this.templatePath(`common/eslintrc`), this.destinationPath((0, _path.resolve)(this.destinationPathName, '.eslintrc')), this.props);
112
+ this.fs.copyTpl(this.templatePath(`common/eslintignore`), this.destinationPath((0, _path.resolve)(this.destinationPathName, '.eslintignore')), this.props);
113
+ this.fs.copy(this.templatePath(`${this.props.pluginType}/src`), this.destinationPath((0, _path.resolve)(this.destinationPathName, 'src')));
114
+ this.fs.copy(this.templatePath(`common/index.js`), this.destinationPath((0, _path.resolve)(this.destinationPathName, `index.js`)));
115
+ this.fs.copy(this.templatePath(`common/tsconfig.json`), this.destinationPath((0, _path.resolve)(this.destinationPathName, 'tsconfig.json')));
116
+ this.fs.copy(this.templatePath(`${this.props.pluginType}/types`), this.destinationPath((0, _path.resolve)(this.destinationPathName, 'types')));
117
+ this.fs.copy(this.templatePath(`common/editorconfig`), this.destinationPath((0, _path.resolve)(this.destinationPathName, '.editorconfig')));
125
118
  }
126
-
127
119
  install() {
128
- process.chdir(this.projectName); // this.installDependencies({ npm: true, bower: false });
120
+ process.chdir(this.projectName);
121
+ // this.installDependencies({ npm: true, bower: false });
129
122
  }
130
-
131
123
  }
132
-
133
- module.exports = VerdaccioPluginGenerator;
124
+ var _default = exports.default = PluginGenerator;
134
125
  //# sourceMappingURL=index.js.map
@@ -1 +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","store","choices","value","default","validate","input","startsWith","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","module","exports"],"sources":["../../src/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\nclass 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 ${chalk.red('generator-verdaccio-plugin')} plugin generator!`,\n ),\n );\n\n const prompts = [\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: 'name',\n require: true,\n message: `What's the plugin name? The prefix (verdaccio-xxx) will be added automatically`,\n default: 'customname',\n validate: function(input: string) {\n if (input.startsWith('verdaccio-')) {\n return false;\n } else if (input === '') {\n return false;\n }\n return true;\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.js`,\n ),\n this.destinationPath(\n resolve(\n this.destinationPathName,\n `index.js`,\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\nmodule.exports = VerdaccioPluginGenerator;\n"],"mappings":";;AAAA;;AAEA;;AACA;;AACA;;;;AAYA,MAAMA,KAAK,GAAGC,OAAO,CAAC,OAAD,CAArB;;AAEA,MAAMC,wBAAN,SAAuCC,wBAAvC,CAAiD;EAEvCC,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,CACA,cAAaY,cAAA,CAAMC,GAAN,CAAU,4BAAV,CAAwC,oBADrD,CADT;IAMA,MAAMC,OAAO,GAAG,CACd;MACEC,IAAI,EAAE,MADR;MAEEC,IAAI,EAAE,YAFR;MAGEf,OAAO,EAAE,IAHX;MAIEgB,OAAO,EAAE,yCAJX;MAKEC,KAAK,EAAE,IALT;MAMEC,OAA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R,CACI,KAAKH,YAAL,CAAmB,cAAa,KAAKnC,KAAL,CAAW+B,UAAW,QAAtD,CADJ,EAEI,KAAKK,eAAL,CAAqB,IAAAR,aAAA,EAAQ,KAAKhC,mBAAb,EAAkC,OAAlC,CAArB,CAFJ;IAKA,KAAKqC,EAAL,CAAQK,IAAR,CACI,KAAKH,YAAL,CAAmB,gCAAnB,CADJ,EAEI,KAAKC,eAAL,CAAqB,IAAAR,aAAA,EAAQ,KAAKhC,mBAAb,EAAkC,eAAlC,CAArB,CAFJ;EAID;;EAED2C,OAAO,GAAG;IACRC,OAAO,CAACC,KAAR,CAAc,KAAK9C,WAAnB,EADQ,CAER;EACD;;AAhL8C;;AAmLjD+C,MAAM,CAACC,OAAP,GAAiBlD,wBAAjB"}
1
+ {"version":3,"file":"index.js","names":["_chalk","_interopRequireDefault","require","_lodash","_path","_yeomanGenerator","_yosay","obj","__esModule","default","PluginGenerator","Generator","projectName","destinationPathName","constructor","args","opts","props","prompting","log","yosay","chalk","red","prompts","type","name","message","store","choices","value","validate","input","startsWith","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","_default","exports"],"sources":["../../src/app/index.ts"],"sourcesContent":["import chalk from 'chalk';\nimport _ from 'lodash';\nimport { resolve } from 'path';\nimport Generator from 'yeoman-generator';\nimport yosay from 'yosay';\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\nclass PluginGenerator 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(yosay(`Welcome to ${chalk.red('generator-verdaccio-plugin')} plugin generator!`));\n\n const prompts = [\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: [{ value: 'auth' }, { value: 'storage' }, { value: 'middleware' }],\n },\n {\n type: 'input',\n name: 'name',\n require: true,\n message: `What's the plugin name? The prefix (verdaccio-xxx) will be added automatically`,\n default: 'customname',\n validate: function (input: string) {\n if (input.startsWith('verdaccio-')) {\n return false;\n } else if (input === '') {\n return false;\n }\n return true;\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 = `${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(`common/gitignore`),\n this.destinationPath(resolve(this.destinationPathName, '.gitignore'))\n );\n this.fs.copy(\n this.templatePath(`common/npmignore`),\n this.destinationPath(resolve(this.destinationPathName, '.npmignore'))\n );\n this.fs.copy(\n this.templatePath(`common/jest.config.js`),\n this.destinationPath(resolve(this.destinationPathName, 'jest.config.js'))\n );\n this.fs.copyTpl(\n this.templatePath(`common/README.md`),\n this.destinationPath(resolve(this.destinationPathName, 'README.md')),\n this.props\n );\n this.fs.copyTpl(\n this.templatePath(`common/eslintrc`),\n this.destinationPath(resolve(this.destinationPathName, '.eslintrc')),\n this.props\n );\n this.fs.copyTpl(\n this.templatePath(`common/eslintignore`),\n this.destinationPath(resolve(this.destinationPathName, '.eslintignore')),\n this.props\n );\n\n this.fs.copy(\n this.templatePath(`${this.props.pluginType}/src`),\n this.destinationPath(resolve(this.destinationPathName, 'src'))\n );\n\n this.fs.copy(\n this.templatePath(`common/index.js`),\n this.destinationPath(resolve(this.destinationPathName, `index.js`))\n );\n\n this.fs.copy(\n this.templatePath(`common/tsconfig.json`),\n this.destinationPath(resolve(this.destinationPathName, 'tsconfig.json'))\n );\n this.fs.copy(\n this.templatePath(`${this.props.pluginType}/types`),\n this.destinationPath(resolve(this.destinationPathName, 'types'))\n );\n\n this.fs.copy(\n this.templatePath(`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\nexport default PluginGenerator;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,MAAA,GAAAL,sBAAA,CAAAC,OAAA;AAA0B,SAAAD,uBAAAM,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAY1B,MAAMG,eAAe,SAASC,wBAAS,CAAC;EAE9BC,WAAW,GAAG,YAAY;EAC1BC,mBAAmB,GAAG,YAAY;EAC1CC,WAAWA,CAACC,IAAI,EAAEC,IAAI,EAA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';
1
2
  import {
2
- PluginOptions,
3
3
  AuthAccessCallback,
4
4
  AuthCallback,
5
- PackageAccess,
6
5
  IPluginAuth,
7
- RemoteUser,
8
6
  Logger,
7
+ PackageAccess,
8
+ PluginOptions,
9
+ RemoteUser,
9
10
  } from '@verdaccio/types';
10
- import {getInternalError} from '@verdaccio/commons-api';
11
11
 
12
- import {CustomConfig} from '../types/index';
12
+ import { CustomConfig } from '../types/index';
13
13
 
14
14
  /**
15
15
  * Custom Verdaccio Authenticate Plugin.
@@ -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,22 +1,22 @@
1
1
  # <%= name %>
2
2
 
3
3
  <%- (description || '').split('\n').map(function (line) {
4
- return '> ' + line
4
+ return '> ' + line
5
5
  }).join('\n') %>
6
6
 
7
7
  ---
8
8
 
9
9
  ## development
10
10
 
11
- See the [verdaccio contributing guide](https://github.com/verdaccio/verdaccio/blob/master/CONTRIBUTING.md) for instructions setting up your development environment.
11
+ See the [verdaccio contributing guide](https://github.com/verdaccio/verdaccio/blob/master/CONTRIBUTING.md) for instructions setting up your development environment.
12
12
  Once you have completed that, use the following npm tasks.
13
13
 
14
- - `npm run build`
14
+ - `npm run build`
15
15
 
16
- Build a distributable archive
16
+ Build a distributable archive
17
17
 
18
- - `npm run test`
18
+ - `npm run test`
19
19
 
20
- Run unit test
20
+ Run unit test
21
21
 
22
22
  For more information about any of these commands run `npm run ${task} -- --help`.
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', {
4
+ value: true,
5
+ });
6
+ exports.default = void 0;
7
+
8
+ let _index = _interopRequireDefault(require('./lib/index'));
9
+
10
+ function _interopRequireDefault(obj) {
11
+ return obj && obj.__esModule ? obj : { default: obj };
12
+ }
13
+
14
+ let _default = _index.default;
15
+ exports.default = _default;
@@ -10,8 +10,5 @@
10
10
  "allowSyntheticDefaultImports": true,
11
11
  "esModuleInterop": true
12
12
  },
13
- "include": [
14
- "src/*.ts",
15
- "types/*.ts"
16
- ]
13
+ "include": ["src/*.ts", "types/*.ts"]
17
14
  }
@@ -1,7 +1,14 @@
1
- import {Logger, IPluginMiddleware, IBasicAuth, IStorageManager, PluginOptions} from '@verdaccio/types';
2
- import {Router, Request, Response, NextFunction, Application} from 'express';
1
+ import { Application, NextFunction, Request, Response, Router } from 'express';
3
2
 
4
- import {CustomConfig} from '../types/index';
3
+ import {
4
+ IBasicAuth,
5
+ IPluginMiddleware,
6
+ IStorageManager,
7
+ Logger,
8
+ PluginOptions,
9
+ } from '@verdaccio/types';
10
+
11
+ import { CustomConfig } from '../types/index';
5
12
 
6
13
  export default class VerdaccioMiddlewarePlugin implements IPluginMiddleware<CustomConfig> {
7
14
  public logger: Logger;
@@ -12,10 +19,10 @@ export default class VerdaccioMiddlewarePlugin implements IPluginMiddleware<Cust
12
19
  }
13
20
 
14
21
  public register_middlewares(
15
- app: Application,
16
- auth: IBasicAuth<CustomConfig>,
17
- /* eslint @typescript-eslint/no-unused-vars: off */
18
- _storage: IStorageManager<CustomConfig>,
22
+ app: Application,
23
+ auth: IBasicAuth<CustomConfig>,
24
+ /* eslint @typescript-eslint/no-unused-vars: off */
25
+ _storage: IStorageManager<CustomConfig>
19
26
  ): void {
20
27
  /**
21
28
  * This is just an example of implementation
@@ -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,28 +1,25 @@
1
+ import { getConflict, getInternalError, getNotFound } from '@verdaccio/commons-api';
2
+ import { ReadTarball, UploadTarball } from '@verdaccio/streams';
1
3
  import {
2
4
  Callback,
3
- Logger,
4
- ILocalPackageManager,
5
- StorageUpdateCallback,
6
- PackageTransformer,
7
- StorageWriteCallback,
8
5
  CallbackAction,
6
+ ILocalPackageManager,
7
+ Logger,
9
8
  Package,
9
+ PackageTransformer,
10
10
  ReadPackageCallback,
11
+ StorageUpdateCallback,
12
+ StorageWriteCallback,
11
13
  } from '@verdaccio/types';
12
- import {UploadTarball, ReadTarball} from '@verdaccio/streams';
13
- import {getNotFound, getConflict, getInternalError} from '@verdaccio/commons-api';
14
14
 
15
- import {CustomConfig} from '../types/index';
15
+ import { CustomConfig } from '../types/index';
16
+
16
17
  export default class StoragePluginManage implements ILocalPackageManager {
17
18
  public logger: Logger;
18
19
  public packageName: string;
19
20
  public config: CustomConfig;
20
21
 
21
- public constructor(
22
- config: CustomConfig,
23
- packageName: string,
24
- logger: Logger,
25
- ) {
22
+ public constructor(config: CustomConfig, packageName: string, logger: Logger) {
26
23
  this.logger = logger;
27
24
  this.packageName = packageName;
28
25
  this.config = config;
@@ -37,11 +34,11 @@ export default class StoragePluginManage implements ILocalPackageManager {
37
34
  * @param onEnd
38
35
  */
39
36
  public updatePackage(
40
- name: string,
41
- updateHandler: StorageUpdateCallback,
42
- onWrite: StorageWriteCallback,
43
- transformPackage: PackageTransformer,
44
- onEnd: CallbackAction,
37
+ name: string,
38
+ updateHandler: StorageUpdateCallback,
39
+ onWrite: StorageWriteCallback,
40
+ transformPackage: PackageTransformer,
41
+ onEnd: CallbackAction
45
42
  ): void {
46
43
  /**
47
44
  * Example of implementation:
@@ -99,11 +96,7 @@ export default class StoragePluginManage implements ILocalPackageManager {
99
96
  * @param data
100
97
  * @param callback
101
98
  */
102
- public createPackage(
103
- name: string,
104
- data: Package,
105
- callback: CallbackAction,
106
- ): void {
99
+ public createPackage(name: string, data: Package, callback: CallbackAction): void {
107
100
  /**
108
101
  * Example of implementation:
109
102
  * this.customStore.create(name, data).then(err => {
@@ -166,7 +159,6 @@ export default class StoragePluginManage implements ILocalPackageManager {
166
159
  * const stream = new UploadTarball({});
167
160
  return stream;
168
161
  */
169
-
170
162
  }
171
163
 
172
164
  /**
@@ -0,0 +1 @@
1
+ export { default } from './plugin';
@@ -1,30 +1,26 @@
1
+ import { getInternalError } from '@verdaccio/commons-api';
1
2
  import {
2
- Logger,
3
3
  Callback,
4
+ Config,
5
+ IPackageStorage,
4
6
  IPluginStorage,
7
+ Logger,
5
8
  PluginOptions,
6
- IPackageStorage,
7
- TokenFilter,
8
9
  Token,
9
- Config,
10
+ TokenFilter,
10
11
  onEndSearchPackage,
11
12
  onSearchPackage,
12
13
  onValidatePackage,
13
14
  } from '@verdaccio/types';
14
- import {getInternalError} from '@verdaccio/commons-api';
15
-
16
- import {CustomConfig} from '../types/index';
17
15
 
16
+ import { CustomConfig } from '../types/index';
18
17
  import PackageStorage from './PackageStorage';
19
18
 
20
19
  export default class VerdaccioStoragePlugin implements IPluginStorage<CustomConfig> {
21
20
  config: CustomConfig & Config;
22
21
  version?: string;
23
22
  public logger: Logger;
24
- public constructor(
25
- config: CustomConfig,
26
- options: PluginOptions<CustomConfig>,
27
- ) {
23
+ public constructor(config: CustomConfig, options: PluginOptions<CustomConfig>) {
28
24
  this.config = config;
29
25
  this.logger = options.logger;
30
26
  }
@@ -49,9 +45,7 @@ export default class VerdaccioStoragePlugin implements IPluginStorage<CustomConf
49
45
  * @param {*} name
50
46
  * @return {Error|*}
51
47
  */
52
- public add(name: string, callback: Callback): void {
53
-
54
- }
48
+ public add(name: string, callback: Callback): void {}
55
49
 
56
50
  /**
57
51
  * Perform a search in your registry
@@ -60,9 +54,9 @@ export default class VerdaccioStoragePlugin implements IPluginStorage<CustomConf
60
54
  * @param validateName
61
55
  */
62
56
  public search(
63
- onPackage: onSearchPackage,
64
- onEnd: onEndSearchPackage,
65
- validateName: onValidatePackage,
57
+ onPackage: onSearchPackage,
58
+ onEnd: onEndSearchPackage,
59
+ validateName: onValidatePackage
66
60
  ): void {
67
61
  /**
68
62
  * Example of implementation:
@@ -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": "4.1.0",
3
+ "version": "5.0.0-next-7.0",
4
4
  "description": "plugin generator for verdaccio",
5
5
  "homepage": "https://github.com/verdaccio",
6
6
  "author": {
@@ -18,68 +18,21 @@
18
18
  "dependencies": {
19
19
  "chalk": "4.1.2",
20
20
  "lodash": "4.17.21",
21
- "yeoman-environment": "3.10.0",
22
- "yeoman-generator": "5.7.0",
23
- "yosay": "2.0.2"
21
+ "yeoman-environment": "3.19.3",
22
+ "yeoman-generator": "5.9.0",
23
+ "yosay": "2.0.2",
24
+ "@verdaccio/core": "7.0.0-next-7.17",
25
+ "@verdaccio/config": "7.0.0-next-7.17"
24
26
  },
25
27
  "devDependencies": {
26
- "@babel/cli": "7.18.10",
27
- "@babel/core": "7.18.10",
28
- "@babel/node": "7.18.10",
29
- "@changesets/changelog-github": "0.4.6",
30
- "@changesets/cli": "2.24.1",
31
- "@changesets/get-dependents-graph": "1.3.3",
32
- "@babel/plugin-proposal-class-properties": "7.18.6",
33
- "@babel/plugin-proposal-decorators": "7.18.10",
34
- "@babel/plugin-proposal-export-namespace-from": "7.18.9",
35
- "@babel/plugin-proposal-function-sent": "7.18.6",
36
- "@babel/plugin-proposal-json-strings": "7.18.6",
37
- "@babel/plugin-proposal-nullish-coalescing-operator": "7.18.6",
38
- "@babel/plugin-proposal-numeric-separator": "7.18.6",
39
- "@babel/plugin-proposal-object-rest-spread": "7.18.9",
40
- "@babel/plugin-proposal-optional-chaining": "7.18.9",
41
- "@babel/plugin-proposal-throw-expressions": "7.18.6",
42
- "@babel/plugin-syntax-dynamic-import": "7.8.3",
43
- "@babel/plugin-syntax-import-meta": "7.10.4",
44
- "@babel/plugin-transform-async-to-generator": "7.18.6",
45
- "@babel/plugin-transform-classes": "7.18.9",
46
- "@babel/plugin-transform-runtime": "7.18.10",
47
- "@babel/preset-env": "7.18.10",
48
- "@babel/preset-react": "7.18.6",
49
- "@babel/preset-typescript": "7.18.6",
50
- "@babel/register": "7.18.9",
51
- "@babel/runtime": "7.18.9",
52
- "@trivago/prettier-plugin-sort-imports": "3.3.0",
53
- "@types/chalk": "2.2.0",
54
- "@types/express": "4.17.13",
55
- "@types/lodash": "4.14.182",
56
- "@types/mocha": "9.1.1",
57
- "@types/node": "17.0.40",
58
- "@types/yeoman-environment": "2.10.7",
59
- "@types/yeoman-generator": "5.2.10",
60
- "@types/yeoman-test": "4.0.3",
61
- "@typescript-eslint/eslint-plugin": "5.32.0",
62
- "@typescript-eslint/parser": "5.32.0",
63
- "@verdaccio/types": "10.5.2",
64
- "eslint": "8.21.0",
65
- "eslint-config-google": "0.14.0",
66
- "npm-run-all": "4.1.5",
67
- "eslint-config-prettier": "8.5.0",
68
- "eslint-plugin-babel": "5.3.1",
69
- "eslint-plugin-import": "2.26.0",
70
- "eslint-plugin-jest": "26.7.0",
71
- "eslint-plugin-prettier": "4.2.1",
72
- "eslint-plugin-simple-import-sort": "7.0.0",
73
- "express": "4.18.1",
74
- "jest": "28.1.3",
75
- "prettier": "2.7.1",
76
- "ts-jest": "^28.0.4",
77
- "typescript": "4.7.4",
28
+ "@verdaccio/test-helper": "3.0.0-next-7.2",
29
+ "@verdaccio/types": "12.0.0-next-7.4",
30
+ "ts-jest": "29.1.0",
78
31
  "yeoman-assert": "3.1.1",
79
32
  "yeoman-test": "6.3.0"
80
33
  },
81
34
  "engines": {
82
- "node": ">=14"
35
+ "node": ">18.0.0"
83
36
  },
84
37
  "repository": {
85
38
  "type": "git",
@@ -87,19 +40,10 @@
87
40
  },
88
41
  "license": "MIT",
89
42
  "scripts": {
90
- "format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,yml,yaml,md}\"",
91
- "format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,json,yml,yaml,md}\"",
92
- "release": "standard-version -a -s",
93
43
  "type-check": "tsc --noEmit -p tsconfig.build.json",
94
44
  "build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json",
95
45
  "build": "babel src/ --out-dir generators/ --copy-files --extensions \".ts,.tsx\" --source-maps --ignore src/app/templates",
96
- "test": "jest",
97
- "lint": "eslint --max-warnings 0 \"**/*.{js,ts}\"",
98
- "changeset": "changeset",
99
- "changeset:check": "changeset status --since-master",
100
- "ci:version": "run-s ci:version:changeset ci:version:install",
101
- "ci:version:install": "pnpm install --frozen-lockfile=false",
102
- "ci:version:changeset": "changeset version",
103
- "ci:publish": "changeset publish"
46
+ "test": "vitest run --pool=forks",
47
+ "lint": "eslint --max-warnings 0 \"**/*.{js,ts}\""
104
48
  }
105
49
  }
@@ -1,13 +0,0 @@
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;
@@ -1 +0,0 @@
1
- export {default} from './plugin';