-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
239 additions
and
210 deletions.
There are no files selected for viewing
101 changes: 101 additions & 0 deletions
101
.github/workflows/continuous-integration-storefront.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
name: Continuous Integration (Storefront) | ||
on: | ||
pull_request: | ||
types: ["opened", "edited", "reopened", "synchronize"] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
defaults: | ||
run: | ||
working-directory: packages/storefront | ||
|
||
jobs: | ||
scanning: | ||
name: GitGuardian scan | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 # fetch all history so multiple commits can be scanned | ||
- name: GitGuardian scan | ||
uses: GitGuardian/[email protected] | ||
with: | ||
args: -v | ||
env: | ||
GITHUB_PUSH_BEFORE_SHA: ${{ github.event.before }} | ||
GITHUB_PUSH_BASE_SHA: ${{ github.event.base }} | ||
GITHUB_PULL_BASE_SHA: ${{ github.event.pull_request.base.sha }} | ||
GITHUB_DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} | ||
GITGUARDIAN_API_KEY: ${{ secrets.GITGUARDIAN_API_KEY }} | ||
|
||
run-ci: | ||
name: Run CI | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node_version: ["18"] | ||
permissions: | ||
contents: read | ||
id-token: write | ||
steps: | ||
- name: Expose github environment as shell variables | ||
env: | ||
SECRETS_CONTEXT: ${{ toJson(secrets) }} | ||
VARS_CONTEXT: ${{ toJson(vars) }} | ||
run: | | ||
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable | ||
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings | ||
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) | ||
to_envs() { jq -r "to_entries[] | \"\(.key)<<$EOF\n\(.value)\n$EOF\n\""; } | ||
echo "$SECRETS_CONTEXT" | to_envs >> $GITHUB_ENV | ||
- name: Checkout code 🛎️ | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup node 🏗️ | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node_version }} | ||
|
||
- name: Get cache 🗄️ | ||
id: cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: "**/node_modules" | ||
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} | ||
|
||
- run: npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_RELEASE_TOKEN }} | ||
|
||
- name: Install dependencies | ||
shell: bash | ||
if: steps.cache.outputs.cache-hit != true | ||
run: HUSKY=0 yarn --frozen-lockfile | ||
|
||
- name: Detect circular dependencies 🔄 | ||
uses: vuestorefront/engineering-toolkit/github-actions/circular-dependencies@main | ||
with: | ||
filesPath: "packages/**/*.{ts,vue}" | ||
|
||
- name: Check licenses 🧪 | ||
uses: vuestorefront/engineering-toolkit/github-actions/check-licenses@main | ||
with: | ||
projectPath: ${{ github.workspace }} | ||
|
||
- name: Build project | ||
run: yarn build | ||
|
||
- name: Run tests | ||
run: yarn test | ||
|
||
- name: Upload test coverage | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: coverage-${{ runner.os }}-${{ github.event.pull_request.head.sha }} | ||
path: | | ||
coverage | ||
packages/**/coverage | ||
- name: Lint project | ||
run: yarn lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,7 @@ coverage | |
|
||
# Nuxt generated files | ||
.nuxt | ||
.output | ||
|
||
# Next generated files | ||
.next | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
packages/storefront/packages/next/__tests__/apps/app-router/app/csr/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
packages/storefront/packages/next/__tests__/apps/app-router/app/layout.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
packages/storefront/packages/next/__tests__/apps/app-router/app/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export default async function Home() { | ||
return ( | ||
<main> | ||
<h1>Home Page</h1> | ||
</main> | ||
); | ||
} |
6 changes: 4 additions & 2 deletions
6
packages/storefront/packages/next/__tests__/apps/app-router/hooks/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import { createSdkContext } from "../sdk.config"; | ||
// eslint-disable-next-line import/no-unresolved | ||
import { createSdkContext } from "@vue-storefront/next/client"; | ||
import { getSdk } from "../sdk.config"; | ||
|
||
export const [SdkProvider, useSdk] = createSdkContext(); | ||
export const [SdkProvider, useSdk] = createSdkContext(getSdk() as any); |
3 changes: 2 additions & 1 deletion
3
packages/storefront/packages/next/__tests__/apps/app-router/next.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = { | ||
transpilePackages: ["@storefront/shared"], | ||
// With swcMinify set to true, the build will fail because of some transpilation error, probably an issue on Next.js side | ||
swcMinify: true, | ||
}; | ||
|
||
module.exports = nextConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 4 additions & 2 deletions
6
packages/storefront/packages/next/__tests__/apps/pages-router/hooks/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import { createSdkContext } from "../sdk.config"; | ||
/* eslint-disable import/no-unresolved */ | ||
import { createSdkContext } from "@vue-storefront/next/client"; | ||
import { getSdk } from "../sdk.config"; | ||
|
||
export const [SdkProvider, useSdk] = createSdkContext(); | ||
export const [SdkProvider, useSdk] = createSdkContext(getSdk()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
packages/storefront/packages/next/__tests__/apps/pages-router/pages/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export default function Home() { | ||
return ( | ||
<main> | ||
<h1>Home Page</h1> | ||
</main> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
"use client"; | ||
|
||
export * from "./sdk/client"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
// eslint-disable-next-line import/extensions, import/no-unresolved | ||
export * from "./SdkContext"; | ||
export * from "./resolveDynamicContext"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { defineConfig } from "tsup"; | ||
|
||
export default defineConfig({ | ||
entry: { | ||
index: "src/index.ts", | ||
client: "src/client.ts", | ||
}, | ||
target: "es2015", | ||
format: ["cjs", "esm"], | ||
dts: true, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,15 @@ | ||
<template> | ||
<div> | ||
<nav> | ||
<ul> | ||
<li> | ||
<a href="/ssr">SSR Page</a> | ||
</li> | ||
<li> | ||
<a href="/csr">CSR Page</a> | ||
</li> | ||
</ul> | ||
</nav> | ||
<NuxtPage /> | ||
</div> | ||
</template> |
Oops, something went wrong.