-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
copy hydrogen example from vercel/vercel (#1015)
- Loading branch information
1 parent
4a613d6
commit 6a86305
Showing
120 changed files
with
17,932 additions
and
0 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
framework-boilerplates/hydrogen/.devcontainer/devcontainer.json
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,18 @@ | ||
{ | ||
"name": "Shopify Hydrogen", | ||
"image": "mcr.microsoft.com/vscode/devcontainers/javascript-node:0-16", | ||
"settings": {}, | ||
"extensions": [ | ||
"graphql.vscode-graphql", | ||
"dbaeumer.vscode-eslint", | ||
"bradlc.vscode-tailwindcss", | ||
"esbenp.prettier-vscode" | ||
], | ||
"forwardPorts": [3000], | ||
"postCreateCommand": "yarn install", | ||
"postStartCommand": "yarn dev", | ||
"remoteUser": "node", | ||
"features": { | ||
"git": "latest" | ||
} | ||
} |
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 @@ | ||
module.exports = { | ||
extends: ['plugin:hydrogen/recommended', 'plugin:hydrogen/typescript'], | ||
rules: { | ||
'node/no-missing-import': 'off', | ||
'@typescript-eslint/ban-ts-comment': 'off', | ||
'@typescript-eslint/naming-convention': 'off', | ||
}, | ||
}; |
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,79 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
*.lcov | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# TypeScript cache | ||
*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Microbundle cache | ||
.rpt2_cache/ | ||
.rts2_cache_cjs/ | ||
.rts2_cache_es/ | ||
.rts2_cache_umd/ | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
.env.test | ||
|
||
# Serverless directories | ||
.serverless/ | ||
|
||
# Stores VSCode versions used for testing VSCode extensions | ||
.vscode-test | ||
|
||
# yarn v2 | ||
.yarn/cache | ||
.yarn/unplugged | ||
.yarn/build-state.yml | ||
.yarn/install-state.gz | ||
.pnp.* | ||
|
||
# Vite output | ||
dist | ||
|
||
.vercel |
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,50 @@ | ||
# Hydrogen | ||
|
||
[Hydrogen](https://shopify.dev/custom-storefronts/hydrogen) is a React framework and SDK that you can use to build fast and dynamic Shopify custom storefronts. | ||
|
||
## Deploy Your Own | ||
|
||
Deploy your own Hydrogen project with Vercel. | ||
|
||
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/vercel/examples/tree/main/framework-boilerplates/hydrogen&template=hydrogen) | ||
|
||
_Live Example: https://hydrogen-template.vercel.app_ | ||
|
||
## Getting started | ||
|
||
**Requirements:** | ||
|
||
- Node.js version 16.5.0 or higher | ||
- Yarn | ||
|
||
To create a new Hydrogen app, run: | ||
|
||
```bash | ||
npm init @shopify/hydrogen | ||
``` | ||
|
||
## Running the dev server | ||
|
||
Then `cd` into the new directory and run: | ||
|
||
```bash | ||
npm install | ||
npm run dev | ||
``` | ||
|
||
Remember to update `hydrogen.config.js` with your shop's domain and Storefront API token! | ||
|
||
## Building for production | ||
|
||
```bash | ||
npm run build | ||
``` | ||
|
||
## Previewing a production build | ||
|
||
To run a local preview of your Hydrogen app in an environment similar to Oxygen, build your Hydrogen app and then run `npm run preview`: | ||
|
||
```bash | ||
npm run build | ||
npm run preview | ||
``` |
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,18 @@ | ||
import {defineConfig, CookieSessionStorage} from '@shopify/hydrogen/config'; | ||
|
||
export default defineConfig({ | ||
shopify: { | ||
defaultCountryCode: 'US', | ||
defaultLanguageCode: 'EN', | ||
storeDomain: 'hydrogen-preview.myshopify.com', | ||
storefrontToken: '3b580e70970c4528da70c98e097c2fa0', | ||
storefrontApiVersion: '2022-07', | ||
}, | ||
session: CookieSessionStorage('__session', { | ||
path: '/', | ||
httpOnly: true, | ||
secure: import.meta.env.PROD, | ||
sameSite: 'Strict', | ||
maxAge: 60 * 60 * 24 * 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,17 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/src/assets/favicon.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Hydrogen</title> | ||
<link rel="stylesheet" href="/src/styles/index.css" /> | ||
<link rel="preconnect" href="https://cdn.shopify.com" /> | ||
<link rel="preconnect" href="https://shop.app/" /> | ||
<link rel="preconnect" href="https://hydrogen-preview.myshopify.com/" /> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="/@shopify/hydrogen/entry-client"></script> | ||
</body> | ||
</html> |
Oops, something went wrong.