chore: add verdaccio and webpack dev server script

This commit is contained in:
Juan Picado @jotadeveloper 2019-04-06 17:51:26 +02:00
parent 6fcb415091
commit 3a63fba339
No known key found for this signature in database
GPG Key ID: 18AC54485952D158
3 changed files with 50 additions and 7 deletions

View File

@ -20,6 +20,7 @@
"autosuggest-highlight": "3.1.1", "autosuggest-highlight": "3.1.1",
"bundlesize": "0.17.1", "bundlesize": "0.17.1",
"codecov": "3.2.0", "codecov": "3.2.0",
"concurrently": "4.1.0",
"cross-env": "5.2.0", "cross-env": "5.2.0",
"css-loader": "0.28.10", "css-loader": "0.28.10",
"date-fns": "1.30.1", "date-fns": "1.30.1",
@ -113,8 +114,10 @@
"coverage:publish": "codecov", "coverage:publish": "codecov",
"lint:css": "stylelint 'src/webui/**/styles.js'", "lint:css": "stylelint 'src/webui/**/styles.js'",
"pre:webpack": "rimraf static/*", "pre:webpack": "rimraf static/*",
"dev": "cross-env BABEL_ENV=ui babel-node tools/dev.server.js", "dev:web": "cross-env BABEL_ENV=ui babel-node tools/dev.server.js",
"build": "npm run pre:webpack && cross-env BABEL_ENV=ui webpack --config tools/webpack.prod.config.babel.js" "verdaccio:server": "node tools/verdaccio.js",
"build": "npm run pre:webpack && cross-env BABEL_ENV=ui webpack --config tools/webpack.prod.config.babel.js",
"dev": "concurrently --kill-others \"npm run dev:web\" \"npm run verdaccio:server\""
}, },
"engines": { "engines": {
"node": ">=8", "node": ">=8",

View File

@ -2,12 +2,18 @@ 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 configJsonFormat = yalm.safeLoad(fs.readFileSync('./_config.yaml', 'utf8')); const configJsonFormat = yalm.safeLoad(fs.readFileSync('./tools/_config.yaml', 'utf8'));
const handler = function(webServer, addr, pkgName, pkgVersion) { const handler = 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', () => {
webServer.close(() => {
console.log('Process terminated')
})
})
}; };
startServer(configJsonFormat, 8080, '', '1.0.0', 'verdaccio', handler); startServer(configJsonFormat, 8080, '', '1.0.0', 'verdaccio', handler);

View File

@ -3519,6 +3519,21 @@ concat-stream@1.6.2, concat-stream@^1.4.10, concat-stream@^1.5.0:
readable-stream "^2.2.2" readable-stream "^2.2.2"
typedarray "^0.0.6" typedarray "^0.0.6"
concurrently@4.1.0:
version "4.1.0"
resolved "https://registry.verdaccio.org/concurrently/-/concurrently-4.1.0.tgz#17fdf067da71210685d9ea554423ef239da30d33"
integrity sha512-pwzXCE7qtOB346LyO9eFWpkFJVO3JQZ/qU/feGeaAHiX1M3Rw3zgXKc5cZ8vSH5DGygkjzLFDzA/pwoQDkRNGg==
dependencies:
chalk "^2.4.1"
date-fns "^1.23.0"
lodash "^4.17.10"
read-pkg "^4.0.1"
rxjs "^6.3.3"
spawn-command "^0.0.2-1"
supports-color "^4.5.0"
tree-kill "^1.1.0"
yargs "^12.0.1"
connect-history-api-fallback@^1.3.0: connect-history-api-fallback@^1.3.0:
version "1.6.0" version "1.6.0"
resolved "https://registry.yarnpkg.com/connect-history-api-fallback/-/connect-history-api-fallback-1.6.0.tgz#8b32089359308d111115d81cad3fceab888f97bc" resolved "https://registry.yarnpkg.com/connect-history-api-fallback/-/connect-history-api-fallback-1.6.0.tgz#8b32089359308d111115d81cad3fceab888f97bc"
@ -4226,7 +4241,7 @@ data-urls@^1.0.0:
whatwg-mimetype "^2.2.0" whatwg-mimetype "^2.2.0"
whatwg-url "^7.0.0" whatwg-url "^7.0.0"
date-fns@1.30.1: date-fns@1.30.1, date-fns@^1.23.0:
version "1.30.1" version "1.30.1"
resolved "https://registry.verdaccio.org/date-fns/-/date-fns-1.30.1.tgz#2e71bf0b119153dbb4cc4e88d9ea5acfb50dc05c" resolved "https://registry.verdaccio.org/date-fns/-/date-fns-1.30.1.tgz#2e71bf0b119153dbb4cc4e88d9ea5acfb50dc05c"
integrity sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw== integrity sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw==
@ -10972,6 +10987,15 @@ read-pkg@^3.0.0:
normalize-package-data "^2.3.2" normalize-package-data "^2.3.2"
path-type "^3.0.0" path-type "^3.0.0"
read-pkg@^4.0.1:
version "4.0.1"
resolved "https://registry.verdaccio.org/read-pkg/-/read-pkg-4.0.1.tgz#963625378f3e1c4d48c85872b5a6ec7d5d093237"
integrity sha1-ljYlN48+HE1IyFhytabsfV0JMjc=
dependencies:
normalize-package-data "^2.3.2"
parse-json "^4.0.0"
pify "^3.0.0"
"readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.4, readable-stream@^2.0.6, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.0, readable-stream@^2.3.3, readable-stream@^2.3.5, readable-stream@^2.3.6, readable-stream@~2.3.6: "readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.4, readable-stream@^2.0.6, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.0, readable-stream@^2.3.3, readable-stream@^2.3.5, readable-stream@^2.3.6, readable-stream@~2.3.6:
version "2.3.6" version "2.3.6"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf"
@ -11501,7 +11525,7 @@ run-queue@^1.0.0, run-queue@^1.0.3:
dependencies: dependencies:
aproba "^1.1.1" aproba "^1.1.1"
rxjs@^6.4.0: rxjs@^6.3.3, rxjs@^6.4.0:
version "6.4.0" version "6.4.0"
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.4.0.tgz#f3bb0fe7bda7fb69deac0c16f17b50b0b8790504" resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.4.0.tgz#f3bb0fe7bda7fb69deac0c16f17b50b0b8790504"
integrity sha512-Z9Yfa11F6B9Sg/BK9MnqnQ+aQYicPLtilXBp2yUtDt2JRCE0h26d33EnfO3ZxoNxG0T92OUucP3Ct7cpfkdFfw== integrity sha512-Z9Yfa11F6B9Sg/BK9MnqnQ+aQYicPLtilXBp2yUtDt2JRCE0h26d33EnfO3ZxoNxG0T92OUucP3Ct7cpfkdFfw==
@ -11949,6 +11973,11 @@ source-map@^0.7.2, source-map@^0.7.3:
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383"
integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ== integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==
spawn-command@^0.0.2-1:
version "0.0.2-1"
resolved "https://registry.verdaccio.org/spawn-command/-/spawn-command-0.0.2-1.tgz#62f5e9466981c1b796dc5929937e11c9c6921bd0"
integrity sha1-YvXpRmmBwbeW3Fkpk34RycaSG9A=
spdx-correct@^3.0.0: spdx-correct@^3.0.0:
version "3.1.0" version "3.1.0"
resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.1.0.tgz#fb83e504445268f154b074e218c87c003cd31df4" resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.1.0.tgz#fb83e504445268f154b074e218c87c003cd31df4"
@ -12461,7 +12490,7 @@ supports-color@^3.2.3:
dependencies: dependencies:
has-flag "^1.0.0" has-flag "^1.0.0"
supports-color@^4.0.0: supports-color@^4.0.0, supports-color@^4.5.0:
version "4.5.0" version "4.5.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.5.0.tgz#be7a0de484dec5c5cddf8b3d59125044912f635b" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.5.0.tgz#be7a0de484dec5c5cddf8b3d59125044912f635b"
integrity sha1-vnoN5ITexcXN34s9WRJQRJEvY1s= integrity sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=
@ -12781,6 +12810,11 @@ tr46@^1.0.1:
dependencies: dependencies:
punycode "^2.1.0" punycode "^2.1.0"
tree-kill@^1.1.0:
version "1.2.1"
resolved "https://registry.verdaccio.org/tree-kill/-/tree-kill-1.2.1.tgz#5398f374e2f292b9dcc7b2e71e30a5c3bb6c743a"
integrity sha512-4hjqbObwlh2dLyW4tcz0Ymw0ggoaVDMveUB9w8kFSQScdRLo0gxO9J7WFcUBo+W3C1TLdFIEwNOWebgZZ0RH9Q==
trim-newlines@^1.0.0: trim-newlines@^1.0.0:
version "1.0.0" version "1.0.0"
resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-1.0.0.tgz#5887966bb582a4503a41eb524f7d35011815a613" resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-1.0.0.tgz#5887966bb582a4503a41eb524f7d35011815a613"
@ -13715,7 +13749,7 @@ yargs@12.0.2:
y18n "^3.2.1 || ^4.0.0" y18n "^3.2.1 || ^4.0.0"
yargs-parser "^10.1.0" yargs-parser "^10.1.0"
yargs@^12.0.2, yargs@^12.0.4, yargs@^12.0.5: yargs@^12.0.1, yargs@^12.0.2, yargs@^12.0.4, yargs@^12.0.5:
version "12.0.5" version "12.0.5"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-12.0.5.tgz#05f5997b609647b64f66b81e3b4b10a368e7ad13" resolved "https://registry.yarnpkg.com/yargs/-/yargs-12.0.5.tgz#05f5997b609647b64f66b81e3b4b10a368e7ad13"
integrity sha512-Lhz8TLaYnxq/2ObqHDql8dX8CJi97oHxrjUcYtzKbbykPtVW9WB+poxI+NM2UIzsMgNCZTIf0AQwsjK5yMAqZw== integrity sha512-Lhz8TLaYnxq/2ObqHDql8dX8CJi97oHxrjUcYtzKbbykPtVW9WB+poxI+NM2UIzsMgNCZTIf0AQwsjK5yMAqZw==