Skip to content

Commit

Permalink
Merge pull request #415 from chromaui/next
Browse files Browse the repository at this point in the history
release 6.0.0
  • Loading branch information
ndelangen authored Sep 30, 2021
2 parents b5d1bfc + c372e18 commit 6fbb083
Show file tree
Hide file tree
Showing 242 changed files with 2,016 additions and 1,579 deletions.
4 changes: 3 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ module.exports = {
'no-use-before-define': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'eslint-comments/disable-enable-pair': 'off',
'import/no-extraneous-dependencies': 'off',
},
parser: '@typescript-eslint/parser',
parserOptions: {
project: ['./tsconfig.eslint.json'],
extraFileExtensions: ['.cjs'],
},
overrides: [
{
files: ['*.json'],
files: ['*.json', 'isChromatic.mjs', 'isChromatic.cjs', '.eslintrc.cjs'],
parser: 'esprima',
rules: {
'@typescript-eslint/naming-convention': 'off',
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/chromatic-workflow_run.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: "Chromatic (workflow_run)"
on:
workflow_run:
workflows:
- "Action"
types:
- completed

jobs:
chromatic:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- run: yarn
- uses: chromaui/action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
projectToken: gcaw1ai2dgo
exitZeroOnChanges: true
exitOnceUploaded: true
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ action/main.js
storybook-static
chromatic-build-*.xml
# the dist folder IS included so we can test every version in the CI without publishing
bin
action
5 changes: 4 additions & 1 deletion .storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
module.exports = {
stories: [
// CLI stories
'../bin/ui/**/*.stories.js',
'../bin-src/ui/**/*.stories.js',
// Test stories
'../**/stories/*.stories.js',
],
features: {
postcss: false,
},
};
25 changes: 13 additions & 12 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-env browser */
import { addDecorator, addParameters } from '@storybook/react';
import ansiHTML from 'ansi-html';
import chalk from 'chalk';
import React from 'react';
Expand Down Expand Up @@ -29,16 +28,18 @@ const style = {
color: '#c0c4cd',
};

addParameters({
export const parameters = {
layout: 'fullscreen',
});
};

addDecorator((storyFn, { kind }) => {
if (kind.startsWith('CLI/')) {
document.body.style.backgroundColor = '#16242c';
// eslint-disable-next-line react/no-danger
return <code style={style} dangerouslySetInnerHTML={{ __html: ansiHTML(storyFn()) }} />;
}
document.body.style.backgroundColor = 'paleturquoise';
return storyFn();
});
export const decorators = [
(storyFn, { kind }) => {
if (kind.startsWith('CLI/')) {
document.body.style.backgroundColor = '#16242c';
// eslint-disable-next-line react/no-danger
return <code style={style} dangerouslySetInnerHTML={{ __html: ansiHTML(storyFn()) }} />;
}
document.body.style.backgroundColor = 'paleturquoise';
return storyFn();
},
];
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# 6.0.0 - unreleased

- [393](https://github.com/chromaui/chromatic-cli/pull/393) Bundle the bin & action so it's dependency-less
- [393](https://github.com/chromaui/chromatic-cli/pull/393) Add support for `workflow_run` event

Remove the deprecated storybook addon
Change the `isChromatic` to the main export of the package

before:
```js
import isChromatic from 'chromatic/isChromatic';
```

after:
```js
import isChromatic from 'chromatic';
```
# 5.10.1 - 2021-09-21

- [404](https://github.com/chromaui/chromatic-cli/pull/404) Fix the version of node-fetch to `2.6.0` due to a bug in `2.6.3`
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
26 changes: 20 additions & 6 deletions action/main.ts → action-src/main.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { error, getInput, setFailed, setOutput } from '@actions/core';
import { error, getInput, setFailed, setOutput, info } from '@actions/core';
import { context } from '@actions/github';
import { readFile } from 'jsonfile';
import pkgUp from 'pkg-up';
import { v4 as uuid } from 'uuid';
import path from 'path';

import getEnv from '../bin/lib/getEnv';
import { createLogger } from '../bin/lib/log';
import parseArgs from '../bin/lib/parseArgs';
import { runAll } from '../bin/main';
import getEnv from '../bin-src/lib/getEnv';
import { createLogger } from '../bin-src/lib/log';
import parseArgs from '../bin-src/lib/parseArgs';
import { runAll } from '../bin-src/main';

const maybe = (a: string, b: any = undefined) => {
if (!a) {
Expand Down Expand Up @@ -42,6 +42,17 @@ const getBuildInfo = (event: typeof context) => {
slug: repository.full_name,
};
}
case 'workflow_run': {
const { repository } = event.payload;
// eslint-disable-next-line @typescript-eslint/naming-convention
const { head_sha, head_branch } = event.payload.workflow_run;

return {
sha: head_sha,
branch: head_branch.replace('refs/heads/', ''),
slug: repository.full_name,
};
}
case 'workflow_dispatch': {
const { ref, sha } = event.payload.inputs;

Expand Down Expand Up @@ -186,4 +197,7 @@ async function run() {
process.exit(1);
}
}
run();
run().catch((e) => {
error(e);
setFailed(e.message);
});
6 changes: 6 additions & 0 deletions action-src/register.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const Observable = require('zen-observable');

global.Observable = Observable;
require('any-observable/register')('global.Observable');

require('./main');
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,5 @@ outputs:
description: 'The exit code for the current run of the Chromatic CLI'

runs:
main: action/register.js
main: action/main.js
using: node12
Loading

0 comments on commit 6fbb083

Please sign in to comment.