@jtff/miztemplate-lib 3.0.0-rc20 → 3.0.0-rc22

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/ci/build.js CHANGED
@@ -1,6 +1,6 @@
1
1
  const templatelib = require('@jtff/miztemplate-lib');
2
2
 
3
- const config = require("../../config.json");
3
+ const config = require("../../../config.json");
4
4
  const jtffci = new templatelib.MizTemplateCI(config);
5
5
 
6
6
  templatelib.build(jtffci);
package/ci/clean.js CHANGED
@@ -1,4 +1,4 @@
1
1
  const templatelib = require('@jtff/miztemplate-lib');
2
- const config = require("../../config.json");
2
+ const config = require("../../../config.json");
3
3
 
4
4
  templatelib.clean(config);
package/ci/ftpupload.js CHANGED
@@ -1,6 +1,6 @@
1
1
  const templatelib = require('@jtff/miztemplate-lib');
2
2
 
3
- const config = require("../../config.json");
3
+ const config = require("../../../config.json");
4
4
  const jtffci = new templatelib.MizTemplateCI(config);
5
5
 
6
6
  templatelib.ftpupload(jtffci);
@@ -1,6 +1,6 @@
1
1
  const templatelib = require('@jtff/miztemplate-lib');
2
2
 
3
- const config = require("../../config.json");
3
+ const config = require("../../../config.json");
4
4
  const jtffci = new templatelib.MizTemplateCI(config);
5
5
 
6
6
  templatelib.gdriveupload(jtffci);
@@ -1,6 +1,6 @@
1
1
  const templatelib = require('@jtff/miztemplate-lib');
2
2
 
3
- const config = require("../../config.json");
3
+ const config = require("../../../config.json");
4
4
  const jtffci = new templatelib.MizTemplateCI(config);
5
5
 
6
6
  templatelib.getmizfiles(jtffci);
@@ -1,6 +1,6 @@
1
1
  const templatelib = require('@jtff/miztemplate-lib');
2
2
 
3
- const config = require("../../config.json");
3
+ const config = require("../../../config.json");
4
4
  const jtffci = new templatelib.MizTemplateCI(config);
5
5
 
6
6
  if (process.argv.slice(2).length > 0) {
@@ -1,5 +1,5 @@
1
1
  const templatelib = require('@jtff/miztemplate-lib');
2
- const config = require("../../config.json");
2
+ const config = require("../../../config.json");
3
3
  const jtffci = new templatelib.MizTemplateCI(config);
4
4
 
5
5
  templatelib.injectScripts(jtffci, process.env.npm_config_mission);
@@ -1,5 +1,5 @@
1
1
  const templatelib = require('@jtff/miztemplate-lib');
2
- const config = require("../../config.json");
2
+ const config = require("../../../config.json");
3
3
  const jtffci = new templatelib.MizTemplateCI(config);
4
4
 
5
5
  templatelib.nextversionPrepare(jtffci, "./config.json");
package/ci/release.js CHANGED
@@ -1,5 +1,5 @@
1
1
  const templatelib = require('@jtff/miztemplate-lib');
2
- const config = require("../../config.json");
2
+ const config = require("../../../config.json");
3
3
  const jtffci = new templatelib.MizTemplateCI(config);
4
4
 
5
5
  templatelib.release(jtffci, "./config.json");
@@ -1,5 +1,5 @@
1
1
  const templatelib = require('@jtff/miztemplate-lib');
2
- const config = require("../../config.json");
2
+ const config = require("../../../config.json");
3
3
  const jtffci = new templatelib.MizTemplateCI(config);
4
4
 
5
5
  templatelib.templateUpdate(jtffci);
@@ -230,15 +230,15 @@ class MizTemplateCI{
230
230
  "description": "build jtff-style missions",
231
231
  "main": "none",
232
232
  "scripts": {
233
- "build": "node src/nodejs/build.js",
234
- "clean": "node src/nodejs/clean.js",
235
- "template-update": "node src/nodejs/template-update.js",
236
- "nextversion-prepare": "node src/nodejs/prepare-nextversion.js",
237
- "version": "node src/nodejs/getset-version.js",
238
- "release": "node src/nodejs/release.js",
239
- "getmiz": "node src/nodejs/get-mizfiles.js",
240
- "gdrive-upload": "node src/nodejs/gdrive-upload.js",
241
- "ftp-upload": "node src/nodejs/ftpupload.js"
233
+ "build": "node .workspace/src/nodejs/build.js",
234
+ "clean": "node .workspace/src/nodejs/clean.js",
235
+ "template-update": "node .workspace/src/nodejs/template-update.js",
236
+ "nextversion-prepare": "node .workspace/src/nodejs/prepare-nextversion.js",
237
+ "version": "node .workspace/src/nodejs/getset-version.js",
238
+ "release": "node .workspace/src/nodejs/release.js",
239
+ "getmiz": "node .workspace/src/nodejs/get-mizfiles.js",
240
+ "gdrive-upload": "node .workspace/src/nodejs/gdrive-upload.js",
241
+ "ftp-upload": "node .workspace/src/nodejs/ftpupload.js"
242
242
  },
243
243
  "author": "Sebastien LONGO",
244
244
  "license": "GPL-3.0-or-later",
package/lib/mizlib.js CHANGED
@@ -119,20 +119,21 @@ class Mizlib {
119
119
  for (let file of srcFiles) {
120
120
  console.log('updating src/' + file + ' from the miztemplate-lib');
121
121
  fs.cpSync('node_modules/@jtff/miztemplate-lib/lua/src/' + file,
122
- 'src/' + file,
122
+ '.workspace/src/' + file,
123
123
  {force: true}
124
124
  );
125
125
  }
126
126
  for (let file of libFiles) {
127
127
  console.log('updating lib/' + file + ' from the miztemplate-lib');
128
128
  fs.cpSync('node_modules/@jtff/miztemplate-lib/lua/lib/' + file,
129
- 'lib/' + file,
129
+ '.workspace/lib/' + file,
130
130
  {force: true}
131
131
  );
132
132
  }
133
+ this.injectLuaFilesFromFolderIntoZipObject(zipObject, '.workspace/src');
134
+ this.injectLuaFilesFromFolderIntoZipObject(zipObject, '.workspace/lib');
133
135
  this.injectLuaFilesFromFolderIntoZipObject(zipObject, 'src');
134
- this.injectLuaFilesFromFolderIntoZipObject(zipObject, 'lib');
135
- zipObject = await this.injectRadioPresetsFromFolderIntoZipObject(zipObject, 'resources/radios/' + strTheatreSettings);
136
+ await this.injectRadioPresetsFromFolderIntoZipObject(zipObject, 'resources/radios/' + strTheatreSettings);
136
137
  this.injectSettingsLuaFilesFromFolderIntoZipObject(zipObject, singleMission ? '' : strTheatreSettings);
137
138
  await this.injectSoundFoldersIntoZipObject(zipObject);
138
139
  const inputZip = await zipObject.generateAsync({
@@ -318,7 +319,13 @@ class Mizlib {
318
319
  if (fs.existsSync('resources/sounds') && fs.lstatSync('resources/sounds').isDirectory()) {
319
320
  const folderArray = fs.readdirSync('resources/sounds');
320
321
  for (const folder of folderArray) {
321
- await this.injectSingleSoundFolderIntoZipObject(zip, folder);
322
+ await this.injectSingleSoundFolderIntoZipObject(zip, '.', folder, false);
323
+ }
324
+ }
325
+ if (fs.existsSync('.workspace/resources/sounds') && fs.lstatSync('.workspace/resources/sounds').isDirectory()) {
326
+ const folderArray = fs.readdirSync('.workspace/resources/sounds');
327
+ for (const folder of folderArray) {
328
+ await this.injectSingleSoundFolderIntoZipObject(zip, '.', folder, true);
322
329
  }
323
330
  }
324
331
  }
@@ -362,14 +369,16 @@ class Mizlib {
362
369
 
363
370
  async injectSingleSoundFolderIntoZipObject(zip, workspacePath, folder, fromLibrary = true) {
364
371
  if (
365
- fs.existsSync([workspacePath,fromLibrary? '/.workspace/resources/sounds/' : '/resources/sounds/',folder].join('')) &&
366
- fs.lstatSync([workspacePath,fromLibrary? '/.workspace/resources/sounds/' : '/resources/sounds/',folder].join('')).isDirectory()) {
367
- console.log(['adding sound files from ',workspacePath,fromLibrary? '/.workspace/resources/sounds/' : '/resources/sounds/',folder,' folder...'].join(''));
368
- zip = zip.remove(folder).folder(folder);
372
+ fs.existsSync([workspacePath,fromLibrary? '/.workspace/resources/sounds/'+folder : '/resources/sounds'].join('')) &&
373
+ fs.lstatSync([workspacePath,fromLibrary? '/.workspace/resources/sounds/'+folder : '/resources/sounds'].join('')).isDirectory()) {
374
+ console.log(['adding sound files from ',workspacePath,fromLibrary? '/.workspace/resources/sounds/'+folder : '/resources/sounds',' folder...'].join(''));
375
+ if (fromLibrary) {
376
+ zip = zip.remove(folder).folder(folder);
377
+ }
369
378
  await this.addFilesToZip(
370
379
  zip,
371
- [workspacePath,fromLibrary? '/.workspace/resources/sounds/' : '/resources/sounds/',folder].join(''),
372
- fs.readdirSync([workspacePath,fromLibrary? '/.workspace/resources/sounds/' : '/resources/sounds/',folder].join('')));
380
+ [workspacePath,fromLibrary? '/.workspace/resources/sounds/'+folder : '/resources/sounds'].join(''),
381
+ fs.readdirSync([workspacePath,fromLibrary? '/.workspace/resources/sounds/'+folder : '/resources/sounds'].join('')));
373
382
  }
374
383
  }
375
384
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jtff/miztemplate-lib",
3
- "version": "3.0.0-rc20",
3
+ "version": "3.0.0-rc22",
4
4
  "description": "JTFF mission template library",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -514,19 +514,10 @@ function injectScripts(jtffci, env_mission) {
514
514
  level: 9
515
515
  }
516
516
  }));
517
+ // generation des outils CI JTFF
517
518
  await jtffci.deployCIScriptsFromZipObjectIntoWorkspace(workspacePath, mizObject, env_mission);
518
519
  console.log('...Done...');
519
520
  return 0;
520
- // fs.writeFileSync(destinationMizFilePath, inputZip);
521
- // await fs.createWriteStream(destinationMizFilePath, await mizObject.generateNodeStream({
522
- // type: 'nodebuffer',
523
- // streamFiles: true,
524
- // compression: "DEFLATE",
525
- // compressionOptions: {
526
- // level: 9
527
- // }
528
- // }));
529
- // generation des outils CI JTFF
530
521
  });
531
522
  }
532
523