From 632ee35e9976b06581473243f823e53af77e3820 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Tue, 21 May 2024 11:13:48 +0200 Subject: [PATCH 1/3] Removed .env configuration --- .github/workflows/build.yml | 5 +---- .github/workflows/lint.yml | 2 +- .github/workflows/typecheck.yml | 2 +- .gitignore | 1 - CONTRIBUTING.md | 2 -- README.md | 2 -- webpack/.env-example | 4 ---- webpack/.env-no-vhost-example | 4 ---- webpack/webpack.vars.js | 11 +---------- 9 files changed, 4 insertions(+), 29 deletions(-) delete mode 100644 webpack/.env-example delete mode 100644 webpack/.env-no-vhost-example diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f3a6b65d5..b023c09c1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,9 +21,6 @@ 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 @@ -96,4 +93,4 @@ jobs: upload_url: ${{ steps.release_info.outputs.upload_url }} asset_path: ./${{ github.event.repository.name }}/${{ github.event.repository.name }}.zip asset_name: ${{ github.event.repository.name }}.zip - asset_content_type: application/zip \ No newline at end of file + asset_content_type: application/zip diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index b822c2abb..f800b0d0c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -26,4 +26,4 @@ jobs: node-version: 16 - name: Lint js - run: touch ./webpack/.env && npm ci && npm run lint + run: npm ci && npm run lint diff --git a/.github/workflows/typecheck.yml b/.github/workflows/typecheck.yml index 57ed2ea80..8b622c3cc 100644 --- a/.github/workflows/typecheck.yml +++ b/.github/workflows/typecheck.yml @@ -13,4 +13,4 @@ jobs: node-version: 16 - name: Build and check types - run: touch ./webpack/.env && npm ci && npm run build + run: npm ci && npm run build diff --git a/.gitignore b/.gitignore index 34c4f5f31..269bca3ef 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ node_modules assets -.env coverage diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index dbc1871a1..423e14a0d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -26,8 +26,6 @@ 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` diff --git a/README.md b/README.md index 9acc2a27c..1e93e4aab 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,6 @@ 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` diff --git a/webpack/.env-example b/webpack/.env-example deleted file mode 100644 index 33f3c5134..000000000 --- a/webpack/.env-example +++ /dev/null @@ -1,4 +0,0 @@ -PORT=3505 -SERVER_ADDRESS=domain.local -SITE_URL=http://domain.local -PUBLIC_PATH=/themes/hummingbird/assets/ diff --git a/webpack/.env-no-vhost-example b/webpack/.env-no-vhost-example deleted file mode 100644 index 8bbe6cad6..000000000 --- a/webpack/.env-no-vhost-example +++ /dev/null @@ -1,4 +0,0 @@ -PORT=3506 -SERVER_ADDRESS=localhost -SITE_URL=http://localhost:3506/ -PUBLIC_PATH=/ps-new-theme/themes/hummingbird/assets/ diff --git a/webpack/webpack.vars.js b/webpack/webpack.vars.js index ebd350768..f8809ebca 100644 --- a/webpack/webpack.vars.js +++ b/webpack/webpack.vars.js @@ -1,19 +1,10 @@ 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}); -} else { - console.error('\x1b[41m\x1b[37m%s\x1b[0m', 'Your .env file not exits. Read getting started section in documentation for more information https://github.com/PrestaShop/hummingbird?tab=readme-ov-file#how-to-build-assets/.'); - process.exit(); -} const { PORT: port, - PUBLIC_PATH: publicPath, SERVER_ADDRESS: serverAddress, SITE_URL: siteURL, } = process.env; From 84455a78bb1a7572c01093c9def7708b1daf2344 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Fri, 31 May 2024 11:37:02 +0200 Subject: [PATCH 2/3] Remove the exit when env file is not available --- .github/workflows/build.yml | 3 +++ .github/workflows/lint.yml | 2 +- .github/workflows/typecheck.yml | 2 +- .gitignore | 1 + CONTRIBUTING.md | 2 ++ README.md | 2 ++ webpack/.env-example | 4 ++++ webpack/.env-no-vhost-example | 4 ++++ webpack/webpack.vars.js | 14 ++++++++++---- 9 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 webpack/.env-example create mode 100644 webpack/.env-no-vhost-example diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b023c09c1..b8378e78e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index f800b0d0c..b822c2abb 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -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 diff --git a/.github/workflows/typecheck.yml b/.github/workflows/typecheck.yml index 8b622c3cc..57ed2ea80 100644 --- a/.github/workflows/typecheck.yml +++ b/.github/workflows/typecheck.yml @@ -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 diff --git a/.gitignore b/.gitignore index 269bca3ef..34c4f5f31 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules assets +.env coverage diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 423e14a0d..dbc1871a1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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` diff --git a/README.md b/README.md index 1e93e4aab..9acc2a27c 100644 --- a/README.md +++ b/README.md @@ -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` diff --git a/webpack/.env-example b/webpack/.env-example new file mode 100644 index 000000000..33f3c5134 --- /dev/null +++ b/webpack/.env-example @@ -0,0 +1,4 @@ +PORT=3505 +SERVER_ADDRESS=domain.local +SITE_URL=http://domain.local +PUBLIC_PATH=/themes/hummingbird/assets/ diff --git a/webpack/.env-no-vhost-example b/webpack/.env-no-vhost-example new file mode 100644 index 000000000..8bbe6cad6 --- /dev/null +++ b/webpack/.env-no-vhost-example @@ -0,0 +1,4 @@ +PORT=3506 +SERVER_ADDRESS=localhost +SITE_URL=http://localhost:3506/ +PUBLIC_PATH=/ps-new-theme/themes/hummingbird/assets/ diff --git a/webpack/webpack.vars.js b/webpack/webpack.vars.js index f8809ebca..46dad4189 100644 --- a/webpack/webpack.vars.js +++ b/webpack/webpack.vars.js @@ -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 = { From 103cddebc94e1e0a8cd42b3e1a6f08f50db015c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Tue, 4 Jun 2024 16:56:22 +0200 Subject: [PATCH 3/3] try to fix ui test --- templates/catalog/_partials/miniatures/product.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/catalog/_partials/miniatures/product.tpl b/templates/catalog/_partials/miniatures/product.tpl index 6dba1ad1c..e2591a89c 100644 --- a/templates/catalog/_partials/miniatures/product.tpl +++ b/templates/catalog/_partials/miniatures/product.tpl @@ -176,7 +176,7 @@ {/block} - {if $product.add_to_cart_url && $product.product_type !== 'combinations'} + {if $product.add_to_cart_url}