From d17864b5002c440336687c80aa7da06074221744 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Wed, 17 Feb 2021 14:22:23 +0100 Subject: [PATCH 1/5] v5.6.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4a8acbbd2..9f076df7d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "chromatic", - "version": "5.6.2", + "version": "5.6.3", "description": "Visual Testing for Storybook", "homepage": "https://www.chromatic.com", "bugs": { From 176810e3f69b17c79d134bf3192ffbc3f2df6595 Mon Sep 17 00:00:00 2001 From: Gert Hengeveld Date: Fri, 2 Apr 2021 10:32:19 +0200 Subject: [PATCH 2/5] Better logging when Storybook validation fails --- bin/tasks/upload.js | 15 ++++++++------- bin/ui/tasks/upload.js | 17 ++++++++++------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/bin/tasks/upload.js b/bin/tasks/upload.js index 2b7b2f241..81f25f30a 100644 --- a/bin/tasks/upload.js +++ b/bin/tasks/upload.js @@ -34,20 +34,21 @@ const TesterGetUploadUrlsMutation = ` // Get all paths in rootDir, starting at dirname. // We don't want the paths to include rootDir -- so if rootDir = storybook-static, // paths will be like iframe.html rather than storybook-static/iframe.html -function getPathsInDir(rootDir, dirname = '.') { +function getPathsInDir(ctx, rootDir, dirname = '.') { try { return readdirSync(join(rootDir, dirname)) .map((p) => join(dirname, p)) .map((pathname) => { const stats = statSync(join(rootDir, pathname)); if (stats.isDirectory()) { - return getPathsInDir(rootDir, pathname); + return getPathsInDir(ctx, rootDir, pathname); } return [{ pathname, contentLength: stats.size }]; }) .reduce((a, b) => [...a, ...b], []); // flatten } catch (e) { - throw new Error(invalid({ sourceDir: rootDir }).output); + ctx.log.debug(e); + throw new Error(invalid({ sourceDir: rootDir }, e).output); } } @@ -61,8 +62,8 @@ function getOutputDir(buildLog) { return outputDir.trim(); } -function getFileInfo(sourceDir) { - const lengths = getPathsInDir(sourceDir).map((o) => ({ ...o, knownAs: slash(o.pathname) })); +function getFileInfo(ctx, sourceDir) { + const lengths = getPathsInDir(ctx, sourceDir).map((o) => ({ ...o, knownAs: slash(o.pathname) })); const paths = lengths.map(({ knownAs }) => knownAs); const total = lengths.map(({ contentLength }) => contentLength).reduce((a, b) => a + b, 0); return { lengths, paths, total }; @@ -72,7 +73,7 @@ const isValidStorybook = ({ paths, total }) => total > 0 && paths.includes('iframe.html') && paths.includes('index.html'); export const uploadStorybook = async (ctx, task) => { - let fileInfo = getFileInfo(ctx.sourceDir); + let fileInfo = getFileInfo(ctx, ctx.sourceDir); if (!isValidStorybook(fileInfo) && ctx.buildLogFile) { try { @@ -81,7 +82,7 @@ export const uploadStorybook = async (ctx, task) => { if (outputDir && outputDir !== ctx.sourceDir) { ctx.log.warn(deviatingOutputDir(ctx, outputDir)); ctx.sourceDir = outputDir; - fileInfo = getFileInfo(ctx.sourceDir); + fileInfo = getFileInfo(ctx, ctx.sourceDir); } } catch (e) { ctx.log.debug(e); diff --git a/bin/ui/tasks/upload.js b/bin/ui/tasks/upload.js index 7112a00f2..49b879477 100644 --- a/bin/ui/tasks/upload.js +++ b/bin/ui/tasks/upload.js @@ -36,13 +36,16 @@ export const skipped = (ctx) => ({ output: `Using hosted Storybook at ${ctx.options.storybookUrl}`, }); -export const invalid = (ctx) => ({ - status: 'error', - title: 'Publishing your built Storybook', - output: `Invalid Storybook build at ${ctx.sourceDir}${ - ctx.buildLogFile ? ' (check the build log)' : '' - }`, -}); +export const invalid = (ctx, error) => { + let output = `Invalid Storybook build at ${ctx.sourceDir}`; + if (ctx.buildLogFile) output += ' (check the build log)'; + if (error) output += `: ${error.message}`; + return { + status: 'error', + title: 'Publishing your built Storybook', + output, + }; +}; export const failed = (ctx) => ({ status: 'error', From bae8594fc37abdaee9a234c20522c92fc6016541 Mon Sep 17 00:00:00 2001 From: Gert Hengeveld Date: Fri, 2 Apr 2021 10:33:22 +0200 Subject: [PATCH 3/5] 5.7.1-canary.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2151ed661..41c74aa80 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "chromatic", - "version": "5.7.0", + "version": "5.7.1-canary.0", "description": "Automate visual testing across browsers. Gather UI feedback. Versioned documentation.", "homepage": "https://www.chromatic.com", "bugs": { From 3393b0c583f224dccc476cdb7a756a5acc851885 Mon Sep 17 00:00:00 2001 From: Gert Hengeveld Date: Fri, 2 Apr 2021 16:17:47 +0200 Subject: [PATCH 4/5] 5.7.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 41c74aa80..e1d220bc1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "chromatic", - "version": "5.7.1-canary.0", + "version": "5.7.1", "description": "Automate visual testing across browsers. Gather UI feedback. Versioned documentation.", "homepage": "https://www.chromatic.com", "bugs": { From 054c84fd541db9a092780935374552736caac2ed Mon Sep 17 00:00:00 2001 From: Gert Hengeveld Date: Fri, 2 Apr 2021 16:22:03 +0200 Subject: [PATCH 5/5] 5.7.1 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e9b610b6..8b963c1b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 5.7.1 - 2021-02-02 + +- Better logging when Storybook validation fails + # 5.7.0 - 2021-03-11 - [283](https://github.com/chromaui/chromatic-cli/pull/283) Explicitly allow multiple project-tokens (last will be used)