Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,554,411
Community Members
 
Community Events
184
Community Groups

How to configure Publish to Chromatic

Hi, I am trying to publish to chromatic and have added the configs to my bitbucket pipeline but I am getting the following error...

 

yarn run v1.22.5

error Couldn't find a package.json file in "/opt/atlassian/pipelines/agent/build"

info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.


My pipeline is below, I have removed the token for the purpose of posting this question.  Any advise is welcome.

  # 👇 Adds Chromatic as a step
- step:
name: 'Publish to Chromatic'
caches:
- node
script:
- yarn install
# 👇 Runs Chromatic
- yarn chromatic --project-token=XXX

 

2 answers

I encountered this error as well trying to Publish to Chromatic from BitBucket. Reviewing the tutorial I was following it looks like I needed to perform the below steps:

 

  1. Verify chromatic is installed for the project.
    npm install --save-dev chromatic
  2. Create a Chromatic account (chromatic.com). You can use your BitBucket account.
  3. In Chromatic, connect your BitBucket application/repo to your Chromatic project, e.g., select the BitBucket repo you are working on.
  4. Copy the `project-token` that Chromatic generated and execute it in the terminal.
    yarn chromatic --project-token=<project-token>
  5. Navigate to the resulting URL once the build passes:
    PassedURL.png
  6. You should see a message stating "Nice. You published a Storybook."
    Build1.png
0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Oct 05, 2022

Hi @Shawn Williams and welcome to the community!

I am not familiar with Chromatic, but based on the output you posted here the command is failing because there is no package.json file in the clone directory where the build is running.

Just to give you some context: for every step in your bitbucket-pipelines.yml file, a Docker container starts, your repo is cloned in the directory /opt/atlassian/pipelines/agent/build, then the commands of that step's script are executed, and afterwards the container gets destroyed.

If Chromatic needs a package.json file, you can create this in your repository so that it will be available during the Pipelines builds. I would suggest checking the documentation of the package to see what needs to be configured in the package.json file:

https://classic.yarnpkg.com/en/docs/cli/run
https://yarnpkg.com/package/chromatic
https://www.chromatic.com/docs/cli

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events