@jtff/miztemplate-lib 3.0.0-rc16 → 3.0.0-rc17
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/jtff-lib-ci.js +11 -1
- package/lib/mizlib.js +25 -8
- package/package.json +1 -1
- package/scripts/build.js +8 -17
package/lib/jtff-lib-ci.js
CHANGED
|
@@ -59,7 +59,7 @@ class MizTemplateCI{
|
|
|
59
59
|
return newVersionObject;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
getDestinationMizFilePathArrayFromConfig() {
|
|
63
63
|
const returnArray = this.config.missionTemplates.map(missionTemplate => {
|
|
64
64
|
return this.config.general.missionFolder + '/'
|
|
65
65
|
+ this.config.general.missionPrefix + '_'
|
|
@@ -70,6 +70,16 @@ class MizTemplateCI{
|
|
|
70
70
|
return returnArray;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
getDestinationMizFilePathFromConfigMissionTemplate(missionTemplate) {
|
|
74
|
+
const destinationMizPath = [this.config.general.missionFolder + '/',
|
|
75
|
+
this.config.general.missionPrefix + '_',
|
|
76
|
+
missionTemplate.theatre + '_',
|
|
77
|
+
this.config.general.missionSuffix.length > 0 ? this.config.general.missionSuffix + '_' : '',
|
|
78
|
+
this.config.general.missionVersion + '.miz'].join('')
|
|
79
|
+
;
|
|
80
|
+
return destinationMizPath;
|
|
81
|
+
}
|
|
82
|
+
|
|
73
83
|
getGeneratedMizFilePaths() {
|
|
74
84
|
return fs.readdirSync(this.config.general.missionFolder + '/')
|
|
75
85
|
.filter(file => file.endsWith((".miz")))
|
package/lib/mizlib.js
CHANGED
|
@@ -111,12 +111,29 @@ class Mizlib {
|
|
|
111
111
|
const zipObject = await this.getZipObjectFromMizPath(mizPath);
|
|
112
112
|
const missionObject = await this.getMissionObjectFromZipObject(zipObject);
|
|
113
113
|
const strTheatreSettings = missionObject.theatre;
|
|
114
|
-
|
|
114
|
+
const srcFiles = fs.readdirSync("node_modules/@jtff/miztemplate-lib/lua/src",{recursive: true})
|
|
115
|
+
.filter(filename => path.extname(filename).toLowerCase()==='.lua' && !(filename.startsWith('200-')));
|
|
116
|
+
const libFiles = fs.readdirSync("node_modules/@jtff/miztemplate-lib/lua/lib",{recursive: true})
|
|
117
|
+
.filter(filename => path.extname(filename).toLowerCase()==='.lua');
|
|
118
|
+
for (let file of srcFiles) {
|
|
119
|
+
console.log('updating src/' + file + ' from the miztemplate-lib');
|
|
120
|
+
fs.cpSync('node_modules/@jtff/miztemplate-lib/lua/src/' + file,
|
|
121
|
+
'src/' + file,
|
|
122
|
+
{force: true}
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
for (let file of libFiles) {
|
|
126
|
+
console.log('updating lib/' + file + ' from the miztemplate-lib');
|
|
127
|
+
fs.cpSync('node_modules/@jtff/miztemplate-lib/lua/lib/' + file,
|
|
128
|
+
'lib/' + file,
|
|
129
|
+
{force: true}
|
|
130
|
+
);
|
|
131
|
+
}
|
|
115
132
|
this.injectLuaFilesFromFolderIntoZipObject(zipObject, 'src');
|
|
116
133
|
this.injectLuaFilesFromFolderIntoZipObject(zipObject, 'lib');
|
|
117
134
|
await this.injectRadioPresetsFromFolderIntoZipObject(zipObject, 'resources/radios/' + strTheatreSettings);
|
|
118
|
-
this.
|
|
119
|
-
await this.
|
|
135
|
+
this.injectSettingsLuaFilesFromFolderIntoZipObject(zipObject, singleMission ? '' : strTheatreSettings);
|
|
136
|
+
await this.injectSoundFoldersIntoZipObject(zipObject);
|
|
120
137
|
const inputZip = await zipObject.generateAsync({
|
|
121
138
|
type: 'nodebuffer',
|
|
122
139
|
streamFiles: true,
|
|
@@ -290,14 +307,14 @@ class Mizlib {
|
|
|
290
307
|
this.mizUpdateMissionDataFile(zip, {mission: mission_object});
|
|
291
308
|
}
|
|
292
309
|
|
|
293
|
-
|
|
294
|
-
for (let file of fs.readdirSync(['settings',strTheatre].join('
|
|
295
|
-
console.log('updating
|
|
296
|
-
this.injectFileIntoZipObject(zip, ['settings',strTheatre,file].join('
|
|
310
|
+
injectSettingsLuaFilesFromFolderIntoZipObject(zip, strTheatre) {
|
|
311
|
+
for (let file of fs.readdirSync(['settings',strTheatre.length > 0 ? '/' + strTheatre : ''].join('')).filter(file => path.extname(file).toLowerCase()==='.lua')) {
|
|
312
|
+
console.log(['updating settings',strTheatre.length > 0 ? '/' + strTheatre : '','/',file,' file in miz file'].join(''));
|
|
313
|
+
this.injectFileIntoZipObject(zip, ['settings',strTheatre.length > 0 ? '/' + strTheatre : '','/',file].join(''));
|
|
297
314
|
}
|
|
298
315
|
}
|
|
299
316
|
|
|
300
|
-
async
|
|
317
|
+
async injectSoundFoldersIntoZipObject(zip) {
|
|
301
318
|
if (fs.existsSync('resources/sounds') && fs.lstatSync('resources/sounds').isDirectory()) {
|
|
302
319
|
const folderArray = fs.readdirSync('resources/sounds');
|
|
303
320
|
for (const folder of folderArray) {
|
package/package.json
CHANGED
package/scripts/build.js
CHANGED
|
@@ -6,25 +6,16 @@ function build(jtffci) {
|
|
|
6
6
|
if (missionTemplate.filename) {
|
|
7
7
|
await jtffci.mizlib.buildMizFileFromMizTemplate(
|
|
8
8
|
missionTemplate.filename,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
missionTemplate.theatre,
|
|
12
|
-
jtffci.config.general.missionSuffix,
|
|
13
|
-
jtffci.displayVersion(jtffci.getVersion())].join('_'),
|
|
14
|
-
".miz"
|
|
15
|
-
].join(""),(jtffci.config.missionTemplates.length > 1) ? false : true);
|
|
9
|
+
jtffci.getDestinationMizFilePathFromConfigMissionTemplate(missionTemplate),
|
|
10
|
+
(jtffci.config.missionTemplates.length > 1) ? false : true);
|
|
16
11
|
} else {
|
|
17
12
|
await jtffci.mizlib.buildMizFileFromMizTemplate([
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
jtffci.config.general.missionSuffix,
|
|
25
|
-
jtffci.displayVersion(jtffci.getVersion())].join('_'),
|
|
26
|
-
".miz"
|
|
27
|
-
].join(""), false);
|
|
13
|
+
[missionTemplate.prefix,
|
|
14
|
+
missionTemplate.theatre].join('_'),
|
|
15
|
+
".miz"
|
|
16
|
+
].join(""),
|
|
17
|
+
jtffci.getDestinationMizFilePathFromConfigMissionTemplate(missionTemplate),
|
|
18
|
+
false);
|
|
28
19
|
}
|
|
29
20
|
let publicationConfig = {
|
|
30
21
|
theatre: missionTemplate.theatre,
|