chore: improve local dev displaying 2 packages by default

vue and jquery as examples
This commit is contained in:
Juan Picado @jotadeveloper 2019-08-04 10:17:43 +02:00
parent 240535ddad
commit 6f8d891c42
No known key found for this signature in database
GPG Key ID: 15AA875EF3768142
6 changed files with 30113 additions and 18 deletions

View File

@ -0,0 +1 @@
{"list":["vue","jquery"],"secret":"3bb332943c7086716a35dea44754b43b956ee655af1fe61866fbdaf38486836c"}

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
web: web:
title: Verdaccio title: Verdaccio Local Dev
# gravatar: false sort_packages: asc
# sort_packages: asc primary_color: #CCC
plugins: ../ plugins: ../
@ -14,22 +14,15 @@ auth:
bar: bar:
name: bar name: bar
password: test password: test
store:
memory:
limit: 1000
# theme:
security: security:
api: api:
jwt: jwt:
sign: sign:
expiresIn: 60d expiresIn: 120d
notBefore: 1 notBefore: 1
web: web:
sign: sign:
expiresIn: 7d expiresIn: 100d
notBefore: 1 notBefore: 1
uplinks: uplinks:
@ -41,12 +34,18 @@ packages:
access: $all access: $all
publish: $authenticated publish: $authenticated
unpublish: $authenticated unpublish: $authenticated
'vue':
access: foo
publish: foo
unpublish: foo
'jquery':
access: $all
publish: bar
unpublish: bar
'**': '**':
access: $all access: $all
publish: $authenticated publish: $authenticated
unpublish: $authenticated unpublish: $authenticated
middlewares: middlewares:
audit: audit:
enabled: true enabled: true

View File

@ -1,19 +1,26 @@
const fs = require('fs'); const fs = require('fs');
const startServer = require('verdaccio').default; const startServer = require('verdaccio').default;
const yalm = require('js-yaml'); const yalm = require('js-yaml');
const path = require('path');
const configJsonFormat = yalm.safeLoad(fs.readFileSync('./tools/_config.yaml', 'utf8')); const storageLocation = path.join(__dirname, '../partials/storage');
const pluginsLocation = path.join(__dirname, '../partials/plugins');
const configJsonFormat = Object.assign({}, yalm.safeLoad(fs.readFileSync('./tools/_verdaccio.config.yaml', 'utf8')), {
storage: storageLocation,
plugins: pluginsLocation,
});
const handler = function(webServer, addr, pkgName, pkgVersion) { const serverHandler = function(webServer, addr, pkgName, pkgVersion) {
webServer.listen(addr.port || addr.path, addr.host, () => { webServer.listen(addr.port || addr.path, addr.host, () => {
console.log(`${pkgName}:${pkgVersion} running ${addr.proto}://${addr.host}:${addr.port}`); console.log(`${pkgName}:${pkgVersion} running ${addr.proto}://${addr.host}:${addr.port}`);
}); });
process.on('SIGTERM', () => { process.on('SIGTERM', () => {
webServer.close(() => { webServer.close(() => {
console.log('Process terminated'); console.log('verdaccio server has been shutdown');
}); });
}); });
}; };
startServer(configJsonFormat, 8080, '', '1.0.0', 'verdaccio', handler); // https://verdaccio.org/docs/en/node-api
startServer(configJsonFormat, 8080, '', '1.0.0', 'verdaccio', serverHandler);