Skip to content

Commit

Permalink
More updates to use app_name and app_local_port
Browse files Browse the repository at this point in the history
  • Loading branch information
doshitan committed Jan 7, 2025
1 parent 3aa4a52 commit e57712d
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 13 deletions.
5 changes: 5 additions & 0 deletions template/{{app_name}}/.env.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# !! Don't put secrets in this file. Use .env.local for secrets instead !!
# This file is checked into your git repo and provides defaults for non-sensitive
# env vars when running `next` commands.
# Learn more: https://nextjs.org/docs/app/building-your-application/configuring/environment-variables
PORT={{ app_local_port }}
12 changes: 7 additions & 5 deletions template/{{app_name}}/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.PHONY: release-build dev storybook stop pre-dev

include Makefile.config

# Docker user configuration
# This logic is to avoid issues with permissions and mounting local volumes,
# which should be owned by the same UID for Linux distros. Mac OS can use root,
Expand Down Expand Up @@ -46,12 +48,12 @@ container-npm-install: # Install NPM packages from within Docker
fi

dev: # Run the Next.js local dev server in Docker
docker compose up --detach nextjs
docker compose logs --follow nextjs
docker compose up --detach $(APP_NAME)
docker compose logs --follow $(APP_NAME)

storybook: # Run the Storybook local dev server in Docker
docker compose up --detach storybook
docker compose logs --follow storybook
docker compose up --detach $(APP_NAME)-storybook
docker compose logs --follow $(APP_NAME)-storybook

stop:
docker compose down
docker compose down
1 change: 1 addition & 0 deletions template/{{app_name}}/Makefile.config.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
APP_NAME := {{ app_name }}
4 changes: 2 additions & 2 deletions template/{{app_name}}/README.md.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ From the `{{ app_name }}/` directory:
```bash
npm run dev
```
1. Navigate to [localhost:3000](http://localhost:3000) to view the application
1. Navigate to [localhost:{{ app_local_port }}](http://localhost:{{ app_local_port }}) to view the application

##### Other scripts

Expand All @@ -73,7 +73,7 @@ From the `{{ app_name }}/` directory:
```bash
make dev
```
1. Navigate to [localhost:3000](http://localhost:3000) to view the application
1. Navigate to [localhost:{{ app_local_port }}](http://localhost:{{ app_local_port }}) to view the application

##### Other scripts

Expand Down
9 changes: 4 additions & 5 deletions template/{{app_name}}/docker-compose.yml.jinja
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Local development compose file
services:
nextjs:
container_name: next-dev
{{ app_name }}:
build:
context: .
target: dev
env_file:
- ./.env
# Add your non-secret environment variables to this file:
- ./.env.development
# If you have secrets, add them to this file and uncomment this line:
Expand All @@ -15,10 +15,9 @@ services:
- ./public:/app/public
restart: always
ports:
- 3000:3000
- {{ app_local_port }}:{{ app_local_port }}

storybook:
container_name: storybook
{{ app_name}}-storybook:
build:
context: ./
target: dev
Expand Down
2 changes: 1 addition & 1 deletion template/{{app_name}}/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"lint": "next lint --dir src --dir stories --dir .storybook --dir tests --dir scripts --dir app --dir lib --dir types",
"lint-fix": "npm run lint -- --fix",
"postinstall": "node ./scripts/postinstall.js",
"start": "next start -p ${PORT:-3000}",
"start": "next start",
"storybook": "storybook dev -p 6006",
"storybook-build": "storybook build",
"test": "jest --ci --coverage",
Expand Down

0 comments on commit e57712d

Please sign in to comment.