generator-verdaccio-plugin 4.0.0-next.1 → 4.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.
- package/README.md +11 -17
- package/generators/app/index.js +17 -11
- package/generators/app/index.js.map +1 -1
- package/generators/app/templates/typescript/auth/_package.json +5 -6
- package/generators/app/templates/typescript/auth/src/index.ts +5 -4
- package/generators/app/templates/typescript/common/eslintignore +1 -1
- package/generators/app/templates/typescript/common/index.js +0 -1
- package/generators/app/templates/typescript/common/npmignore +0 -1
- package/generators/app/templates/typescript/common/tsconfig.json +2 -6
- package/generators/app/templates/typescript/middleware/_package.json +5 -6
- package/generators/app/templates/typescript/storage/_package.json +7 -8
- package/package.json +30 -31
- package/generators/app/index.ts +0 -195
- package/generators/app/templates/.eslintrc +0 -5
- package/generators/app/templates/typescript/auth/src/index.js +0 -92
- package/generators/app/templates/typescript/auth/src/index.js.map +0 -1
- package/generators/app/templates/typescript/auth/types/index.js +0 -6
- package/generators/app/templates/typescript/auth/types/index.js.map +0 -1
- package/generators/app/templates/typescript/common/index.js.map +0 -1
- package/generators/app/templates/typescript/common/index.ts +0 -3
- package/generators/app/templates/typescript/middleware/src/index.js +0 -36
- package/generators/app/templates/typescript/middleware/src/index.js.map +0 -1
- package/generators/app/templates/typescript/middleware/types/index.js +0 -6
- package/generators/app/templates/typescript/middleware/types/index.js.map +0 -1
- package/generators/app/templates/typescript/storage/src/PackageStorage.js +0 -168
- package/generators/app/templates/typescript/storage/src/PackageStorage.js.map +0 -1
- package/generators/app/templates/typescript/storage/src/index.js +0 -16
- package/generators/app/templates/typescript/storage/src/index.js.map +0 -1
- package/generators/app/templates/typescript/storage/src/plugin.js +0 -129
- package/generators/app/templates/typescript/storage/src/plugin.js.map +0 -1
- package/generators/app/templates/typescript/storage/types/index.js +0 -6
- package/generators/app/templates/typescript/storage/types/index.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Plugin Generator
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/verdaccio)
|
|
4
|
+
[](https://www.npmjs.com/package/verdaccio)
|
|
5
|
+
[](https://verdaccio.org/docs/en/docker.html)
|
|
6
6
|
[](https://opencollective.com/verdaccio)
|
|
7
7
|
[](https://stackshare.io/verdaccio)
|
|
8
8
|
[](http://chat.verdaccio.org/)
|
|
@@ -10,11 +10,6 @@ generator-verdaccio-plugin/master?type=dev)
|
|
|
10
10
|
|
|
11
11
|
Verdaccio plugin generator based in [Yeoman](http://yeoman.io) aims to help to scaffold plugins development
|
|
12
12
|
|
|
13
|
-
### Maintainers
|
|
14
|
-
|
|
15
|
-
* [Anix](https://github.com/anikethsaha)
|
|
16
|
-
* [Juan Picado](https://github.com/juanpicado)
|
|
17
|
-
|
|
18
13
|
## Installation
|
|
19
14
|
|
|
20
15
|
First, install [Yeoman](http://yeoman.io) and generator-verdaccio-plugin using [npm](https://www.npmjs.com/) (we assume you have pre-installed [node.js](https://nodejs.org/)).
|
|
@@ -32,16 +27,15 @@ yo verdaccio-plugin
|
|
|
32
27
|
|
|
33
28
|
## Plugin Types Supported
|
|
34
29
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
* Authentication
|
|
31
|
+
* Storage
|
|
32
|
+
* Middleware
|
|
38
33
|
|
|
34
|
+
### Maintainers
|
|
35
|
+
|
|
36
|
+
* [Anix](https://github.com/anikethsaha)
|
|
37
|
+
* [Juan Picado](https://github.com/juanpicado)
|
|
39
38
|
|
|
40
39
|
## License
|
|
41
40
|
|
|
42
41
|
MIT © [Juan Picado <@jotadeveloper>]()
|
|
43
|
-
|
|
44
|
-
[npm-image]: https://badge.fury.io/js/generator-verdaccio-plugin.svg
|
|
45
|
-
[npm-url]: https://npmjs.org/package/generator-verdaccio-plugin
|
|
46
|
-
[daviddm-image]: https://david-dm.org/verdaccio/generator-verdaccio-plugin.svg?theme=shields.io
|
|
47
|
-
[daviddm-url]: https://david-dm.org/verdaccio/generator-verdaccio-plugin
|
package/generators/app/index.js
CHANGED
|
@@ -22,17 +22,8 @@ class VerdaccioPluginGenerator extends _yeomanGenerator.default {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
prompting() {
|
|
25
|
-
this.log(yosay(
|
|
25
|
+
this.log(yosay(`Welcome to ${_chalk.default.red('generator-verdaccio-plugin')} plugin generator!`));
|
|
26
26
|
const prompts = [{
|
|
27
|
-
type: 'input',
|
|
28
|
-
name: 'name',
|
|
29
|
-
require: true,
|
|
30
|
-
message: 'What is the name of your plugin?',
|
|
31
|
-
default: 'customname',
|
|
32
|
-
validate: function (input) {
|
|
33
|
-
return input !== '';
|
|
34
|
-
}
|
|
35
|
-
}, {
|
|
36
27
|
type: 'list',
|
|
37
28
|
name: 'pluginType',
|
|
38
29
|
require: true,
|
|
@@ -45,6 +36,21 @@ class VerdaccioPluginGenerator extends _yeomanGenerator.default {
|
|
|
45
36
|
}, {
|
|
46
37
|
value: 'middleware'
|
|
47
38
|
}]
|
|
39
|
+
}, {
|
|
40
|
+
type: 'input',
|
|
41
|
+
name: 'name',
|
|
42
|
+
require: true,
|
|
43
|
+
message: `What's the plugin name? The prefix (verdaccio-xxx) will be added automatically`,
|
|
44
|
+
default: 'customname',
|
|
45
|
+
validate: function (input) {
|
|
46
|
+
if (input.startsWith('verdaccio-')) {
|
|
47
|
+
return false;
|
|
48
|
+
} else if (input === '') {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
48
54
|
}, {
|
|
49
55
|
type: 'input',
|
|
50
56
|
name: 'description',
|
|
@@ -112,7 +118,7 @@ class VerdaccioPluginGenerator extends _yeomanGenerator.default {
|
|
|
112
118
|
this.fs.copyTpl(this.templatePath(`typescript/common/eslintrc`), this.destinationPath((0, _path.resolve)(this.destinationPathName, '.eslintrc')), this.props);
|
|
113
119
|
this.fs.copyTpl(this.templatePath(`typescript/common/eslintignore`), this.destinationPath((0, _path.resolve)(this.destinationPathName, '.eslintignore')), this.props);
|
|
114
120
|
this.fs.copy(this.templatePath(`typescript/${this.props.pluginType}/src`), this.destinationPath((0, _path.resolve)(this.destinationPathName, 'src')));
|
|
115
|
-
this.fs.copy(this.templatePath(`typescript/common/index.
|
|
121
|
+
this.fs.copy(this.templatePath(`typescript/common/index.js`), this.destinationPath((0, _path.resolve)(this.destinationPathName, `index.js`)));
|
|
116
122
|
this.fs.copy(this.templatePath(`typescript/common/tsconfig.json`), this.destinationPath((0, _path.resolve)(this.destinationPathName, 'tsconfig.json')));
|
|
117
123
|
this.fs.copy(this.templatePath(`typescript/${this.props.pluginType}/types`), this.destinationPath((0, _path.resolve)(this.destinationPathName, 'types')));
|
|
118
124
|
this.fs.copy(this.templatePath(`typescript/common/editorconfig`), this.destinationPath((0, _path.resolve)(this.destinationPathName, '.editorconfig')));
|
|
@@ -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","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","module","exports"],"sources":["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 ' +\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\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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I,IAAAR,aAAA,EAAQ,KAAK/B,mBAAb,EAAkC,eAAlC,CADJ,CAFJ;IAMA,KAAKoC,EAAL,CAAQK,IAAR,CACI,KAAKH,YAAL,CAAmB,cAAa,KAAKlC,KAAL,CAAW8B,UAAW,QAAtD,CADJ,EAEI,KAAKK,eAAL,CAAqB,IAAAR,aAAA,EAAQ,KAAK/B,mBAAb,EAAkC,OAAlC,CAArB,CAFJ;IAKA,KAAKoC,EAAL,CAAQK,IAAR,CACI,KAAKH,YAAL,CAAmB,gCAAnB,CADJ,EAEI,KAAKC,eAAL,CAAqB,IAAAR,aAAA,EAAQ,KAAK/B,mBAAb,EAAkC,eAAlC,CAArB,CAFJ;EAID;;EAED0C,OAAO,GAAG;IACRC,OAAO,CAACC,KAAR,CAAc,KAAK7C,WAAnB,EADQ,CAER;EACD;;AA7K8C;;AAgLjD8C,MAAM,CAACC,OAAP,GAAiBjD,wBAAjB"}
|
|
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,K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AAKH,YAAL,CACK,4BADL,CADJ,EAII,KAAKC,eAAL,CACI,IAAAR,aAAA,EACI,KAAKhC,mBADT,EAEK,UAFL,CADJ,CAJJ;IAYA,KAAKqC,EAAL,CAAQK,IAAR,CACI,KAAKH,YAAL,CAAmB,iCAAnB,CADJ,EAEI,KAAKC,eAAL,CACI,IAAAR,aAAA,EAAQ,KAAKhC,mBAAb,EAAkC,eAAlC,CADJ,CAFJ;IAMA,KAAKqC,EAAL,CAAQK,IAAR,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"}
|
|
@@ -2,22 +2,21 @@
|
|
|
2
2
|
"name": "<%= name %>",
|
|
3
3
|
"version": "0.0.1",
|
|
4
4
|
"description": "<%= description %>",
|
|
5
|
-
"main": "lib/index.js",
|
|
6
|
-
"types": "lib/index.d.ts",
|
|
7
|
-
"files": ["lib/"],
|
|
5
|
+
"main": "lib/src/index.js",
|
|
6
|
+
"types": "lib/src/index.d.ts",
|
|
8
7
|
"engines": {
|
|
9
8
|
"node": ">=12"
|
|
10
9
|
},
|
|
11
10
|
"dependencies": {
|
|
12
|
-
"@verdaccio/commons-api": "
|
|
11
|
+
"@verdaccio/commons-api": "10.2.0"
|
|
13
12
|
},
|
|
14
13
|
"devDependencies": {
|
|
15
14
|
"@types/jest": "27.5.1",
|
|
16
|
-
"@types/node": "
|
|
15
|
+
"@types/node": "12.12.5",
|
|
17
16
|
"@types/express": "4.17.13",
|
|
18
17
|
"@typescript-eslint/eslint-plugin": "5.26.0",
|
|
19
18
|
"@typescript-eslint/parser": "5.26.0",
|
|
20
|
-
"@verdaccio/types": "
|
|
19
|
+
"@verdaccio/types": "10.5.1",
|
|
21
20
|
"eslint": "8.16.0",
|
|
22
21
|
"jest": "28.1.1",
|
|
23
22
|
"typescript": "4.7.3"
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
RemoteUser,
|
|
8
8
|
Logger,
|
|
9
9
|
} from '@verdaccio/types';
|
|
10
|
+
import {getInternalError} from '@verdaccio/commons-api';
|
|
10
11
|
|
|
11
12
|
import {CustomConfig} from '../types/index';
|
|
12
13
|
|
|
@@ -33,7 +34,7 @@ export default class AuthCustomPlugin implements IPluginAuth<CustomConfig> {
|
|
|
33
34
|
if (this.foo) {
|
|
34
35
|
cb(null, ['group-foo', 'group-bar']);
|
|
35
36
|
} else {
|
|
36
|
-
cb(
|
|
37
|
+
cb(getInternalError("error, try again"), false);
|
|
37
38
|
}
|
|
38
39
|
*/
|
|
39
40
|
}
|
|
@@ -52,7 +53,7 @@ export default class AuthCustomPlugin implements IPluginAuth<CustomConfig> {
|
|
|
52
53
|
cb(null, true)
|
|
53
54
|
} else {
|
|
54
55
|
this.logger.error({name: user.name}, '@{name} is not allowed to access this package');
|
|
55
|
-
|
|
56
|
+
cb(getInternalError("error, try again"), false);
|
|
56
57
|
}
|
|
57
58
|
*/
|
|
58
59
|
}
|
|
@@ -71,7 +72,7 @@ export default class AuthCustomPlugin implements IPluginAuth<CustomConfig> {
|
|
|
71
72
|
cb(null, true)
|
|
72
73
|
} else {
|
|
73
74
|
this.logger.error({name: user.name}, '@{name} is not allowed to publish this package');
|
|
74
|
-
|
|
75
|
+
cb(getInternalError("error, try again"), false);
|
|
75
76
|
}
|
|
76
77
|
*/
|
|
77
78
|
}
|
|
@@ -84,7 +85,7 @@ export default class AuthCustomPlugin implements IPluginAuth<CustomConfig> {
|
|
|
84
85
|
cb(null, true)
|
|
85
86
|
} else {
|
|
86
87
|
this.logger.error({name: user.name}, '@{name} is not allowed to publish this package');
|
|
87
|
-
cb(
|
|
88
|
+
cb(getInternalError("error, try again"), false);
|
|
88
89
|
}
|
|
89
90
|
*/
|
|
90
91
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
node_modules
|
|
2
|
-
lib
|
|
2
|
+
lib/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"target": "
|
|
3
|
+
"target": "es6",
|
|
4
4
|
"module": "commonjs",
|
|
5
5
|
"declaration": true,
|
|
6
6
|
"allowJs": false,
|
|
@@ -8,11 +8,7 @@
|
|
|
8
8
|
"strict": true,
|
|
9
9
|
"outDir": "./lib",
|
|
10
10
|
"allowSyntheticDefaultImports": true,
|
|
11
|
-
"esModuleInterop": true
|
|
12
|
-
"typeRoots": [
|
|
13
|
-
"../../node_modules/@verdaccio/types/lib/verdaccio",
|
|
14
|
-
"../../node_modules/@types"
|
|
15
|
-
]
|
|
11
|
+
"esModuleInterop": true
|
|
16
12
|
},
|
|
17
13
|
"include": [
|
|
18
14
|
"src/*.ts",
|
|
@@ -2,23 +2,22 @@
|
|
|
2
2
|
"name": "<%= name %>",
|
|
3
3
|
"version": "0.0.1",
|
|
4
4
|
"description": "<%= description %>",
|
|
5
|
-
"main": "lib/index.js",
|
|
6
|
-
"types": "lib/index.d.ts",
|
|
7
|
-
"files": ["lib/"],
|
|
5
|
+
"main": "lib/src/index.js",
|
|
6
|
+
"types": "lib/src/index.d.ts",
|
|
8
7
|
"engines": {
|
|
9
8
|
"node": ">=12"
|
|
10
9
|
},
|
|
11
10
|
"dependencies": {
|
|
12
|
-
"@verdaccio/commons-api": "
|
|
11
|
+
"@verdaccio/commons-api": "10.2.0",
|
|
13
12
|
"express": "4.18.1"
|
|
14
13
|
},
|
|
15
14
|
"devDependencies": {
|
|
16
15
|
"@types/jest": "27.5.1",
|
|
17
|
-
"@types/node": "
|
|
16
|
+
"@types/node": "12.12.5",
|
|
18
17
|
"@types/express": "4.17.13",
|
|
19
18
|
"@typescript-eslint/eslint-plugin": "5.26.0",
|
|
20
19
|
"@typescript-eslint/parser": "5.26.0",
|
|
21
|
-
"@verdaccio/types": "
|
|
20
|
+
"@verdaccio/types": "10.5.1",
|
|
22
21
|
"eslint": "8.16.0",
|
|
23
22
|
"jest": "28.1.1",
|
|
24
23
|
"typescript": "4.7.3"
|
|
@@ -2,23 +2,22 @@
|
|
|
2
2
|
"name": "<%= name %>",
|
|
3
3
|
"version": "0.0.1",
|
|
4
4
|
"description": "<%= description %>",
|
|
5
|
-
"main": "lib/index.js",
|
|
6
|
-
"types": "lib/index.d.ts",
|
|
7
|
-
"files": ["lib/"],
|
|
5
|
+
"main": "lib/src/index.js",
|
|
6
|
+
"types": "lib/src/index.d.ts",
|
|
8
7
|
"engines": {
|
|
9
|
-
"node": ">=
|
|
8
|
+
"node": ">=12"
|
|
10
9
|
},
|
|
11
10
|
"dependencies": {
|
|
12
|
-
"@verdaccio/commons-api": "
|
|
13
|
-
"@verdaccio/streams": "
|
|
11
|
+
"@verdaccio/commons-api": "10.2.0",
|
|
12
|
+
"@verdaccio/streams": "10.2.0"
|
|
14
13
|
},
|
|
15
14
|
"devDependencies": {
|
|
16
15
|
"@types/jest": "27.5.1",
|
|
17
|
-
"@types/node": "
|
|
16
|
+
"@types/node": "12.12.5",
|
|
18
17
|
"@types/express": "4.17.13",
|
|
19
18
|
"@typescript-eslint/eslint-plugin": "5.26.0",
|
|
20
19
|
"@typescript-eslint/parser": "5.26.0",
|
|
21
|
-
"@verdaccio/types": "
|
|
20
|
+
"@verdaccio/types": "10.5.1",
|
|
22
21
|
"eslint": "8.16.0",
|
|
23
22
|
"jest": "28.1.1",
|
|
24
23
|
"typescript": "4.7.3"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "generator-verdaccio-plugin",
|
|
3
|
-
"version": "4.0.0
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "plugin generator for verdaccio",
|
|
5
5
|
"homepage": "https://github.com/verdaccio",
|
|
6
6
|
"author": {
|
|
@@ -23,32 +23,32 @@
|
|
|
23
23
|
"yosay": "2.0.2"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@babel/cli": "7.
|
|
27
|
-
"@babel/core": "7.
|
|
28
|
-
"@babel/node": "7.
|
|
29
|
-
"@changesets/changelog-github": "0.4.
|
|
30
|
-
"@changesets/cli": "2.
|
|
31
|
-
"@changesets/get-dependents-graph": "1.2
|
|
32
|
-
"@babel/plugin-proposal-class-properties": "7.
|
|
33
|
-
"@babel/plugin-proposal-decorators": "7.
|
|
34
|
-
"@babel/plugin-proposal-export-namespace-from": "7.
|
|
35
|
-
"@babel/plugin-proposal-function-sent": "7.
|
|
36
|
-
"@babel/plugin-proposal-json-strings": "7.
|
|
37
|
-
"@babel/plugin-proposal-nullish-coalescing-operator": "7.
|
|
26
|
+
"@babel/cli": "7.17.10",
|
|
27
|
+
"@babel/core": "7.18.5",
|
|
28
|
+
"@babel/node": "7.18.5",
|
|
29
|
+
"@changesets/changelog-github": "0.4.5",
|
|
30
|
+
"@changesets/cli": "2.23.0",
|
|
31
|
+
"@changesets/get-dependents-graph": "1.3.2",
|
|
32
|
+
"@babel/plugin-proposal-class-properties": "7.17.12",
|
|
33
|
+
"@babel/plugin-proposal-decorators": "7.18.2",
|
|
34
|
+
"@babel/plugin-proposal-export-namespace-from": "7.17.12",
|
|
35
|
+
"@babel/plugin-proposal-function-sent": "7.18.2",
|
|
36
|
+
"@babel/plugin-proposal-json-strings": "7.17.12",
|
|
37
|
+
"@babel/plugin-proposal-nullish-coalescing-operator": "7.17.12",
|
|
38
38
|
"@babel/plugin-proposal-numeric-separator": "7.16.7",
|
|
39
|
-
"@babel/plugin-proposal-object-rest-spread": "7.
|
|
40
|
-
"@babel/plugin-proposal-optional-chaining": "7.
|
|
39
|
+
"@babel/plugin-proposal-object-rest-spread": "7.18.0",
|
|
40
|
+
"@babel/plugin-proposal-optional-chaining": "7.17.12",
|
|
41
41
|
"@babel/plugin-proposal-throw-expressions": "7.16.7",
|
|
42
42
|
"@babel/plugin-syntax-dynamic-import": "7.8.3",
|
|
43
43
|
"@babel/plugin-syntax-import-meta": "7.10.4",
|
|
44
|
-
"@babel/plugin-transform-async-to-generator": "7.
|
|
45
|
-
"@babel/plugin-transform-classes": "7.
|
|
46
|
-
"@babel/plugin-transform-runtime": "7.
|
|
47
|
-
"@babel/preset-env": "7.
|
|
48
|
-
"@babel/preset-react": "7.
|
|
49
|
-
"@babel/preset-typescript": "7.
|
|
50
|
-
"@babel/register": "7.
|
|
51
|
-
"@babel/runtime": "7.
|
|
44
|
+
"@babel/plugin-transform-async-to-generator": "7.17.12",
|
|
45
|
+
"@babel/plugin-transform-classes": "7.18.4",
|
|
46
|
+
"@babel/plugin-transform-runtime": "7.18.5",
|
|
47
|
+
"@babel/preset-env": "7.18.2",
|
|
48
|
+
"@babel/preset-react": "7.17.12",
|
|
49
|
+
"@babel/preset-typescript": "7.17.12",
|
|
50
|
+
"@babel/register": "7.17.7",
|
|
51
|
+
"@babel/runtime": "7.18.3",
|
|
52
52
|
"@trivago/prettier-plugin-sort-imports": "3.2.0",
|
|
53
53
|
"@types/chalk": "2.2.0",
|
|
54
54
|
"@types/express": "4.17.13",
|
|
@@ -58,16 +58,16 @@
|
|
|
58
58
|
"@types/yeoman-environment": "2.10.7",
|
|
59
59
|
"@types/yeoman-generator": "5.2.10",
|
|
60
60
|
"@types/yeoman-test": "4.0.3",
|
|
61
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
62
|
-
"@typescript-eslint/parser": "5.
|
|
63
|
-
"@verdaccio/types": "10.
|
|
61
|
+
"@typescript-eslint/eslint-plugin": "5.28.0",
|
|
62
|
+
"@typescript-eslint/parser": "5.28.0",
|
|
63
|
+
"@verdaccio/types": "10.5.1",
|
|
64
64
|
"eslint": "8.17.0",
|
|
65
65
|
"eslint-config-google": "0.14.0",
|
|
66
66
|
"npm-run-all": "4.1.5",
|
|
67
67
|
"eslint-config-prettier": "8.5.0",
|
|
68
68
|
"eslint-plugin-babel": "5.3.1",
|
|
69
69
|
"eslint-plugin-import": "2.26.0",
|
|
70
|
-
"eslint-plugin-jest": "26.
|
|
70
|
+
"eslint-plugin-jest": "26.5.3",
|
|
71
71
|
"eslint-plugin-prettier": "4.0.0",
|
|
72
72
|
"eslint-plugin-simple-import-sort": "7.0.0",
|
|
73
73
|
"express": "4.18.1",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"yeoman-test": "6.3.0"
|
|
80
80
|
},
|
|
81
81
|
"engines": {
|
|
82
|
-
"node": ">=
|
|
82
|
+
"node": ">=14"
|
|
83
83
|
},
|
|
84
84
|
"repository": {
|
|
85
85
|
"type": "git",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"release": "standard-version -a -s",
|
|
93
93
|
"type-check": "tsc --noEmit -p tsconfig.build.json",
|
|
94
94
|
"build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json",
|
|
95
|
-
"build": "babel
|
|
95
|
+
"build": "babel src/ --out-dir generators/ --copy-files --extensions \".ts,.tsx\" --source-maps --ignore src/app/templates",
|
|
96
96
|
"test": "jest",
|
|
97
97
|
"lint": "eslint --max-warnings 0 \"**/*.{js,ts}\"",
|
|
98
98
|
"changeset": "changeset",
|
|
@@ -101,6 +101,5 @@
|
|
|
101
101
|
"ci:version:install": "pnpm install --frozen-lockfile=false",
|
|
102
102
|
"ci:version:changeset": "changeset version",
|
|
103
103
|
"ci:publish": "changeset publish"
|
|
104
|
-
}
|
|
105
|
-
"readme": "# Verdaccio plugin generator\n\n[![NPM version][npm-image]][npm-url]\ngenerator-verdaccio-plugin/master?type=dev)\n[](./LICENSE)\n[](https://opencollective.com/verdaccio)\n[](https://stackshare.io/verdaccio)\n[](http://chat.verdaccio.org/)\n[](https://twitter.com/verdaccio_npm)\n\nVerdaccio plugin generator based in [Yeoman](http://yeoman.io) aims to help to scaffold plugins development\n\n### Maintainers\n\n* [Anix](https://github.com/anikethsaha)\n* [Juan Picado](https://github.com/juanpicado)\n\n## Installation\n\nFirst, install [Yeoman](http://yeoman.io) and generator-verdaccio-plugin using [npm](https://www.npmjs.com/) (we assume you have pre-installed [node.js](https://nodejs.org/)).\n\n```bash\nnpm install -g yo\nnpm install -g generator-verdaccio-plugin\n```\n\nThen generate your new project:\n\n```bash\nyo verdaccio-plugin\n```\n\n## Plugin Types Supported\n\n- Authentication\n- Storage\n- Middleware\n\n\n## License\n\nMIT © [Juan Picado <@jotadeveloper>]()\n\n[npm-image]: https://badge.fury.io/js/generator-verdaccio-plugin.svg\n[npm-url]: https://npmjs.org/package/generator-verdaccio-plugin\n[daviddm-image]: https://david-dm.org/verdaccio/generator-verdaccio-plugin.svg?theme=shields.io\n[daviddm-url]: https://david-dm.org/verdaccio/generator-verdaccio-plugin\n"
|
|
104
|
+
}
|
|
106
105
|
}
|
package/generators/app/index.ts
DELETED
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
import {resolve} from 'path';
|
|
2
|
-
|
|
3
|
-
import Generator from 'yeoman-generator';
|
|
4
|
-
import chalk from 'chalk';
|
|
5
|
-
import _ from 'lodash';
|
|
6
|
-
|
|
7
|
-
type propsTypes = {
|
|
8
|
-
name?: string;
|
|
9
|
-
pluginType?: string;
|
|
10
|
-
description?: string;
|
|
11
|
-
githubUsername?: string;
|
|
12
|
-
authorName?: string;
|
|
13
|
-
authorEmail?: string;
|
|
14
|
-
keywords?: string[];
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const yosay = require('yosay');
|
|
18
|
-
|
|
19
|
-
class VerdaccioPluginGenerator extends Generator {
|
|
20
|
-
private props: propsTypes;
|
|
21
|
-
private projectName = 'verdaccio-';
|
|
22
|
-
private destinationPathName = 'verdaccio-';
|
|
23
|
-
constructor(args, opts) {
|
|
24
|
-
super(args, opts);
|
|
25
|
-
this.props = {};
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
prompting() {
|
|
29
|
-
this.log(
|
|
30
|
-
yosay(
|
|
31
|
-
'Welcome to ' +
|
|
32
|
-
chalk.red('generator-verdaccio-plugin') +
|
|
33
|
-
' plugin generator!',
|
|
34
|
-
),
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
const prompts = [
|
|
38
|
-
{
|
|
39
|
-
type: 'input',
|
|
40
|
-
name: 'name',
|
|
41
|
-
require: true,
|
|
42
|
-
message: 'What is the name of your plugin?',
|
|
43
|
-
default: 'customname',
|
|
44
|
-
validate: function(input) {
|
|
45
|
-
return input !== '';
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
type: 'list',
|
|
50
|
-
name: 'pluginType',
|
|
51
|
-
require: true,
|
|
52
|
-
message: 'What kind of plugin you want to create?',
|
|
53
|
-
store: true,
|
|
54
|
-
choices: [
|
|
55
|
-
{value: 'auth'},
|
|
56
|
-
{value: 'storage'},
|
|
57
|
-
{value: 'middleware'},
|
|
58
|
-
],
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
type: 'input',
|
|
62
|
-
name: 'description',
|
|
63
|
-
message: 'Please, describe your plugin',
|
|
64
|
-
default: 'An amazing verdaccio plugin',
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
name: 'githubUsername',
|
|
68
|
-
message: 'GitHub username or Organization',
|
|
69
|
-
validate: function(input) {
|
|
70
|
-
return input !== '';
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
name: 'authorName',
|
|
75
|
-
message: 'Author\'s Name',
|
|
76
|
-
store: true,
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
name: 'authorEmail',
|
|
80
|
-
message: 'Author\'s Email',
|
|
81
|
-
store: true,
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
name: 'keywords',
|
|
85
|
-
message: 'Key your keywords (comma to split)',
|
|
86
|
-
filter: function(keywords) {
|
|
87
|
-
return _.uniq(_.words(keywords).concat(['verdaccio-']));
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
];
|
|
91
|
-
|
|
92
|
-
return this.prompt(prompts).then(
|
|
93
|
-
function(_props) {
|
|
94
|
-
// To access props later use this.props.someAnswer;
|
|
95
|
-
// @ts-ignore
|
|
96
|
-
this.props = _props;
|
|
97
|
-
const {name, githubUsername} = _props;
|
|
98
|
-
// @ts-ignore
|
|
99
|
-
this.props.license = 'MIT';
|
|
100
|
-
if (githubUsername) {
|
|
101
|
-
// @ts-ignore
|
|
102
|
-
this.props.repository = githubUsername + '/' + name;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// @ts-ignore
|
|
106
|
-
this.projectName = `verdaccio-${name}`;
|
|
107
|
-
|
|
108
|
-
// @ts-ignore
|
|
109
|
-
this.destinationPathName = resolve(this.projectName);
|
|
110
|
-
// @ts-ignore
|
|
111
|
-
this.props.name = this.projectName;
|
|
112
|
-
}.bind(this),
|
|
113
|
-
);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
packageJSON() {
|
|
117
|
-
const {pluginType} = this.props;
|
|
118
|
-
const pkgJsonLocation = `typescript/${pluginType}/_package.json`;
|
|
119
|
-
this.fs.copyTpl(
|
|
120
|
-
this.templatePath(pkgJsonLocation),
|
|
121
|
-
this.destinationPath(resolve(this.destinationPathName, 'package.json')),
|
|
122
|
-
this.props,
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
writing() {
|
|
127
|
-
this.fs.copy(
|
|
128
|
-
this.templatePath(`typescript/common/gitignore`),
|
|
129
|
-
this.destinationPath(resolve(this.destinationPathName, '.gitignore')),
|
|
130
|
-
);
|
|
131
|
-
this.fs.copy(
|
|
132
|
-
this.templatePath(`typescript/common/npmignore`),
|
|
133
|
-
this.destinationPath(resolve(this.destinationPathName, '.npmignore')),
|
|
134
|
-
);
|
|
135
|
-
this.fs.copy(
|
|
136
|
-
this.templatePath(`typescript/common/jest.config.js`),
|
|
137
|
-
this.destinationPath(resolve(this.destinationPathName, 'jest.config.js')),
|
|
138
|
-
);
|
|
139
|
-
this.fs.copyTpl(
|
|
140
|
-
this.templatePath(`typescript/common/README.md`),
|
|
141
|
-
this.destinationPath(resolve(this.destinationPathName, 'README.md')),
|
|
142
|
-
this.props,
|
|
143
|
-
);
|
|
144
|
-
this.fs.copyTpl(
|
|
145
|
-
this.templatePath(`typescript/common/eslintrc`),
|
|
146
|
-
this.destinationPath(resolve(this.destinationPathName, '.eslintrc')),
|
|
147
|
-
this.props,
|
|
148
|
-
);
|
|
149
|
-
this.fs.copyTpl(
|
|
150
|
-
this.templatePath(`typescript/common/eslintignore`),
|
|
151
|
-
this.destinationPath(resolve(this.destinationPathName, '.eslintignore')),
|
|
152
|
-
this.props,
|
|
153
|
-
);
|
|
154
|
-
|
|
155
|
-
this.fs.copy(
|
|
156
|
-
this.templatePath(`typescript/${this.props.pluginType}/src`),
|
|
157
|
-
this.destinationPath(resolve(this.destinationPathName, 'src')),
|
|
158
|
-
);
|
|
159
|
-
|
|
160
|
-
this.fs.copy(
|
|
161
|
-
this.templatePath(
|
|
162
|
-
`typescript/common/index.ts`,
|
|
163
|
-
),
|
|
164
|
-
this.destinationPath(
|
|
165
|
-
resolve(
|
|
166
|
-
this.destinationPathName,
|
|
167
|
-
`index.ts`,
|
|
168
|
-
),
|
|
169
|
-
),
|
|
170
|
-
);
|
|
171
|
-
|
|
172
|
-
this.fs.copy(
|
|
173
|
-
this.templatePath(`typescript/common/tsconfig.json`),
|
|
174
|
-
this.destinationPath(
|
|
175
|
-
resolve(this.destinationPathName, 'tsconfig.json'),
|
|
176
|
-
),
|
|
177
|
-
);
|
|
178
|
-
this.fs.copy(
|
|
179
|
-
this.templatePath(`typescript/${this.props.pluginType}/types`),
|
|
180
|
-
this.destinationPath(resolve(this.destinationPathName, 'types')),
|
|
181
|
-
);
|
|
182
|
-
|
|
183
|
-
this.fs.copy(
|
|
184
|
-
this.templatePath(`typescript/common/editorconfig`),
|
|
185
|
-
this.destinationPath(resolve(this.destinationPathName, '.editorconfig')),
|
|
186
|
-
);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
install() {
|
|
190
|
-
process.chdir(this.projectName);
|
|
191
|
-
// this.installDependencies({ npm: true, bower: false });
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
module.exports = VerdaccioPluginGenerator;
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Custom Verdaccio Authenticate Plugin.
|
|
10
|
-
*/
|
|
11
|
-
class AuthCustomPlugin {
|
|
12
|
-
constructor(config, options) {
|
|
13
|
-
this.logger = options.logger;
|
|
14
|
-
this.foo = config.foo;
|
|
15
|
-
return this;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Authenticate an user.
|
|
19
|
-
* @param user user to log
|
|
20
|
-
* @param password provided password
|
|
21
|
-
* @param cb callback function
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
authenticate(user, password, cb) {
|
|
26
|
-
/**
|
|
27
|
-
* This code is just an example for demostration purpose
|
|
28
|
-
if (this.foo) {
|
|
29
|
-
cb(null, ['group-foo', 'group-bar']);
|
|
30
|
-
} else {
|
|
31
|
-
cb('error, try again', false);
|
|
32
|
-
}
|
|
33
|
-
*/
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Triggered on each access request
|
|
37
|
-
* @param user
|
|
38
|
-
* @param pkg
|
|
39
|
-
* @param cb
|
|
40
|
-
*/
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
allow_access(user, pkg, cb) {
|
|
44
|
-
/**
|
|
45
|
-
* This code is just an example for demostration purpose
|
|
46
|
-
if (user.name === this.foo && pkg?.access?.includes[user.name]) {
|
|
47
|
-
this.logger.debug({name: user.name}, 'your package has been granted for @{name}');
|
|
48
|
-
cb(null, true)
|
|
49
|
-
} else {
|
|
50
|
-
this.logger.error({name: user.name}, '@{name} is not allowed to access this package');
|
|
51
|
-
cb('error, try again', false);
|
|
52
|
-
}
|
|
53
|
-
*/
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Triggered on each publish request
|
|
57
|
-
* @param user
|
|
58
|
-
* @param pkg
|
|
59
|
-
* @param cb
|
|
60
|
-
*/
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
allow_publish(user, pkg, cb) {
|
|
64
|
-
/**
|
|
65
|
-
* This code is just an example for demostration purpose
|
|
66
|
-
if (user.name === this.foo && pkg?.access?.includes[user.name]) {
|
|
67
|
-
this.logger.debug({name: user.name}, '@{name} has been granted to publish');
|
|
68
|
-
cb(null, true)
|
|
69
|
-
} else {
|
|
70
|
-
this.logger.error({name: user.name}, '@{name} is not allowed to publish this package');
|
|
71
|
-
cb('error, try again', false);
|
|
72
|
-
}
|
|
73
|
-
*/
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
allow_unpublish(user, pkg, cb) {
|
|
77
|
-
/**
|
|
78
|
-
* This code is just an example for demostration purpose
|
|
79
|
-
if (user.name === this.foo && pkg?.access?.includes[user.name]) {
|
|
80
|
-
this.logger.debug({name: user.name}, '@{name} has been granted to unpublish');
|
|
81
|
-
cb(null, true)
|
|
82
|
-
} else {
|
|
83
|
-
this.logger.error({name: user.name}, '@{name} is not allowed to publish this package');
|
|
84
|
-
cb('error, try again', false);
|
|
85
|
-
}
|
|
86
|
-
*/
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
exports.default = AuthCustomPlugin;
|
|
92
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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":["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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["index.ts"],"sourcesContent":["import {Config} from '@verdaccio/types';\n\nexport interface CustomConfig extends Config {\n foo: string;\n}\n"],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["VerdaccioPlugin"],"sources":["index.ts"],"sourcesContent":["import VerdaccioPlugin from './lib/index';\n\nexport default VerdaccioPlugin;\n"],"mappings":";;;;;;;AAAA;;;;eAEeA,c"}
|
|
@@ -1,36 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["VerdaccioMiddlewarePlugin","constructor","config","options","foo","undefined","strict_ssl","logger","register_middlewares","app","auth","_storage"],"sources":["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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["index.ts"],"sourcesContent":["import {Config} from '@verdaccio/types';\n\nexport interface CustomConfig extends Config {\n foo: string;\n}\n"],"mappings":""}
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
class StoragePluginManage {
|
|
9
|
-
constructor(config, packageName, logger) {
|
|
10
|
-
this.logger = logger;
|
|
11
|
-
this.packageName = packageName;
|
|
12
|
-
this.config = config;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Handle a metadata update and
|
|
16
|
-
* @param name
|
|
17
|
-
* @param updateHandler
|
|
18
|
-
* @param onWrite
|
|
19
|
-
* @param transformPackage
|
|
20
|
-
* @param onEnd
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
updatePackage(name, updateHandler, onWrite, transformPackage, onEnd) {
|
|
25
|
-
/**
|
|
26
|
-
* Example of implementation:
|
|
27
|
-
this.customStore.get().then((pkg: Package) => {
|
|
28
|
-
updateHandler(pkg, function onUpdateFinish(err) {
|
|
29
|
-
if (err) {
|
|
30
|
-
onEnd(err);
|
|
31
|
-
} else {
|
|
32
|
-
onWrite(name, pkg, onEnd);
|
|
33
|
-
}
|
|
34
|
-
})
|
|
35
|
-
});
|
|
36
|
-
*/
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Delete a specific file (tarball or package.json)
|
|
40
|
-
* @param fileName
|
|
41
|
-
* @param callback
|
|
42
|
-
*/
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
deletePackage(fileName, callback) {
|
|
46
|
-
/**
|
|
47
|
-
* Example of implementation:
|
|
48
|
-
this.customStore.delete(fileName, (err) => {
|
|
49
|
-
if (err) {
|
|
50
|
-
callback(err);
|
|
51
|
-
} else {
|
|
52
|
-
callback(null);
|
|
53
|
-
}
|
|
54
|
-
})
|
|
55
|
-
*/
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Delete a package (folder, path)
|
|
59
|
-
* This happens after all versions ar tarballs have been removed.
|
|
60
|
-
* @param callback
|
|
61
|
-
*/
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
removePackage(callback) {
|
|
65
|
-
/**
|
|
66
|
-
* Example of implementation:
|
|
67
|
-
this.customStore.removePackage((err) => {
|
|
68
|
-
if (err) {
|
|
69
|
-
callback(err);
|
|
70
|
-
} else {
|
|
71
|
-
callback(null);
|
|
72
|
-
}
|
|
73
|
-
})
|
|
74
|
-
*/
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Publish a new package (version).
|
|
78
|
-
* @param name
|
|
79
|
-
* @param data
|
|
80
|
-
* @param callback
|
|
81
|
-
*/
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
createPackage(name, data, callback) {
|
|
85
|
-
/**
|
|
86
|
-
* Example of implementation:
|
|
87
|
-
* this.customStore.create(name, data).then(err => {
|
|
88
|
-
if (err.notFound) {
|
|
89
|
-
callback(getNotFound());
|
|
90
|
-
} else if (err.alreadyExist) {
|
|
91
|
-
callback(getConflict());
|
|
92
|
-
} else {
|
|
93
|
-
callback(null);
|
|
94
|
-
}
|
|
95
|
-
})
|
|
96
|
-
*/
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Perform write anobject to the storage.
|
|
100
|
-
* Similar to updatePackage but without middleware handlers
|
|
101
|
-
* @param pkgName package name
|
|
102
|
-
* @param pkg package metadata
|
|
103
|
-
* @param callback
|
|
104
|
-
*/
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
savePackage(pkgName, pkg, callback) {
|
|
108
|
-
/*
|
|
109
|
-
Example of implementation:
|
|
110
|
-
this.cumstomStore.write(pkgName, pkgName).then(data => {
|
|
111
|
-
callback(null);
|
|
112
|
-
}).catch(err => {
|
|
113
|
-
callback(getInternalError(err.message));
|
|
114
|
-
})
|
|
115
|
-
*/
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Read a package from storage
|
|
119
|
-
* @param pkgName package name
|
|
120
|
-
* @param callback
|
|
121
|
-
*/
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
readPackage(pkgName, callback) {
|
|
125
|
-
/**
|
|
126
|
-
* Example of implementation:
|
|
127
|
-
* this.customStorage.read(name, (err, pkg: Package) => {
|
|
128
|
-
if (err.fooError) {
|
|
129
|
-
callback(getInternalError(err))
|
|
130
|
-
} else if (err.barError) {
|
|
131
|
-
callback(getNotFound());
|
|
132
|
-
} else {
|
|
133
|
-
callback(null, pkg)
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
*/
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* Create writtable stream (write a tarball)
|
|
140
|
-
* @param name
|
|
141
|
-
*/
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
writeTarball(name) {
|
|
145
|
-
/**
|
|
146
|
-
* Example of implementation:
|
|
147
|
-
* const stream = new UploadTarball({});
|
|
148
|
-
return stream;
|
|
149
|
-
*/
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Create a readable stream (read a from a tarball)
|
|
153
|
-
* @param name
|
|
154
|
-
*/
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
readTarball(name) {
|
|
158
|
-
/**
|
|
159
|
-
* Example of implementation:
|
|
160
|
-
* const stream = new ReadTarball({});
|
|
161
|
-
return stream;
|
|
162
|
-
*/
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
exports.default = StoragePluginManage;
|
|
168
|
-
//# sourceMappingURL=PackageStorage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PackageStorage.js","names":["StoragePluginManage","constructor","config","packageName","logger","updatePackage","name","updateHandler","onWrite","transformPackage","onEnd","deletePackage","fileName","callback","removePackage","createPackage","data","savePackage","pkgName","pkg","readPackage","writeTarball","readTarball"],"sources":["PackageStorage.ts"],"sourcesContent":["import {\n Callback,\n Logger,\n ILocalPackageManager,\n StorageUpdateCallback,\n PackageTransformer,\n StorageWriteCallback,\n CallbackAction,\n Package,\n ReadPackageCallback,\n} from '@verdaccio/types';\nimport {UploadTarball, ReadTarball} from '@verdaccio/streams';\nimport {getNotFound, getConflict, getInternalError} from '@verdaccio/commons-api';\n\nimport {CustomConfig} from '../types/index';\nexport default class StoragePluginManage implements ILocalPackageManager {\n public logger: Logger;\n public packageName: string;\n public config: CustomConfig;\n\n public constructor(\n config: CustomConfig,\n packageName: string,\n logger: Logger,\n ) {\n this.logger = logger;\n this.packageName = packageName;\n this.config = config;\n }\n\n /**\n * Handle a metadata update and\n * @param name\n * @param updateHandler\n * @param onWrite\n * @param transformPackage\n * @param onEnd\n */\n public updatePackage(\n name: string,\n updateHandler: StorageUpdateCallback,\n onWrite: StorageWriteCallback,\n transformPackage: PackageTransformer,\n onEnd: CallbackAction,\n ): void {\n /**\n * Example of implementation:\n this.customStore.get().then((pkg: Package) => {\n updateHandler(pkg, function onUpdateFinish(err) {\n if (err) {\n onEnd(err);\n } else {\n onWrite(name, pkg, onEnd);\n }\n })\n });\n */\n }\n\n /**\n * Delete a specific file (tarball or package.json)\n * @param fileName\n * @param callback\n */\n public deletePackage(fileName: string, callback: CallbackAction): void {\n /**\n * Example of implementation:\n this.customStore.delete(fileName, (err) => {\n if (err) {\n callback(err);\n } else {\n callback(null);\n }\n })\n */\n }\n\n /**\n * Delete a package (folder, path)\n * This happens after all versions ar tarballs have been removed.\n * @param callback\n */\n public removePackage(callback: CallbackAction): void {\n /**\n * Example of implementation:\n this.customStore.removePackage((err) => {\n if (err) {\n callback(err);\n } else {\n callback(null);\n }\n })\n */\n }\n\n /**\n * Publish a new package (version).\n * @param name\n * @param data\n * @param callback\n */\n public createPackage(\n name: string,\n data: Package,\n callback: CallbackAction,\n ): void {\n /**\n * Example of implementation:\n * this.customStore.create(name, data).then(err => {\n if (err.notFound) {\n callback(getNotFound());\n } else if (err.alreadyExist) {\n callback(getConflict());\n } else {\n callback(null);\n }\n })\n */\n }\n\n /**\n * Perform write anobject to the storage.\n * Similar to updatePackage but without middleware handlers\n * @param pkgName package name\n * @param pkg package metadata\n * @param callback\n */\n public savePackage(pkgName: string, pkg: Package, callback: CallbackAction): void {\n /*\n Example of implementation:\n this.cumstomStore.write(pkgName, pkgName).then(data => {\n callback(null);\n }).catch(err => {\n callback(getInternalError(err.message));\n })\n */\n }\n\n /**\n * Read a package from storage\n * @param pkgName package name\n * @param callback\n */\n public readPackage(pkgName: string, callback: ReadPackageCallback): void {\n /**\n * Example of implementation:\n * this.customStorage.read(name, (err, pkg: Package) => {\n if (err.fooError) {\n callback(getInternalError(err))\n } else if (err.barError) {\n callback(getNotFound());\n } else {\n callback(null, pkg)\n }\n });\n */\n }\n\n /**\n * Create writtable stream (write a tarball)\n * @param name\n */\n public writeTarball(name: string): UploadTarball {\n /**\n * Example of implementation:\n * const stream = new UploadTarball({});\n return stream;\n */\n\n }\n\n /**\n * Create a readable stream (read a from a tarball)\n * @param name\n */\n public readTarball(name: string): ReadTarball {\n /**\n * Example of implementation:\n * const stream = new ReadTarball({});\n return stream;\n */\n }\n}\n"],"mappings":";;;;;;;AAee,MAAMA,mBAAN,CAA0D;EAKhEC,WAAW,CACdC,MADc,EAEdC,WAFc,EAGdC,MAHc,EAIhB;IACA,KAAKA,MAAL,GAAcA,MAAd;IACA,KAAKD,WAAL,GAAmBA,WAAnB;IACA,KAAKD,MAAL,GAAcA,MAAd;EACD;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;;;EACSG,aAAa,CAChBC,IADgB,EAEhBC,aAFgB,EAGhBC,OAHgB,EAIhBC,gBAJgB,EAKhBC,KALgB,EAMZ;IACN;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACG;EAED;AACF;AACA;AACA;AACA;;;EACSC,aAAa,CAACC,QAAD,EAAmBC,QAAnB,EAAmD;IACrE;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACG;EAED;AACF;AACA;AACA;AACA;;;EACSC,aAAa,CAACD,QAAD,EAAiC;IACnD;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACG;EAED;AACF;AACA;AACA;AACA;AACA;;;EACSE,aAAa,CAChBT,IADgB,EAEhBU,IAFgB,EAGhBH,QAHgB,EAIZ;IACN;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACG;EAED;AACF;AACA;AACA;AACA;AACA;AACA;;;EACSI,WAAW,CAACC,OAAD,EAAkBC,GAAlB,EAAgCN,QAAhC,EAAgE;IAChF;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;EACG;EAED;AACF;AACA;AACA;AACA;;;EACSO,WAAW,CAACF,OAAD,EAAkBL,QAAlB,EAAuD;IACvE;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACG;EAED;AACF;AACA;AACA;;;EACSQ,YAAY,CAACf,IAAD,EAA8B;IAC/C;AACJ;AACA;AACA;AACA;EAEG;EAED;AACF;AACA;AACA;;;EACSgB,WAAW,CAAChB,IAAD,EAA4B;IAC5C;AACJ;AACA;AACA;AACA;EACG;;AAtKsE"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "default", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _plugin.default;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
var _plugin = _interopRequireDefault(require("./plugin"));
|
|
14
|
-
|
|
15
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["index.ts"],"sourcesContent":["export {default} from './plugin';\n"],"mappings":";;;;;;;;;;;;AAAA"}
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _PackageStorage = _interopRequireDefault(require("./PackageStorage"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
|
-
class VerdaccioStoragePlugin {
|
|
13
|
-
constructor(config, options) {
|
|
14
|
-
this.config = config;
|
|
15
|
-
this.logger = options.logger;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
*
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
async getSecret() {
|
|
23
|
-
/**
|
|
24
|
-
* return await resolveSecret();
|
|
25
|
-
*/
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
async setSecret(secret) {
|
|
29
|
-
/**
|
|
30
|
-
* return await getYourSecret();
|
|
31
|
-
*/
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Add a new element.
|
|
35
|
-
* @param {*} name
|
|
36
|
-
* @return {Error|*}
|
|
37
|
-
*/
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
add(name, callback) {}
|
|
41
|
-
/**
|
|
42
|
-
* Perform a search in your registry
|
|
43
|
-
* @param onPackage
|
|
44
|
-
* @param onEnd
|
|
45
|
-
* @param validateName
|
|
46
|
-
*/
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
search(onPackage, onEnd, validateName) {
|
|
50
|
-
/**
|
|
51
|
-
* Example of implementation:
|
|
52
|
-
* try {
|
|
53
|
-
* someApi.getPackages((items) => {
|
|
54
|
-
* items.map(() => {
|
|
55
|
-
* if (validateName(item.name)) {
|
|
56
|
-
* onPackage(item);
|
|
57
|
-
* }
|
|
58
|
-
* });
|
|
59
|
-
* onEnd();
|
|
60
|
-
* } catch(err) {
|
|
61
|
-
* onEnd(err);
|
|
62
|
-
* }
|
|
63
|
-
* });
|
|
64
|
-
*/
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Remove an element from the database.
|
|
68
|
-
* @param {*} name
|
|
69
|
-
* @return {Error|*}
|
|
70
|
-
*/
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
remove(name, callback) {
|
|
74
|
-
/**
|
|
75
|
-
* Example of implementation
|
|
76
|
-
database.getPackage(name, (item, err) => {
|
|
77
|
-
if (err) {
|
|
78
|
-
callback(getInternalError('your own message here'));
|
|
79
|
-
}
|
|
80
|
-
// if all goes well we return nothing
|
|
81
|
-
callback(null);
|
|
82
|
-
}
|
|
83
|
-
*/
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Return all database elements.
|
|
87
|
-
* @return {Array}
|
|
88
|
-
*/
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
get(callback) {
|
|
92
|
-
/*
|
|
93
|
-
Example of implementation
|
|
94
|
-
database.getAll((allItems, err) => {
|
|
95
|
-
callback(err, allItems);
|
|
96
|
-
})
|
|
97
|
-
*/
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Create an instance of the `PackageStorage`
|
|
101
|
-
* @param packageInfo
|
|
102
|
-
*/
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
getPackageStorage(packageInfo) {
|
|
106
|
-
return new _PackageStorage.default(this.config, packageInfo, this.logger);
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* All methods for npm token support
|
|
110
|
-
* more info here https://github.com/verdaccio/verdaccio/pull/1427
|
|
111
|
-
*/
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
saveToken(token) {
|
|
115
|
-
throw new Error('Method not implemented.');
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
deleteToken(user, tokenKey) {
|
|
119
|
-
throw new Error('Method not implemented.');
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
readTokens(filter) {
|
|
123
|
-
throw new Error('Method not implemented.');
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
exports.default = VerdaccioStoragePlugin;
|
|
129
|
-
//# sourceMappingURL=plugin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","names":["VerdaccioStoragePlugin","constructor","config","options","logger","getSecret","setSecret","secret","add","name","callback","search","onPackage","onEnd","validateName","remove","get","getPackageStorage","packageInfo","PackageStorage","saveToken","token","Error","deleteToken","user","tokenKey","readTokens","filter"],"sources":["plugin.ts"],"sourcesContent":["import {\n Logger,\n Callback,\n IPluginStorage,\n PluginOptions,\n IPackageStorage,\n TokenFilter,\n Token,\n Config,\n onEndSearchPackage,\n onSearchPackage,\n onValidatePackage,\n} from '@verdaccio/types';\nimport {getInternalError} from '@verdaccio/commons-api';\n\nimport {CustomConfig} from '../types/index';\n\nimport PackageStorage from './PackageStorage';\n\nexport default class VerdaccioStoragePlugin implements IPluginStorage<CustomConfig> {\n config: CustomConfig & Config;\n version?: string;\n public logger: Logger;\n public constructor(\n config: CustomConfig,\n options: PluginOptions<CustomConfig>,\n ) {\n this.config = config;\n this.logger = options.logger;\n }\n\n /**\n *\n */\n public async getSecret(): Promise<string> {\n /**\n * return await resolveSecret();\n */\n }\n\n public async setSecret(secret: string): Promise<any> {\n /**\n * return await getYourSecret();\n */\n }\n\n /**\n * Add a new element.\n * @param {*} name\n * @return {Error|*}\n */\n public add(name: string, callback: Callback): void {\n\n }\n\n /**\n * Perform a search in your registry\n * @param onPackage\n * @param onEnd\n * @param validateName\n */\n public search(\n onPackage: onSearchPackage,\n onEnd: onEndSearchPackage,\n validateName: onValidatePackage,\n ): void {\n /**\n * Example of implementation:\n * try {\n * someApi.getPackages((items) => {\n * items.map(() => {\n * if (validateName(item.name)) {\n * onPackage(item);\n * }\n * });\n * onEnd();\n * } catch(err) {\n * onEnd(err);\n * }\n * });\n */\n }\n\n /**\n * Remove an element from the database.\n * @param {*} name\n * @return {Error|*}\n */\n public remove(name: string, callback: Callback): void {\n /**\n * Example of implementation\n database.getPackage(name, (item, err) => {\n if (err) {\n callback(getInternalError('your own message here'));\n }\n\n // if all goes well we return nothing\n callback(null);\n }\n */\n }\n\n /**\n * Return all database elements.\n * @return {Array}\n */\n public get(callback: Callback): void {\n /*\n Example of implementation\n database.getAll((allItems, err) => {\n callback(err, allItems);\n })\n */\n }\n\n /**\n * Create an instance of the `PackageStorage`\n * @param packageInfo\n */\n public getPackageStorage(packageInfo: string): IPackageStorage {\n return new PackageStorage(this.config, packageInfo, this.logger);\n }\n\n /**\n * All methods for npm token support\n * more info here https://github.com/verdaccio/verdaccio/pull/1427\n */\n\n public saveToken(token: Token): Promise<any> {\n throw new Error('Method not implemented.');\n }\n\n public deleteToken(user: string, tokenKey: string): Promise<any> {\n throw new Error('Method not implemented.');\n }\n\n public readTokens(filter: TokenFilter): Promise<Token[]> {\n throw new Error('Method not implemented.');\n }\n}\n"],"mappings":";;;;;;;AAiBA;;;;AAEe,MAAMA,sBAAN,CAAqE;EAI3EC,WAAW,CACdC,MADc,EAEdC,OAFc,EAGhB;IACA,KAAKD,MAAL,GAAcA,MAAd;IACA,KAAKE,MAAL,GAAcD,OAAO,CAACC,MAAtB;EACD;EAED;AACF;AACA;;;EACwB,MAATC,SAAS,GAAoB;IACxC;AACJ;AACA;EACG;;EAEqB,MAATC,SAAS,CAACC,MAAD,EAA+B;IACnD;AACJ;AACA;EACG;EAED;AACF;AACA;AACA;AACA;;;EACSC,GAAG,CAACC,IAAD,EAAeC,QAAf,EAAyC,CAElD;EAED;AACF;AACA;AACA;AACA;AACA;;;EACSC,MAAM,CACTC,SADS,EAETC,KAFS,EAGTC,YAHS,EAIL;IACN;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACG;EAED;AACF;AACA;AACA;AACA;;;EACSC,MAAM,CAACN,IAAD,EAAeC,QAAf,EAAyC;IACpD;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EAEG;EAED;AACF;AACA;AACA;;;EACSM,GAAG,CAACN,QAAD,EAA2B;IACnC;AACJ;AACA;AACA;AACA;AACA;EACG;EAED;AACF;AACA;AACA;;;EACSO,iBAAiB,CAACC,WAAD,EAAuC;IAC7D,OAAO,IAAIC,uBAAJ,CAAmB,KAAKjB,MAAxB,EAAgCgB,WAAhC,EAA6C,KAAKd,MAAlD,CAAP;EACD;EAED;AACF;AACA;AACA;;;EAESgB,SAAS,CAACC,KAAD,EAA6B;IAC3C,MAAM,IAAIC,KAAJ,CAAU,yBAAV,CAAN;EACD;;EAEMC,WAAW,CAACC,IAAD,EAAeC,QAAf,EAA+C;IAC/D,MAAM,IAAIH,KAAJ,CAAU,yBAAV,CAAN;EACD;;EAEMI,UAAU,CAACC,MAAD,EAAwC;IACvD,MAAM,IAAIL,KAAJ,CAAU,yBAAV,CAAN;EACD;;AAvHiF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["index.ts"],"sourcesContent":["import {Config} from '@verdaccio/types';\n\nexport interface CustomConfig extends Config {\n foo: string;\n}\n"],"mappings":""}
|