Skip to content

Commit

Permalink
chore: merge v2-develop into v2
Browse files Browse the repository at this point in the history
update docs
  • Loading branch information
FRSgit authored Nov 26, 2024
2 parents 5b82b3e + 6eeda6b commit 5f70b82
Show file tree
Hide file tree
Showing 18 changed files with 72 additions and 32 deletions.
1 change: 1 addition & 0 deletions .github/workflows/deploy-docs-vue-storefront-cloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
ARTIFACT_TYPE: 'sfui2-docs'
DOCKERFILE_PATH: './.vuestorefrontcloud/docs/Dockerfile'
ENVIRONMENT: ${{ needs.configure-enviroment.outputs.environment }}
TARGET_DOMAIN: ${{ needs.configure-enviroment.outputs.target-domain }}

sync-assets:
needs: [build, configure-enviroment]
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/deploy-router-vue-storefront-cloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
ARTIFACT_TYPE: "vue-storefront"
DOCKERFILE_PATH: ".vuestorefrontcloud/router/docker/Dockerfile"
ENVIRONMENT: ${{ needs.configure-enviroment.outputs.environment }}
TARGET_DOMAIN: ${{ needs.configure-enviroment.outputs.target-domain }}

deploy:
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/deploy-test-next-storefront-cloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
ARTIFACT_TYPE: "sfui2-docs-react"
DOCKERFILE_PATH: ".vuestorefrontcloud/test-next/docker/Dockerfile"
ENVIRONMENT: ${{ needs.configure-enviroment.outputs.environment }}
TARGET_DOMAIN: ${{ needs.configure-enviroment.outputs.target-domain }}

deploy:
needs: [ build, configure-enviroment ]
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/deploy-test-nuxt-storefront-cloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
ARTIFACT_TYPE: "sfui2-docs-vue"
DOCKERFILE_PATH: ".vuestorefrontcloud/test-nuxt/docker/Dockerfile"
ENVIRONMENT: ${{ needs.configure-enviroment.outputs.environment }}
TARGET_DOMAIN: ${{ needs.configure-enviroment.outputs.target-domain }}

deploy:
needs: [ build, configure-enviroment ]
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/image-build-vue-storefront-cloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ on:
ENVIRONMENT:
required: true
type: string
TARGET_DOMAIN:
required: true
type: string

jobs:
build:
Expand All @@ -29,11 +32,12 @@ jobs:
uses: elgohr/Publish-Docker-Github-Action@v5
env:
ENVIRONMENT: ${{ inputs.ENVIRONMENT }}
TARGET_DOMAIN: ${{ inputs.TARGET_DOMAIN }}
with:
name: ${{ inputs.DOCKER_NAMESPACE }}/${{ inputs.ARTIFACT_TYPE }}:${{ github.sha }}
registry: registry.storefrontcloud.io
username: ${{ secrets.CLOUD_USERNAME }}
password: ${{ secrets.CLOUD_PASSWORD }}
dockerfile: ${{ inputs.DOCKERFILE_PATH }}
buildoptions: '--compress'
buildargs: VITE_DOCS_BASEPATH,VITE_DOCS_EXAMPLES_REACT_PATH,VITE_DOCS_EXAMPLES_VUE_PATH,ENVIRONMENT
buildargs: VITE_DOCS_BASEPATH,VITE_DOCS_EXAMPLES_REACT_PATH,VITE_DOCS_EXAMPLES_VUE_PATH,ENVIRONMENT,TARGET_DOMAIN
10 changes: 6 additions & 4 deletions .vuestorefrontcloud/docs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@ FROM node:20-alpine AS build

WORKDIR /var/www

COPY . .

ARG VITE_DOCS_BASEPATH
ARG VITE_DOCS_EXAMPLES_REACT_PATH
ARG VITE_DOCS_EXAMPLES_VUE_PATH
ARG ENVIRONMENT

ENV VITE_DOCS_BASEPATH=$VITE_DOCS_BASEPATH
ENV VITE_DOCS_EXAMPLES_REACT_PATH=$VITE_DOCS_EXAMPLES_REACT_PATH
ENV VITE_DOCS_EXAMPLES_VUE_PATH=$VITE_DOCS_EXAMPLES_VUE_PATH
ENV NUXT_DOCS_BASEPATH=$VITE_DOCS_BASEPATH
ENV NUXT_APP_BASE_URL=$VITE_DOCS_BASEPATH
ENV NUXT_DOCS_EXAMPLES_REACT_PATH=$VITE_DOCS_EXAMPLES_REACT_PATH
ENV NUXT_DOCS_EXAMPLES_VUE_PATH=$VITE_DOCS_EXAMPLES_VUE_PATH
ENV ENVIRONMENT=$ENVIRONMENT

COPY . .
RUN yarn
RUN ENV_NAME=$ENVIRONMENT yarn build:replace-assets-url-with
RUN yarn build:vue
Expand Down
6 changes: 3 additions & 3 deletions .vuestorefrontcloud/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

You can debug dockerized docs image by following steps below:

- 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 .`,
- 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)
- 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 .`,
- 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)
- open browser and go to the address `http://localhost:3000/v2/` to see the docs page running.

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.
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.
10 changes: 10 additions & 0 deletions .vuestorefrontcloud/router/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,13 @@ An alternative to robots.txt in this case could be using the built-in Farmer fea
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.

That's a lot of work to do such a simple thing, but the situation is what it is.

## Debugging

You can debug dockerized docs image by following steps below:

- run `docs` docker image,
- run terminal in `root` directory,
- build image using `DOCKER_BUILDKIT=1 docker build -t docs-router --build-arg TARGET_DOMAIN=http://localhost:3004 -f .vuestorefrontcloud/router/docker/Dockerfile .`,
- 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)
- open browser and go to the address `http://localhost:3004` to see the app page running.
9 changes: 8 additions & 1 deletion .vuestorefrontcloud/router/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
FROM nginx
COPY .vuestorefrontcloud/router/docker/default.conf /etc/nginx/conf.d/default.conf

ARG TARGET_DOMAIN

ENV TARGET_DOMAIN=$TARGET_DOMAIN

COPY .vuestorefrontcloud/router/docker/default.conf.template /etc/nginx/conf.d/default.conf.template

RUN envsubst '$TARGET_DOMAIN' < /etc/nginx/conf.d/default.conf.template > /etc/nginx/conf.d/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ server {

# https://www.oliverdavies.uk/blog/nginx-redirects-query-string-arguments
location / {
return 301 https://docs.storefrontui.io/v2$uri$is_args$args;
return 301 ${TARGET_DOMAIN}/v2$uri$is_args$args;
}
}
3 changes: 1 addition & 2 deletions .vuestorefrontcloud/test-next/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ ARG VITE_DOCS_BASEPATH
ARG VITE_DOCS_EXAMPLES_REACT_PATH
ARG ENVIRONMENT

ENV VITE_DOCS_BASEPATH=$VITE_DOCS_BASEPATH
ENV VITE_DOCS_EXAMPLES_REACT_PATH=$VITE_DOCS_EXAMPLES_REACT_PATH
ENV NEXT_DOCS_EXAMPLES_REACT_PATH=$VITE_DOCS_EXAMPLES_REACT_PATH
ENV ENVIRONMENT=$ENVIRONMENT

RUN yarn
Expand Down
2 changes: 1 addition & 1 deletion .vuestorefrontcloud/test-next/docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
You can debug dockerized docs image by following steps below:

- run terminal in `root` directory
- build image using `DOCKER_BUILDKIT=1 docker build -t test-next -f .vuestorefrontcloud/test-next/docker/Dockerfile .`,
- 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 .`,
- 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)
- open browser and go to the address `http://localhost:3002` to see the app page running.
3 changes: 1 addition & 2 deletions .vuestorefrontcloud/test-nuxt/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ ARG VITE_DOCS_BASEPATH
ARG VITE_DOCS_EXAMPLES_VUE_PATH
ARG ENVIRONMENT

ENV VITE_DOCS_BASEPATH=$VITE_DOCS_BASEPATH
ENV VITE_DOCS_EXAMPLES_VUE_PATH=$VITE_DOCS_EXAMPLES_VUE_PATH
ENV NUXT_DOCS_EXAMPLES_VUE_PATH=$VITE_DOCS_EXAMPLES_VUE_PATH
ENV ENVIRONMENT=$ENVIRONMENT

RUN yarn
Expand Down
2 changes: 1 addition & 1 deletion .vuestorefrontcloud/test-nuxt/docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
You can debug dockerized docs image by following steps below:

- run terminal in `root` directory
- build image using `DOCKER_BUILDKIT=1 docker build -t test-nuxt -f .vuestorefrontcloud/test-nuxt/docker/Dockerfile .`,
- 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 .`,
- 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)
- open browser and go to the address `http://localhost:3001` to see the app page running.
6 changes: 3 additions & 3 deletions apps/docs/components/.env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
VITE_DOCS_EXAMPLES_VUE_PATH=http://localhost:3001
VITE_DOCS_EXAMPLES_REACT_PATH=http://localhost:3002
VITE_DOCS_BASEPATH=/v2
NUXT_DOCS_EXAMPLES_VUE_PATH=http://localhost:3001
NUXT_DOCS_EXAMPLES_REACT_PATH=http://localhost:3002
NUXT_DOCS_BASEPATH=/v2
11 changes: 5 additions & 6 deletions apps/docs/components/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
export default defineNuxtConfig({
extends: ['sf-docs-base'],
app: {
baseURL: process.env.VITE_DOCS_BASEPATH ?? '',

head: {
link: [
{
Expand All @@ -15,10 +13,10 @@ export default defineNuxtConfig({
},
},
robots: {
enabled: false
enabled: false,
},
sitemap: {
enabled: false
enabled: false,
},
// fix via https://github.com/nuxt/content/issues/2254
alias: {
Expand All @@ -28,8 +26,8 @@ export default defineNuxtConfig({
runtimeConfig: {
public: {
storefrontUi: true,
DOCS_EXAMPLES_VUE_PATH: process.env.VITE_DOCS_EXAMPLES_VUE_PATH,
DOCS_EXAMPLES_REACT_PATH: process.env.VITE_DOCS_EXAMPLES_REACT_PATH,
DOCS_EXAMPLES_VUE_PATH: process.env.NUXT_DOCS_EXAMPLES_VUE_PATH,
DOCS_EXAMPLES_REACT_PATH: process.env.NUXT_DOCS_EXAMPLES_REACT_PATH,
siteUrl: process.env.NUXT_PUBLIC_SITE_URL || 'https://docs.storefrontui.io',
siteName: 'Storefront UI',
siteDescription: 'Fast, accessible, and fully customizable components built for e-commerce.',
Expand All @@ -43,6 +41,7 @@ export default defineNuxtConfig({
},
},
prerender: {
routes: ['/'],
crawlLinks: true,
failOnError: false,
},
Expand Down
22 changes: 16 additions & 6 deletions apps/preview/next/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ const isProd = process.env.PROD === 'true';
/** @type {import('next').NextConfig} */
export default {
env: {
DOCS_EXAMPLES_REACT_PATH: process.env.VITE_DOCS_EXAMPLES_REACT_PATH || '',
DOCS_EXAMPLES_REACT_PATH: process.env.NEXT_DOCS_EXAMPLES_REACT_PATH || '',
},
basePath: process.env.VITE_DOCS_EXAMPLES_REACT_PATH
? new URL(process.env.VITE_DOCS_EXAMPLES_REACT_PATH).pathname
basePath: process.env.NEXT_DOCS_EXAMPLES_REACT_PATH
? new URL(process.env.NEXT_DOCS_EXAMPLES_REACT_PATH).pathname
: '',
reactStrictMode: true,
swcMinify: true,
Expand Down Expand Up @@ -49,14 +49,24 @@ export default {
},
});

const reactPackage = resolve(process.cwd(), '..', '..', '..', 'packages', 'sfui', 'frameworks', 'react', 'index.ts');
const reactPackage = resolve(
process.cwd(),
'..',
'..',
'..',
'packages',
'sfui',
'frameworks',
'react',
'index.ts',
);
config.resolve.alias = {
...config.resolve.alias,
'@storefront-ui/react': reactPackage,
'@storefront-ui/vue': reactPackage,
}
};
}

return config;
}
},
};
8 changes: 7 additions & 1 deletion apps/preview/nuxt/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const isProd = process.env.PROD === 'true';

export default defineNuxtConfig({
app: {
baseURL: process.env.VITE_DOCS_EXAMPLES_VUE_PATH ? new URL(process.env.VITE_DOCS_EXAMPLES_VUE_PATH).pathname : '',
baseURL: process.env.NUXT_DOCS_EXAMPLES_VUE_PATH ? new URL(process.env.NUXT_DOCS_EXAMPLES_VUE_PATH).pathname : '',
head: {
htmlAttrs: {
lang: 'en',
Expand Down Expand Up @@ -42,6 +42,12 @@ export default defineNuxtConfig({
}
: {}),
},
nitro: {
prerender: {
routes: ['/'],
crawlLinks: true,
},
},
vite: {
plugins: [
{
Expand Down

0 comments on commit 5f70b82

Please sign in to comment.