From 508bb4434825ed48b37f073610129b8c2907e0e6 Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Sun, 16 Jun 2019 17:02:38 +0200 Subject: [PATCH] fix(core): update --- .gitignore | 8 +- .gitlab-ci.yml | 20 +-- package-lock.json | 227 ++++++++++++++++++++-------------- package.json | 17 ++- ts/index.ts | 86 +------------ ts/tsbundle.class.tsbundle.ts | 113 +++++++++++++++++ ts/tsbundle.cli.ts | 23 ++++ ts/tsbundle.logging.ts | 2 +- ts/tsbundle.plugins.ts | 12 +- ts/tsbundle.rollup.prepend.ts | 1 - 10 files changed, 309 insertions(+), 200 deletions(-) create mode 100644 ts/tsbundle.class.tsbundle.ts create mode 100644 ts/tsbundle.cli.ts delete mode 100644 ts/tsbundle.rollup.prepend.ts diff --git a/.gitignore b/.gitignore index ee945c7..91c0db0 100644 --- a/.gitignore +++ b/.gitignore @@ -8,13 +8,15 @@ pages/ # installs node_modules/ -# caches and builds +# caches .yarn/ .cache/ +.rpt2_cache + +# builds dist/ dist_web/ dist_serve/ dist_ts_web/ -# custom -.rpt2_cache \ No newline at end of file +# custom \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8321aed..63b309d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,4 @@ -# gitzone standard +# gitzone ci_default image: hosttoday/ht-docker-node:npmci cache: @@ -78,19 +78,11 @@ release: # ==================== codequality: stage: metadata - image: docker:stable allow_failure: true - services: - - docker:stable-dind script: - - export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/') - - docker run - --env SOURCE_CODE="$PWD" - --volume "$PWD":/code - --volume /var/run/docker.sock:/var/run/docker.sock - "registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code - artifacts: - paths: [codeclimate.json] + - npmci command npm install -g tslint typescript + - npmci npm install + - npmci command "tslint -c tslint.json ./ts/**/*.ts" tags: - docker - priv @@ -109,10 +101,10 @@ pages: image: hosttoday/ht-docker-node:npmci stage: metadata script: - - npmci command npm install -g typedoc typescript + - npmci command npm install -g @gitzone/tsdoc - npmci npm prepare - npmci npm install - - npmci command typedoc --module "commonjs" --target "ES2016" --out public/ ts/ + - npmci command tsdoc tags: - docker - notpriv diff --git a/package-lock.json b/package-lock.json index aaeefd8..52a20b8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1267,7 +1267,7 @@ }, "@pushrocks/lik": { "version": "3.0.5", - "resolved": "https://registry.npmjs.org/@pushrocks/lik/-/lik-3.0.5.tgz", + "resolved": "https://verdaccio.lossless.one/@pushrocks%2flik/-/lik-3.0.5.tgz", "integrity": "sha512-pc5Nq0WUysS34qPpyiZXiX254kL3vyRVbt3D36Q5QU+eHhxAThHofSzgOdyVHUZU2WFoaMlKowIVsyUFzIkfdw==", "requires": { "@pushrocks/smartdelay": "^2.0.2", @@ -1310,7 +1310,7 @@ }, "@pushrocks/smartevent": { "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@pushrocks/smartevent/-/smartevent-2.0.3.tgz", + "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartevent/-/smartevent-2.0.3.tgz", "integrity": "sha512-x4B1mzzE6LrMATXsRLNuZpMTlB2JodL44MA4bF4FucU3SBBiWhFv3CFJRlO9B23SKZ1fwdJQrk2lT7YTUHXXJQ==", "requires": { "@pushrocks/smartpromise": "^2.0.5" @@ -1367,7 +1367,7 @@ }, "@pushrocks/smartparam": { "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@pushrocks/smartparam/-/smartparam-1.0.4.tgz", + "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartparam/-/smartparam-1.0.4.tgz", "integrity": "sha512-UAqhnTQGBaJRptTK3qTd47Yt2ZTrAWByteow4auSNZD+k0xrpY9mTPPgKh0IwsURe0cZhj7zYNpGiekhKkL4rA==", "requires": { "@pushrocks/smartpromise": "^2.0.5", @@ -1399,7 +1399,7 @@ }, "@pushrocks/smartrx": { "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@pushrocks/smartrx/-/smartrx-2.0.3.tgz", + "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartrx/-/smartrx-2.0.3.tgz", "integrity": "sha512-OWxagu+CBdPaq76AIg91hJyrNhDTlEpesj01ooWCeVIaLY3G7yvFkqHsEKNOwPUG1LzCWmjq1l1dHQx9p2vJ9A==", "requires": { "@pushrocks/lik": "^3.0.2", @@ -1421,7 +1421,7 @@ }, "@pushrocks/smarttime": { "version": "3.0.7", - "resolved": "https://registry.npmjs.org/@pushrocks/smarttime/-/smarttime-3.0.7.tgz", + "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmarttime/-/smarttime-3.0.7.tgz", "integrity": "sha512-IL/+lgVQLvZvoMSbOpT3JSGjogGzpNbWdzfFZAjjxrTtwxAN1FNWGcCESCvq1BPlUGECPTBeyyaURXhhhLfihA==", "requires": { "@pushrocks/smartpromise": "^3.0.2", @@ -1433,7 +1433,7 @@ "dependencies": { "@pushrocks/smartpromise": { "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@pushrocks/smartpromise/-/smartpromise-3.0.2.tgz", + "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartpromise/-/smartpromise-3.0.2.tgz", "integrity": "sha512-jmrJMUEmBCWChWK8CIcx4Vw3wv/8OgVNmkaxJrbs+WMaoRUfJtpWWJfrAwwHWt9ZXJbarJ+CwfwfYiiZXymndQ==" } } @@ -1484,9 +1484,9 @@ } }, "@types/cron": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/@types/cron/-/cron-1.7.0.tgz", - "integrity": "sha512-LRu/XiiOExELholyEwEuSTPAEiO+sVR1nXmWEjezneGgYpDyMNVIsjiaHYBoCEUJo4F1hCOlAzQAh80iEUVbKw==", + "version": "1.7.1", + "resolved": "https://verdaccio.lossless.one/@types%2fcron/-/cron-1.7.1.tgz", + "integrity": "sha512-48brwgU18DqA0mQX1As5OcJEo1yNjaXMM6Mk4r8K1dOzLJRQ37FE/kCivKx7ClKEHfhX2FdcxKzJ1B744a+V3A==", "requires": { "@types/node": "*", "moment": ">=2.14.0" @@ -1522,13 +1522,13 @@ } }, "@types/luxon": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/@types/luxon/-/luxon-1.12.0.tgz", - "integrity": "sha512-+UzPmwHSEEyv7aGlNkVpuFxp/BirXgl8NnPGCtmyx2KXIzAapoW3IqSVk87/Z3PUk8vEL8Pe1HXEMJbNBOQgtg==" + "version": "1.15.1", + "resolved": "https://verdaccio.lossless.one/@types%2fluxon/-/luxon-1.15.1.tgz", + "integrity": "sha512-SOGSpxsAoR+pHLev7oFGbQ4mZCmfcmYY2xsv2+/UeEG2rcJA30k5NVux3cW9rgTe2EVtrqFG+KtMs6ERZsTGKA==" }, "@types/minimatch": { "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", + "resolved": "https://verdaccio.lossless.one/@types%2fminimatch/-/minimatch-3.0.3.tgz", "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==" }, "@types/node": { @@ -1561,7 +1561,7 @@ }, "@types/yargs": { "version": "12.0.12", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-12.0.12.tgz", + "resolved": "https://verdaccio.lossless.one/@types%2fyargs/-/yargs-12.0.12.tgz", "integrity": "sha512-SOhuU4wNBxhhTHxYaiG5NY4HBhDIDnJF60GU+2LqHAdKKer86//e4yg69aENCtQ04n0ovz+tq2YPME5t5yp4pw==" }, "acorn": { @@ -1576,7 +1576,7 @@ }, "ansi-regex": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "resolved": "https://verdaccio.lossless.one/ansi-regex/-/ansi-regex-3.0.0.tgz", "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=" }, "ansi-styles": { @@ -1757,8 +1757,7 @@ "buffer-from": { "version": "1.1.1", "resolved": "https://verdaccio.lossless.one/buffer-from/-/buffer-from-1.1.1.tgz", - "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", - "dev": true + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==" }, "builtin-modules": { "version": "1.1.1", @@ -1784,7 +1783,7 @@ }, "camelcase": { "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "resolved": "https://verdaccio.lossless.one/camelcase/-/camelcase-5.3.1.tgz", "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" }, "caniuse-lite": { @@ -1873,7 +1872,7 @@ }, "cliui": { "version": "4.1.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz", + "resolved": "https://verdaccio.lossless.one/cliui/-/cliui-4.1.0.tgz", "integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==", "requires": { "string-width": "^2.1.1", @@ -1912,7 +1911,7 @@ }, "code-point-at": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "resolved": "https://verdaccio.lossless.one/code-point-at/-/code-point-at-1.1.0.tgz", "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" }, "collection-visit": { @@ -1949,8 +1948,7 @@ "commander": { "version": "2.20.0", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz", - "integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==", - "dev": true + "integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==" }, "component-emitter": { "version": "1.3.0", @@ -2006,8 +2004,7 @@ "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", - "dev": true + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, "cron": { "version": "1.7.1", @@ -2019,7 +2016,7 @@ }, "cross-spawn": { "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "resolved": "https://verdaccio.lossless.one/cross-spawn/-/cross-spawn-6.0.5.tgz", "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", "requires": { "nice-try": "^1.0.4", @@ -2039,7 +2036,7 @@ }, "decamelize": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "resolved": "https://verdaccio.lossless.one/decamelize/-/decamelize-1.2.0.tgz", "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" }, "decode-uri-component": { @@ -2127,7 +2124,7 @@ }, "end-of-stream": { "version": "1.4.1", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", + "resolved": "https://verdaccio.lossless.one/end-of-stream/-/end-of-stream-1.4.1.tgz", "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", "requires": { "once": "^1.4.0" @@ -2162,7 +2159,7 @@ }, "execa": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", + "resolved": "https://verdaccio.lossless.one/execa/-/execa-1.0.0.tgz", "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", "requires": { "cross-spawn": "^6.0.0", @@ -2322,7 +2319,7 @@ }, "find-up": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "resolved": "https://verdaccio.lossless.one/find-up/-/find-up-3.0.0.tgz", "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", "requires": { "locate-path": "^3.0.0" @@ -2379,7 +2376,7 @@ }, "get-caller-file": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", + "resolved": "https://verdaccio.lossless.one/get-caller-file/-/get-caller-file-1.0.3.tgz", "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==" }, "get-func-name": { @@ -2390,7 +2387,7 @@ }, "get-stream": { "version": "4.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "resolved": "https://verdaccio.lossless.one/get-stream/-/get-stream-4.1.0.tgz", "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", "requires": { "pump": "^3.0.0" @@ -2472,8 +2469,7 @@ "inherits": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" }, "invariant": { "version": "2.2.4", @@ -2485,7 +2481,7 @@ }, "invert-kv": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz", + "resolved": "https://verdaccio.lossless.one/invert-kv/-/invert-kv-2.0.0.tgz", "integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==" }, "is-accessor-descriptor": { @@ -2553,7 +2549,7 @@ }, "is-fullwidth-code-point": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "resolved": "https://verdaccio.lossless.one/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" }, "is-module": { @@ -2589,12 +2585,12 @@ }, "is-promise": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", + "resolved": "https://verdaccio.lossless.one/is-promise/-/is-promise-2.1.0.tgz", "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=" }, "is-stream": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "resolved": "https://verdaccio.lossless.one/is-stream/-/is-stream-1.1.0.tgz", "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=" }, "is-utf8": { @@ -2623,6 +2619,25 @@ "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=" }, + "jest-worker": { + "version": "24.6.0", + "resolved": "https://verdaccio.lossless.one/jest-worker/-/jest-worker-24.6.0.tgz", + "integrity": "sha512-jDwgW5W9qGNvpI1tNnvajh0a5IE/PuGLFmHk6aR/BZFz8tSgGw17GsDPXAJ6p91IvYDjOw8GpFbvvZGAK+DPQQ==", + "requires": { + "merge-stream": "^1.0.1", + "supports-color": "^6.1.0" + }, + "dependencies": { + "supports-color": { + "version": "6.1.0", + "resolved": "https://verdaccio.lossless.one/supports-color/-/supports-color-6.1.0.tgz", + "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, "js-levenshtein": { "version": "1.1.6", "resolved": "https://verdaccio.lossless.one/js-levenshtein/-/js-levenshtein-1.1.6.tgz", @@ -2671,7 +2686,7 @@ }, "lcid": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz", + "resolved": "https://verdaccio.lossless.one/lcid/-/lcid-2.0.0.tgz", "integrity": "sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA==", "requires": { "invert-kv": "^2.0.0" @@ -2698,7 +2713,7 @@ }, "locate-path": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "resolved": "https://verdaccio.lossless.one/locate-path/-/locate-path-3.0.0.tgz", "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", "requires": { "p-locate": "^3.0.0", @@ -2727,9 +2742,9 @@ } }, "luxon": { - "version": "1.12.1", - "resolved": "https://registry.npmjs.org/luxon/-/luxon-1.12.1.tgz", - "integrity": "sha512-Zv/qJb2X1ESTrlniAViWx2aqGwi2cVpeoZFTbPdPiCu4EsadKsmb/QCH8HQjMUpDZKKJIHKHsJxV5Rwpq47HKQ==" + "version": "1.16.0", + "resolved": "https://verdaccio.lossless.one/luxon/-/luxon-1.16.0.tgz", + "integrity": "sha512-qaqB+JwpGwtl7UbIXng3A/l4W/ySBr8drQvwtMLZBMiLD2V+0fEnPWMrs+UjnIy9PsktazQaKvwDUCLzoWz0Hw==" }, "magic-string": { "version": "0.25.2", @@ -2747,7 +2762,7 @@ }, "map-age-cleaner": { "version": "0.1.3", - "resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz", + "resolved": "https://verdaccio.lossless.one/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz", "integrity": "sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w==", "requires": { "p-defer": "^1.0.0" @@ -2768,7 +2783,7 @@ }, "mem": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/mem/-/mem-4.3.0.tgz", + "resolved": "https://verdaccio.lossless.one/mem/-/mem-4.3.0.tgz", "integrity": "sha512-qX2bG48pTqYRVmDB37rn/6PT7LcR8T7oAX3bf99u1Tt1nzxYfxkgqDwUwolPlXweM0XzBOBFzSx4kfp7KP1s/w==", "requires": { "map-age-cleaner": "^0.1.1", @@ -2776,6 +2791,14 @@ "p-is-promise": "^2.0.0" } }, + "merge-stream": { + "version": "1.0.1", + "resolved": "https://verdaccio.lossless.one/merge-stream/-/merge-stream-1.0.1.tgz", + "integrity": "sha1-QEEgLVCKNCugAXQAjfDCUbjBNeE=", + "requires": { + "readable-stream": "^2.0.1" + } + }, "micromatch": { "version": "3.1.10", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", @@ -2813,7 +2836,7 @@ }, "mimic-fn": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "resolved": "https://verdaccio.lossless.one/mimic-fn/-/mimic-fn-2.1.0.tgz", "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==" }, "minimatch": { @@ -2867,12 +2890,12 @@ }, "moment": { "version": "2.24.0", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.24.0.tgz", + "resolved": "https://verdaccio.lossless.one/moment/-/moment-2.24.0.tgz", "integrity": "sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg==" }, "moment-timezone": { "version": "0.5.25", - "resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.25.tgz", + "resolved": "https://verdaccio.lossless.one/moment-timezone/-/moment-timezone-0.5.25.tgz", "integrity": "sha512-DgEaTyN/z0HFaVcVbSyVCUU6HeFdnNC3vE4c9cgu2dgMTvjBUBdBzWfasTBmAW45u5OIMeCJtU8yNjM22DHucw==", "requires": { "moment": ">= 2.9.0" @@ -2909,7 +2932,7 @@ }, "nice-try": { "version": "1.0.5", - "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "resolved": "https://verdaccio.lossless.one/nice-try/-/nice-try-1.0.5.tgz", "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==" }, "node-releases": { @@ -2922,7 +2945,7 @@ }, "npm-run-path": { "version": "2.0.2", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "resolved": "https://verdaccio.lossless.one/npm-run-path/-/npm-run-path-2.0.2.tgz", "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", "requires": { "path-key": "^2.0.0" @@ -2930,7 +2953,7 @@ }, "number-is-nan": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "resolved": "https://verdaccio.lossless.one/number-is-nan/-/number-is-nan-1.0.1.tgz", "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" }, "object-copy": { @@ -3030,7 +3053,7 @@ }, "os-locale": { "version": "3.1.0", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.1.0.tgz", + "resolved": "https://verdaccio.lossless.one/os-locale/-/os-locale-3.1.0.tgz", "integrity": "sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q==", "requires": { "execa": "^1.0.0", @@ -3040,22 +3063,22 @@ }, "p-defer": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", + "resolved": "https://verdaccio.lossless.one/p-defer/-/p-defer-1.0.0.tgz", "integrity": "sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=" }, "p-finally": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "resolved": "https://verdaccio.lossless.one/p-finally/-/p-finally-1.0.0.tgz", "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=" }, "p-is-promise": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-2.1.0.tgz", + "resolved": "https://verdaccio.lossless.one/p-is-promise/-/p-is-promise-2.1.0.tgz", "integrity": "sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg==" }, "p-limit": { "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.0.tgz", + "resolved": "https://verdaccio.lossless.one/p-limit/-/p-limit-2.2.0.tgz", "integrity": "sha512-pZbTJpoUsCzV48Mc9Nh51VbwO0X9cuPFE8gYwx9BTCt9SF8/b7Zljd2fVgOxhIF/HDTKgpVzs+GPhyKfjLLFRQ==", "requires": { "p-try": "^2.0.0" @@ -3063,7 +3086,7 @@ }, "p-locate": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "resolved": "https://verdaccio.lossless.one/p-locate/-/p-locate-3.0.0.tgz", "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", "requires": { "p-limit": "^2.0.0" @@ -3071,7 +3094,7 @@ }, "p-try": { "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "resolved": "https://verdaccio.lossless.one/p-try/-/p-try-2.2.0.tgz", "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==" }, "pascalcase": { @@ -3081,7 +3104,7 @@ }, "path-exists": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "resolved": "https://verdaccio.lossless.one/path-exists/-/path-exists-3.0.0.tgz", "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=" }, "path-is-absolute": { @@ -3092,7 +3115,7 @@ }, "path-key": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "resolved": "https://verdaccio.lossless.one/path-key/-/path-key-2.0.1.tgz", "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=" }, "path-parse": { @@ -3131,12 +3154,11 @@ "process-nextick-args": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", - "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", - "dev": true + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==" }, "pump": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "resolved": "https://verdaccio.lossless.one/pump/-/pump-3.0.0.tgz", "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", "requires": { "end-of-stream": "^1.1.0", @@ -3147,7 +3169,6 @@ "version": "2.3.6", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, "requires": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", @@ -3255,12 +3276,12 @@ }, "require-directory": { "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "resolved": "https://verdaccio.lossless.one/require-directory/-/require-directory-2.1.1.tgz", "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=" }, "require-main-filename": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", + "resolved": "https://verdaccio.lossless.one/require-main-filename/-/require-main-filename-1.0.1.tgz", "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=" }, "resolve": { @@ -3354,6 +3375,17 @@ "source-map-resolve": "^0.5.0" } }, + "rollup-plugin-terser": { + "version": "5.0.0", + "resolved": "https://verdaccio.lossless.one/rollup-plugin-terser/-/rollup-plugin-terser-5.0.0.tgz", + "integrity": "sha512-W+jJ4opYnlmNyVW0vtRufs+EGf68BIJ7bnOazgz8mgz8pA9lUyrEifAhPs5y9M16wFeAyBGaRjKip4dnFBtXaw==", + "requires": { + "@babel/code-frame": "^7.0.0", + "jest-worker": "^24.6.0", + "serialize-javascript": "^1.7.0", + "terser": "^4.0.0" + } + }, "rollup-plugin-typescript2": { "version": "0.21.0", "resolved": "https://verdaccio.lossless.one/rollup-plugin-typescript2/-/rollup-plugin-typescript2-0.21.0.tgz", @@ -3386,9 +3418,9 @@ } }, "rxjs": { - "version": "6.5.1", - "resolved": "https://verdaccio.lossless.one/rxjs/-/rxjs-6.5.1.tgz", - "integrity": "sha512-y0j31WJc83wPu31vS1VlAFW5JGrnGC+j+TtGAa1fRQphy48+fDYiDmX8tjGloToEsMkxnouOg/1IzXGKkJnZMg==", + "version": "6.5.2", + "resolved": "https://verdaccio.lossless.one/rxjs/-/rxjs-6.5.2.tgz", + "integrity": "sha512-HUb7j3kvb7p7eCUHE3FqjoDsC1xfZQ4AHFWfTKSpZ+sAhhz5X1WX0ZuUqWbzB2QhSLp3DoLUG+hMdEDKqWo2Zg==", "requires": { "tslib": "^1.9.0" } @@ -3411,9 +3443,14 @@ "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==" }, + "serialize-javascript": { + "version": "1.7.0", + "resolved": "https://verdaccio.lossless.one/serialize-javascript/-/serialize-javascript-1.7.0.tgz", + "integrity": "sha512-ke8UG8ulpFOxO8f8gRYabHQe/ZntKlcig2Mp+8+URDP1D8vJZ0KUt7LYo07q25Z/+JVSgpr/cui9PIp5H6/+nA==" + }, "set-blocking": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "resolved": "https://verdaccio.lossless.one/set-blocking/-/set-blocking-2.0.0.tgz", "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" }, "set-value": { @@ -3439,7 +3476,7 @@ }, "shebang-command": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "resolved": "https://verdaccio.lossless.one/shebang-command/-/shebang-command-1.2.0.tgz", "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", "requires": { "shebang-regex": "^1.0.0" @@ -3447,7 +3484,7 @@ }, "shebang-regex": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "resolved": "https://verdaccio.lossless.one/shebang-regex/-/shebang-regex-1.0.0.tgz", "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=" }, "signal-exit": { @@ -3574,8 +3611,7 @@ "source-map": { "version": "0.6.1", "resolved": "https://verdaccio.lossless.one/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" }, "source-map-resolve": { "version": "0.5.2", @@ -3593,7 +3629,6 @@ "version": "0.5.12", "resolved": "https://verdaccio.lossless.one/source-map-support/-/source-map-support-0.5.12.tgz", "integrity": "sha512-4h2Pbvyy15EE02G+JOZpUCmqWJuqrs+sEkzewTm++BPi7Hvn/HwcqLAcNxYAyI0x13CpPPn+kMjl+hplXMHITQ==", - "dev": true, "requires": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" @@ -3644,7 +3679,7 @@ }, "string-width": { "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "resolved": "https://verdaccio.lossless.one/string-width/-/string-width-2.1.1.tgz", "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", "requires": { "is-fullwidth-code-point": "^2.0.0", @@ -3655,14 +3690,13 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, "requires": { "safe-buffer": "~5.1.0" } }, "strip-ansi": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "resolved": "https://verdaccio.lossless.one/strip-ansi/-/strip-ansi-4.0.0.tgz", "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", "requires": { "ansi-regex": "^3.0.0" @@ -3698,7 +3732,7 @@ }, "strip-eof": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "resolved": "https://verdaccio.lossless.one/strip-eof/-/strip-eof-1.0.0.tgz", "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=" }, "supports-color": { @@ -3710,9 +3744,19 @@ } }, "symbol-tree": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.2.tgz", - "integrity": "sha1-rifbOPZgp64uHDt9G8KQgZuFGeY=" + "version": "3.2.4", + "resolved": "https://verdaccio.lossless.one/symbol-tree/-/symbol-tree-3.2.4.tgz", + "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==" + }, + "terser": { + "version": "4.0.0", + "resolved": "https://verdaccio.lossless.one/terser/-/terser-4.0.0.tgz", + "integrity": "sha512-dOapGTU0hETFl1tCo4t56FN+2jffoKyER9qBGoUFyZ6y7WLoKT0bF+lAYi6B6YsILcGF3q1C2FBh8QcKSCgkgA==", + "requires": { + "commander": "^2.19.0", + "source-map": "~0.6.1", + "source-map-support": "~0.5.10" + } }, "to-fast-properties": { "version": "2.0.0", @@ -3938,8 +3982,7 @@ "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "dev": true + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, "vinyl": { "version": "2.2.0", @@ -3986,12 +4029,12 @@ }, "which-module": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "resolved": "https://verdaccio.lossless.one/which-module/-/which-module-2.0.0.tgz", "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=" }, "wrap-ansi": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "resolved": "https://verdaccio.lossless.one/wrap-ansi/-/wrap-ansi-2.1.0.tgz", "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", "requires": { "string-width": "^1.0.1", @@ -4000,12 +4043,12 @@ "dependencies": { "ansi-regex": { "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "resolved": "https://verdaccio.lossless.one/ansi-regex/-/ansi-regex-2.1.1.tgz", "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" }, "is-fullwidth-code-point": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "resolved": "https://verdaccio.lossless.one/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "requires": { "number-is-nan": "^1.0.0" @@ -4013,7 +4056,7 @@ }, "string-width": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "resolved": "https://verdaccio.lossless.one/string-width/-/string-width-1.0.2.tgz", "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "requires": { "code-point-at": "^1.0.0", @@ -4023,7 +4066,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": "https://verdaccio.lossless.one/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "requires": { "ansi-regex": "^2.0.0" @@ -4038,12 +4081,12 @@ }, "y18n": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", + "resolved": "https://verdaccio.lossless.one/y18n/-/y18n-4.0.0.tgz", "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==" }, "yargs": { "version": "12.0.5", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-12.0.5.tgz", + "resolved": "https://verdaccio.lossless.one/yargs/-/yargs-12.0.5.tgz", "integrity": "sha512-Lhz8TLaYnxq/2ObqHDql8dX8CJi97oHxrjUcYtzKbbykPtVW9WB+poxI+NM2UIzsMgNCZTIf0AQwsjK5yMAqZw==", "requires": { "cliui": "^4.0.0", @@ -4062,7 +4105,7 @@ }, "yargs-parser": { "version": "11.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-11.1.1.tgz", + "resolved": "https://verdaccio.lossless.one/yargs-parser/-/yargs-parser-11.1.1.tgz", "integrity": "sha512-C6kB/WJDiaxONLJQnF8ccx9SEeoTTLek8RVbaOIsrAUS8VrBEXfmeSnCZxygc+XC2sNMBIwOOnfcxiynjHsVSQ==", "requires": { "camelcase": "^5.0.0", diff --git a/package.json b/package.json index e575374..62696dd 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "author": "Lossless GmbH", "license": "MIT", "scripts": { - "test": "cd test && node ../cli.ts.js", + "test": "cd test && node ../cli.ts.js --production", "build": "(tsbuild)", "format": "(gitzone format)" }, @@ -40,6 +40,17 @@ "rollup-plugin-commonjs": "^9.3.4", "rollup-plugin-node-resolve": "^4.2.3", "rollup-plugin-sourcemaps": "^0.4.2", + "rollup-plugin-terser": "^5.0.0", "rollup-plugin-typescript2": "^0.21.0" - } -} + }, + "files": [ + "ts/*", + "ts_web/*", + "dist/*", + "dist_web/*", + "assets/*", + "cli.js", + "npmextra.json", + "readme.md" + ] +} \ No newline at end of file diff --git a/ts/index.ts b/ts/index.ts index bed8795..dd60ad3 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -1,86 +1,12 @@ import * as early from '@pushrocks/early'; early.start('tsbundle'); -import * as plugins from './tsbundle.plugins'; +// lets import all plugins beforehand +import './tsbundle.plugins'; + import { logger } from './tsbundle.logging'; +import { runCli } from './tsbundle.cli'; early.stop(); -const rollupOptions: plugins.rollup.RollupOptions = { - input: `ts_web/index.ts`, - output: { - name: 'tsbundle', - // file: 'dist_web/bundle.js', - file: 'dist_web/bundle.js', - format: 'iife', - sourcemap: true - }, - // Indicate here external modules you don't wanna include in your bundle (i.e.: 'lodash') - external: [], - watch: { - include: ['src/**'] - }, - plugins: [ - // Compile TypeScript files - plugins.rollupTypescript({ - useTsconfigDeclarationDir: true, - tsconfigOverride: { - compilerOptions: { - declaration: true, - emitDecoratorMetadata: true, - experimentalDecorators: true, - inlineSourceMap: true, - noEmitOnError: true, - lib: ['es2017', 'dom'], - target: 'es2017', - noImplicitAny: false - } - } - }), - // Allow node_modules resolution, so you can use 'external' to control - // which external modules to include in the bundle - // https://github.com/rollup/rollup-plugin-node-resolve#usage - plugins.rollupResolve(), - plugins.rollupCommonjs({ - namedExports: { - 'node_modules/@pushrocks/smartstate/dist/index.js': ['Smartstate'] - } - }), - - // Resolve source maps to the original source - plugins.rollupSourceMaps(), - plugins.rollupBabel({ - runtimeHelpers: true, - extensions: ['.js', '.jsx', '.ts', '.tsx'], - babelrc: false, - presets: [ - [ - '@babel/preset-env', - { - modules: false, - targets: { - chrome: '41' - } - } - ] - ], - plugins: [ - [ - '@babel/plugin-transform-runtime', - { - regenerator: true - } - ] - ] - }) - ] -}; - -async function build() { - // create a bundle - logger.log('info', `starting bundling now!`); - const bundle = await plugins.rollup.rollup(rollupOptions); - bundle.generate(rollupOptions.output); - bundle.write(rollupOptions.output); - logger.log('ok', `Successfully bundled files!`); +if (process.env.CLI_CALL) { + runCli(); } - -build(); diff --git a/ts/tsbundle.class.tsbundle.ts b/ts/tsbundle.class.tsbundle.ts new file mode 100644 index 0000000..5e3ce12 --- /dev/null +++ b/ts/tsbundle.class.tsbundle.ts @@ -0,0 +1,113 @@ +import * as plugins from './tsbundle.plugins'; +import { logger } from './tsbundle.logging'; + +export class TsBundle { + public optionsTest: plugins.rollup.RollupOptions = this.getBaseOptions(); + public optionsProduction: plugins.rollup.RollupOptions = (() => { + const productionOptions = this.getBaseOptions(); + productionOptions.plugins.push(plugins.rollupTerser()); + return productionOptions; + })(); + + constructor() {} + + /** + * creates a bundle for the test enviroment + */ + public async buildTest() { + // create a bundle + logger.log('info', `starting bundling for TEST now!`); + const bundle = await plugins.rollup.rollup(this.optionsTest); + bundle.generate(this.optionsTest.output); + bundle.write(this.optionsTest.output); + logger.log('ok', `Successfully bundled files!`); + } + + /** + * creates a bundle for the production environment + */ + public async buildProduction() { + // create a bundle + logger.log('info', `starting for PRODUCTION now!`); + const bundle = await plugins.rollup.rollup(this.optionsProduction); + bundle.generate(this.optionsProduction.output); + bundle.write(this.optionsProduction.output); + logger.log('ok', `Successfully bundled files!`); + } + + /** + * the basic default options for rollup + */ + public getBaseOptions() { + const baseOptions: plugins.rollup.RollupOptions = { + input: `ts_web/index.ts`, + output: { + name: 'tsbundle', + // file: 'dist_web/bundle.js', + file: 'dist_web/bundle.js', + format: 'iife', + sourcemap: true + }, + // Indicate here external modules you don't wanna include in your bundle (i.e.: 'lodash') + external: [], + watch: { + include: ['src/**'] + }, + plugins: [ + // Compile TypeScript files + plugins.rollupTypescript({ + useTsconfigDeclarationDir: true, + tsconfigOverride: { + compilerOptions: { + declaration: true, + emitDecoratorMetadata: true, + experimentalDecorators: true, + inlineSourceMap: true, + noEmitOnError: true, + lib: ['es2017', 'dom'], + target: 'es2017', + noImplicitAny: false + } + } + }), + // Allow node_modules resolution, so you can use 'external' to control + // which external modules to include in the bundle + // https://github.com/rollup/rollup-plugin-node-resolve#usage + plugins.rollupResolve(), + plugins.rollupCommonjs({ + namedExports: { + 'node_modules/@pushrocks/smartstate/dist/index.js': ['Smartstate'] + } + }), + + // Resolve source maps to the original source + plugins.rollupSourceMaps(), + plugins.rollupBabel({ + runtimeHelpers: true, + extensions: ['.js', '.jsx', '.ts', '.tsx'], + babelrc: false, + presets: [ + [ + '@babel/preset-env', + { + modules: false, + targets: { + chrome: '41' + } + } + ] + ], + plugins: [ + [ + '@babel/plugin-transform-runtime', + { + regenerator: true + } + ] + ] + }) + ] + }; + return baseOptions; + } +} diff --git a/ts/tsbundle.cli.ts b/ts/tsbundle.cli.ts new file mode 100644 index 0000000..a512046 --- /dev/null +++ b/ts/tsbundle.cli.ts @@ -0,0 +1,23 @@ +import * as plugins from './tsbundle.plugins'; +import { TsBundle } from './tsbundle.class.tsbundle'; +import { logger } from './tsbundle.logging'; + +export const runCli = async () => { + const tsBundleCli = new plugins.smartcli.Smartcli(); + tsBundleCli.standardTask().subscribe(async argvArg => { + const tsbundle = new TsBundle(); + switch (true) { + case argvArg.production: + await tsbundle.buildProduction(); + break; + case argvArg.test: + await tsbundle.buildTest(); + break; + default: + logger.log('error', `Can not determine build target environement. Please specify via --production or --test`) + return; + } + }); + + tsBundleCli.startParse(); +}; diff --git a/ts/tsbundle.logging.ts b/ts/tsbundle.logging.ts index 9c28847..eb90c15 100644 --- a/ts/tsbundle.logging.ts +++ b/ts/tsbundle.logging.ts @@ -5,7 +5,7 @@ export const logger = new plugins.smartlog.Smartlog({ company: 'Some Company', companyunit: 'Some CompanyUnit', containerName: 'Some Containername', - environment: "local", + environment: 'local', runtime: 'node', zone: 'gitzone' }, diff --git a/ts/tsbundle.plugins.ts b/ts/tsbundle.plugins.ts index 0ba818a..87e60e5 100644 --- a/ts/tsbundle.plugins.ts +++ b/ts/tsbundle.plugins.ts @@ -1,11 +1,9 @@ // pushrocks scope +import * as smartcli from '@pushrocks/smartcli'; import * as smartlog from '@pushrocks/smartlog'; import * as smartlogDestinationLocal from '@pushrocks/smartlog-destination-local'; -export { - smartlog, - smartlogDestinationLocal -} +export { smartcli, smartlog, smartlogDestinationLocal }; // third party scope import * as rollup from 'rollup'; @@ -13,6 +11,7 @@ import rollupBabel from 'rollup-plugin-babel'; import rollupCommonjs from 'rollup-plugin-commonjs'; import rollupResolve from 'rollup-plugin-node-resolve'; import rollupSourceMaps from 'rollup-plugin-sourcemaps'; +import { terser as rollupTerser } from 'rollup-plugin-terser'; import rollupTypescript from 'rollup-plugin-typescript2'; export { @@ -21,5 +20,6 @@ export { rollupCommonjs, rollupResolve, rollupSourceMaps, - rollupTypescript, -}; \ No newline at end of file + rollupTerser, + rollupTypescript +}; diff --git a/ts/tsbundle.rollup.prepend.ts b/ts/tsbundle.rollup.prepend.ts deleted file mode 100644 index 52b0b19..0000000 --- a/ts/tsbundle.rollup.prepend.ts +++ /dev/null @@ -1 +0,0 @@ -import * as plugins from './tsbundle.plugins';