mirror of
https://github.com/zhigang1992/bundlewatch.git
synced 2026-04-29 04:15:22 +08:00
json pack URL
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
"github-build": "^1.2.0",
|
||||
"glob": "^7.1.2",
|
||||
"gzip-size": "^4.0.0",
|
||||
"jsonpack": "^1.1.5",
|
||||
"lodash.merge": "^4.6.1",
|
||||
"read-pkg-up": "^3.0.0"
|
||||
},
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import jsonpack from 'jsonpack/main'
|
||||
|
||||
const createURL = ({ results, bundlesizeServiceHost }) => {
|
||||
// TODO strip out data, etc
|
||||
// TODO 'minify' data
|
||||
// TODO url shortern service?
|
||||
const urlResultData = encodeURIComponent(JSON.stringify(results))
|
||||
const packedJSON = jsonpack.pack(results)
|
||||
const urlResultData = encodeURIComponent(packedJSON)
|
||||
const url = `${bundlesizeServiceHost}/results?d=${urlResultData}`
|
||||
return url
|
||||
}
|
||||
|
||||
@@ -35,6 +35,13 @@ const main = async () => {
|
||||
if (config.files && config.files.length > 0) {
|
||||
const results = await bundlesizeApi(config)
|
||||
|
||||
if (results.url) {
|
||||
logger.log('')
|
||||
logger.log(
|
||||
`${chalk.cyanBright('Result breakdown at:')} ${results.url}`,
|
||||
)
|
||||
}
|
||||
|
||||
prettyPrintResults(results.fullResults)
|
||||
|
||||
if (results.isFail) {
|
||||
|
||||
Reference in New Issue
Block a user