From 6c5023fbbfe70012483ea16a4847b3a3d78a8910 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Thu, 18 Feb 2021 13:14:04 +0100 Subject: [PATCH 01/22] change to the proper url --- action/main.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action/main.ts b/action/main.ts index fc7d6bb3d..f7f24fb9e 100755 --- a/action/main.ts +++ b/action/main.ts @@ -81,7 +81,7 @@ async function runChromatic(options): Promise { url: ctx.build?.webUrl, code: ctx.exitCode, buildUrl: ctx.build?.webUrl, - storybookUrl: ctx.build?.isolatorUrl, + storybookUrl: ctx.build?.cachedUrl, }; } From 3248c35cead7032c24d44887913068aae28aaf09 Mon Sep 17 00:00:00 2001 From: Tom Coleman Date: Mon, 22 Feb 2021 13:55:45 +1100 Subject: [PATCH 02/22] Upgrade to husky-5 --- .husky/.gitignore | 1 + .husky/pre-commit | 4 ++++ package.json | 6 +++++- yarn.lock | 40 ++++++++++++++++++++++++++++++++++++---- 4 files changed, 46 insertions(+), 5 deletions(-) create mode 100644 .husky/.gitignore create mode 100755 .husky/pre-commit diff --git a/.husky/.gitignore b/.husky/.gitignore new file mode 100644 index 000000000..c9cdc63b0 --- /dev/null +++ b/.husky/.gitignore @@ -0,0 +1 @@ +_ \ No newline at end of file diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 000000000..dc0378c34 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +yarn lint-staged \ No newline at end of file diff --git a/package.json b/package.json index 4a8acbbd2..1b1bca120 100644 --- a/package.json +++ b/package.json @@ -38,10 +38,13 @@ "chromatic-staging": "CHROMATIC_INDEX_URL=https://www.staging-chromatic.com node ./bin/register.js", "chromatic-verbose": "cross-env LOG_LEVEL=verbose node ./bin/register.js", "dev": "npm-run-all --parallel -l 'build:** -- --watch'", + "postinstall": "husky install", "lint": "yarn lint:js src .storybook bin stories", "lint:js": "cross-env NODE_ENV=production eslint --fix --cache --cache-location=.cache/eslint --ext .js,.json,.mjs --report-unused-disable-directives", "lint:package": "sort-package-json", "prepare": "npm run build", + "prepublishOnly": "pinst --disable", + "postpublish": "pinst --enable", "publish-action": "yarn build:action && node scripts/publish-action.js", "storybook": "start-storybook -p 9009 -s static", "test": "jest" @@ -114,10 +117,11 @@ "cpy": "^8.1.1", "cross-env": "^7.0.3", "eslint": "^7.19.0", - "husky": "5.0.9", + "husky": "5", "jest": "^26.6.1", "lint-staged": "^10.5.4", "npm-run-all": "^4.0.2", + "pinst": "^2.1.4", "prettier": "^2.2.1", "prop-types": "^15.7.2", "react": "^17.0.1", diff --git a/yarn.lock b/yarn.lock index 974f1d64f..66f95cf2e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6625,6 +6625,11 @@ from2@^2.1.0: inherits "^2.0.1" readable-stream "^2.0.0" +fromentries@^1.3.2: + version "1.3.2" + resolved "https://registry.yarnpkg.com/fromentries/-/fromentries-1.3.2.tgz#e4bca6808816bf8f93b52750f1127f5a6fd86e3a" + integrity sha512-cHEpEQHUg0f8XdtZCc2ZAhrHzKzT0MrFUTcvx+hfxYu7rGMDc5SKoXFh+n4YigxsHXRzc6OrCshdR1bWH6HHyg== + fs-extra@^0.30.0: version "0.30.0" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-0.30.0.tgz#f233ffcc08d4da7d432daa449776989db1df93f0" @@ -7269,10 +7274,10 @@ human-signals@^2.1.0: resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw== -husky@5.0.9: - version "5.0.9" - resolved "https://registry.yarnpkg.com/husky/-/husky-5.0.9.tgz#6d38706643d66ed395bcd4ee952d02e3f15eb3a3" - integrity sha512-0SjcaY21a+IRdx7p7r/X33Vc09UR2m8SbP8yfkhUX2/jAmwcz+GR7i9jXkp2pP3GfX23JhMkVP6SWwXB18uXtg== +husky@5: + version "5.1.0" + resolved "https://registry.yarnpkg.com/husky/-/husky-5.1.0.tgz#68b1148523acc838af0655ead71bf4671adb9f93" + integrity sha512-Os0EY2haOO+59YZSwMiUDsHY43RFwBVIRStHcnnT8/kvA+sFfaA/YS4uLFRiymXYgQl6E6TQTt3y4v/Z2ctEtw== iconv-lite@0.4.24, iconv-lite@^0.4.24: version "0.4.24" @@ -9992,6 +9997,14 @@ pify@^4.0.1: resolved "https://registry.yarnpkg.com/pify/-/pify-4.0.1.tgz#4b2cd25c50d598735c50292224fd8c6df41e3231" integrity sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g== +pinst@^2.1.4: + version "2.1.4" + resolved "https://registry.yarnpkg.com/pinst/-/pinst-2.1.4.tgz#f951567ac350b5a6d920bca0d53f558df15a27e4" + integrity sha512-T44k87is/GiSjONFxSl/uL6yGqwVpojdnUfbYzNeatDTM8uRCoCEQjuQ0g1oW6XENfbdO2XKtMfdGlDSQ19MJA== + dependencies: + fromentries "^1.3.2" + write-json-file "^4.3.0" + pirates@^4.0.0, pirates@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.1.tgz#643a92caf894566f91b2b986d2c66950a8e2fb87" @@ -11562,6 +11575,13 @@ snapdragon@^0.8.1: source-map-resolve "^0.5.0" use "^3.1.0" +sort-keys@^4.0.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/sort-keys/-/sort-keys-4.2.0.tgz#6b7638cee42c506fff8c1cecde7376d21315be18" + integrity sha512-aUYIEU/UviqPgc8mHR6IW1EGxkAXpeRETYcrzg8cLAvUPZcpAlleSXHV2mY7G12GphSH6Gzv+4MMVSSkbdteHg== + dependencies: + is-plain-obj "^2.0.0" + sort-object-keys@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/sort-object-keys/-/sort-object-keys-1.1.3.tgz#bff833fe85cab147b34742e45863453c1e190b45" @@ -13120,6 +13140,18 @@ write-file-atomic@^3.0.0: signal-exit "^3.0.2" typedarray-to-buffer "^3.1.5" +write-json-file@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/write-json-file/-/write-json-file-4.3.0.tgz#908493d6fd23225344af324016e4ca8f702dd12d" + integrity sha512-PxiShnxf0IlnQuMYOPPhPkhExoCQuTUNPOa/2JWCYTmBquU9njyyDuwRKN26IZBlp4yn1nt+Agh2HOOBl+55HQ== + dependencies: + detect-indent "^6.0.0" + graceful-fs "^4.1.15" + is-plain-obj "^2.0.0" + make-dir "^3.0.0" + sort-keys "^4.0.0" + write-file-atomic "^3.0.0" + ws@^7.2.3: version "7.4.1" resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.1.tgz#a333be02696bd0e54cea0434e21dcc8a9ac294bb" From fd2b8f7369a0bdbb9208cabc71176951adb8609b Mon Sep 17 00:00:00 2001 From: Tom Coleman Date: Tue, 23 Feb 2021 16:47:00 +1100 Subject: [PATCH 03/22] Revert "Upgrade to husky 5" --- .husky/.gitignore | 1 - .husky/pre-commit | 4 ---- package.json | 6 +----- yarn.lock | 40 ++++------------------------------------ 4 files changed, 5 insertions(+), 46 deletions(-) delete mode 100644 .husky/.gitignore delete mode 100755 .husky/pre-commit diff --git a/.husky/.gitignore b/.husky/.gitignore deleted file mode 100644 index c9cdc63b0..000000000 --- a/.husky/.gitignore +++ /dev/null @@ -1 +0,0 @@ -_ \ No newline at end of file diff --git a/.husky/pre-commit b/.husky/pre-commit deleted file mode 100755 index dc0378c34..000000000 --- a/.husky/pre-commit +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -. "$(dirname "$0")/_/husky.sh" - -yarn lint-staged \ No newline at end of file diff --git a/package.json b/package.json index 1b1bca120..4a8acbbd2 100644 --- a/package.json +++ b/package.json @@ -38,13 +38,10 @@ "chromatic-staging": "CHROMATIC_INDEX_URL=https://www.staging-chromatic.com node ./bin/register.js", "chromatic-verbose": "cross-env LOG_LEVEL=verbose node ./bin/register.js", "dev": "npm-run-all --parallel -l 'build:** -- --watch'", - "postinstall": "husky install", "lint": "yarn lint:js src .storybook bin stories", "lint:js": "cross-env NODE_ENV=production eslint --fix --cache --cache-location=.cache/eslint --ext .js,.json,.mjs --report-unused-disable-directives", "lint:package": "sort-package-json", "prepare": "npm run build", - "prepublishOnly": "pinst --disable", - "postpublish": "pinst --enable", "publish-action": "yarn build:action && node scripts/publish-action.js", "storybook": "start-storybook -p 9009 -s static", "test": "jest" @@ -117,11 +114,10 @@ "cpy": "^8.1.1", "cross-env": "^7.0.3", "eslint": "^7.19.0", - "husky": "5", + "husky": "5.0.9", "jest": "^26.6.1", "lint-staged": "^10.5.4", "npm-run-all": "^4.0.2", - "pinst": "^2.1.4", "prettier": "^2.2.1", "prop-types": "^15.7.2", "react": "^17.0.1", diff --git a/yarn.lock b/yarn.lock index 66f95cf2e..974f1d64f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6625,11 +6625,6 @@ from2@^2.1.0: inherits "^2.0.1" readable-stream "^2.0.0" -fromentries@^1.3.2: - version "1.3.2" - resolved "https://registry.yarnpkg.com/fromentries/-/fromentries-1.3.2.tgz#e4bca6808816bf8f93b52750f1127f5a6fd86e3a" - integrity sha512-cHEpEQHUg0f8XdtZCc2ZAhrHzKzT0MrFUTcvx+hfxYu7rGMDc5SKoXFh+n4YigxsHXRzc6OrCshdR1bWH6HHyg== - fs-extra@^0.30.0: version "0.30.0" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-0.30.0.tgz#f233ffcc08d4da7d432daa449776989db1df93f0" @@ -7274,10 +7269,10 @@ human-signals@^2.1.0: resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw== -husky@5: - version "5.1.0" - resolved "https://registry.yarnpkg.com/husky/-/husky-5.1.0.tgz#68b1148523acc838af0655ead71bf4671adb9f93" - integrity sha512-Os0EY2haOO+59YZSwMiUDsHY43RFwBVIRStHcnnT8/kvA+sFfaA/YS4uLFRiymXYgQl6E6TQTt3y4v/Z2ctEtw== +husky@5.0.9: + version "5.0.9" + resolved "https://registry.yarnpkg.com/husky/-/husky-5.0.9.tgz#6d38706643d66ed395bcd4ee952d02e3f15eb3a3" + integrity sha512-0SjcaY21a+IRdx7p7r/X33Vc09UR2m8SbP8yfkhUX2/jAmwcz+GR7i9jXkp2pP3GfX23JhMkVP6SWwXB18uXtg== iconv-lite@0.4.24, iconv-lite@^0.4.24: version "0.4.24" @@ -9997,14 +9992,6 @@ pify@^4.0.1: resolved "https://registry.yarnpkg.com/pify/-/pify-4.0.1.tgz#4b2cd25c50d598735c50292224fd8c6df41e3231" integrity sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g== -pinst@^2.1.4: - version "2.1.4" - resolved "https://registry.yarnpkg.com/pinst/-/pinst-2.1.4.tgz#f951567ac350b5a6d920bca0d53f558df15a27e4" - integrity sha512-T44k87is/GiSjONFxSl/uL6yGqwVpojdnUfbYzNeatDTM8uRCoCEQjuQ0g1oW6XENfbdO2XKtMfdGlDSQ19MJA== - dependencies: - fromentries "^1.3.2" - write-json-file "^4.3.0" - pirates@^4.0.0, pirates@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.1.tgz#643a92caf894566f91b2b986d2c66950a8e2fb87" @@ -11575,13 +11562,6 @@ snapdragon@^0.8.1: source-map-resolve "^0.5.0" use "^3.1.0" -sort-keys@^4.0.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/sort-keys/-/sort-keys-4.2.0.tgz#6b7638cee42c506fff8c1cecde7376d21315be18" - integrity sha512-aUYIEU/UviqPgc8mHR6IW1EGxkAXpeRETYcrzg8cLAvUPZcpAlleSXHV2mY7G12GphSH6Gzv+4MMVSSkbdteHg== - dependencies: - is-plain-obj "^2.0.0" - sort-object-keys@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/sort-object-keys/-/sort-object-keys-1.1.3.tgz#bff833fe85cab147b34742e45863453c1e190b45" @@ -13140,18 +13120,6 @@ write-file-atomic@^3.0.0: signal-exit "^3.0.2" typedarray-to-buffer "^3.1.5" -write-json-file@^4.3.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/write-json-file/-/write-json-file-4.3.0.tgz#908493d6fd23225344af324016e4ca8f702dd12d" - integrity sha512-PxiShnxf0IlnQuMYOPPhPkhExoCQuTUNPOa/2JWCYTmBquU9njyyDuwRKN26IZBlp4yn1nt+Agh2HOOBl+55HQ== - dependencies: - detect-indent "^6.0.0" - graceful-fs "^4.1.15" - is-plain-obj "^2.0.0" - make-dir "^3.0.0" - sort-keys "^4.0.0" - write-file-atomic "^3.0.0" - ws@^7.2.3: version "7.4.1" resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.1.tgz#a333be02696bd0e54cea0434e21dcc8a9ac294bb" From 0142c8dfec076bb5dd124ea5d3e34a508d9d1c06 Mon Sep 17 00:00:00 2001 From: Gert Hengeveld Date: Tue, 2 Mar 2021 16:17:14 +0100 Subject: [PATCH 04/22] Gracefully handle failing git config command --- bin/tasks/gitInfo.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/tasks/gitInfo.js b/bin/tasks/gitInfo.js index 6e6f6a747..383fe7918 100644 --- a/bin/tasks/gitInfo.js +++ b/bin/tasks/gitInfo.js @@ -21,8 +21,10 @@ const TesterSkipBuildMutation = ` export const setGitInfo = async (ctx, task) => { const { branchName, patchBaseRef, fromCI: ci } = ctx.options; ctx.git = await getCommitAndBranch({ branchName, patchBaseRef, ci, log: ctx.log }); - ctx.git.slug = ctx.git.slug || (await getSlug()); ctx.git.version = await getVersion(); + if (!ctx.git.slug) { + ctx.git.slug = await getSlug().catch((e) => ctx.log.warn('Failed to retrieve slug', e)); + } if (ctx.options.ownerName) { ctx.git.slug = ctx.git.slug.replace(/[^/]+/, ctx.options.ownerName); From 7ee6a1a56afa6551e364aaf2518e4df17ad1b144 Mon Sep 17 00:00:00 2001 From: Gert Hengeveld Date: Tue, 2 Mar 2021 16:25:04 +0100 Subject: [PATCH 05/22] Fix mocks --- bin/main.test.js | 23 ++++++++++++----------- bin/tasks/gitInfo.test.js | 16 ++++++++-------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/bin/main.test.js b/bin/main.test.js index 196e7ba46..6d613284a 100644 --- a/bin/main.test.js +++ b/bin/main.test.js @@ -127,17 +127,18 @@ fs.statSync = jest.fn((path) => { }); jest.mock('./git/git', () => ({ - hasPreviousCommit: () => true, - getCommit: () => ({ - commit: 'commit', - committedAt: 1234, - committerEmail: 'test@test.com', - committerName: 'tester', - }), - getBranch: () => 'branch', - getBaselineCommits: () => ['baseline'], - getSlug: () => 'user/repo', - getVersion: () => '2.24.1', + hasPreviousCommit: () => Promise.resolve(true), + getCommit: () => + Promise.resolve({ + commit: 'commit', + committedAt: 1234, + committerEmail: 'test@test.com', + committerName: 'tester', + }), + getBranch: () => Promise.resolve('branch'), + getBaselineCommits: () => Promise.resolve(['baseline']), + getSlug: () => Promise.resolve('user/repo'), + getVersion: () => Promise.resolve('2.24.1'), })); jest.mock('./lib/startStorybook'); diff --git a/bin/tasks/gitInfo.test.js b/bin/tasks/gitInfo.test.js index 1f1f5b5da..d1ffc8a6b 100644 --- a/bin/tasks/gitInfo.test.js +++ b/bin/tasks/gitInfo.test.js @@ -9,10 +9,10 @@ const log = { debug: jest.fn() }; describe('setGitInfo', () => { it('sets the git info on context', async () => { - getCommitAndBranch.mockReturnValue({ commit: '123asdf', branch: 'something' }); - getBaselineCommits.mockReturnValue(['asd2344']); - getVersion.mockReturnValue('Git v1.0.0'); - getSlug.mockReturnValue('user/repo'); + getCommitAndBranch.mockReturnValue(Promise.resolve({ commit: '123asdf', branch: 'something' })); + getBaselineCommits.mockReturnValue(Promise.resolve(['asd2344'])); + getVersion.mockReturnValue(Promise.resolve('Git v1.0.0')); + getSlug.mockReturnValue(Promise.resolve('user/repo')); const ctx = { log, options: {} }; await setGitInfo(ctx, {}); expect(ctx.git).toMatchObject({ @@ -25,10 +25,10 @@ describe('setGitInfo', () => { }); it('supports overriding the owner name in the slug', async () => { - getCommitAndBranch.mockReturnValue({ commit: '123asdf', branch: 'something' }); - getBaselineCommits.mockReturnValue(['asd2344']); - getVersion.mockReturnValue('Git v1.0.0'); - getSlug.mockReturnValue('user/repo'); + getCommitAndBranch.mockReturnValue(Promise.resolve({ commit: '123asdf', branch: 'something' })); + getBaselineCommits.mockReturnValue(Promise.resolve(['asd2344'])); + getVersion.mockReturnValue(Promise.resolve('Git v1.0.0')); + getSlug.mockReturnValue(Promise.resolve('user/repo')); const ctx = { log, options: { ownerName: 'org' } }; await setGitInfo(ctx, {}); expect(ctx.git).toMatchObject({ From 9380ecfe1ac1cf452a64a3c51019f95cbe3f9462 Mon Sep 17 00:00:00 2001 From: Adrian Macneil Date: Wed, 3 Mar 2021 17:24:54 -0800 Subject: [PATCH 06/22] Support yarn execpath --- bin/tasks/build.js | 2 +- bin/tasks/build.test.js | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/bin/tasks/build.js b/bin/tasks/build.js index fcda2fd49..52737b9b6 100644 --- a/bin/tasks/build.js +++ b/bin/tasks/build.js @@ -27,7 +27,7 @@ export const setSpawnParams = (ctx) => { // Based on https://github.com/mysticatea/npm-run-all/blob/52eaf86242ba408dedd015f53ca7ca368f25a026/lib/run-task.js#L156-L174 const npmExecPath = process.env.npm_execpath; const isJsPath = typeof npmExecPath === 'string' && /\.m?js/.test(path.extname(npmExecPath)); - const isYarn = npmExecPath && path.basename(npmExecPath) === 'yarn.js'; + const isYarn = npmExecPath && /^yarn(\.js)?$/.test(path.basename(npmExecPath)); ctx.spawnParams = { command: (isJsPath ? process.execPath : npmExecPath) || 'npm', clientArgs: isJsPath ? [npmExecPath, 'run'] : ['run', '--silent'], diff --git a/bin/tasks/build.test.js b/bin/tasks/build.test.js index ad98b77ea..fbc1d7a76 100644 --- a/bin/tasks/build.test.js +++ b/bin/tasks/build.test.js @@ -41,6 +41,17 @@ describe('setSpawnParams', () => { scriptArgs: ['build:storybook', '--', '--output-dir', './source-dir/'], }); }); + + it('supports yarn', async () => { + process.env.npm_execpath = '/path/to/yarn'; + const ctx = { sourceDir: './source-dir/', options: { buildScriptName: 'build:storybook' } }; + await setSpawnParams(ctx); + expect(ctx.spawnParams).toEqual({ + command: '/path/to/yarn', + clientArgs: ['run', '--silent'], + scriptArgs: ['build:storybook', '--output-dir', './source-dir/'], + }); + }); }); describe('buildStorybook', () => { From c0cf9d8baea205f6b0153bff4eb21e81c00ecfa2 Mon Sep 17 00:00:00 2001 From: nisshii0313 Date: Thu, 4 Mar 2021 11:18:20 +0900 Subject: [PATCH 07/22] add @storybook/vue3 support --- bin/lib/getStorybookInfo.js | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/lib/getStorybookInfo.js b/bin/lib/getStorybookInfo.js index ebc5e613e..dcf5b5be1 100644 --- a/bin/lib/getStorybookInfo.js +++ b/bin/lib/getStorybookInfo.js @@ -5,6 +5,7 @@ import fs from 'fs-extra'; const viewLayers = [ 'react', 'vue', + 'vue3', 'angular', 'html', 'web-components', From 92466f556974677c0165c27253ca022e77eb06e6 Mon Sep 17 00:00:00 2001 From: Machiste Quintana Date: Wed, 3 Mar 2021 23:58:45 -0500 Subject: [PATCH 08/22] Document outputs in action.yml --- action.yml | 60 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 25 deletions(-) diff --git a/action.yml b/action.yml index 206cb0e28..4454dc913 100755 --- a/action.yml +++ b/action.yml @@ -1,55 +1,65 @@ name: Publish to Chromatic author: Chroma Software, Inc. -description: "Publish your Storybook to Chromatic and run visual regression tests" +description: 'Publish your Storybook to Chromatic and run visual regression tests' branding: - icon: "aperture" - color: "orange" + icon: 'aperture' + color: 'orange' inputs: token: - description: "Your github token" + description: 'Your github token' projectToken: - description: "Your chromatic project token" + description: 'Your chromatic project token' workingDir: - description: "Working directory for the package.json file" + description: 'Working directory for the package.json file' appCode: - description: "Deprecated, please use projectToken instead" + description: 'Deprecated, please use projectToken instead' buildScriptName: - description: "The npm script that builds your Storybook [build-storybook]" + description: 'The npm script that builds your Storybook [build-storybook]' scriptName: - description: "The npm script that starts your Storybook [storybook]" + description: 'The npm script that starts your Storybook [storybook]' exec: - description: "Alternatively, a full command to run to start your storybook" + description: 'Alternatively, a full command to run to start your storybook' skip: - description: "Skip Chromatic tests, but mark the commit as passing" + description: 'Skip Chromatic tests, but mark the commit as passing' doNotStart: - description: "Do not attempt to start or build; use if your Storybook is already running" + description: 'Do not attempt to start or build; use if your Storybook is already running' storybookBuildDir: - description: "Provide a directory with your built storybook; use if you have already built your storybook" + description: 'Provide a directory with your built storybook; use if you have already built your storybook' storybookCa: - description: "Use if Storybook is running on https (auto detected from -s, if set)" + description: 'Use if Storybook is running on https (auto detected from -s, if set)' storybookCert: - description: "Use if Storybook is running on https (auto detected from -s, if set)" + description: 'Use if Storybook is running on https (auto detected from -s, if set)' storybookHttps: - description: "Use if Storybook is running on https (auto detected from -s, if set)" + description: 'Use if Storybook is running on https (auto detected from -s, if set)' storybookKey: - description: "Use if Storybook is running on https (auto detected from -s, if set)" + description: 'Use if Storybook is running on https (auto detected from -s, if set)' storybookPort: - description: "What port is your Storybook running on (auto detected from -s, if set)" + description: 'What port is your Storybook running on (auto detected from -s, if set)' storybookUrl: - description: "Storybook is already running at (external) url (implies -S)" + description: 'Storybook is already running at (external) url (implies -S)' preserveMissing: - description: "Pass the baselines forward and treat all missing stories as “preserved” without re-capturing them" + description: 'Pass the baselines forward and treat all missing stories as “preserved” without re-capturing them' autoAcceptChanges: - description: "Automatically accept all changes in chromatic: boolean or branchname" + description: 'Automatically accept all changes in chromatic: boolean or branchname' allowConsoleErrors: - description: "Do not exit when runtime errors occur in storybook" + description: 'Do not exit when runtime errors occur in storybook' exitZeroOnChanges: - description: "Positive exit of action even when there are changes: boolean or branchname" + description: 'Positive exit of action even when there are changes: boolean or branchname' exitOnceUploaded: - description: "Exit with 0 once the built version has been sent to chromatic: boolean or branchname" + description: 'Exit with 0 once the built version has been sent to chromatic: boolean or branchname' ignoreLastBuildOnBranch: - description: "Do not use the last build on this branch as a baseline if it is no longer in history (i.e. branch was rebased)" + description: 'Do not use the last build on this branch as a baseline if it is no longer in history (i.e. branch was rebased)' + +outputs: + url: + description: An alias for the build URL (e.g. https://www.chromatic.com/build?appId=&number=) + buildUrl: + description: The build URL (e.g. https://www.chromatic.com/build?appId=&number=) + storybookUrl: + description: The Storybook preview URL for your current branch / Pull Request (e.g. https://-.chromatic.com/) + code: + description: The exit code for the current run of the Chromatic CLI runs: main: action/register.js From b4192dcaedf1798de1802c937c5dd26258235230 Mon Sep 17 00:00:00 2001 From: Machiste Quintana Date: Thu, 4 Mar 2021 00:03:16 -0500 Subject: [PATCH 09/22] Add missing `required` field from GitHub Action schema --- action.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/action.yml b/action.yml index 4454dc913..f555d738d 100755 --- a/action.yml +++ b/action.yml @@ -8,48 +8,70 @@ branding: inputs: token: description: 'Your github token' + required: true projectToken: description: 'Your chromatic project token' + required: true workingDir: description: 'Working directory for the package.json file' + required: false appCode: description: 'Deprecated, please use projectToken instead' + required: false buildScriptName: description: 'The npm script that builds your Storybook [build-storybook]' + required: false scriptName: description: 'The npm script that starts your Storybook [storybook]' + required: false exec: description: 'Alternatively, a full command to run to start your storybook' + required: false skip: description: 'Skip Chromatic tests, but mark the commit as passing' + required: false doNotStart: description: 'Do not attempt to start or build; use if your Storybook is already running' + required: false storybookBuildDir: description: 'Provide a directory with your built storybook; use if you have already built your storybook' + required: false storybookCa: description: 'Use if Storybook is running on https (auto detected from -s, if set)' + required: false storybookCert: description: 'Use if Storybook is running on https (auto detected from -s, if set)' + required: false storybookHttps: description: 'Use if Storybook is running on https (auto detected from -s, if set)' + required: false storybookKey: description: 'Use if Storybook is running on https (auto detected from -s, if set)' + required: false storybookPort: description: 'What port is your Storybook running on (auto detected from -s, if set)' + required: false storybookUrl: description: 'Storybook is already running at (external) url (implies -S)' + required: false preserveMissing: description: 'Pass the baselines forward and treat all missing stories as “preserved” without re-capturing them' + required: false autoAcceptChanges: description: 'Automatically accept all changes in chromatic: boolean or branchname' + required: false allowConsoleErrors: description: 'Do not exit when runtime errors occur in storybook' + required: false exitZeroOnChanges: description: 'Positive exit of action even when there are changes: boolean or branchname' + required: false exitOnceUploaded: description: 'Exit with 0 once the built version has been sent to chromatic: boolean or branchname' + required: false ignoreLastBuildOnBranch: description: 'Do not use the last build on this branch as a baseline if it is no longer in history (i.e. branch was rebased)' + required: false outputs: url: From eccc9460c05c5424a8c9ff613bf36a6a613664d3 Mon Sep 17 00:00:00 2001 From: Machiste Quintana Date: Thu, 4 Mar 2021 00:10:11 -0500 Subject: [PATCH 10/22] Document action outputs in Readme --- action/README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/action/README.md b/action/README.md index d1f70470f..fe8bcc32b 100755 --- a/action/README.md +++ b/action/README.md @@ -68,6 +68,15 @@ We suggest you use a secret to hide the project token: You can to configure secrets in the repository settings (`///settings/secrets`). However if you need to be able to run this action on pull requests from forks, because those can't access your secret. +### Outputs + +| Name | Type | Description | +| --- | --- | --- | +| `url` | string | An alias for the build URL (e.g. `https://www.chromatic.com/build?appId=&number=)` | +| `buildUrl` | string | The build URL (e.g. `https://www.chromatic.com/build?appId=&number=`) | +| `storybookUrl` | string | The Storybook preview URL for your current branch / Pull Request (e.g. `https://-.chromatic.com/`) | +| `code` | string | The exit code for the current run of the Chromatic CLI | + ## Checkout depth Version 2 of the `actions/checkout` action will only checkout a single commit without history by default. Chromatic needs the full git history in order to track changes over time. Set `fetch-depth: 0` to enable this. See [actions/checkout](https://github.com/actions/checkout#readme) for details. From 3bfa34dd2217b1c25f6a56ae53748f91c07ccabf Mon Sep 17 00:00:00 2001 From: Machiste Quintana Date: Thu, 4 Mar 2021 00:14:21 -0500 Subject: [PATCH 11/22] Beautify this table real quick --- action/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/action/README.md b/action/README.md index fe8bcc32b..04a03fc73 100755 --- a/action/README.md +++ b/action/README.md @@ -70,12 +70,12 @@ You can to configure secrets in the repository settings (`/// ### Outputs -| Name | Type | Description | -| --- | --- | --- | -| `url` | string | An alias for the build URL (e.g. `https://www.chromatic.com/build?appId=&number=)` | -| `buildUrl` | string | The build URL (e.g. `https://www.chromatic.com/build?appId=&number=`) | +| Name | Type | Description | +| -------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------- | +| `url` | string | An alias for the build URL (e.g. `https://www.chromatic.com/build?appId=&number=)` | +| `buildUrl` | string | The build URL (e.g. `https://www.chromatic.com/build?appId=&number=`) | | `storybookUrl` | string | The Storybook preview URL for your current branch / Pull Request (e.g. `https://-.chromatic.com/`) | -| `code` | string | The exit code for the current run of the Chromatic CLI | +| `code` | string | The exit code for the current run of the Chromatic CLI | ## Checkout depth From 392d33322b54ea9a541f2f8d6bce68250de4c8e9 Mon Sep 17 00:00:00 2001 From: Machiste Quintana Date: Thu, 4 Mar 2021 08:56:10 -0500 Subject: [PATCH 12/22] Fix quotes on output descriptions in action.yml --- action.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/action.yml b/action.yml index f555d738d..810d307c3 100755 --- a/action.yml +++ b/action.yml @@ -75,13 +75,13 @@ inputs: outputs: url: - description: An alias for the build URL (e.g. https://www.chromatic.com/build?appId=&number=) + description: 'An alias for the build URL (e.g. https://www.chromatic.com/build?appId=&number=)' buildUrl: - description: The build URL (e.g. https://www.chromatic.com/build?appId=&number=) + description: 'The build URL (e.g. https://www.chromatic.com/build?appId=&number=)' storybookUrl: - description: The Storybook preview URL for your current branch / Pull Request (e.g. https://-.chromatic.com/) + description: 'The Storybook preview URL for your current branch / Pull Request (e.g. https://-.chromatic.com/)' code: - description: The exit code for the current run of the Chromatic CLI + description: 'The exit code for the current run of the Chromatic CLI' runs: main: action/register.js From 44aa1f273d07d7c2f0e24e5246e9cef81169867a Mon Sep 17 00:00:00 2001 From: Gert Hengeveld Date: Tue, 9 Mar 2021 16:09:25 +0100 Subject: [PATCH 13/22] Strip off origin/* prefix --- bin/git/getCommitAndBranch.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bin/git/getCommitAndBranch.js b/bin/git/getCommitAndBranch.js index 8862680e1..0a54ddbe3 100644 --- a/bin/git/getCommitAndBranch.js +++ b/bin/git/getCommitAndBranch.js @@ -85,6 +85,9 @@ export async function getCommitAndBranch({ branchName, patchBaseRef, ci, log } = !!process.env.REPOSITORY_URL || // https://www.netlify.com/docs/continuous-deployment/ !!process.env.GITHUB_REPOSITORY; + // Strip off any `origin/` prefix that's added sometimes. + if (!branchName && !isFromEnvVariable) branch = branch.replace(/^origin\//, ''); + log.debug( `git info: ${JSON.stringify({ commit, From dd7ab5da4649b7fb8dade0e2f464543a454f0ac0 Mon Sep 17 00:00:00 2001 From: Gert Hengeveld Date: Tue, 9 Mar 2021 16:22:45 +0100 Subject: [PATCH 14/22] Warn when origin prefix is stripped --- bin/git/getCommitAndBranch.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/git/getCommitAndBranch.js b/bin/git/getCommitAndBranch.js index 0a54ddbe3..55b64afd0 100644 --- a/bin/git/getCommitAndBranch.js +++ b/bin/git/getCommitAndBranch.js @@ -6,6 +6,7 @@ import missingTravisInfo from '../ui/messages/errors/missingTravisInfo'; import travisInternalBuild from '../ui/messages/warnings/travisInternalBuild'; import { getBranch, getCommit, hasPreviousCommit } from './git'; +const ORIGIN_PREFIX_REGEXP = /^origin\//; const notHead = (branch) => (branch && branch !== 'HEAD' ? branch : false); export async function getCommitAndBranch({ branchName, patchBaseRef, ci, log } = {}) { @@ -86,7 +87,10 @@ export async function getCommitAndBranch({ branchName, patchBaseRef, ci, log } = !!process.env.GITHUB_REPOSITORY; // Strip off any `origin/` prefix that's added sometimes. - if (!branchName && !isFromEnvVariable) branch = branch.replace(/^origin\//, ''); + if (!branchName && !isFromEnvVariable && ORIGIN_PREFIX_REGEXP.test(branch)) { + log.warn(`Ignoring 'origin/' prefix in branch name.`); + branch = branch.replace(ORIGIN_PREFIX_REGEXP, ''); + } log.debug( `git info: ${JSON.stringify({ From bc321ec567c1ef58ac54aa585d71c971c028482b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 9 Mar 2021 16:05:29 +0000 Subject: [PATCH 15/22] Bump elliptic from 6.5.3 to 6.5.4 Bumps [elliptic](https://github.com/indutny/elliptic) from 6.5.3 to 6.5.4. - [Release notes](https://github.com/indutny/elliptic/releases) - [Commits](https://github.com/indutny/elliptic/compare/v6.5.3...v6.5.4) Signed-off-by: dependabot[bot] --- yarn.lock | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/yarn.lock b/yarn.lock index 974f1d64f..1b348970a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4127,10 +4127,10 @@ bluebird@^3.3.5, bluebird@^3.5.5: resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== -bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.4.0: - version "4.11.9" - resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.9.tgz#26d556829458f9d1e81fc48952493d0ba3507828" - integrity sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw== +bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.11.9: + version "4.12.0" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88" + integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA== bn.js@^5.0.0, bn.js@^5.1.1: version "5.1.3" @@ -4203,7 +4203,7 @@ braces@^3.0.1, braces@~3.0.2: dependencies: fill-range "^7.0.1" -brorand@^1.0.1: +brorand@^1.0.1, brorand@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" integrity sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8= @@ -5618,17 +5618,17 @@ element-resize-detector@^1.2.1: batch-processor "1.0.0" elliptic@^6.5.3: - version "6.5.3" - resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.3.tgz#cb59eb2efdaf73a0bd78ccd7015a62ad6e0f93d6" - integrity sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw== + version "6.5.4" + resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.4.tgz#da37cebd31e79a1367e941b592ed1fbebd58abbb" + integrity sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ== dependencies: - bn.js "^4.4.0" - brorand "^1.0.1" + bn.js "^4.11.9" + brorand "^1.1.0" hash.js "^1.0.0" - hmac-drbg "^1.0.0" - inherits "^2.0.1" - minimalistic-assert "^1.0.0" - minimalistic-crypto-utils "^1.0.0" + hmac-drbg "^1.0.1" + inherits "^2.0.4" + minimalistic-assert "^1.0.1" + minimalistic-crypto-utils "^1.0.1" emittery@^0.7.1: version "0.7.2" @@ -7128,7 +7128,7 @@ highlight.js@^10.1.1, highlight.js@~10.4.0: resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-10.4.1.tgz#d48fbcf4a9971c4361b3f95f302747afe19dbad0" integrity sha512-yR5lWvNz7c85OhVAEAeFhVCc/GV4C30Fjzc/rCP0aCWzc1UUOPUk55dK/qdwTZHBvMZo+eZ2jpk62ndX/xMFlg== -hmac-drbg@^1.0.0: +hmac-drbg@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" integrity sha1-0nRXAQJabHdabFRXk+1QL8DGSaE= @@ -9119,7 +9119,7 @@ minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" integrity sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A== -minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1: +minimalistic-crypto-utils@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" integrity sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo= From f71c06b6a72ba0d37349d7fe866f01b4c20d5554 Mon Sep 17 00:00:00 2001 From: Gert Hengeveld Date: Thu, 11 Mar 2021 11:56:35 +0100 Subject: [PATCH 16/22] Update compiled action --- action/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action/main.js b/action/main.js index f32a17198..7772a9479 100644 --- a/action/main.js +++ b/action/main.js @@ -128,7 +128,7 @@ function runChromatic(options) { url: (_a = ctx.build) === null || _a === void 0 ? void 0 : _a.webUrl, code: ctx.exitCode, buildUrl: (_b = ctx.build) === null || _b === void 0 ? void 0 : _b.webUrl, - storybookUrl: (_c = ctx.build) === null || _c === void 0 ? void 0 : _c.isolatorUrl + storybookUrl: (_c = ctx.build) === null || _c === void 0 ? void 0 : _c.cachedUrl }]; } }); From 1de55dde19056fb2b113e0ca4d96098b4afabec6 Mon Sep 17 00:00:00 2001 From: Tom Coleman Date: Thu, 11 Mar 2021 22:22:30 +1100 Subject: [PATCH 17/22] The tunnel is still hosted at chromaticqa.com --- bin/lib/getEnv.js | 2 +- bin/tasks/tunnel.test.js | 8 ++++---- bin/tasks/verify.test.js | 2 +- bin/ui/tasks/tunnel.stories.js | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/bin/lib/getEnv.js b/bin/lib/getEnv.js index 83891a7eb..3c1fa9a00 100644 --- a/bin/lib/getEnv.js +++ b/bin/lib/getEnv.js @@ -2,7 +2,7 @@ const { CHROMATIC_SERVER_PORT = 3004, CHROMATIC_INDEX_URL = 'https://index.chromatic.com', - CHROMATIC_TUNNEL_URL = 'https://tunnel.chromatic.com', + CHROMATIC_TUNNEL_URL = 'https://tunnel.chromaticqa.com', CHROMATIC_CREATE_TUNNEL = 'true', CHROMATIC_RETRIES = 5, CHROMATIC_POLL_INTERVAL = 1000, diff --git a/bin/tasks/tunnel.test.js b/bin/tasks/tunnel.test.js index c64480980..4caece30e 100644 --- a/bin/tasks/tunnel.test.js +++ b/bin/tasks/tunnel.test.js @@ -10,19 +10,19 @@ const log = { debug: jest.fn() }; describe('createTunnel', () => { it('opens the tunnel and sets the isolatorUrl on context', async () => { - openTunnel.mockReturnValue({ url: 'https://tunnel.chromatic.com' }); + openTunnel.mockReturnValue({ url: 'https://tunnel.chromaticqa.com' }); const ctx = { log, isolatorUrl: 'http://localhost:9001', options: {} }; await createTunnel(ctx); expect(openTunnel).toHaveBeenCalledWith({ log, port: '9001', https: undefined }); - expect(ctx.isolatorUrl).toBe('https://tunnel.chromatic.com/'); + expect(ctx.isolatorUrl).toBe('https://tunnel.chromaticqa.com/'); }); }); describe('testConnection', () => { it('tries to fetch the isolatorUrl', async () => { - testConnection({ isolatorUrl: 'https://tunnel.chromatic.com' }); - expect(fetch).toHaveBeenCalledWith('https://tunnel.chromatic.com'); + testConnection({ isolatorUrl: 'https://tunnel.chromaticqa.com' }); + expect(fetch).toHaveBeenCalledWith('https://tunnel.chromaticqa.com'); }); }); diff --git a/bin/tasks/verify.test.js b/bin/tasks/verify.test.js index 7390b6120..f14ba80b3 100644 --- a/bin/tasks/verify.test.js +++ b/bin/tasks/verify.test.js @@ -28,7 +28,7 @@ describe('createBuild', () => { git: { version: 'whatever', matchesBranch: () => false }, pkg: { version: '1.0.0' }, storybook: { version: '2.0.0', viewLayer: 'react', addons: [] }, - isolatorUrl: 'https://tunnel.chromatic.com/', + isolatorUrl: 'https://tunnel.chromaticqa.com/', }; it('creates a build on the index and puts it on context', async () => { diff --git a/bin/ui/tasks/tunnel.stories.js b/bin/ui/tasks/tunnel.stories.js index fd3794bb2..66b5d6532 100644 --- a/bin/ui/tasks/tunnel.stories.js +++ b/bin/ui/tasks/tunnel.stories.js @@ -6,7 +6,7 @@ export default { decorators: [(storyFn) => task(storyFn())], }; -const CHROMATIC_TUNNEL_URL = 'https://tunnel.chromatic.com'; +const CHROMATIC_TUNNEL_URL = 'https://tunnel.chromaticqa.com'; const cachedUrl = 'https://fdeulpymiq.tunnel.chromatic.com/iframe.html'; export const Initial = () => initial; From 0bce217583e32524776f7672d92f597ed15ac93d Mon Sep 17 00:00:00 2001 From: Tom Coleman Date: Thu, 11 Mar 2021 22:25:09 +1100 Subject: [PATCH 18/22] Couple more --- bin/ui/messages/errors/fatalError.stories.js | 2 +- bin/ui/tasks/tunnel.stories.js | 2 +- stories/timing.stories-disabled.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/ui/messages/errors/fatalError.stories.js b/bin/ui/messages/errors/fatalError.stories.js index 5569d39f9..9530f48fb 100644 --- a/bin/ui/messages/errors/fatalError.stories.js +++ b/bin/ui/messages/errors/fatalError.stories.js @@ -36,7 +36,7 @@ const context = { number: 1400, webUrl: 'https://www.chromatic.com/build?appId=5d67dc0374b2e300209c41e7&number=1400', }, - isolatorUrl: 'https://pfkaemtlit.tunnel.chromatic.com/iframe.html', + isolatorUrl: 'https://pfkaemtlit.tunnel.chromaticqa.com/iframe.html', cachedUrl: 'https://5d67dc0374b2e300209c41e7-pfkaemtlit.chromatic.com/iframe.html', }; diff --git a/bin/ui/tasks/tunnel.stories.js b/bin/ui/tasks/tunnel.stories.js index 66b5d6532..1b770e907 100644 --- a/bin/ui/tasks/tunnel.stories.js +++ b/bin/ui/tasks/tunnel.stories.js @@ -7,7 +7,7 @@ export default { }; const CHROMATIC_TUNNEL_URL = 'https://tunnel.chromaticqa.com'; -const cachedUrl = 'https://fdeulpymiq.tunnel.chromatic.com/iframe.html'; +const cachedUrl = 'https://fdeulpymiq.tunnel.chromaticqa.com/iframe.html'; export const Initial = () => initial; diff --git a/stories/timing.stories-disabled.js b/stories/timing.stories-disabled.js index 0cac2c528..3fd9f89bf 100644 --- a/stories/timing.stories-disabled.js +++ b/stories/timing.stories-disabled.js @@ -6,7 +6,7 @@ import React, { useState } from 'react'; // Some stories to test out timing code. Disabled by default // These stories are available at (e.g.) -// http://vmdbnybkvx.tunnel.staging-chromatic.com/iframe.html?id=timing--5s +// http://vmdbnybkvx.staging-tunnel.chromaticqa.com/iframe.html?id=timing--5s // A component that guarantees the load event won't load for timeout seconds // Note that the img loading tends to take a litle longer so this is a minimum From 147a2e01ccddfed96a43aeaa9e95c8a4035b3563 Mon Sep 17 00:00:00 2001 From: Gert Hengeveld Date: Thu, 11 Mar 2021 13:32:02 +0100 Subject: [PATCH 19/22] Adopt prerelease scheme from 'auto' --- README.md | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 76820550b..92b936167 100644 --- a/README.md +++ b/README.md @@ -42,32 +42,36 @@ Before publishing, make sure you've done the following: - Committed and pushed everything - Decide on the proper semver bump (major/minor/patch) -#### Doing a `dev` or `rc` release +#### Doing a `canary` or `next` release -We have two types of pre-releases: `dev` and `rc`. `dev` releases are intended for development purposes and should not be used in production, as they may only work against a staging or dev environment. `rc` releases should be valid, working releases that can potentially be used by early adopters of new features, for example to handle a support request. +We have two types of pre-releases: `canary` and `next`. `canary` releases are intended for development purposes and should not be used in production, as they may only work against a staging or dev environment. `next` releases should be valid, working releases that can potentially be used by early adopters of new features, for example to handle a support request. -For the first `dev` (or `rc`) release, bump the version like so (depending on the semver bump): +> Users should *not* use tags in their package.json (e.g. `chromatic@next`), but rather specific version numbers (e.g. `chromatic@5.6.2-next.0`). Otherwise they'll end up with a broken build when we remove or update the tag. + +For the first `canary` (or `next`) release, bump the version like so (depending on the semver bump): ```sh -npm version --preid dev +npm version --preid canary ``` -For consecutive `dev` releases on the same version: +For consecutive `canary` releases on the same version: ```sh -npm version prerelease --preid=dev +npm version prerelease --preid=canary ``` Then push and publish: ```sh git push --follow-tags -npm publish --tag dev +npm publish --tag canary ``` -Make sure to replace `dev` with `rc` if appropriate. +Make sure to replace `canary` with `next` if appropriate. + +#### Doing a `latest` release -#### Doing a final release +A final release is automatically tagged `latest` by npm. ```sh npm version @@ -76,8 +80,10 @@ npm publish yarn publish-action ``` -And finally, remove the `dev` and/or `rc` tag, if any: +And finally, remove the `canary` and/or `next` tag, if any: ``` -npm dist-tag rm chromatic dev +npm dist-tag rm chromatic canary ``` + +This ensures we can safely do a new `canary` or `next` release later, without anyone getting an unexpected update. From abb85910e781405c7229ef63f25e362bfd2f8343 Mon Sep 17 00:00:00 2001 From: Gert Hengeveld Date: Thu, 11 Mar 2021 13:34:57 +0100 Subject: [PATCH 20/22] Update tag warning --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 92b936167..0f1080869 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ Before publishing, make sure you've done the following: We have two types of pre-releases: `canary` and `next`. `canary` releases are intended for development purposes and should not be used in production, as they may only work against a staging or dev environment. `next` releases should be valid, working releases that can potentially be used by early adopters of new features, for example to handle a support request. -> Users should *not* use tags in their package.json (e.g. `chromatic@next`), but rather specific version numbers (e.g. `chromatic@5.6.2-next.0`). Otherwise they'll end up with a broken build when we remove or update the tag. +> As a consumer, **you should not specify a tag** (e.g. `chromatic@next`) in your package dependencies, but rather a specific version number (e.g. `chromatic@5.6.2-next.0`). Otherwise you'll end up with a broken build when we remove or update the tag. For the first `canary` (or `next`) release, bump the version like so (depending on the semver bump): From e549ff3f15f13f8e5ec52776a17beae193a406e5 Mon Sep 17 00:00:00 2001 From: Gert Hengeveld Date: Thu, 11 Mar 2021 13:42:16 +0100 Subject: [PATCH 21/22] Slug might be undefined --- bin/tasks/gitInfo.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/tasks/gitInfo.js b/bin/tasks/gitInfo.js index 383fe7918..6d9bfa6cf 100644 --- a/bin/tasks/gitInfo.js +++ b/bin/tasks/gitInfo.js @@ -26,7 +26,7 @@ export const setGitInfo = async (ctx, task) => { ctx.git.slug = await getSlug().catch((e) => ctx.log.warn('Failed to retrieve slug', e)); } - if (ctx.options.ownerName) { + if (ctx.git.slug && ctx.options.ownerName) { ctx.git.slug = ctx.git.slug.replace(/[^/]+/, ctx.options.ownerName); } From 89c8662f81ee4a622558544e6e9e47e27880aa46 Mon Sep 17 00:00:00 2001 From: Gert Hengeveld Date: Thu, 11 Mar 2021 13:44:03 +0100 Subject: [PATCH 22/22] Cleanup mocking --- bin/tasks/gitInfo.test.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bin/tasks/gitInfo.test.js b/bin/tasks/gitInfo.test.js index d1ffc8a6b..59e00f612 100644 --- a/bin/tasks/gitInfo.test.js +++ b/bin/tasks/gitInfo.test.js @@ -9,10 +9,10 @@ const log = { debug: jest.fn() }; describe('setGitInfo', () => { it('sets the git info on context', async () => { - getCommitAndBranch.mockReturnValue(Promise.resolve({ commit: '123asdf', branch: 'something' })); - getBaselineCommits.mockReturnValue(Promise.resolve(['asd2344'])); - getVersion.mockReturnValue(Promise.resolve('Git v1.0.0')); - getSlug.mockReturnValue(Promise.resolve('user/repo')); + getCommitAndBranch.mockResolvedValue({ commit: '123asdf', branch: 'something' }); + getBaselineCommits.mockResolvedValue(['asd2344']); + getVersion.mockResolvedValue('Git v1.0.0'); + getSlug.mockResolvedValue('user/repo'); const ctx = { log, options: {} }; await setGitInfo(ctx, {}); expect(ctx.git).toMatchObject({ @@ -25,10 +25,10 @@ describe('setGitInfo', () => { }); it('supports overriding the owner name in the slug', async () => { - getCommitAndBranch.mockReturnValue(Promise.resolve({ commit: '123asdf', branch: 'something' })); - getBaselineCommits.mockReturnValue(Promise.resolve(['asd2344'])); - getVersion.mockReturnValue(Promise.resolve('Git v1.0.0')); - getSlug.mockReturnValue(Promise.resolve('user/repo')); + getCommitAndBranch.mockResolvedValue({ commit: '123asdf', branch: 'something' }); + getBaselineCommits.mockResolvedValue(['asd2344']); + getVersion.mockResolvedValue('Git v1.0.0'); + getSlug.mockResolvedValue('user/repo'); const ctx = { log, options: { ownerName: 'org' } }; await setGitInfo(ctx, {}); expect(ctx.git).toMatchObject({