chore: replace isChromatic with isPixel (#26832)
Swaps `chromatic/isChromatic` for `@coder/pixel-storybook`'s `isPixel()` so the snapshot-determinism gates (fixed workspace name, frozen Spinner, fixed CLI origin, no scroll, font loader) fire under pixel instead of Chromatic. Drops the now-unused `chromatic` dependency. Stacked on #27658 (pixel-storybook 0.3); `isPixel` comes from the new `@coder/pixel-storybook/storyapi` subpath. Verified the app and Storybook builds both bundle `isPixel` cleanly, and `tsc` passes with the dependency removed. This is the last piece of the Chromatic removal; the story params migrated in #26844 and the addon came out in #27353. <details> <summary>Chromatic removal sequence</summary> 1. Remove the Chromatic CI job + scripts + docs reference. (#26777, merged) 2. **This PR** — `isChromatic()` → `isPixel()`; drop the `chromatic` dependency. 3. `data-pixel` + `pixel.exclude`; drop `delay` / `pauseAnimationAtEnd`. (#26778, merged) 4. Migrate story snapshot params (`viewports` / `diffThreshold` / theme modes → `pixel.matrix`); delete `testHelpers/chromatic.ts`. (#26844, merged) 5. Remove the `@chromatic-com/storybook` addon. (done on main in #27353) </details> --- > Generated by Coder Agents on behalf of @aslilac.
This commit is contained in:
1 parent
95275d9659
commit
6cfefc0685
8 files changed
+9
-38
No files matched your search
@@ -23,7 +23,6 @@
|
||||
"ignoreBinaries": ["make", "protoc"],
|
||||
"ignoreDependencies": [
|
||||
"@babel/plugin-syntax-typescript",
|
||||
"@coder/pixel-storybook",
|
||||
"@types/react-virtualized-auto-sizer",
|
||||
"ts-proto"
|
||||
]
|
||||
|
||||
@@ -7,8 +7,7 @@ import {
|
||||
StyledEngineProvider,
|
||||
} from "@mui/material/styles";
|
||||
import { DecoratorHelpers } from "@storybook/addon-themes";
|
||||
import type { Decorator, Loader, Parameters } from "@storybook/react-vite";
|
||||
import isChromatic from "chromatic/isChromatic";
|
||||
import type { Decorator, Parameters } from "@storybook/react-vite";
|
||||
import { StrictMode } from "react";
|
||||
import { QueryClient, QueryClientProvider } from "react-query";
|
||||
import { withRouter } from "storybook-addon-remix-react-router";
|
||||
@@ -132,12 +131,3 @@ const withTheme: Decorator = (Story, context) => {
|
||||
};
|
||||
|
||||
export const decorators: Decorator[] = [withRouter, withQuery, withTheme];
|
||||
|
||||
// Try to fix storybook rendering fonts inconsistently
|
||||
// https://www.chromatic.com/docs/font-loading/#solution-c-check-fonts-have-loaded-in-a-loader
|
||||
const fontLoader = async () => ({
|
||||
fonts: await document.fonts.ready,
|
||||
});
|
||||
|
||||
export const loaders: Loader[] =
|
||||
isChromatic() && document.fonts ? [fontLoader] : [];
|
||||
@@ -161,7 +161,6 @@
|
||||
"@vitest/browser-playwright": "4.1.7",
|
||||
"autoprefixer": "10.5.0",
|
||||
"babel-plugin-react-compiler": "1.0.0",
|
||||
"chromatic": "11.29.0",
|
||||
"dpdm": "3.15.1",
|
||||
"express": "4.21.2",
|
||||
"jest-canvas-mock": "2.5.2",
|
||||
|
||||
Generated
-17
@@ -399,9 +399,6 @@ importers:
|
||||
babel-plugin-react-compiler:
|
||||
specifier: 1.0.0
|
||||
version: 1.0.0
|
||||
chromatic:
|
||||
specifier: 11.29.0
|
||||
version: 11.29.0
|
||||
dpdm:
|
||||
specifier: 3.15.1
|
||||
version: 3.15.1
|
||||
@@ -3313,18 +3310,6 @@ packages:
|
||||
chroma-js@2.6.0:
|
||||
resolution: {integrity: sha512-BLHvCB9s8Z1EV4ethr6xnkl/P2YRFOGqfgvuMG/MyCbZPrTA+NeiByY6XvgF0zP4/2deU2CXnWyMa3zu1LqQ3A==, tarball: https://registry.npmjs.org/chroma-js/-/chroma-js-2.6.0.tgz}
|
||||
|
||||
chromatic@11.29.0:
|
||||
resolution: {integrity: sha512-yisBlntp9hHVj19lIQdpTlcYIXuU9H/DbFuu6tyWHmj6hWT2EtukCCcxYXL78XdQt1vm2GfIrtgtKpj/Rzmo4A==, tarball: https://registry.npmjs.org/chromatic/-/chromatic-11.29.0.tgz}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
'@chromatic-com/cypress': ^0.*.* || ^1.0.0
|
||||
'@chromatic-com/playwright': ^0.*.* || ^1.0.0
|
||||
peerDependenciesMeta:
|
||||
'@chromatic-com/cypress':
|
||||
optional: true
|
||||
'@chromatic-com/playwright':
|
||||
optional: true
|
||||
|
||||
class-variance-authority@0.7.1:
|
||||
resolution: {integrity: sha512-Ka+9Trutv7G8M6WT6SeiRWz792K5qEqIGEGzXKhAE6xOWAY6pPH8U+9IY3oCMv6kqTmLsv7Xh/2w2RigkePMsg==, tarball: https://registry.npmjs.org/class-variance-authority/-/class-variance-authority-0.7.1.tgz}
|
||||
|
||||
@@ -9518,8 +9503,6 @@ snapshots:
|
||||
|
||||
chroma-js@2.6.0: {}
|
||||
|
||||
chromatic@11.29.0: {}
|
||||
|
||||
class-variance-authority@0.7.1:
|
||||
dependencies:
|
||||
clsx: 2.1.1
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* https://v0.dev/ help.
|
||||
*/
|
||||
|
||||
import isChromatic from "chromatic/isChromatic";
|
||||
import { isPixel } from "@coder/pixel-storybook/storyapi";
|
||||
import { cva, type VariantProps } from "class-variance-authority";
|
||||
import type { ReactNode } from "react";
|
||||
import { cn } from "#/utils/cn";
|
||||
@@ -59,7 +59,7 @@ export function Spinner({
|
||||
rx="1"
|
||||
// 0.8 = leaves * 0.1
|
||||
className={
|
||||
isChromatic() ? "" : "animate-[loading_0.8s_ease-in-out_infinite]"
|
||||
isPixel() ? "" : "animate-[loading_0.8s_ease-in-out_infinite]"
|
||||
}
|
||||
style={{
|
||||
transform: `rotate(${leaf * (360 / leaves.length)}deg)`,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import isChromatic from "chromatic/isChromatic";
|
||||
import { isPixel } from "@coder/pixel-storybook/storyapi";
|
||||
import {
|
||||
animals,
|
||||
colors,
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
} from "unique-names-generator";
|
||||
|
||||
export const generateWorkspaceName = () => {
|
||||
if (isChromatic()) {
|
||||
if (isPixel()) {
|
||||
return "yellow-bird-23";
|
||||
}
|
||||
const numberDictionary = NumberDictionary.generate({ min: 0, max: 99 });
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import isChromatic from "chromatic/isChromatic";
|
||||
import { isPixel } from "@coder/pixel-storybook/storyapi";
|
||||
import type { FC } from "react";
|
||||
import { pageTitle } from "#/utils/page";
|
||||
import { CliInstallPageView } from "./CliInstallPageView";
|
||||
|
||||
const CliInstallPage: FC = () => {
|
||||
const origin = isChromatic() ? "https://example.com" : location.origin;
|
||||
const origin = isPixel() ? "https://example.com" : location.origin;
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import isChromatic from "chromatic/isChromatic";
|
||||
import { isPixel } from "@coder/pixel-storybook/storyapi";
|
||||
import {
|
||||
ArrowLeftIcon,
|
||||
PauseIcon,
|
||||
@@ -487,7 +487,7 @@ const TaskLogPreview: FC<TaskLogPreviewProps> = ({
|
||||
}) => {
|
||||
// Scroll to the bottom on mount since snapshot logs are static.
|
||||
const scrollToBottom = useCallback((el: HTMLDivElement | null) => {
|
||||
if (!isChromatic() && el) {
|
||||
if (!isPixel() && el) {
|
||||
el.scrollIntoView({ block: "end" });
|
||||
}
|
||||
}, []);
|
||||
|
||||
Reference in new issue
Block a user