Skip to content

Commit

Permalink
Fix build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
shilman committed Aug 22, 2022
1 parent c9cffa0 commit 07f8ad4
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 12 deletions.
14 changes: 7 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ jobs:
# executor:
# class: large
# name: sb_cypress_8_node_14
# parallelism: 2
# parallelism: 8
# steps:
# - git-shallow-clone/checkout_advanced:
# clone_options: '--depth 1 --verbose'
Expand Down Expand Up @@ -462,7 +462,7 @@ jobs:
executor:
class: medium+
name: sb_node_14_browsers
parallelism: 2
parallelism: 8
steps:
- git-shallow-clone/checkout_advanced:
clone_options: '--depth 1 --verbose'
Expand All @@ -482,7 +482,7 @@ jobs:
executor:
class: medium+
name: sb_node_14_browsers
parallelism: 2
parallelism: 8
steps:
- git-shallow-clone/checkout_advanced:
clone_options: '--depth 1 --verbose'
Expand All @@ -498,7 +498,7 @@ jobs:
executor:
class: medium+
name: sb_node_14_browsers
parallelism: 2
parallelism: 8
steps:
- git-shallow-clone/checkout_advanced:
clone_options: '--depth 1 --verbose'
Expand All @@ -518,7 +518,7 @@ jobs:
executor:
class: medium+
name: sb_node_14_browsers
parallelism: 2
parallelism: 8
steps:
- git-shallow-clone/checkout_advanced:
clone_options: '--depth 1 --verbose'
Expand All @@ -534,7 +534,7 @@ jobs:
executor:
class: medium+
name: sb_node_14_browsers
parallelism: 2
parallelism: 8
steps:
- git-shallow-clone/checkout_advanced:
clone_options: '--depth 1 --verbose'
Expand All @@ -549,7 +549,7 @@ jobs:
e2e-sandboxes:
docker:
- image: mcr.microsoft.com/playwright:v1.24.0-focal
parallelism: 2
parallelism: 8
steps:
- git-shallow-clone/checkout_advanced:
clone_options: '--depth 1 --verbose'
Expand Down
6 changes: 6 additions & 0 deletions code/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,11 @@ module.exports = {
'jest/no-test-callback': 'off', // These aren't jest tests
},
},
{
files: ['**/builder-vite/input/iframe.html'],
rules: {
'no-undef': 'off', // ignore "window" undef errors
},
},
],
};
11 changes: 9 additions & 2 deletions code/lib/builder-vite/src/source-loader-plugin.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import type { Plugin } from 'vite';
import sourceLoaderTransform from '@storybook/source-loader';
import type { ExtendedOptions } from './types';
import MagicString from 'magic-string';
import type { ExtendedOptions } from './types';

const storyPattern = /\.stories\.[jt]sx?$/;
const storySourcePattern = /var __STORY__ = "(.*)"/;
const storySourceReplacement = '--STORY_SOURCE_REPLACEMENT--';

const mockClassLoader = (id: string) => ({ emitWarning: (message: string) => console.warn(message), resourcePath: id });
const mockClassLoader = (id: string) => ({
// eslint-disable-next-line no-console
emitWarning: (message: string) => console.warn(message),
resourcePath: id,
});

// HACK: Until we can support only node 15+ and use string.prototype.replaceAll
const replaceAll = (str: string, search: string, replacement: string) => {
Expand All @@ -31,6 +35,7 @@ export function sourceLoaderPlugin(config: ExtendedOptions): Plugin | Plugin[] {
map: s.generateMap({ hires: true, source: id }),
};
}
return undefined;
},
};
}
Expand Down Expand Up @@ -66,6 +71,7 @@ export function sourceLoaderPlugin(config: ExtendedOptions): Plugin | Plugin[] {
map: s.generateMap(),
};
}
return undefined;
},
},
{
Expand All @@ -90,6 +96,7 @@ export function sourceLoaderPlugin(config: ExtendedOptions): Plugin | Plugin[] {
map: s.generateMap(),
};
}
return undefined;
},
},
];
Expand Down
3 changes: 2 additions & 1 deletion code/lib/core-server/src/build-dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export async function buildDevStandalone(options: CLIOptions & LoadOptions & Bui
if (options.smokeTest) {
const warnings: Error[] = [];
warnings.push(...((managerStats && managerStats.toJson().warnings) || []));
warnings.push(...((managerStats && previewStats.toJson().warnings) || []));
warnings.push(...((previewStats && previewStats.toJson().warnings) || []));

const problems = warnings
.filter((warning) => !warning.message.includes(`export 'useInsertionEffect'`))
Expand All @@ -128,6 +128,7 @@ export async function buildDevStandalone(options: CLIOptions & LoadOptions & Bui
(warning) => !warning.message.includes(`Conflicting values for 'process.env.NODE_ENV'`)
);

// eslint-disable-next-line no-console
console.log(problems.map((p) => p.stack));
process.exit(problems.length > 0 ? 1 : 0);
return;
Expand Down
1 change: 1 addition & 0 deletions code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@
"@storybook/codemod": "workspace:*",
"@storybook/components": "workspace:*",
"@storybook/core-events": "workspace:*",
"@storybook/core-vite": "workspace:*",
"@storybook/core-webpack": "workspace:*",
"@storybook/csf-tools": "workspace:*",
"@storybook/docs-tools": "workspace:*",
Expand Down
3 changes: 2 additions & 1 deletion code/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8256,7 +8256,7 @@ __metadata:
languageName: unknown
linkType: soft

"@storybook/[email protected], @storybook/core-vite@workspace:lib/core-vite":
"@storybook/[email protected], @storybook/core-vite@workspace:*, @storybook/core-vite@workspace:lib/core-vite":
version: 0.0.0-use.local
resolution: "@storybook/core-vite@workspace:lib/core-vite"
dependencies:
Expand Down Expand Up @@ -9212,6 +9212,7 @@ __metadata:
"@storybook/codemod": "workspace:*"
"@storybook/components": "workspace:*"
"@storybook/core-events": "workspace:*"
"@storybook/core-vite": "workspace:*"
"@storybook/core-webpack": "workspace:*"
"@storybook/csf-tools": "workspace:*"
"@storybook/docs-tools": "workspace:*"
Expand Down
2 changes: 1 addition & 1 deletion scripts/build-package.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ async function run() {
}

selection?.filter(Boolean).forEach(async (v) => {
const commmand = (await readJSON(resolve(v.location, 'package.json'))).scripts.prep;
const commmand = (await readJSON(resolve(v.location, 'package.json'))).scripts.prepare;
const cwd = resolve(__dirname, '..', 'code', v.location);
const sub = require('execa').command(
`${commmand}${watchMode ? ' --watch' : ''}${prodMode ? ' --optimized' : ''}`,
Expand Down

0 comments on commit 07f8ad4

Please sign in to comment.