@jtff/miztemplate-lib 3.0.5 → 3.0.6

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.
@@ -250,7 +250,10 @@ class MizTemplateCI{
250
250
  }
251
251
 
252
252
  async InjectCiScriptsIntoWorkspace(workspacePath) {
253
- fs.cpSync(getInstalledPathSync('@jtff/miztemplate-lib',{local: true}) + '/ci',workspacePath + '/.workspace/src/nodejs',{recursive: true});
253
+
254
+ this.mizlib.copyRecursiveSync(getInstalledPathSync('@jtff/miztemplate-lib',{local: true}) + '/ci', workspacePath + '/.workspace/src/nodejs');
255
+
256
+ // fs.cpSync(getInstalledPathSync('@jtff/miztemplate-lib',{local: true}) + '/ci',workspacePath + '/.workspace/src/nodejs',{recursive: true});
254
257
  }
255
258
 
256
259
  async deployCIScriptsFromZipObjectIntoWorkspace(workspacePath, mizObject, mizFilePath) {
package/lib/mizlib.js CHANGED
@@ -42,7 +42,7 @@ class Mizlib {
42
42
  colorString
43
43
  );
44
44
  for (let luaScript of luaScriptsArray) {
45
- fs.cpSync(
45
+ fs.copyFileSync(
46
46
  [
47
47
  getInstalledPathSync('@jtff/miztemplate-lib',{local: true}),
48
48
  '/lua/',
@@ -56,8 +56,7 @@ class Mizlib {
56
56
  folderPath,
57
57
  "/",
58
58
  path.basename(luaScript)
59
- ].join(""),
60
- {force: true}
59
+ ].join("")
61
60
  );
62
61
  }
63
62
  return tuple;
@@ -121,16 +120,14 @@ class Mizlib {
121
120
  .filter(filename => path.extname(filename).toLowerCase()==='.lua');
122
121
  for (let file of srcFiles) {
123
122
  console.log('updating src/' + file + ' from the miztemplate-lib');
124
- fs.cpSync(getInstalledPathSync('@jtff/miztemplate-lib',{local: true}) + '/lua/src/' + file,
125
- '.workspace/src/' + file,
126
- {force: true}
123
+ fs.copyFileSync(getInstalledPathSync('@jtff/miztemplate-lib',{local: true}) + '/lua/src/' + file,
124
+ '.workspace/src/' + file
127
125
  );
128
126
  }
129
127
  for (let file of libFiles) {
130
128
  console.log('updating lib/' + file + ' from the miztemplate-lib');
131
- fs.cpSync(getInstalledPathSync('@jtff/miztemplate-lib',{local: true}) + '/lua/lib/' + file,
132
- '.workspace/lib/' + file,
133
- {force: true}
129
+ fs.copyFileSync(getInstalledPathSync('@jtff/miztemplate-lib',{local: true}) + '/lua/lib/' + file,
130
+ '.workspace/lib/' + file
134
131
  );
135
132
  }
136
133
  this.injectLuaFilesFromFolderIntoZipObject(zipObject, '.workspace/src', mizSettingSubFolder);
@@ -330,6 +327,22 @@ class Mizlib {
330
327
  }
331
328
  }
332
329
 
330
+ copyRecursiveSync(src, dest) {
331
+ let exists = fs.existsSync(src);
332
+ let stats = exists && fs.statSync(src);
333
+ let isDirectory = exists && stats.isDirectory();
334
+ if (isDirectory) {
335
+ fs.mkdirSync(dest);
336
+ fs.readdirSync(src).forEach(function(childItemName) {
337
+ copyRecursiveSync(path.join(src, childItemName),
338
+ path.join(dest, childItemName));
339
+ });
340
+ } else {
341
+ fs.copyFileSync(src, dest);
342
+ }
343
+ };
344
+
345
+
333
346
  async updateWorkspaceWithSingleSoundFolder(workspacePath, folderString) {
334
347
  if (
335
348
  fs.existsSync(
@@ -359,11 +372,16 @@ class Mizlib {
359
372
  "/.workspace/resources/sounds/",
360
373
  folderString
361
374
  ].join(""), {recursive: true});
362
- fs.cpSync(getInstalledPathSync('@jtff/miztemplate-lib',{local: true}) + '/resources/sounds/' + folderString,[
375
+ this.copyRecursiveSync(getInstalledPathSync('@jtff/miztemplate-lib',{local: true}) + '/resources/sounds/' + folderString,[
363
376
  workspacePath,
364
377
  "/.workspace/resources/sounds/",
365
378
  folderString
366
- ].join(""), {recursive: true});
379
+ ].join(""));
380
+ // fs.cpSync(getInstalledPathSync('@jtff/miztemplate-lib',{local: true}) + '/resources/sounds/' + folderString,[
381
+ // workspacePath,
382
+ // "/.workspace/resources/sounds/",
383
+ // folderString
384
+ // ].join(""), {recursive: true});
367
385
  }
368
386
  }
369
387
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jtff/miztemplate-lib",
3
- "version": "3.0.5",
3
+ "version": "3.0.6",
4
4
  "description": "JTFF mission template library",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -473,7 +473,8 @@ function injectScripts(jtffci, env_mission) {
473
473
  if ((/^y\b|o\b|yes\b|oui\b/i).test(prompt_result.inject_radio_presets)) {
474
474
  // injection des preset radio
475
475
  fs.mkdirSync(workspacePath + '/resources/radios/' + missionObject.theatre,{recursive: true});
476
- fs.cpSync(getInstalledPathSync('@jtff/miztemplate-lib',{local: true}) + '/resources/radios/' + missionObject.theatre,workspacePath + '/resources/radios/' + missionObject.theatre,{recursive: true})
476
+ jtffci.mizlib.copyRecursiveSync(getInstalledPathSync('@jtff/miztemplate-lib',{local: true}) + '/resources/radios/' + missionObject.theatre,workspacePath + '/resources/radios/' + missionObject.theatre);
477
+ // fs.cpSync(getInstalledPathSync('@jtff/miztemplate-lib',{local: true}) + '/resources/radios/' + missionObject.theatre,workspacePath + '/resources/radios/' + missionObject.theatre,{recursive: true})
477
478
  console.log(destinationMizFilePath + ": injecting radio presets declared in resources/radios/" + missionObject.theatre);
478
479
  await jtffci.mizlib.injectRadioPresetsFromFolderIntoZipObject(mizObject, workspacePath + '/resources/radios/' + missionObject.theatre);
479
480
  }