From ccb67709ea7a93e9611ff3357a20e14172829cee Mon Sep 17 00:00:00 2001 From: XanderWP Date: Fri, 6 Feb 2026 04:05:42 +0200 Subject: [PATCH 1/2] build(webpack): copy src/types into dist using copy-webpack-plugin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add copy-webpack-plugin and configure webpack to copy files from src/types into the build output while preserving the src → dist structure. This ensures type declarations are included in the distribution so consumers can resolve typings. Also add the dependency to package.json. --- package-lock.json | 74 +++++++++++++++++++++++++++++++++++++++++++++++ package.json | 1 + webpack.config.js | 17 +++++++++++ 3 files changed, 92 insertions(+) diff --git a/package-lock.json b/package-lock.json index 3197891..54fcb79 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,6 +16,7 @@ "@types/webpack": "^5.28.5", "@typescript-eslint/eslint-plugin": "^6.15.0", "@typescript-eslint/parser": "^6.15.0", + "copy-webpack-plugin": "^13.0.1", "eslint": "^8.56.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-prettier": "^5.2.1", @@ -2478,6 +2479,30 @@ "dev": true, "license": "MIT" }, + "node_modules/copy-webpack-plugin": { + "version": "13.0.1", + "resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-13.0.1.tgz", + "integrity": "sha512-J+YV3WfhY6W/Xf9h+J1znYuqTye2xkBUIGyTPWuBAT27qajBa5mR4f8WBmfDY3YjRftT2kqZZiLi1qf0H+UOFw==", + "dev": true, + "license": "MIT", + "dependencies": { + "glob-parent": "^6.0.1", + "normalize-path": "^3.0.0", + "schema-utils": "^4.2.0", + "serialize-javascript": "^6.0.2", + "tinyglobby": "^0.2.12" + }, + "engines": { + "node": ">= 18.12.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.1.0" + } + }, "node_modules/create-jest": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/create-jest/-/create-jest-29.7.0.tgz", @@ -5870,6 +5895,55 @@ "dev": true, "license": "MIT" }, + "node_modules/tinyglobby": { + "version": "0.2.15", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz", + "integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.3" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/tinyglobby/node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/tinyglobby/node_modules/picomatch": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/tmpl": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", diff --git a/package.json b/package.json index fa178bb..aacf147 100644 --- a/package.json +++ b/package.json @@ -52,6 +52,7 @@ "@types/webpack": "^5.28.5", "@typescript-eslint/eslint-plugin": "^6.15.0", "@typescript-eslint/parser": "^6.15.0", + "copy-webpack-plugin": "^13.0.1", "eslint": "^8.56.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-prettier": "^5.2.1", diff --git a/webpack.config.js b/webpack.config.js index 743e6fd..3730563 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,4 +1,5 @@ const path = require('path'); +const CopyWebpackPlugin = require('copy-webpack-plugin'); const config = { entry: { @@ -33,6 +34,22 @@ const config = { optimization: { minimize: false, }, + plugins: [ + new CopyWebpackPlugin({ + patterns: [ + { + from: 'src/types', + to({ context, absoluteFilename }) { + // сохраняем структуру src → dist + return path.relative( + path.resolve(__dirname, 'src'), + absoluteFilename + ); + }, + }, + ], + }), + ], }; module.exports = config; From 777079fd014d24b7d74b2d4ccbd73f99b09998c3 Mon Sep 17 00:00:00 2001 From: XanderWP Date: Fri, 6 Feb 2026 04:06:27 +0200 Subject: [PATCH 2/2] 1.3.1 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 54fcb79..c4223de 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@xxanderwp/env-types-webpack-plugin", - "version": "1.3.0", + "version": "1.3.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@xxanderwp/env-types-webpack-plugin", - "version": "1.3.0", + "version": "1.3.1", "license": "MIT", "devDependencies": { "@types/eslint__eslintrc": "^2.1.2", diff --git a/package.json b/package.json index aacf147..11e0fa0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@xxanderwp/env-types-webpack-plugin", - "version": "1.3.0", + "version": "1.3.1", "description": "Webpack plugin that automatically generates TypeScript definitions for environment variables from .env files", "main": "dist/EnvTypesPlugin.js", "types": "dist/EnvTypesPlugin.d.ts",