jizy-packer 2.1.39 → 2.1.41
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 +3 -3
- package/lib/utils.js +4 -6
- package/package.json +1 -1
package/lib/Rollup.js
CHANGED
|
@@ -193,9 +193,9 @@ function onComplete() {
|
|
|
193
193
|
moveFolderFiles(src, dest);
|
|
194
194
|
|
|
195
195
|
const replacements = {
|
|
196
|
-
'
|
|
197
|
-
'
|
|
198
|
-
'
|
|
196
|
+
'%MODULE_ALIAS%': jPackConfig.get('alias'),
|
|
197
|
+
'%MODULE_NAME%': jPackConfig.get('name'),
|
|
198
|
+
'%VERSION%': jPackConfig.get('version'),
|
|
199
199
|
};
|
|
200
200
|
mirrorExampleFiles(dest, replacements);
|
|
201
201
|
}
|
package/lib/utils.js
CHANGED
|
@@ -143,7 +143,7 @@ export function mirrorExampleFiles(targetDir, replacements) {
|
|
|
143
143
|
const exampleDir = path.join(__dirname, '/../_example');
|
|
144
144
|
|
|
145
145
|
fs.mkdirSync(targetDir, { recursive: true });
|
|
146
|
-
|
|
146
|
+
|
|
147
147
|
const files = [
|
|
148
148
|
'css/',
|
|
149
149
|
'js/',
|
|
@@ -173,13 +173,11 @@ export function mirrorExampleFiles(targetDir, replacements) {
|
|
|
173
173
|
|
|
174
174
|
let content = fs.readFileSync(srcPath);
|
|
175
175
|
if (content) {
|
|
176
|
-
replacements.forEach(
|
|
177
|
-
|
|
178
|
-
const regex = new RegExp(placeholder, 'g');
|
|
179
|
-
content = content.toString().replace(regex, value);
|
|
176
|
+
Object.entries(replacements).forEach(([key, value]) => {
|
|
177
|
+
content = content.toString().replace(new RegExp(`%${key}%`, "g"), value);
|
|
180
178
|
});
|
|
181
179
|
}
|
|
182
|
-
|
|
180
|
+
|
|
183
181
|
fs.writeFileSync(destPath, content, { encoding: 'utf8' });
|
|
184
182
|
});
|
|
185
183
|
};
|