Skip to content

Commit 325e620

Browse files
gorgeousvladVladislav Kharitonov
andauthored
Move story images inside repo (#766)
* feat: move story and editor images inside repo --------- Co-authored-by: Vladislav Kharitonov <[email protected]>
1 parent d960ea0 commit 325e620

File tree

122 files changed

+544
-519
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+544
-519
lines changed

.github/workflows/main-preview.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
push:
55
branches: [main]
66

7+
env:
8+
PREVIEW_DEST_PATH: /page-constructor/main/
9+
710
jobs:
811
main:
912
name: Build and Deploy
@@ -27,6 +30,6 @@ jobs:
2730
uses: gravity-ui/preview-upload-to-s3-action@v1
2831
with:
2932
src-path: storybook-static
30-
dest-path: /page-constructor/main/
33+
dest-path: ${{ env.PREVIEW_DEST_PATH }}
3134
s3-key-id: ${{ secrets.STORYBOOK_S3_KEY_ID }}
3235
s3-secret-key: ${{ secrets.STORYBOOK_S3_SECRET_KEY }}

.github/workflows/pr-preview-build.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ name: PR Preview Build
33
on:
44
pull_request:
55

6+
env:
7+
PREVIEW_DEST_PATH: /page-constructor/${{ github.event.pull_request.number }}
8+
69
jobs:
710
build:
811
name: Build

.storybook/main.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ import {resolve} from 'path';
22
import WebpackShellPluginNext from 'webpack-shell-plugin-next';
33
import MonacoWebpackPlugin from 'monaco-editor-webpack-plugin';
44

5+
const ASSET_PATH = 'story-assets';
6+
const PREVIEW_DEST_PATH = process.env.PREVIEW_DEST_PATH;
7+
58
const customAlias = {
69
widget: resolve(__dirname, '../widget'),
710
};
@@ -14,6 +17,7 @@ const config = {
1417
autodocs: true,
1518
},
1619
stories: ['./stories/**/*.mdx', '../src/**/__stories__/*.mdx', '../src/**/*.stories.@(ts|tsx)'],
20+
staticDirs: ['./public'],
1721
addons: [
1822
'@storybook/preset-scss',
1923
{
@@ -32,14 +36,30 @@ const config = {
3236
new WebpackShellPluginNext({
3337
onBuildStart: {
3438
scripts: ['npm run build:widget'],
35-
blocking: true,
39+
blocking: false,
3640
},
3741
}),
3842
);
43+
3944
storybookBaseConfig.resolve.alias = {
4045
...(storybookBaseConfig.resolve?.alias || {}),
4146
...customAlias,
4247
};
48+
49+
// main and branch storybook previews are deployed in subfolders
50+
// so we need to add subfolder prefix to stories asset static path:
51+
if (PREVIEW_DEST_PATH) {
52+
storybookBaseConfig.module.rules.push({
53+
test: /data\.json$/,
54+
loader: 'string-replace-loader',
55+
options: {
56+
search: `/${ASSET_PATH}/`,
57+
replace: `${PREVIEW_DEST_PATH}/${ASSET_PATH}/`,
58+
flags: 'g',
59+
},
60+
});
61+
}
62+
4363
return storybookBaseConfig;
4464
},
4565
};

.storybook/manager-head.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<link rel="icon" href="https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/favicon.png" />
1+
<link rel="icon" href="/story-assets/favicon.png" />
1.99 KB
19.3 KB
16.6 KB
310 KB
Binary file not shown.
19.3 KB
592 KB
Binary file not shown.

0 commit comments

Comments
 (0)