Skip to content

Commit

Permalink
Merge pull request #24850 from storybookjs/valentin/fix-ci-2
Browse files Browse the repository at this point in the history
Build: Fix benchmark command
  • Loading branch information
ndelangen authored Nov 15, 2023
2 parents f18dbe6 + b7e3e37 commit 3ff7b92
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 11 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/generate-sandboxes-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ jobs:
git config --global user.name "Storybook Bot"
git config --global user.email "bot@storybook.js.org"
- name: Install dependencies
run: node ./scripts/check-dependencies.js
run: |
cd ./scripts
node --loader esbuild-register/loader -r esbuild-register ./check-dependencies.ts
cd ..
- name: Compile Storybook libraries
run: yarn task --task compile --start-from=auto --no-link
- name: Publishing to local registry
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/generate-sandboxes-next.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ jobs:
git config --global user.name "Storybook Bot"
git config --global user.email "bot@storybook.js.org"
- name: Install dependencies
run: node ./scripts/check-dependencies.js
run: |
cd ./scripts
node --loader esbuild-register/loader -r esbuild-register ./check-dependencies.ts
cd ..
- name: Compile Storybook libraries
run: yarn task --task compile --start-from=auto --no-link
- name: Publishing to local registry
Expand Down
7 changes: 0 additions & 7 deletions scripts/check-dependencies.cjs

This file was deleted.

7 changes: 7 additions & 0 deletions scripts/check-dependencies.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { checkDependencies } from './utils/cli-utils';

checkDependencies().catch((e) => {
// eslint-disable-next-line no-console
console.error(e);
process.exit(1);
});
9 changes: 7 additions & 2 deletions scripts/tasks/bench.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable import/extensions */
import prettyBytes from 'pretty-bytes';
import prettyTime from 'pretty-ms';

Expand All @@ -19,22 +20,26 @@ export const bench: Task = {
const controllers: AbortController[] = [];
try {
const { disableDocs } = options;
const { browse } = await import('../bench/browse');
const { saveBench, loadBench } = await import('../bench/utils');
// @ts-expect-error Default import required for dynamic import processed by esbuild
const { browse } = (await import('../bench/browse.ts')).default;
// @ts-expect-error Default import required for dynamic import processed by esbuild
const { saveBench, loadBench } = (await import('../bench/utils.ts')).default;

const devController = await dev.run(details, { ...options, debug: false });
if (!devController) {
throw new Error('dev: controller is null');
}
controllers.push(devController);
const devBrowseResult = await browse(`http://localhost:${devPort}`, { disableDocs });

devController.abort();

const serveController = await serve.run(details, { ...options, debug: false });
if (!serveController) {
throw new Error('serve: controller is null');
}
controllers.push(serveController);

const buildBrowseResult = await browse(`http://localhost:${servePort}`, { disableDocs });
serveController.abort();

Expand Down

0 comments on commit 3ff7b92

Please sign in to comment.