Skip to content

Commit c0a3c3c

Browse files
committed
Remove the exit when env file is not available
1 parent c610683 commit c0a3c3c

File tree

9 files changed

+28
-6
lines changed

9 files changed

+28
-6
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ jobs:
2121
- name: Install dependencies
2222
run: npm ci
2323

24+
- name: Copy Webpack config
25+
run: cp ./webpack/.env-example ./webpack/.env
26+
2427
- name: Build assets
2528
run: npm run build
2629

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ jobs:
2626
node-version: 16
2727

2828
- name: Lint js
29-
run: npm ci && npm run lint
29+
run: touch ./webpack/.env && npm ci && npm run lint

.github/workflows/typecheck.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ jobs:
1313
node-version: 16
1414

1515
- name: Build and check types
16-
run: npm ci && npm run build
16+
run: touch ./webpack/.env && npm ci && npm run build

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules
22
assets
3+
.env
34
coverage

CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ First you need to install every node module:
2626

2727
`npm ci`
2828

29+
then create a `.env` file inside the *webpack* folder by copying `webpack/.env-example` and complete it with your environment's informations. Please use a free tcp port.
30+
2931
then build assets:
3032

3133
`npm run build`

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ First you need to install every node module:
1515

1616
`npm ci`
1717

18+
then create a `.env` file inside the *webpack* folder by copying `webpack/.env-example` and complete it with your environment's informations. Please use a free tcp port.
19+
1820
then build assets:
1921

2022
`npm run build`

webpack/.env-example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
PORT=3505
2+
SERVER_ADDRESS=domain.local
3+
SITE_URL=http://domain.local
4+
PUBLIC_PATH=/themes/hummingbird/assets/

webpack/.env-no-vhost-example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
PORT=3506
2+
SERVER_ADDRESS=localhost
3+
SITE_URL=http://localhost:3506/
4+
PUBLIC_PATH=/ps-new-theme/themes/hummingbird/assets/

webpack/webpack.vars.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
const fs = require('fs');
22
const path = require('path');
3-
const publicPath = '/themes/hummingbird/assets/';
43
const themeDev = path.resolve(__dirname, '../src');
54

5+
const envFilePath = './webpack/.env';
6+
7+
if (fs.existsSync(envFilePath)) {
8+
require('dotenv').config({path: envFilePath});
9+
}
10+
611
const {
7-
PORT: port,
8-
SERVER_ADDRESS: serverAddress,
9-
SITE_URL: siteURL,
12+
PORT: port = null,
13+
PUBLIC_PATH: publicPath = null,
14+
SERVER_ADDRESS: serverAddress = null,
15+
SITE_URL: siteURL = null,
1016
} = process.env;
1117

1218
const entriesArray = {

0 commit comments

Comments
 (0)