Skip to content

Commit

Permalink
move metafiles to code, so nx can cache it properly
Browse files Browse the repository at this point in the history
  • Loading branch information
JReinhold committed Sep 25, 2024
1 parent f02e568 commit 173de14
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ jobs:
yarn local-registry --publish
- report-workflow-on-failure
- store_artifacts:
path: bench/esbuild-metafiles
path: code/bench/esbuild-metafiles
- save_cache:
name: Save Yarn cache
key: build-yarn-2-cache-v4--{{ checksum "code/yarn.lock" }}--{{ checksum "scripts/yarn.lock" }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ test-results
/repros
/sandbox
/bench
/code/bench
.verdaccio-cache
.next
/.npmrc
Expand Down
6 changes: 3 additions & 3 deletions code/.storybook/bench.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import type { Meta } from '@storybook/react';
// @ts-expect-error - TS doesn't know about import.meta.glob from Vite
const allMetafiles = import.meta.glob(
[
'../../bench/esbuild-metafiles/**/*.json',
'../bench/esbuild-metafiles/**/*.json',
// the core metafile is too big to be loaded automatically in the iframe
'!../../bench/esbuild-metafiles/core/core.json',
'!../bench/esbuild-metafiles/core/core.json',
],
{
// eagerly loading is not ideal because it imports all metafiles upfront,
Expand All @@ -17,7 +17,7 @@ const allMetafiles = import.meta.glob(
}
);

const METAFILES_DIR = '../../bench/esbuild-metafiles/';
const METAFILES_DIR = '../bench/esbuild-metafiles/';
const PACKAGES_WITHOUT_ORG = ['storybook', 'sb', 'create-storybook'];

// allows the metafile path to be used in the URL hash
Expand Down
2 changes: 1 addition & 1 deletion code/core/scripts/prep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ async function run() {
});
} else {
// repo root/bench/esbuild-metafiles/core
const metafilesDir = join(__dirname, '..', '..', '..', 'bench', 'esbuild-metafiles', 'core');
const metafilesDir = join(__dirname, '..', '..', 'bench', 'esbuild-metafiles', 'core');
if (existsSync(metafilesDir)) {
await rm(metafilesDir, { recursive: true });
}
Expand Down
2 changes: 1 addition & 1 deletion code/nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"{workspaceRoot}/../scripts/prepare/{bundle,addon-bundle,esm-bundle}.ts"
],
"dependsOn": ["^build"],
"outputs": ["{projectRoot}/dist", "{workspaceRoot}/../bench/esbuild-metafiles/{projectName}"],
"outputs": ["{projectRoot}/dist", "{workspaceRoot}/bench/esbuild-metafiles/{projectName}"],
"cache": true
},
"test": {
Expand Down
1 change: 1 addition & 0 deletions scripts/prepare/addon-bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ const run = async ({ cwd, flags }: { cwd: string; flags: string[] }) => {
__dirname,
'..',
'..',
'code',
'bench',
'esbuild-metafiles',
name.replace('@storybook/', '')
Expand Down
1 change: 1 addition & 0 deletions scripts/prepare/bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const run = async ({ cwd, flags }: { cwd: string; flags: string[] }) => {
__dirname,
'..',
'..',
'code',
'bench',
'esbuild-metafiles',
name.replace('@storybook', '')
Expand Down

0 comments on commit 173de14

Please sign in to comment.