Skip to content

Commit

Permalink
FIX storybook msw service worker load (#1906)
Browse files Browse the repository at this point in the history
  • Loading branch information
shajz authored Dec 29, 2022
1 parent a452a46 commit eab9f43
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 341 deletions.
2 changes: 1 addition & 1 deletion .storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
stories: ['../stories/**/*.stories.mdx', '../stories/**/*.stories.@(js|jsx|ts|tsx)'],
staticDirs: ['./public'],
staticDirs: ['public'],
addons: ['@storybook/addon-essentials', '@storybook/addon-a11y'],
core: {
builder: 'webpack5',
Expand Down
303 changes: 0 additions & 303 deletions .storybook/msw/mockServiceWorker.js

This file was deleted.

10 changes: 9 additions & 1 deletion .storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,13 @@ if (typeof global.process === 'undefined') {
// Start the mocking when each story is loaded.
// Repetitive calls to the `.start()` method do not register a new worker,
// but check whether there's an existing once, reusing it, if so.
worker.start();

const pathname = document.location.pathname.slice(0, document.location.pathname.lastIndexOf('/'));
worker.start({
serviceWorker: {
// Points to the custom location of the Service Worker file.
url: `${pathname}/mockServiceWorker.js`,
scope: '/',
},
});
}
20 changes: 8 additions & 12 deletions .storybook/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"types": [
"node"
],
"allowSyntheticDefaultImports": true
},
"exclude": ["../node_modules/**/*", "../dist/**/*", "../packages/**/*.spec.ts", "../stories/**/*.spec.ts"],
"include": ["../packages/**/*", "../stories/**/*", "./msw/**/*"],
"files": [
"./typings.d.ts"
]
"extends": "../tsconfig.json",
"compilerOptions": {
"types": ["node"],
"allowSyntheticDefaultImports": true
},
"exclude": ["../packages/**/*.spec.ts", "../stories/**/*.spec.ts"],
"include": ["../packages/**/*", "../stories/**/*", "./msw/**/*"],
"files": ["./typings.d.ts"]
}
1 change: 0 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ node(label: CI.getSelectedNode(script:this)) {
if (isPR || isRc || isMaster) {
loggableStage('Deploy') {
echo "deploying ${branchName}"
bat "npm run compodoc"
bat "npm run build-storybook"
bat "npm run build-compodoc"
powershell "Remove-Item \\\\RBX1-SH1-TECH\\lucca-front\\${branchName}\\storybook -Recurse"
Expand Down
Loading

0 comments on commit eab9f43

Please sign in to comment.