From 3e19237a62d6c5baebd99cbc2ea14c15e1f3c8f6 Mon Sep 17 00:00:00 2001 From: garikhg Date: Tue, 23 Jan 2024 00:11:14 +0400 Subject: [PATCH 1/4] Update path and introduce dotenv in update-version script This commit updates the file paths and introduces dotenv to load environment variables in 'update-version-in-files.js'. These changes provide better control over configuration settings from the environment, improving code maintainability. The file paths are also modified to correct the locations of 'style.scss' and 'functions.php', ensuring accurate file reference for version updates. --- .env | 1 + .github/scripts/update-version-in-files.js | 31 +++++++++++++--------- package.json | 4 ++- 3 files changed, 23 insertions(+), 13 deletions(-) create mode 100644 .env diff --git a/.env b/.env new file mode 100644 index 0000000..ac5834d --- /dev/null +++ b/.env @@ -0,0 +1 @@ +VERSION=1.0.6 diff --git a/.github/scripts/update-version-in-files.js b/.github/scripts/update-version-in-files.js index 671af02..02605e8 100644 --- a/.github/scripts/update-version-in-files.js +++ b/.github/scripts/update-version-in-files.js @@ -1,32 +1,39 @@ 'use strict'; -const replaceInFile = require('replace-in-file'); +const dotenv = require( 'dotenv' ); +const path = require( 'path' ); +dotenv.config( { path: path.resolve( __dirname, '.env' ) } ); +const replaceInFile = require( 'replace-in-file' ); -const {VERSION} = process.env; - -const replaceInFileWithLog = async (options) => { - const results = await replaceInFile(options); - console.log('Replacement results:', results, 'options: ', options); +const { VERSION } = process.env; +const replaceInFileWithLog = async ( options ) => { + const results = await replaceInFile( options ); + console.log( 'Replacement results:', results, 'options: ', options ); }; const run = async () => { try { await replaceInFileWithLog( { - files: './assets/scss/style.scss', + files: '../../assets/sass/style.scss', from: /Version:.*$/m, to: `Version: ${ VERSION }`, } ); await replaceInFileWithLog( { - files: './functions.php', + files: '../../assets/sass/style.scss', + from: /Stable tag:.*$/m, + to: `Stable tag: ${ VERSION }`, + } ); + + await replaceInFileWithLog( { + files: '../../functions.php', from: /WPKIT_ELEMENTOR_VERSION', '(.*?)'/m, to: `WPKIT_ELEMENTOR_VERSION', '${ VERSION }'`, } ); - } catch (err) { - console.error('Error occurred:', err); - process.exit(1); + } catch ( err ) { + console.error( 'Error occurred:', err ); + process.exit( 1 ); } } - run(); diff --git a/package.json b/package.json index cc21da3..70057e3 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "concurrently": "^8.2.2", "copy-webpack-plugin": "^11.0.0", "cssnano": "^6.0.3", + "dotenv": "^16.3.2", "eslint": "^8.56.0", "eslint-config-wordpress": "^2.0.0", "eslint-plugin-babel": "^5.3.1", @@ -48,6 +49,7 @@ "matchdep": "^2.0.0", "npm-build-zip": "^1.0.4", "react": "^18.2.0", + "replace-in-file": "^7.1.0", "rimraf": "^5.0.5", "sass": "^1.69.7", "terser-webpack-plugin": "^5.3.10", @@ -58,7 +60,7 @@ "@babel/plugin-transform-modules-commonjs": "^7.23.3", "@babel/plugin-transform-runtime": "^7.23.7", "@lodder/grunt-postcss": "^3.1.1", - "grunt-autoprefixer": "^3.0.0", + "grunt-autoprefixer": "^3.0.4", "grunt-cssnano": "^3.0.0" } } From aae15e0c2bf856bf664da05d6f6f5d06886d4f5f Mon Sep 17 00:00:00 2001 From: garikhg Date: Tue, 23 Jan 2024 00:11:50 +0400 Subject: [PATCH 2/4] Update WP Kit Elementor theme details This commit revises the author name and the version details in 'style.scss'. Changes in the author name ensure consistency across platforms while updating the version attributes keeps up with the recent advancements made within the WP Kit Elementor theme. --- assets/sass/style.scss | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/sass/style.scss b/assets/sass/style.scss index e424ba4..d0448a3 100644 --- a/assets/sass/style.scss +++ b/assets/sass/style.scss @@ -2,10 +2,10 @@ Theme Name: WP Kit Elementor Theme URI: https://wpkit.pro/themes/wpkit-elementor/ Description: WP Kit Elementor is a versatile and streamlined WordPress theme meticulously crafted to integrate seamlessly with the Elementor page builder plugin. This free and open-source theme is tailored for users seeking a nimble, user-friendly, and highly customizable website. Engineered for optimal performance, WP Kit Elementor establishes a robust groundwork, empowering users to fashion distinctive designs effortlessly through the intuitive Elementor drag-and-drop site builder. With its user-centric simplicity and adaptable features, WP Kit Elementor stands out as an excellent choice for both novices and seasoned web creators alike. -Author: WP Kit +Author: WpKit Author URI: https://wpkit.pro -Version: 1.0.5 -Stable tag: 1.0.5 +Version: 1.0.6 +Stable tag: 1.0.6 Requires at least: 6.0 Tested up to: 6.4 Requires PHP: 7.3 From 6b4c6ac4ba0a069d3b1a37510eca23c158ce8caf Mon Sep 17 00:00:00 2001 From: garikhg Date: Tue, 23 Jan 2024 00:12:07 +0400 Subject: [PATCH 3/4] Update WP Kit Elementor package-lock.json file This commit increases the version number of the wp-kit-elementor theme and the grunt-autoprefixer. It also adds dotenv and replace-in-file as new dependencies. These updates and additions help keep the WP --- package-lock.json | 174 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 164 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index 19d8a7f..254878e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,17 +1,17 @@ { - "name": "wp-kit-elementor-theme", - "version": "1.0.4", + "name": "wp-kit-elementor", + "version": "1.0.6", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "wp-kit-elementor-theme", - "version": "1.0.4", + "name": "wp-kit-elementor", + "version": "1.0.6", "dependencies": { "@babel/plugin-transform-modules-commonjs": "^7.23.3", "@babel/plugin-transform-runtime": "^7.23.7", "@lodder/grunt-postcss": "^3.1.1", - "grunt-autoprefixer": "^3.0.0", + "grunt-autoprefixer": "^3.0.4", "grunt-cssnano": "^3.0.0" }, "devDependencies": { @@ -30,6 +30,7 @@ "concurrently": "^8.2.2", "copy-webpack-plugin": "^11.0.0", "cssnano": "^6.0.3", + "dotenv": "^16.3.2", "eslint": "^8.56.0", "eslint-config-wordpress": "^2.0.0", "eslint-plugin-babel": "^5.3.1", @@ -49,6 +50,7 @@ "matchdep": "^2.0.0", "npm-build-zip": "^1.0.4", "react": "^18.2.0", + "replace-in-file": "^7.1.0", "rimraf": "^5.0.5", "sass": "^1.69.7", "terser-webpack-plugin": "^5.3.10", @@ -10484,6 +10486,18 @@ "node": ">=8" } }, + "node_modules/dotenv": { + "version": "16.3.2", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.2.tgz", + "integrity": "sha512-HTlk5nmhkm8F6JcdXvHIzaorzCoziNQT9mGxLPVXW8wJF1TiGSL60ZGB4gHWabHOaMmWmhvk2/lPHfnBiT78AQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/motdotla/dotenv?sponsor=1" + } + }, "node_modules/downshift": { "version": "6.1.12", "resolved": "https://registry.npmjs.org/downshift/-/downshift-6.1.12.tgz", @@ -13574,19 +13588,20 @@ } }, "node_modules/grunt-autoprefixer": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/grunt-autoprefixer/-/grunt-autoprefixer-3.0.0.tgz", - "integrity": "sha512-X8WNqgXH6e8/qCpbx5pky3JiVY2iTsn+bglwS81B83sxav+XAw7wLAtYS129rAT5CgHT9H3F5dlxDtyyKX1bMw==", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/grunt-autoprefixer/-/grunt-autoprefixer-3.0.4.tgz", + "integrity": "sha512-WlLnLOGoQFI/IQj6vbx+Kx/KMmJn5g1Fkx6rcp5+9VRIFwN46uSSi3BC8HMteHTZ/KA+zAqST957TkoiSDIujw==", "dependencies": { "autoprefixer-core": "^5.1.7", "chalk": "~1.0.0", - "diff": "~1.3.0" + "diff": "~1.3.0", + "postcss": "^4.1.11" }, "engines": { "node": ">= 0.10.0" }, "peerDependencies": { - "grunt": "~0.4.2" + "grunt": ">=0.4.2" } }, "node_modules/grunt-autoprefixer/node_modules/ansi-regex": { @@ -13636,6 +13651,27 @@ "node": ">=0.8.0" } }, + "node_modules/grunt-autoprefixer/node_modules/postcss": { + "version": "4.1.16", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-4.1.16.tgz", + "integrity": "sha512-aAutxE8MvL1bHylFMYb2c2nniFax8XDztHzZ+x5DVsNJnoW6VHvGSNSqdW3+ip255HCWfPjayVVFzMmyiL7opA==", + "dependencies": { + "es6-promise": "~2.3.0", + "js-base64": "~2.1.8", + "source-map": "~0.4.2" + } + }, + "node_modules/grunt-autoprefixer/node_modules/source-map": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", + "integrity": "sha512-Y8nIfcb1s/7DcobUz1yOO1GSp7gyL+D9zLHDehT7iRESqGSxjJ448Sg7rvfgsRJCnKLdSl11uGf0s9X80cH0/A==", + "dependencies": { + "amdefine": ">=0.0.4" + }, + "engines": { + "node": ">=0.8.0" + } + }, "node_modules/grunt-autoprefixer/node_modules/strip-ansi": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-2.0.1.tgz", @@ -23797,6 +23833,124 @@ "node": ">=0.10" } }, + "node_modules/replace-in-file": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/replace-in-file/-/replace-in-file-7.1.0.tgz", + "integrity": "sha512-1uZmJ78WtqNYCSuPC9IWbweXkGxPOtk2rKuar8diTw7naVIQZiE3Tm8ACx2PCMXDtVH6N+XxwaRY2qZ2xHPqXw==", + "dev": true, + "dependencies": { + "chalk": "^4.1.2", + "glob": "^8.1.0", + "yargs": "^17.7.2" + }, + "bin": { + "replace-in-file": "bin/cli.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/replace-in-file/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/replace-in-file/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/replace-in-file/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/replace-in-file/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/replace-in-file/node_modules/glob": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/replace-in-file/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/replace-in-file/node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/replace-in-file/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/requestidlecallback": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/requestidlecallback/-/requestidlecallback-0.3.0.tgz", From a50f6c3b084c2c6203c04ed5b10766d17221373c Mon Sep 17 00:00:00 2001 From: garikhg Date: Tue, 23 Jan 2024 00:12:10 +0400 Subject: [PATCH 4/4] Update webpack.config.js in WP Kit Elementor theme This update extends the webpack configuration of the wp-kit-elementor theme by including '**/.env' in the build process. The adjustment is implemented to ensure that dotenv, a newly added dependency, functions as expected. This change, along with updating the version numbers of wp-kit-elementor theme and grunt-autoprefixer --- webpack.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/webpack.config.js b/webpack.config.js index 5afebc0..ba0d995 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -29,6 +29,7 @@ const copyPluginConfig = new CopyPlugin( { ...Object.keys( entry ).map( ( key ) => `**/assets/js/${ key }.min.asset.php` ), '**.zip', '**.css', + '**/.env', '**/karma.conf.js', '**/assets/scripts/**', '**/assets/sass/**',