Skip to content

Commit 5f70b82

Browse files
authored
chore: merge v2-develop into v2
update docs
2 parents 5b82b3e + 6eeda6b commit 5f70b82

18 files changed

+72
-32
lines changed

.github/workflows/deploy-docs-vue-storefront-cloud.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ jobs:
2121
ARTIFACT_TYPE: 'sfui2-docs'
2222
DOCKERFILE_PATH: './.vuestorefrontcloud/docs/Dockerfile'
2323
ENVIRONMENT: ${{ needs.configure-enviroment.outputs.environment }}
24+
TARGET_DOMAIN: ${{ needs.configure-enviroment.outputs.target-domain }}
2425

2526
sync-assets:
2627
needs: [build, configure-enviroment]

.github/workflows/deploy-router-vue-storefront-cloud.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ jobs:
2121
ARTIFACT_TYPE: "vue-storefront"
2222
DOCKERFILE_PATH: ".vuestorefrontcloud/router/docker/Dockerfile"
2323
ENVIRONMENT: ${{ needs.configure-enviroment.outputs.environment }}
24+
TARGET_DOMAIN: ${{ needs.configure-enviroment.outputs.target-domain }}
2425

2526
deploy:
2627
runs-on: ubuntu-latest

.github/workflows/deploy-test-next-storefront-cloud.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ jobs:
2121
ARTIFACT_TYPE: "sfui2-docs-react"
2222
DOCKERFILE_PATH: ".vuestorefrontcloud/test-next/docker/Dockerfile"
2323
ENVIRONMENT: ${{ needs.configure-enviroment.outputs.environment }}
24+
TARGET_DOMAIN: ${{ needs.configure-enviroment.outputs.target-domain }}
2425

2526
deploy:
2627
needs: [ build, configure-enviroment ]

.github/workflows/deploy-test-nuxt-storefront-cloud.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
ARTIFACT_TYPE: "sfui2-docs-vue"
2121
DOCKERFILE_PATH: ".vuestorefrontcloud/test-nuxt/docker/Dockerfile"
2222
ENVIRONMENT: ${{ needs.configure-enviroment.outputs.environment }}
23+
TARGET_DOMAIN: ${{ needs.configure-enviroment.outputs.target-domain }}
2324

2425
deploy:
2526
needs: [ build, configure-enviroment ]

.github/workflows/image-build-vue-storefront-cloud.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ on:
1414
ENVIRONMENT:
1515
required: true
1616
type: string
17+
TARGET_DOMAIN:
18+
required: true
19+
type: string
1720

1821
jobs:
1922
build:
@@ -29,11 +32,12 @@ jobs:
2932
uses: elgohr/Publish-Docker-Github-Action@v5
3033
env:
3134
ENVIRONMENT: ${{ inputs.ENVIRONMENT }}
35+
TARGET_DOMAIN: ${{ inputs.TARGET_DOMAIN }}
3236
with:
3337
name: ${{ inputs.DOCKER_NAMESPACE }}/${{ inputs.ARTIFACT_TYPE }}:${{ github.sha }}
3438
registry: registry.storefrontcloud.io
3539
username: ${{ secrets.CLOUD_USERNAME }}
3640
password: ${{ secrets.CLOUD_PASSWORD }}
3741
dockerfile: ${{ inputs.DOCKERFILE_PATH }}
3842
buildoptions: '--compress'
39-
buildargs: VITE_DOCS_BASEPATH,VITE_DOCS_EXAMPLES_REACT_PATH,VITE_DOCS_EXAMPLES_VUE_PATH,ENVIRONMENT
43+
buildargs: VITE_DOCS_BASEPATH,VITE_DOCS_EXAMPLES_REACT_PATH,VITE_DOCS_EXAMPLES_VUE_PATH,ENVIRONMENT,TARGET_DOMAIN

.vuestorefrontcloud/docs/Dockerfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,19 @@ FROM node:20-alpine AS build
22

33
WORKDIR /var/www
44

5+
COPY . .
6+
57
ARG VITE_DOCS_BASEPATH
68
ARG VITE_DOCS_EXAMPLES_REACT_PATH
79
ARG VITE_DOCS_EXAMPLES_VUE_PATH
810
ARG ENVIRONMENT
911

10-
ENV VITE_DOCS_BASEPATH=$VITE_DOCS_BASEPATH
11-
ENV VITE_DOCS_EXAMPLES_REACT_PATH=$VITE_DOCS_EXAMPLES_REACT_PATH
12-
ENV VITE_DOCS_EXAMPLES_VUE_PATH=$VITE_DOCS_EXAMPLES_VUE_PATH
12+
ENV NUXT_DOCS_BASEPATH=$VITE_DOCS_BASEPATH
13+
ENV NUXT_APP_BASE_URL=$VITE_DOCS_BASEPATH
14+
ENV NUXT_DOCS_EXAMPLES_REACT_PATH=$VITE_DOCS_EXAMPLES_REACT_PATH
15+
ENV NUXT_DOCS_EXAMPLES_VUE_PATH=$VITE_DOCS_EXAMPLES_VUE_PATH
1316
ENV ENVIRONMENT=$ENVIRONMENT
1417

15-
COPY . .
1618
RUN yarn
1719
RUN ENV_NAME=$ENVIRONMENT yarn build:replace-assets-url-with
1820
RUN yarn build:vue

.vuestorefrontcloud/docs/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
You can debug dockerized docs image by following steps below:
66

7-
- build image using `DOCKER_BUILDKIT=1 docker build -t docs --build-arg VITE_DOCS_EXAMPLES_VUE_PATH=http://localhost:3001 --build-arg VITE_DOCS_EXAMPLES_REACT_PATH=http://localhost:3002 --build-arg VITE_DOCS_BASEPATH=/v2/ -f .vuestorefrontcloud/docs/Dockerfile .`,
8-
- run image using `docker run -t -i -p 3000:80 docs`, (flags `i` and `t` allows to run command and then kill it with `ctrl+c` https://github.com/moby/moby/issues/2838#issuecomment-29205965)
7+
- build image using `DOCKER_BUILDKIT=1 docker build -t docs --build-arg VITE_DOCS_EXAMPLES_VUE_PATH=http://localhost:3001/v2-vue --build-arg VITE_DOCS_EXAMPLES_REACT_PATH=http://localhost:3002/v2-react --build-arg VITE_DOCS_BASEPATH=/v2/ -f .vuestorefrontcloud/docs/Dockerfile .`,
8+
- run image using `docker run -t -i -p 3004:80 docs`, (flags `i` and `t` allows to run command and then kill it with `ctrl+c` https://github.com/moby/moby/issues/2838#issuecomment-29205965)
99
- open browser and go to the address `http://localhost:3000/v2/` to see the docs page running.
1010

11-
NOTE: docs will work but without `vue` and `react` showcases. For full docs experience you have to run `test-next` and `test-nuxt` docker as well.
11+
NOTE: docs will work but without `vue` and `react` showcases. For full docs experience you have to run `test-next` and `test-nuxt` docker as well. And to test root redirect to `/v2/` you need to run `router` docker image too.

.vuestorefrontcloud/router/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,13 @@ An alternative to robots.txt in this case could be using the built-in Farmer fea
2727
However, I went with creating the "nginx + robots.txt file" container here anyways. I'm forced to create a container for nginx so might as well put the robots.txt file here.
2828

2929
That's a lot of work to do such a simple thing, but the situation is what it is.
30+
31+
## Debugging
32+
33+
You can debug dockerized docs image by following steps below:
34+
35+
- run `docs` docker image,
36+
- run terminal in `root` directory,
37+
- build image using `DOCKER_BUILDKIT=1 docker build -t docs-router --build-arg TARGET_DOMAIN=http://localhost:3004 -f .vuestorefrontcloud/router/docker/Dockerfile .`,
38+
- run image using `docker run -t -i -p 3000:3000 docs-router nginx-debug -g 'daemon off;'`, (flags `i` and `t` allows to run command and then kill it with `ctrl+c` https://github.com/moby/moby/issues/2838#issuecomment-29205965)
39+
- open browser and go to the address `http://localhost:3004` to see the app page running.
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
11
FROM nginx
2-
COPY .vuestorefrontcloud/router/docker/default.conf /etc/nginx/conf.d/default.conf
2+
3+
ARG TARGET_DOMAIN
4+
5+
ENV TARGET_DOMAIN=$TARGET_DOMAIN
6+
7+
COPY .vuestorefrontcloud/router/docker/default.conf.template /etc/nginx/conf.d/default.conf.template
8+
9+
RUN envsubst '$TARGET_DOMAIN' < /etc/nginx/conf.d/default.conf.template > /etc/nginx/conf.d/default.conf

.vuestorefrontcloud/router/docker/default.conf renamed to .vuestorefrontcloud/router/docker/default.conf.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ server {
88

99
# https://www.oliverdavies.uk/blog/nginx-redirects-query-string-arguments
1010
location / {
11-
return 301 https://docs.storefrontui.io/v2$uri$is_args$args;
11+
return 301 ${TARGET_DOMAIN}/v2$uri$is_args$args;
1212
}
1313
}

.vuestorefrontcloud/test-next/docker/Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ ARG VITE_DOCS_BASEPATH
88
ARG VITE_DOCS_EXAMPLES_REACT_PATH
99
ARG ENVIRONMENT
1010

11-
ENV VITE_DOCS_BASEPATH=$VITE_DOCS_BASEPATH
12-
ENV VITE_DOCS_EXAMPLES_REACT_PATH=$VITE_DOCS_EXAMPLES_REACT_PATH
11+
ENV NEXT_DOCS_EXAMPLES_REACT_PATH=$VITE_DOCS_EXAMPLES_REACT_PATH
1312
ENV ENVIRONMENT=$ENVIRONMENT
1413

1514
RUN yarn

.vuestorefrontcloud/test-next/docker/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
You can debug dockerized docs image by following steps below:
66

77
- run terminal in `root` directory
8-
- build image using `DOCKER_BUILDKIT=1 docker build -t test-next -f .vuestorefrontcloud/test-next/docker/Dockerfile .`,
8+
- build image using `DOCKER_BUILDKIT=1 docker build -t test-next --build-arg VITE_DOCS_EXAMPLES_REACT_PATH=https://localhost:3002/v2-react -f .vuestorefrontcloud/test-next/docker/Dockerfile .`,
99
- run image using `docker run -t -i -p 3002:3000 test-next`, (flags `i` and `t` allows to run command and then kill it with `ctrl+c` https://github.com/moby/moby/issues/2838#issuecomment-29205965)
1010
- open browser and go to the address `http://localhost:3002` to see the app page running.

.vuestorefrontcloud/test-nuxt/docker/Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ ARG VITE_DOCS_BASEPATH
88
ARG VITE_DOCS_EXAMPLES_VUE_PATH
99
ARG ENVIRONMENT
1010

11-
ENV VITE_DOCS_BASEPATH=$VITE_DOCS_BASEPATH
12-
ENV VITE_DOCS_EXAMPLES_VUE_PATH=$VITE_DOCS_EXAMPLES_VUE_PATH
11+
ENV NUXT_DOCS_EXAMPLES_VUE_PATH=$VITE_DOCS_EXAMPLES_VUE_PATH
1312
ENV ENVIRONMENT=$ENVIRONMENT
1413

1514
RUN yarn

.vuestorefrontcloud/test-nuxt/docker/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
You can debug dockerized docs image by following steps below:
66

77
- run terminal in `root` directory
8-
- build image using `DOCKER_BUILDKIT=1 docker build -t test-nuxt -f .vuestorefrontcloud/test-nuxt/docker/Dockerfile .`,
8+
- build image using `DOCKER_BUILDKIT=1 docker build -t test-nuxt --build-arg VITE_DOCS_EXAMPLES_VUE_PATH=https://localhost:3002/v2-vue -f .vuestorefrontcloud/test-nuxt/docker/Dockerfile .`,
99
- run image using `docker run -t -i -p 3001:3000 test-nuxt`, (flags `i` and `t` allows to run command and then kill it with `ctrl+c` https://github.com/moby/moby/issues/2838#issuecomment-29205965)
1010
- open browser and go to the address `http://localhost:3001` to see the app page running.

apps/docs/components/.env.example

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
VITE_DOCS_EXAMPLES_VUE_PATH=http://localhost:3001
2-
VITE_DOCS_EXAMPLES_REACT_PATH=http://localhost:3002
3-
VITE_DOCS_BASEPATH=/v2
1+
NUXT_DOCS_EXAMPLES_VUE_PATH=http://localhost:3001
2+
NUXT_DOCS_EXAMPLES_REACT_PATH=http://localhost:3002
3+
NUXT_DOCS_BASEPATH=/v2

apps/docs/components/nuxt.config.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
export default defineNuxtConfig({
44
extends: ['sf-docs-base'],
55
app: {
6-
baseURL: process.env.VITE_DOCS_BASEPATH ?? '',
7-
86
head: {
97
link: [
108
{
@@ -15,10 +13,10 @@ export default defineNuxtConfig({
1513
},
1614
},
1715
robots: {
18-
enabled: false
16+
enabled: false,
1917
},
2018
sitemap: {
21-
enabled: false
19+
enabled: false,
2220
},
2321
// fix via https://github.com/nuxt/content/issues/2254
2422
alias: {
@@ -28,8 +26,8 @@ export default defineNuxtConfig({
2826
runtimeConfig: {
2927
public: {
3028
storefrontUi: true,
31-
DOCS_EXAMPLES_VUE_PATH: process.env.VITE_DOCS_EXAMPLES_VUE_PATH,
32-
DOCS_EXAMPLES_REACT_PATH: process.env.VITE_DOCS_EXAMPLES_REACT_PATH,
29+
DOCS_EXAMPLES_VUE_PATH: process.env.NUXT_DOCS_EXAMPLES_VUE_PATH,
30+
DOCS_EXAMPLES_REACT_PATH: process.env.NUXT_DOCS_EXAMPLES_REACT_PATH,
3331
siteUrl: process.env.NUXT_PUBLIC_SITE_URL || 'https://docs.storefrontui.io',
3432
siteName: 'Storefront UI',
3533
siteDescription: 'Fast, accessible, and fully customizable components built for e-commerce.',
@@ -43,6 +41,7 @@ export default defineNuxtConfig({
4341
},
4442
},
4543
prerender: {
44+
routes: ['/'],
4645
crawlLinks: true,
4746
failOnError: false,
4847
},

apps/preview/next/next.config.mjs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ const isProd = process.env.PROD === 'true';
66
/** @type {import('next').NextConfig} */
77
export default {
88
env: {
9-
DOCS_EXAMPLES_REACT_PATH: process.env.VITE_DOCS_EXAMPLES_REACT_PATH || '',
9+
DOCS_EXAMPLES_REACT_PATH: process.env.NEXT_DOCS_EXAMPLES_REACT_PATH || '',
1010
},
11-
basePath: process.env.VITE_DOCS_EXAMPLES_REACT_PATH
12-
? new URL(process.env.VITE_DOCS_EXAMPLES_REACT_PATH).pathname
11+
basePath: process.env.NEXT_DOCS_EXAMPLES_REACT_PATH
12+
? new URL(process.env.NEXT_DOCS_EXAMPLES_REACT_PATH).pathname
1313
: '',
1414
reactStrictMode: true,
1515
swcMinify: true,
@@ -49,14 +49,24 @@ export default {
4949
},
5050
});
5151

52-
const reactPackage = resolve(process.cwd(), '..', '..', '..', 'packages', 'sfui', 'frameworks', 'react', 'index.ts');
52+
const reactPackage = resolve(
53+
process.cwd(),
54+
'..',
55+
'..',
56+
'..',
57+
'packages',
58+
'sfui',
59+
'frameworks',
60+
'react',
61+
'index.ts',
62+
);
5363
config.resolve.alias = {
5464
...config.resolve.alias,
5565
'@storefront-ui/react': reactPackage,
5666
'@storefront-ui/vue': reactPackage,
57-
}
67+
};
5868
}
5969

6070
return config;
61-
}
71+
},
6272
};

apps/preview/nuxt/nuxt.config.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const isProd = process.env.PROD === 'true';
66

77
export default defineNuxtConfig({
88
app: {
9-
baseURL: process.env.VITE_DOCS_EXAMPLES_VUE_PATH ? new URL(process.env.VITE_DOCS_EXAMPLES_VUE_PATH).pathname : '',
9+
baseURL: process.env.NUXT_DOCS_EXAMPLES_VUE_PATH ? new URL(process.env.NUXT_DOCS_EXAMPLES_VUE_PATH).pathname : '',
1010
head: {
1111
htmlAttrs: {
1212
lang: 'en',
@@ -42,6 +42,12 @@ export default defineNuxtConfig({
4242
}
4343
: {}),
4444
},
45+
nitro: {
46+
prerender: {
47+
routes: ['/'],
48+
crawlLinks: true,
49+
},
50+
},
4551
vite: {
4652
plugins: [
4753
{

0 commit comments

Comments
 (0)