Skip to content

Commit

Permalink
feat: ✨ add script solution
Browse files Browse the repository at this point in the history
  • Loading branch information
HofmannZ committed Nov 13, 2023
1 parent 844865d commit 4749cd6
Show file tree
Hide file tree
Showing 66 changed files with 4,109 additions and 288 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"@types/react": "18.2.37",
"@types/react-dom": "18.2.15",
"eslint": "8.53.0",
"eslint-config-next": "14.0.1",
"next": "14.0.1",
"eslint-config-next": "14.0.2",
"next": "14.0.2",
"next-runtime-env": "link:../..",
"react": "18.2.0",
"react-dom": "18.2.0",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions examples/with-app-router-script/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}
36 changes: 36 additions & 0 deletions examples/with-app-router-script/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build
/public/__ENV.js

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
1 change: 1 addition & 0 deletions examples/with-app-router-script/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
39 changes: 39 additions & 0 deletions examples/with-app-router-script/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
## Getting Started

First, run the development server:

```bash
NEXT_PUBLIC_FOO=foo-value BAR=bar-value BAZ=baz-value npm run dev
# or
NEXT_PUBLIC_FOO=foo-value BAR=bar-value BAZ=baz-value yarn dev
# or
NEXT_PUBLIC_FOO=foo-value BAR=bar-value BAZ=baz-value pnpm dev
```

Open [http://localhost:3000/client-side](http://localhost:3000/client-side) or
[http://localhost:3000/server-side](http://localhost:3000/server-side) with your
browser to see the development result.

Next, build the app without the environment variables:

```bash
npm run build
# or
yarn build
# or
pnpm build
```

Finally, run the production server with the environment variables:

```bash
NEXT_PUBLIC_FOO=foo-value BAR=bar-value BAZ=baz-value npm run start
# or
NEXT_PUBLIC_FOO=foo-value BAR=bar-value BAZ=baz-value yarn start
# or
NEXT_PUBLIC_FOO=foo-value BAR=bar-value BAZ=baz-value pnpm start
```

Open [http://localhost:3000/client-side](http://localhost:3000/client-side) or
[http://localhost:3000/server-side](http://localhost:3000/server-side) with your
browser to see the production result.
10 changes: 10 additions & 0 deletions examples/with-app-router-script/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
// This is optional incase you want to make some private env vars publicly
// available.
instrumentationHook: true,
},
};

module.exports = nextConfig;
23 changes: 23 additions & 0 deletions examples/with-app-router-script/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "with-app-router",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@types/node": "20.9.0",
"@types/react": "18.2.37",
"@types/react-dom": "18.2.15",
"eslint": "8.53.0",
"eslint-config-next": "14.0.2",
"next": "14.0.2",
"next-runtime-env": "link:../..",
"react": "18.2.0",
"react-dom": "18.2.0",
"typescript": "5.2.2"
}
}
Loading

0 comments on commit 4749cd6

Please sign in to comment.