diff --git a/README.md b/README.md index 85c9bb6..1c6b985 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,13 @@ -# +# web font + ## 问题 使用 svelte https://github.com/DeMoorJasper/parcel-plugin-svelte 通过这个插件使用 parcel 然后报 new 的错 需要限制 编译的版本,在package.json browserslist 字段限制一下版本就好 + +## 启动 + +```bash +npm i +npm run build +npm run start +``` \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 9c920e8..ab3ef28 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2144,6 +2144,121 @@ "resolved": "https://registry.npm.taobao.org/aproba/download/aproba-1.2.0.tgz", "integrity": "sha1-aALmJk79GMeQobDVF/DyYnvyyUo=" }, + "archiver": { + "version": "0.11.0", + "resolved": "https://registry.npm.taobao.org/archiver/download/archiver-0.11.0.tgz", + "integrity": "sha1-mBd9p6bAGSt/J5jzDNbquKvXZpA=", + "requires": { + "async": "~0.9.0", + "buffer-crc32": "~0.2.1", + "glob": "~3.2.6", + "lazystream": "~0.1.0", + "lodash": "~2.4.1", + "readable-stream": "~1.0.26", + "tar-stream": "~0.4.0", + "zip-stream": "~0.4.0" + }, + "dependencies": { + "glob": { + "version": "3.2.11", + "resolved": "https://registry.npm.taobao.org/glob/download/glob-3.2.11.tgz?cache=0&sync_timestamp=1573078121947&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fglob%2Fdownload%2Fglob-3.2.11.tgz", + "integrity": "sha1-Spc/Y1uRkPcV0QmH1cAP0oFevj0=", + "requires": { + "inherits": "2", + "minimatch": "0.3" + } + }, + "lazystream": { + "version": "0.1.0", + "resolved": "https://registry.npm.taobao.org/lazystream/download/lazystream-0.1.0.tgz", + "integrity": "sha1-GyXWPHcqTCDwpe0KnXf0hLbhaSA=", + "requires": { + "readable-stream": "~1.0.2" + } + }, + "lodash": { + "version": "2.4.2", + "resolved": "https://registry.npm.taobao.org/lodash/download/lodash-2.4.2.tgz?cache=0&sync_timestamp=1577793955950&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Flodash%2Fdownload%2Flodash-2.4.2.tgz", + "integrity": "sha1-+t2DS5aDBz2hebPq5tnA0VBT9z4=" + }, + "lru-cache": { + "version": "2.7.3", + "resolved": "https://registry.npm.taobao.org/lru-cache/download/lru-cache-2.7.3.tgz", + "integrity": "sha1-bUUk6LlV+V1PW1iFHOId1y+06VI=" + }, + "minimatch": { + "version": "0.3.0", + "resolved": "https://registry.npm.taobao.org/minimatch/download/minimatch-0.3.0.tgz", + "integrity": "sha1-J12O2qxPG7MyZHIInnlJyDlGmd0=", + "requires": { + "lru-cache": "2", + "sigmund": "~1.0.0" + } + }, + "readable-stream": { + "version": "1.0.34", + "resolved": "https://registry.npm.taobao.org/readable-stream/download/readable-stream-1.0.34.tgz", + "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + } + } + }, + "archiver-utils": { + "version": "2.1.0", + "resolved": "https://registry.npm.taobao.org/archiver-utils/download/archiver-utils-2.1.0.tgz", + "integrity": "sha1-6KRg6UtpPD49oYKgmMpihbqSSeI=", + "requires": { + "glob": "^7.1.4", + "graceful-fs": "^4.2.0", + "lazystream": "^1.0.0", + "lodash.defaults": "^4.2.0", + "lodash.difference": "^4.5.0", + "lodash.flatten": "^4.4.0", + "lodash.isplainobject": "^4.0.6", + "lodash.union": "^4.6.0", + "normalize-path": "^3.0.0", + "readable-stream": "^2.0.0" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npm.taobao.org/isarray/download/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npm.taobao.org/normalize-path/download/normalize-path-3.0.0.tgz", + "integrity": "sha1-Dc1p/yOhybEf0JeDFmRKA4ghamU=" + }, + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npm.taobao.org/readable-stream/download/readable-stream-2.3.7.tgz", + "integrity": "sha1-Hsoc9xGu+BTAT2IlKjamL2yyO1c=", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npm.taobao.org/string_decoder/download/string_decoder-1.1.1.tgz", + "integrity": "sha1-nPFhG6YmhdcDCunkujQUnDrwP8g=", + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, "archy": { "version": "1.0.0", "resolved": "https://registry.npm.taobao.org/archy/download/archy-1.0.0.tgz", @@ -2368,6 +2483,11 @@ "integrity": "sha1-bIw/uCfdQ+45GPJ7gngqt2WKb9k=", "dev": true }, + "async": { + "version": "0.9.2", + "resolved": "https://registry.npm.taobao.org/async/download/async-0.9.2.tgz", + "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=" + }, "async-done": { "version": "1.3.2", "resolved": "https://registry.npm.taobao.org/async-done/download/async-done-1.3.2.tgz", @@ -2692,6 +2812,27 @@ "file-uri-to-path": "1.0.0" } }, + "bl": { + "version": "0.9.5", + "resolved": "https://registry.npm.taobao.org/bl/download/bl-0.9.5.tgz?cache=0&sync_timestamp=1584503205663&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fbl%2Fdownload%2Fbl-0.9.5.tgz", + "integrity": "sha1-wGt5evCF6gC8Unr8jvzxHeIjIFQ=", + "requires": { + "readable-stream": "~1.0.26" + }, + "dependencies": { + "readable-stream": { + "version": "1.0.34", + "resolved": "https://registry.npm.taobao.org/readable-stream/download/readable-stream-1.0.34.tgz", + "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + } + } + }, "bluebird": { "version": "3.7.2", "resolved": "https://registry.npm.taobao.org/bluebird/download/bluebird-3.7.2.tgz", @@ -2954,6 +3095,11 @@ } } }, + "buffer-crc32": { + "version": "0.2.13", + "resolved": "https://registry.npm.taobao.org/buffer-crc32/download/buffer-crc32-0.2.13.tgz", + "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=" + }, "buffer-equal": { "version": "1.0.0", "resolved": "https://registry.npm.taobao.org/buffer-equal/download/buffer-equal-1.0.0.tgz", @@ -3546,6 +3692,29 @@ "resolved": "https://registry.npm.taobao.org/component-emitter/download/component-emitter-1.3.0.tgz", "integrity": "sha1-FuQHD7qK4ptnnyIVhT7hgasuq8A=" }, + "compress-commons": { + "version": "0.1.6", + "resolved": "https://registry.npm.taobao.org/compress-commons/download/compress-commons-0.1.6.tgz", + "integrity": "sha1-DHQIcP3ljLpRbwrAyCLjOguF36M=", + "requires": { + "buffer-crc32": "~0.2.1", + "crc32-stream": "~0.3.1", + "readable-stream": "~1.0.26" + }, + "dependencies": { + "readable-stream": { + "version": "1.0.34", + "resolved": "https://registry.npm.taobao.org/readable-stream/download/readable-stream-1.0.34.tgz", + "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + } + } + }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npm.taobao.org/concat-map/download/concat-map-0.0.1.tgz", @@ -3747,6 +3916,47 @@ "parse-json": "^4.0.0" } }, + "crc": { + "version": "3.8.0", + "resolved": "https://registry.npm.taobao.org/crc/download/crc-3.8.0.tgz", + "integrity": "sha1-rWAmnCyFb4wpnixMwN5FVpFAVsY=", + "requires": { + "buffer": "^5.1.0" + }, + "dependencies": { + "buffer": { + "version": "5.5.0", + "resolved": "https://registry.npm.taobao.org/buffer/download/buffer-5.5.0.tgz", + "integrity": "sha1-nDyqPWI8M90cfvWEuJuIv5ybwc4=", + "requires": { + "base64-js": "^1.0.2", + "ieee754": "^1.1.4" + } + } + } + }, + "crc32-stream": { + "version": "0.3.4", + "resolved": "https://registry.npm.taobao.org/crc32-stream/download/crc32-stream-0.3.4.tgz", + "integrity": "sha1-c7wltF+sHbZjIjGnv86JJ+nwZVI=", + "requires": { + "buffer-crc32": "~0.2.1", + "readable-stream": "~1.0.24" + }, + "dependencies": { + "readable-stream": { + "version": "1.0.34", + "resolved": "https://registry.npm.taobao.org/readable-stream/download/readable-stream-1.0.34.tgz", + "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + } + } + }, "create-ecdh": { "version": "4.0.3", "resolved": "https://registry.npm.taobao.org/create-ecdh/download/create-ecdh-4.0.3.tgz", @@ -5431,6 +5641,11 @@ } } }, + "fs-constants": { + "version": "1.0.0", + "resolved": "https://registry.npm.taobao.org/fs-constants/download/fs-constants-1.0.0.tgz", + "integrity": "sha1-a+Dem+mYzhavivwkSXue6bfM2a0=" + }, "fs-extra": { "version": "8.1.0", "resolved": "https://registry.npm.taobao.org/fs-extra/download/fs-extra-8.1.0.tgz", @@ -8091,6 +8306,26 @@ "resolved": "https://registry.npm.taobao.org/lodash.debounce/download/lodash.debounce-4.0.8.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Flodash.debounce%2Fdownload%2Flodash.debounce-4.0.8.tgz", "integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=" }, + "lodash.defaults": { + "version": "4.2.0", + "resolved": "https://registry.npm.taobao.org/lodash.defaults/download/lodash.defaults-4.2.0.tgz", + "integrity": "sha1-0JF4cW/+pN3p5ft7N/bwgCJ0WAw=" + }, + "lodash.difference": { + "version": "4.5.0", + "resolved": "https://registry.npm.taobao.org/lodash.difference/download/lodash.difference-4.5.0.tgz", + "integrity": "sha1-nMtOUF1Ia5FlE0V3KIWi3yf9AXw=" + }, + "lodash.flatten": { + "version": "4.4.0", + "resolved": "https://registry.npm.taobao.org/lodash.flatten/download/lodash.flatten-4.4.0.tgz", + "integrity": "sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8=" + }, + "lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npm.taobao.org/lodash.isplainobject/download/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs=" + }, "lodash.memoize": { "version": "4.1.2", "resolved": "https://registry.npm.taobao.org/lodash.memoize/download/lodash.memoize-4.1.2.tgz", @@ -8106,6 +8341,11 @@ "resolved": "https://registry.npm.taobao.org/lodash.toarray/download/lodash.toarray-4.4.0.tgz", "integrity": "sha1-JMS/zWsvuji/0FlNsRedjptlZWE=" }, + "lodash.union": { + "version": "4.6.0", + "resolved": "https://registry.npm.taobao.org/lodash.union/download/lodash.union-4.6.0.tgz", + "integrity": "sha1-SLtQiECfFvGCFmZkHETdGqrjzYg=" + }, "lodash.uniq": { "version": "4.5.0", "resolved": "https://registry.npm.taobao.org/lodash.uniq/download/lodash.uniq-4.5.0.tgz", @@ -11357,6 +11597,11 @@ "integrity": "sha1-1rkYHBpI05cyTISHHvvPxz/AZUs=", "dev": true }, + "sigmund": { + "version": "1.0.1", + "resolved": "https://registry.npm.taobao.org/sigmund/download/sigmund-1.0.1.tgz", + "integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=" + }, "signal-exit": { "version": "3.0.2", "resolved": "https://registry.npm.taobao.org/signal-exit/download/signal-exit-3.0.2.tgz", @@ -12204,6 +12449,17 @@ "yallist": "^3.0.3" } }, + "tar-stream": { + "version": "0.4.7", + "resolved": "https://registry.npm.taobao.org/tar-stream/download/tar-stream-0.4.7.tgz?cache=0&sync_timestamp=1583830284236&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ftar-stream%2Fdownload%2Ftar-stream-0.4.7.tgz", + "integrity": "sha1-Hx0s6evHtCdlJDyg6PG3v9oKrc0=", + "requires": { + "bl": "^0.9.0", + "end-of-stream": "^1.0.0", + "readable-stream": "^1.0.27-1", + "xtend": "^4.0.0" + } + }, "terser": { "version": "4.6.7", "resolved": "https://registry.npm.taobao.org/terser/download/terser-4.6.7.tgz", @@ -13619,6 +13875,204 @@ "resolved": "https://registry.npm.taobao.org/yn/download/yn-3.1.1.tgz", "integrity": "sha1-HodAGgnXZ8HV6rJqbkwYUYLS61A=", "dev": true + }, + "zip-a-folder": { + "version": "0.0.12", + "resolved": "https://registry.npm.taobao.org/zip-a-folder/download/zip-a-folder-0.0.12.tgz", + "integrity": "sha1-c9BUYcN8LV+GssB0M1fXXidOUdk=", + "requires": { + "archiver": "^3.1.1" + }, + "dependencies": { + "archiver": { + "version": "3.1.1", + "resolved": "https://registry.npm.taobao.org/archiver/download/archiver-3.1.1.tgz", + "integrity": "sha1-nbeBnU2vYK7BD+hrFsuSWM7WbqA=", + "requires": { + "archiver-utils": "^2.1.0", + "async": "^2.6.3", + "buffer-crc32": "^0.2.1", + "glob": "^7.1.4", + "readable-stream": "^3.4.0", + "tar-stream": "^2.1.0", + "zip-stream": "^2.1.2" + } + }, + "async": { + "version": "2.6.3", + "resolved": "https://registry.npm.taobao.org/async/download/async-2.6.3.tgz", + "integrity": "sha1-1yYl4jRKNlbjo61Pp0n6gymdgv8=", + "requires": { + "lodash": "^4.17.14" + } + }, + "bl": { + "version": "4.0.2", + "resolved": "https://registry.npm.taobao.org/bl/download/bl-4.0.2.tgz?cache=0&sync_timestamp=1584503205663&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fbl%2Fdownload%2Fbl-4.0.2.tgz", + "integrity": "sha1-UrcekIhRXQYG2d2cx6pI3B+Y5zo=", + "requires": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + }, + "dependencies": { + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npm.taobao.org/inherits/download/inherits-2.0.4.tgz", + "integrity": "sha1-D6LGT5MpF8NDOg3tVTY6rjdBa3w=" + } + } + }, + "buffer": { + "version": "5.5.0", + "resolved": "https://registry.npm.taobao.org/buffer/download/buffer-5.5.0.tgz", + "integrity": "sha1-nDyqPWI8M90cfvWEuJuIv5ybwc4=", + "requires": { + "base64-js": "^1.0.2", + "ieee754": "^1.1.4" + } + }, + "compress-commons": { + "version": "2.1.1", + "resolved": "https://registry.npm.taobao.org/compress-commons/download/compress-commons-2.1.1.tgz", + "integrity": "sha1-lBDZpTTPhDXj+7t8bOSN4twvBhA=", + "requires": { + "buffer-crc32": "^0.2.13", + "crc32-stream": "^3.0.1", + "normalize-path": "^3.0.0", + "readable-stream": "^2.3.6" + }, + "dependencies": { + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npm.taobao.org/readable-stream/download/readable-stream-2.3.7.tgz", + "integrity": "sha1-Hsoc9xGu+BTAT2IlKjamL2yyO1c=", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npm.taobao.org/safe-buffer/download/safe-buffer-5.1.2.tgz", + "integrity": "sha1-mR7GnSluAxN0fVm9/St0XDX4go0=" + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npm.taobao.org/string_decoder/download/string_decoder-1.1.1.tgz", + "integrity": "sha1-nPFhG6YmhdcDCunkujQUnDrwP8g=", + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "crc32-stream": { + "version": "3.0.1", + "resolved": "https://registry.npm.taobao.org/crc32-stream/download/crc32-stream-3.0.1.tgz", + "integrity": "sha1-yubu7QA7DkTXOdJ53lrmOxcbToU=", + "requires": { + "crc": "^3.4.4", + "readable-stream": "^3.4.0" + } + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npm.taobao.org/isarray/download/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npm.taobao.org/normalize-path/download/normalize-path-3.0.0.tgz", + "integrity": "sha1-Dc1p/yOhybEf0JeDFmRKA4ghamU=" + }, + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npm.taobao.org/readable-stream/download/readable-stream-3.6.0.tgz", + "integrity": "sha1-M3u9o63AcGvT4CRCaihtS0sskZg=", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "safe-buffer": { + "version": "5.2.0", + "resolved": "https://registry.npm.taobao.org/safe-buffer/download/safe-buffer-5.2.0.tgz", + "integrity": "sha1-t02uxJsRSPiMZLaNSbHoFcHy9Rk=" + }, + "string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npm.taobao.org/string_decoder/download/string_decoder-1.3.0.tgz", + "integrity": "sha1-QvEUWUpGzxqOMLCoT1bHjD7awh4=", + "requires": { + "safe-buffer": "~5.2.0" + } + }, + "tar-stream": { + "version": "2.1.2", + "resolved": "https://registry.npm.taobao.org/tar-stream/download/tar-stream-2.1.2.tgz?cache=0&sync_timestamp=1583830284236&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ftar-stream%2Fdownload%2Ftar-stream-2.1.2.tgz", + "integrity": "sha1-bV7xp+V4OpX/cLabl0VaWWjcEyU=", + "requires": { + "bl": "^4.0.1", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + } + }, + "zip-stream": { + "version": "2.1.3", + "resolved": "https://registry.npm.taobao.org/zip-stream/download/zip-stream-2.1.3.tgz", + "integrity": "sha1-JsxL25NkGoWQ3QcRLh93rxdYhls=", + "requires": { + "archiver-utils": "^2.1.0", + "compress-commons": "^2.1.1", + "readable-stream": "^3.4.0" + } + } + } + }, + "zip-folder": { + "version": "1.0.0", + "resolved": "https://registry.npm.taobao.org/zip-folder/download/zip-folder-1.0.0.tgz", + "integrity": "sha1-cKd0T9F4mi/rQa00GbMun9h5V7I=", + "requires": { + "archiver": "^0.11.0" + } + }, + "zip-stream": { + "version": "0.4.1", + "resolved": "https://registry.npm.taobao.org/zip-stream/download/zip-stream-0.4.1.tgz", + "integrity": "sha1-TqeVqM4Z6fq0mjHR0IdyFBWfA6M=", + "requires": { + "compress-commons": "~0.1.0", + "lodash": "~2.4.1", + "readable-stream": "~1.0.26" + }, + "dependencies": { + "lodash": { + "version": "2.4.2", + "resolved": "https://registry.npm.taobao.org/lodash/download/lodash-2.4.2.tgz?cache=0&sync_timestamp=1577793955950&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Flodash%2Fdownload%2Flodash-2.4.2.tgz", + "integrity": "sha1-+t2DS5aDBz2hebPq5tnA0VBT9z4=" + }, + "readable-stream": { + "version": "1.0.34", + "resolved": "https://registry.npm.taobao.org/readable-stream/download/readable-stream-1.0.34.tgz", + "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + } + } } } } diff --git a/package.json b/package.json index f55027a..9f528aa 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "license": "MIT", "scripts": { "prebuild": "rimraf dist", - "build": "nest build", + "build": "nest build && parcel build ./static/index.html", "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", "start:web": "parcel ./static/index.html", "start": "nest start", @@ -33,7 +33,9 @@ "rimraf": "^3.0.0", "rxjs": "^6.5.3", "svelte": "^3.20.1", - "tailwindcss": "^1.2.0" + "tailwindcss": "^1.2.0", + "zip-a-folder": "0.0.12", + "zip-folder": "^1.0.0" }, "devDependencies": { "@nestjs/cli": "^6.9.0", diff --git a/src/app.service.ts b/src/app.service.ts index de4e70d..df9a8c5 100644 --- a/src/app.service.ts +++ b/src/app.service.ts @@ -1,13 +1,15 @@ import { Injectable } from '@nestjs/common'; import Fontmin from 'fontmin'; - +const { zip } = require('zip-a-folder'); +import { join } from 'path'; +import { config } from './config'; @Injectable() export class AppService { getHello(): string { return 'Hello World!'; } - font_min(text:string,font:string) { + font_min(text: string, font: string) { const srcPath = `./src/font/${font}.ttf`; // 字体源文件 const outPath = `asset/font/${Date.now()}/`; const destPath = `./${outPath}`; // 输出路径 @@ -22,7 +24,7 @@ export class AppService { .use(Fontmin.ttf2eot()) // eot 转换插件 .use(Fontmin.ttf2woff()) // woff 转换插件 .use(Fontmin.ttf2svg()) // svg 转换插件 - .use(Fontmin.css({ fontPath: `http://127.0.0.1:3000/${outPath}` })) // css 生成插件 + .use(Fontmin.css({ fontPath: `${config.web_font_path}${outPath}` })) // css 生成插件 .dest(destPath); // 输出配置 // 执行 @@ -37,6 +39,10 @@ export class AppService { (f.history[f.history.length - 1] as string).endsWith('.css'), ) .map(f => f._contents.toString()); + zip( + join(__dirname, '../../', destPath), + join(__dirname, '../../', destPath, 'asset.zip'), + ); // resolve({code:0,fil:files.map(f=>f._contents.toString())}); // 成功 // resolve({code:0,files}); // 成功 resolve(css); // 成功 diff --git a/src/config.ts b/src/config.ts new file mode 100644 index 0000000..52b9f11 --- /dev/null +++ b/src/config.ts @@ -0,0 +1,3 @@ +export const config={ + web_font_path:"http://127.0.0.1:3000/" +} \ No newline at end of file diff --git a/static/App.svelte b/static/App.svelte index c4d9848..5b9f689 100644 --- a/static/App.svelte +++ b/static/App.svelte @@ -1,11 +1,11 @@ -