jizy-packer 2.1.30 → 2.1.31
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.
- package/lib/utils.js +9 -6
- package/package.json +1 -1
package/lib/utils.js
CHANGED
|
@@ -3,9 +3,6 @@ import path from 'path';
|
|
|
3
3
|
import LogMe from './LogMe.js';
|
|
4
4
|
import { fileURLToPath } from 'url';
|
|
5
5
|
|
|
6
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
-
const __dirname = path.dirname(__filename);
|
|
8
|
-
|
|
9
6
|
export function emptyTargetPath(targetPath, removeEmpty = false) {
|
|
10
7
|
if (!fs.existsSync(targetPath)) {
|
|
11
8
|
if (removeEmpty) {
|
|
@@ -139,9 +136,11 @@ export function moveFolderFiles(src, dest, overwrite = true, empty = true) {
|
|
|
139
136
|
* - js/main.js
|
|
140
137
|
* - images/
|
|
141
138
|
*/
|
|
142
|
-
export function mirrorExampleFiles(
|
|
143
|
-
const
|
|
144
|
-
const
|
|
139
|
+
export function mirrorExampleFiles(targetDir, moduleAlias, moduleName) {
|
|
140
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
141
|
+
const __dirname = path.dirname(__filename);
|
|
142
|
+
|
|
143
|
+
const exampleDir = path.join(__dirname, '/../_example');
|
|
145
144
|
|
|
146
145
|
fs.mkdirSync(targetDir, { recursive: true });
|
|
147
146
|
|
|
@@ -163,6 +162,10 @@ export function mirrorExampleFiles(dest, moduleAlias, moduleName) {
|
|
|
163
162
|
return;
|
|
164
163
|
}
|
|
165
164
|
|
|
165
|
+
if (!fs.existsSync(srcPath)) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
|
|
166
169
|
if (fs.lstatSync(srcPath).isDirectory()) {
|
|
167
170
|
fs.mkdirSync(destPath, { recursive: true });
|
|
168
171
|
return;
|