@jtff/miztemplate-lib 3.0.0-rc23 → 3.0.0-rc24
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/mizlib.js +11 -11
- package/package.json +1 -1
- package/scripts/build.js +2 -2
package/lib/mizlib.js
CHANGED
|
@@ -108,7 +108,7 @@ class Mizlib {
|
|
|
108
108
|
return MizFile.loadAsync(mizData);
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
async buildMizFileFromMizTemplate(mizPath, copyPath,
|
|
111
|
+
async buildMizFileFromMizTemplate(mizPath, copyPath, mizSettingSubFolder= '') {
|
|
112
112
|
const zipObject = await this.getZipObjectFromMizPath(mizPath);
|
|
113
113
|
const missionObject = await this.getMissionObjectFromZipObject(zipObject);
|
|
114
114
|
const strTheatreSettings = missionObject.theatre;
|
|
@@ -130,11 +130,11 @@ class Mizlib {
|
|
|
130
130
|
{force: true}
|
|
131
131
|
);
|
|
132
132
|
}
|
|
133
|
-
this.injectLuaFilesFromFolderIntoZipObject(zipObject, '.workspace/src');
|
|
134
|
-
this.injectLuaFilesFromFolderIntoZipObject(zipObject, '.workspace/lib');
|
|
135
|
-
this.injectLuaFilesFromFolderIntoZipObject(zipObject, 'src');
|
|
133
|
+
this.injectLuaFilesFromFolderIntoZipObject(zipObject, '.workspace/src', mizSettingSubFolder);
|
|
134
|
+
this.injectLuaFilesFromFolderIntoZipObject(zipObject, '.workspace/lib', mizSettingSubFolder);
|
|
135
|
+
this.injectLuaFilesFromFolderIntoZipObject(zipObject, ['src',mizSettingSubFolder.length > 0 ? '/' + mizSettingSubFolder : ''].join(''), mizSettingSubFolder);
|
|
136
136
|
await this.injectRadioPresetsFromFolderIntoZipObject(zipObject, 'resources/radios/' + strTheatreSettings);
|
|
137
|
-
this.injectSettingsLuaFilesFromFolderIntoZipObject(zipObject,
|
|
137
|
+
this.injectSettingsLuaFilesFromFolderIntoZipObject(zipObject, mizSettingSubFolder.length > 0 ? mizSettingSubFolder : '');
|
|
138
138
|
await this.injectSoundFoldersIntoZipObject(zipObject);
|
|
139
139
|
const inputZip = await zipObject.generateAsync({
|
|
140
140
|
type: 'nodebuffer',
|
|
@@ -236,9 +236,9 @@ class Mizlib {
|
|
|
236
236
|
return zipStream.file("l10n/DEFAULT/mapResource").async("string");
|
|
237
237
|
}
|
|
238
238
|
|
|
239
|
-
injectLuaFilesFromFolderIntoZipObject(zip, folderPath) {
|
|
239
|
+
injectLuaFilesFromFolderIntoZipObject(zip, folderPath, mizSettingSubFolder) {
|
|
240
240
|
for (let file of fs.readdirSync(folderPath).filter(file => file.endsWith(".lua"))) {
|
|
241
|
-
console.log('injecting up2date ' + folderPath + '/' + file + ' file in archive');
|
|
241
|
+
console.log('injecting up2date ' + folderPath + '/' + file + ' file in ' + mizSettingSubFolder + ' archive');
|
|
242
242
|
this.injectFileIntoZipObject(zip, folderPath + "/" + file);
|
|
243
243
|
};
|
|
244
244
|
}
|
|
@@ -308,10 +308,10 @@ class Mizlib {
|
|
|
308
308
|
this.injectMissionObjectIntoZipObject(zip, {mission: mission_object});
|
|
309
309
|
}
|
|
310
310
|
|
|
311
|
-
injectSettingsLuaFilesFromFolderIntoZipObject(zip,
|
|
312
|
-
for (let file of fs.readdirSync(['settings',
|
|
313
|
-
console.log(['updating settings',
|
|
314
|
-
this.injectFileIntoZipObject(zip, ['settings',
|
|
311
|
+
injectSettingsLuaFilesFromFolderIntoZipObject(zip, settingsSubFolder) {
|
|
312
|
+
for (let file of fs.readdirSync(['settings',settingsSubFolder.length > 0 ? '/' + settingsSubFolder : ''].join('')).filter(file => path.extname(file).toLowerCase()==='.lua')) {
|
|
313
|
+
console.log(['updating settings',settingsSubFolder.length > 0 ? '/' + settingsSubFolder : '','/',file,' file in miz file'].join(''));
|
|
314
|
+
this.injectFileIntoZipObject(zip, ['settings',settingsSubFolder.length > 0 ? '/' + settingsSubFolder : '','/',file].join(''));
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
317
|
|
package/package.json
CHANGED
package/scripts/build.js
CHANGED
|
@@ -7,7 +7,7 @@ function build(jtffci) {
|
|
|
7
7
|
await jtffci.mizlib.buildMizFileFromMizTemplate(
|
|
8
8
|
missionTemplate.filename,
|
|
9
9
|
jtffci.getDestinationMizFilePathFromConfigMissionTemplate(missionTemplate),
|
|
10
|
-
(jtffci.config.missionTemplates.length > 1) ?
|
|
10
|
+
(jtffci.config.missionTemplates.length > 1) ? missionTemplate.theatre : '');
|
|
11
11
|
} else {
|
|
12
12
|
await jtffci.mizlib.buildMizFileFromMizTemplate([
|
|
13
13
|
[missionTemplate.prefix,
|
|
@@ -15,7 +15,7 @@ function build(jtffci) {
|
|
|
15
15
|
".miz"
|
|
16
16
|
].join(""),
|
|
17
17
|
jtffci.getDestinationMizFilePathFromConfigMissionTemplate(missionTemplate),
|
|
18
|
-
|
|
18
|
+
missionTemplate.theatre);
|
|
19
19
|
}
|
|
20
20
|
let publicationConfig = {
|
|
21
21
|
theatre: missionTemplate.theatre,
|