Compare commits

..

4 Commits

Author SHA1 Message Date
Vercel Release Bot
7682c9234c Version Packages (#10343)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## vercel@31.3.1

### Patch Changes

- Updated dependencies
\[[`844fb6e88`](844fb6e880)]:
    -   @vercel/remix-builder@1.10.1

## @vercel/remix-builder@1.10.1

### Patch Changes

- Set default env vars for Hydrogen v2 deployments
([#10341](https://github.com/vercel/vercel/pull/10341))

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-08-14 18:13:53 -07:00
Nathan Rajlich
844fb6e880 [remix] Set default env vars for Hydrogen v2 deployments (#10341)
In order to make the default mock shop created from `npm create @shopify/hydrogen@latest` work out-of-the-box and without additional configuration, set the necessary default environment variables to make the server not render an error.
2023-08-15 01:11:01 +00:00
Nathan Rajlich
ae20c7230f [cli] Use vercel-php@0.6.0 in e2e test fixture (#10342)
`0.5.2` uses Node 14, so this test was failing.

<img width="934" alt="Screenshot 2023-08-14 at 5 13 31 PM"
src="https://github.com/vercel/vercel/assets/71256/654c8f71-6006-4b98-9ef0-fe288651d158">
2023-08-14 17:50:52 -07:00
Nathan Rajlich
a36b8eb738 [examples] Update "hydrogen-2" template readme (#10340)
A few tweaks to the readme file for `hydrogen-2`, based on feedback from
Shopify.
2023-08-14 16:05:12 -07:00
10 changed files with 38 additions and 31 deletions

View File

@@ -34,10 +34,15 @@ Hydrogen is Shopifys stack for headless commerce. Hydrogen is designed to dov
## Environment Variables
Using Hydrogen requires a few environment variables to be set in order to properly connect to Shopify. For this template, the minimal set of environment variables are defined in the `vercel.json` file, which will be applied to the deployment when deployed to Vercel. However, you should migrate these default environment variables to your Project's Environment Variables configuration in the Vercel dashboard (or using the `vc env` commands), and update them according to your needs (also change the `SESSION_SECRET` to your own value).
Using Hydrogen requires a few [environment variables](https://shopify.dev/docs/custom-storefronts/hydrogen/environment-variables) to be set in order to properly connect to Shopify. For this template, the minimal set of environment variables are defined in the `vercel.json` file, which will be applied to the deployment when deployed to Vercel. However, you should migrate these default environment variables to your Project's Environment Variables configuration in the Vercel dashboard (or using the `vc env` commands), and update them according to your needs (also change the `SESSION_SECRET` to your own value). Once that is done, delete the `vercel.json` file from your project to prevent the environment variables defined there from taking precedence.
## Local development
Rename the `.env.example` file to `.env` in order for the Shopify dev server to use those environment variables during local development. If you defined/modified additional environment variables based on the section above, be sure to apply those changes in your `.env` file as well.
Then run the following commands:
```bash
npm install
npm run dev
```

View File

@@ -1,5 +1,12 @@
# vercel
## 31.3.1
### Patch Changes
- Updated dependencies [[`844fb6e88`](https://github.com/vercel/vercel/commit/844fb6e880a980f26945f15a7437b4d67bcb5394)]:
- @vercel/remix-builder@1.10.1
## 31.3.0
### Minor Changes

View File

@@ -1,6 +1,6 @@
{
"name": "vercel",
"version": "31.3.0",
"version": "31.3.1",
"preferGlobal": true,
"license": "Apache-2.0",
"description": "The command-line interface for Vercel",
@@ -38,7 +38,7 @@
"@vercel/node": "2.15.10",
"@vercel/python": "3.1.60",
"@vercel/redwood": "1.1.15",
"@vercel/remix-builder": "1.10.0",
"@vercel/remix-builder": "1.10.1",
"@vercel/ruby": "1.3.76",
"@vercel/static-build": "1.3.46"
},

View File

@@ -334,7 +334,7 @@ module.exports = async function prepare(session, binaryPath, tmpFixturesDir) {
'vercel.json': JSON.stringify({
functions: {
'api/**/*.php': {
runtime: 'vercel-php@0.5.2',
runtime: 'vercel-php@0.6.0',
},
},
}),

View File

@@ -1,5 +1,11 @@
# @vercel/remix-builder
## 1.10.1
### Patch Changes
- Set default env vars for Hydrogen v2 deployments ([#10341](https://github.com/vercel/vercel/pull/10341))
## 1.10.0
### Minor Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/remix-builder",
"version": "1.10.0",
"version": "1.10.1",
"license": "Apache-2.0",
"main": "./dist/index.js",
"homepage": "https://vercel.com/docs",

View File

@@ -97,9 +97,22 @@ export function patchHydrogenServer(
.join(', ')}) ${fetchMethod.getBody()!.getText()}`;
defaultExportSymbol.replaceWithText(newFunction);
const defaultEnvVars = {
SESSION_SECRET: 'foobar',
PUBLIC_STORE_DOMAIN: 'mock.shop',
};
const envCode = `const env = { ${envProperties
.map(name => `${name}: process.env.${name}`)
.join(', ')} };`;
.join(', ')} };\n${Object.entries(defaultEnvVars)
.map(
([k, v]) =>
`if (!env.${k}) { env.${k} = ${JSON.stringify(
v
)}; console.warn('Warning: ${JSON.stringify(
k
)} env var not set - using default value ${JSON.stringify(v)}'); }`
)
.join('\n')}`;
const updatedCodeString = sourceFile.getFullText();
return `${envCode}\n${updatedCodeString}`;

View File

@@ -1,12 +0,0 @@
{
"build": {
"env":{
"SESSION_SECRET":"foobar",
"PUBLIC_STORE_DOMAIN":"mock.shop"
}
},
"env":{
"SESSION_SECRET":"foobar",
"PUBLIC_STORE_DOMAIN":"mock.shop"
}
}

View File

@@ -1,12 +0,0 @@
{
"build": {
"env":{
"SESSION_SECRET":"foobar",
"PUBLIC_STORE_DOMAIN":"mock.shop"
}
},
"env":{
"SESSION_SECRET":"foobar",
"PUBLIC_STORE_DOMAIN":"mock.shop"
}
}

2
pnpm-lock.yaml generated
View File

@@ -328,7 +328,7 @@ importers:
specifier: 1.1.15
version: link:../redwood
'@vercel/remix-builder':
specifier: 1.10.0
specifier: 1.10.1
version: link:../remix
'@vercel/ruby':
specifier: 1.3.76