jizy-packer 2.1.30 → 2.1.32
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/Rollup.js +1 -1
- package/lib/utils.js +9 -6
- package/package.json +1 -1
package/lib/Rollup.js
CHANGED
|
@@ -191,7 +191,7 @@ function onComplete() {
|
|
|
191
191
|
const src = path.join(jPackConfig.get('basePath'), 'build/example');
|
|
192
192
|
const dest = path.join(jPackConfig.get('basePath'), 'example');
|
|
193
193
|
moveFolderFiles(src, dest);
|
|
194
|
-
mirrorExampleFiles(
|
|
194
|
+
mirrorExampleFiles(dest, jPackConfig.get('alias'), jPackConfig.get('name'));
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
const onComplete = jPackConfig.get('onComplete');
|
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;
|