-
Notifications
You must be signed in to change notification settings - Fork 0
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
0 parents
commit 396b825
Showing
262 changed files
with
24,263 additions
and
0 deletions.
There are no files selected for viewing
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 @@ | ||
module.exports = { | ||
extends: ["next/core-web-vitals"] | ||
}; |
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,76 @@ | ||
const { defineConfig, loadEnv } = require("@medusajs/utils") | ||
|
||
loadEnv(process.env.NODE_ENV || "development", process.cwd()) | ||
|
||
// CORS when consuming Medusa from admin | ||
// Medusa's docs are added for a better learning experience. Feel free to remove. | ||
const ADMIN_CORS = `${ | ||
process.env.ADMIN_CORS?.length | ||
? `${process.env.ADMIN_CORS},` | ||
: "http://localhost:7000,http://localhost:7001," | ||
}https://docs.medusajs.com,https://medusa-docs-v2-git-docs-v2-medusajs.vercel.app,https://medusa-resources-git-docs-v2-medusajs.vercel.app` | ||
|
||
// CORS to avoid issues when consuming Medusa from a client | ||
// Medusa's docs are added for a better learning experience. Feel free to remove. | ||
const STORE_CORS = `${ | ||
process.env.STORE_CORS?.length | ||
? `${process.env.STORE_CORS},` | ||
: "http://localhost:8000," | ||
}https://docs.medusajs.com,https://medusa-docs-v2-git-docs-v2-medusajs.vercel.app,https://medusa-resources-git-docs-v2-medusajs.vercel.app` | ||
|
||
const DATABASE_URL = | ||
process.env.DATABASE_URL || "postgres://medusa:password@localhost/medusa" | ||
|
||
const REDIS_URL = process.env.REDIS_URL || "redis://localhost:6379" | ||
|
||
export default defineConfig({ | ||
plugins: [ | ||
`medusa-fulfillment-manual`, | ||
`medusa-payment-manual`, | ||
{ | ||
resolve: `@medusajs/file-local`, | ||
options: { | ||
upload_dir: "uploads", | ||
}, | ||
}, | ||
{ | ||
resolve: `medusa-plugin-meilisearch`, | ||
options: { | ||
config: { | ||
host: process.env.MEILISEARCH_HOST, | ||
apiKey: process.env.MEILISEARCH_API_KEY, | ||
}, | ||
settings: { | ||
products: { | ||
indexSettings: { | ||
searchableAttributes: ["title", "description", "variant_sku"], | ||
displayedAttributes: [ | ||
"id", | ||
"title", | ||
"description", | ||
"variant_sku", | ||
"thumbnail", | ||
"handle", | ||
], | ||
}, | ||
primaryKey: "id", | ||
}, | ||
}, | ||
}, | ||
}, | ||
], | ||
admin: { | ||
backendUrl: "http://localhost:9000", | ||
}, | ||
projectConfig: { | ||
databaseUrl: DATABASE_URL, | ||
http: { | ||
storeCors: STORE_CORS, | ||
adminCors: ADMIN_CORS, | ||
authCors: process.env.AUTH_CORS || ADMIN_CORS, | ||
jwtSecret: process.env.JWT_SECRET || "supersecret", | ||
cookieSecret: process.env.COOKIE_SECRET || "supersecret", | ||
}, | ||
redisUrl: REDIS_URL, | ||
}, | ||
}) |
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,150 @@ | ||
name: Medusa NextJS Template Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
env: | ||
PGHOST: localhost | ||
PGPORT: 5432 | ||
PGUSER: postgres | ||
PGPASSWORD: password | ||
PGDATABASE: postgres | ||
|
||
TEST_POSTGRES_USER: test_medusa_user | ||
TEST_POSTGRES_PASSWORD: password | ||
TEST_POSTGRES_DATABASE: test_medusa_db | ||
TEST_POSTGRES_DATABASE_TEMPLATE: test_medusa_db_template | ||
TEST_POSTGRES_HOST: localhost | ||
TEST_POSTGREST_PORT: 5432 | ||
PRODUCTION_POSTGRES_DATABASE: medusa_db | ||
CLIENT_SERVER: http://localhost:9000 | ||
|
||
JWT_SECRET: something | ||
COOKIE_SECRET: something | ||
|
||
DATABASE_TYPE: "postgres" | ||
REDIS_URL: redis://localhost:6379 | ||
DATABASE_URL: postgres://test_medusa_user:password@localhost/test_medusa_db | ||
MEILISEARCH_HOST: http://localhost:7700 | ||
MEILISEARCH_API_KEY: meili_api_key | ||
|
||
NEXT_PUBLIC_BASE_URL: http://localhost:8000 | ||
NEXT_PUBLIC_DEFAULT_REGION: us | ||
NEXT_PUBLIC_MEDUSA_BACKEND_URL: http://localhost:9000 | ||
NEXT_PUBLIC_INDEX_NAME: products | ||
NEXT_PUBLIC_SEARCH_ENDPOINT: http://127.0.0.1:7700 | ||
NEXT_PUBLIC_SEARCH_API_KEY: meili_api_key | ||
REVALIDATE_SECRET: supersecret | ||
|
||
jobs: | ||
e2e-test-runner: | ||
timeout-minutes: 20 | ||
runs-on: | ||
- ubuntu-latest | ||
services: | ||
postgres: | ||
image: postgres:latest | ||
env: | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: password | ||
POSTGRES_DB: test | ||
ports: | ||
- 5432:5432 | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
meilisearch: | ||
image: getmeili/meilisearch:v1.7 | ||
env: | ||
MEILI_MASTER_KEY: meili_api_key | ||
MEILI_ENV: development | ||
ports: | ||
- 7700:7700 | ||
options: >- | ||
--health-cmd "curl --fail http://localhost:7700/health" | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
redis: | ||
image: redis:latest | ||
ports: | ||
- 6379:6379 | ||
options: >- | ||
--health-cmd "redis-cli ping" | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Use Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "20" | ||
|
||
- name: Initialize PostgreSQL | ||
run: | | ||
echo "Initializing Databases" | ||
psql -h localhost -U postgres -d test -c "CREATE USER ${{ env.TEST_POSTGRES_USER }} WITH PASSWORD '${{ env.TEST_POSTGRES_PASSWORD }}';" | ||
psql -h localhost -U postgres -d test -c "CREATE DATABASE ${{ env.TEST_POSTGRES_DATABASE }} OWNER ${{ env.TEST_POSTGRES_USER }};" | ||
- name: Install Medusa CLI | ||
run: npm install @medusajs/medusa-cli@preview -g | ||
- name: Setup medusa backend server | ||
working-directory: ../ | ||
# https://docs.medusajs.com/cli/reference#options | ||
run: | | ||
medusa new backend \ | ||
-y \ | ||
--v2 \ | ||
--branch feat/v2 \ | ||
--skip-db \ | ||
--skip-migrations \ | ||
--skip-env \ | ||
--db-user ${{ env.TEST_POSTGRES_USER }} \ | ||
--db-pass ${{ env.TEST_POSTGRES_PASSWORD }} \ | ||
--db-database ${{ env.TEST_POSTGRES_DATABASE }} \ | ||
--db-host ${{ env.TEST_POSTGRES_HOST }} \ | ||
--db-port ${{ env.TEST_POSTGREST_PORT }} | ||
- name: Setup search in the backend | ||
working-directory: ../backend | ||
run: yarn add medusa-plugin-meilisearch | ||
|
||
- name: Move custom medusa config to the backend | ||
run: cp .github/scripts/medusa-config.js ../backend/medusa-config.js | ||
|
||
- name: Seed data from default seed file | ||
working-directory: ../backend | ||
run: medusa seed --seed-file=data/seed.json | ||
|
||
- name: Run backend server | ||
working-directory: ../backend | ||
run: medusa develop | ||
|
||
- name: Install packages | ||
run: yarn install -y | ||
|
||
- name: Install playwright | ||
run: yarn playwright install --with-deps | ||
|
||
- name: Setup frontend | ||
run: yarn build | ||
|
||
- name: Run Tests | ||
run: yarn test-e2e | ||
|
||
- uses: actions/upload-artifact@v3 | ||
if: always() | ||
with: | ||
name: playwright-report | ||
path: test-results | ||
retention-days: 30 |
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,57 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# IDEs | ||
.idea | ||
.vscode | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# next.js | ||
/.next/ | ||
/out/ | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
*.pem | ||
|
||
# debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
.pnpm-debug.log* | ||
|
||
# local env files | ||
.env | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
# vercel | ||
.vercel | ||
|
||
# typescript | ||
*.tsbuildinfo | ||
node_modules | ||
|
||
.yarn | ||
.swc | ||
dump.rdb | ||
/test-results/ | ||
/playwright-report/ | ||
/blob-report/ | ||
/playwright/.cache/ | ||
/test-results/ | ||
/playwright-report/ | ||
/blob-report/ | ||
/playwright/.cache/ | ||
/playwright/.auth |
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,8 @@ | ||
{ | ||
"arrowParens": "always", | ||
"semi": false, | ||
"endOfLine": "auto", | ||
"singleQuote": false, | ||
"tabWidth": 2, | ||
"trailingComma": "es5" | ||
} |
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 @@ | ||
nodeLinker: node-modules |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2022 Medusa | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
Oops, something went wrong.