@iservice-dev/is-wp-plugin-kit 1.6.4 → 1.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/vite/index.js +8 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iservice-dev/is-wp-plugin-kit",
3
- "version": "1.6.4",
3
+ "version": "1.6.5",
4
4
  "description": "A toolkit for WordPress plugin development with Vite, TypeScript, and modern build tools",
5
5
  "type": "module",
6
6
  "main": "vite/index.js",
package/vite/index.js CHANGED
@@ -43,6 +43,13 @@ export function wpPluginKitVite(userOptions = {}) {
43
43
  { src: "assets/src/legacy/js/*.js", dest: "js" },
44
44
  ];
45
45
 
46
+ // Filter out targets where source path doesn't exist or has no files
47
+ const cwd = userOptions.cwd ?? process.cwd();
48
+ const validTargets = staticCopyTargets.filter((target) => {
49
+ const files = fg.sync(target.src, { cwd });
50
+ return files.length > 0;
51
+ });
52
+
46
53
  return defineConfig({
47
54
  base: "./",
48
55
 
@@ -94,7 +101,7 @@ export function wpPluginKitVite(userOptions = {}) {
94
101
 
95
102
  css: { postcss: "./postcss.config.cjs" },
96
103
 
97
- plugins: [viteStaticCopy({ targets: staticCopyTargets })],
104
+ plugins: [viteStaticCopy({ targets: validTargets })],
98
105
 
99
106
  ...userOptions,
100
107
  });