Skip to content

Commit

Permalink
Remove the exit when env file is not available
Browse files Browse the repository at this point in the history
  • Loading branch information
nicosomb committed Jun 13, 2024
1 parent 6669451 commit 4003aec
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ jobs:
- name: Install dependencies
run: npm ci

- name: Copy Webpack config
run: cp ./webpack/.env-example ./webpack/.env

- name: Build assets
run: npm run build

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ jobs:
node-version: 16

- name: Lint js
run: npm ci && npm run lint
run: touch ./webpack/.env && npm ci && npm run lint
2 changes: 1 addition & 1 deletion .github/workflows/typecheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ jobs:
node-version: 16

- name: Build and check types
run: npm ci && npm run build
run: touch ./webpack/.env && npm ci && npm run build
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
assets
.env
coverage
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ First you need to install every node module:

`npm ci`

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.

then build assets:

`npm run build`
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ First you need to install every node module:

`npm ci`

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.

then build assets:

`npm run build`
Expand Down
4 changes: 4 additions & 0 deletions webpack/.env-example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
PORT=3505
SERVER_ADDRESS=domain.local
SITE_URL=http://domain.local
PUBLIC_PATH=/themes/hummingbird/assets/
4 changes: 4 additions & 0 deletions webpack/.env-no-vhost-example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
PORT=3506
SERVER_ADDRESS=localhost
SITE_URL=http://localhost:3506/
PUBLIC_PATH=/ps-new-theme/themes/hummingbird/assets/
14 changes: 10 additions & 4 deletions webpack/webpack.vars.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
const fs = require('fs');
const path = require('path');
const publicPath = '/themes/hummingbird/assets/';
const themeDev = path.resolve(__dirname, '../src');

const envFilePath = './webpack/.env';

if (fs.existsSync(envFilePath)) {
require('dotenv').config({path: envFilePath});
}

const {
PORT: port,
SERVER_ADDRESS: serverAddress,
SITE_URL: siteURL,
PORT: port = null,
PUBLIC_PATH: publicPath = null,
SERVER_ADDRESS: serverAddress = null,
SITE_URL: siteURL = null,
} = process.env;

const entriesArray = {
Expand Down

0 comments on commit 4003aec

Please sign in to comment.