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

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.
Files changed (74) hide show
  1. package/ci/build.js +6 -0
  2. package/ci/clean.js +4 -0
  3. package/ci/ftpupload.js +6 -0
  4. package/ci/gdrive-upload.js +6 -0
  5. package/ci/get-mizfiles.js +6 -0
  6. package/ci/getset-version.js +10 -0
  7. package/ci/inject-scripts.js +5 -0
  8. package/ci/prepare-nextversion.js +5 -0
  9. package/ci/release.js +5 -0
  10. package/ci/template-update.js +5 -0
  11. package/index.js +2 -2
  12. package/lib/jtff-lib-ci.js +74 -2
  13. package/lib/mizlib.js +376 -284
  14. package/lua/src/199-skynet.lua +1 -1
  15. package/package.json +4 -2
  16. package/resources/radios/Caucasus/354th-caucasus.lua +124 -0
  17. package/resources/radios/Caucasus/494th-caucasus.lua +91 -0
  18. package/resources/radios/Caucasus/79th-SUFA-caucasus.lua +65 -0
  19. package/resources/radios/Caucasus/79th-caucasus.lua +65 -0
  20. package/resources/radios/Caucasus/ec25-D-caucasus.lua +65 -0
  21. package/resources/radios/Caucasus/ec25-caucasus.lua +65 -0
  22. package/resources/radios/Caucasus/vf84-a-caucasus.lua +75 -0
  23. package/resources/radios/Caucasus/vf84-b-caucasus.lua +75 -0
  24. package/resources/radios/Caucasus/vfa-131-caucasus.lua +65 -0
  25. package/resources/radios/Caucasus/vmfa-314-caucasus.lua +65 -0
  26. package/resources/radios/Mariana/354th-marianas.lua +124 -0
  27. package/resources/radios/Mariana/494th-marianas.lua +91 -0
  28. package/resources/radios/Mariana/79th-marianas.lua +65 -0
  29. package/resources/radios/Mariana/ec25-marianas.lua +65 -0
  30. package/resources/radios/Mariana/vf84-a-marianas.lua +75 -0
  31. package/resources/radios/Mariana/vf84-b-marianas.lua +75 -0
  32. package/resources/radios/Mariana/vfa-131-marianas.lua +65 -0
  33. package/resources/radios/Mariana/vmfa-314-marianas.lua +65 -0
  34. package/resources/radios/NTTR/354th-nttr.lua +124 -0
  35. package/resources/radios/NTTR/494th-nttr.lua +91 -0
  36. package/resources/radios/NTTR/79th-nttr.lua +65 -0
  37. package/resources/radios/NTTR/ec25-nttr.lua +65 -0
  38. package/resources/radios/NTTR/vf84-a-nttr.lua +75 -0
  39. package/resources/radios/NTTR/vf84-b-nttr.lua +75 -0
  40. package/resources/radios/NTTR/vfa-131-nttr.lua +65 -0
  41. package/resources/radios/NTTR/vmfa-314-nttr.lua +65 -0
  42. package/resources/radios/PersianGulf/354th-persian.lua +124 -0
  43. package/resources/radios/PersianGulf/3_30-persian.lua +65 -0
  44. package/resources/radios/PersianGulf/494th-persian.lua +91 -0
  45. package/resources/radios/PersianGulf/79th-persian.lua +65 -0
  46. package/resources/radios/PersianGulf/ec25-persian.lua +65 -0
  47. package/resources/radios/PersianGulf/vf84-a-persian.lua +75 -0
  48. package/resources/radios/PersianGulf/vf84-b-persian.lua +75 -0
  49. package/resources/radios/PersianGulf/vfa-131-persian.lua +65 -0
  50. package/resources/radios/PersianGulf/vmfa-314-persian.lua +65 -0
  51. package/resources/radios/SinaiMap/354th-sinai.lua +124 -0
  52. package/resources/radios/SinaiMap/494th-sinai.lua +91 -0
  53. package/resources/radios/SinaiMap/79th-SUFA-sinai.lua +65 -0
  54. package/resources/radios/SinaiMap/79th-sinai.lua +65 -0
  55. package/resources/radios/SinaiMap/ec25-D-sinai.lua +65 -0
  56. package/resources/radios/SinaiMap/ec25-sinai.lua +65 -0
  57. package/resources/radios/SinaiMap/vf84-a-sinai.lua +75 -0
  58. package/resources/radios/SinaiMap/vf84-b-sinai.lua +75 -0
  59. package/resources/radios/SinaiMap/vfa-131-sinai.lua +65 -0
  60. package/resources/radios/SinaiMap/vmfa-314-sinai.lua +65 -0
  61. package/resources/radios/Syria/354th-syria.lua +124 -0
  62. package/resources/radios/Syria/494th-syria.lua +91 -0
  63. package/resources/radios/Syria/79th-SUFA-syria.lua +65 -0
  64. package/resources/radios/Syria/79th-syria.lua +65 -0
  65. package/resources/radios/Syria/ec25-D-syria.lua +65 -0
  66. package/resources/radios/Syria/ec25-syria.lua +65 -0
  67. package/resources/radios/Syria/vf84-a-syria.lua +75 -0
  68. package/resources/radios/Syria/vf84-b-syria.lua +75 -0
  69. package/resources/radios/Syria/vfa-131-syria.lua +65 -0
  70. package/resources/radios/Syria/vmfa-314-syria.lua +65 -0
  71. package/scripts/build.js +15 -18
  72. package/scripts/inject-scripts.js +281 -355
  73. package/scripts/template-update.js +1 -1
  74. package/resources/radios/.gitkeep +0 -0
package/ci/build.js ADDED
@@ -0,0 +1,6 @@
1
+ const templatelib = require('@jtff/miztemplate-lib');
2
+
3
+ const config = require("../../config.json");
4
+ const jtffci = new templatelib.MizTemplateCI(config);
5
+
6
+ templatelib.build(jtffci);
package/ci/clean.js ADDED
@@ -0,0 +1,4 @@
1
+ const templatelib = require('@jtff/miztemplate-lib');
2
+ const config = require("../../config.json");
3
+
4
+ templatelib.clean(config);
@@ -0,0 +1,6 @@
1
+ const templatelib = require('@jtff/miztemplate-lib');
2
+
3
+ const config = require("../../config.json");
4
+ const jtffci = new templatelib.MizTemplateCI(config);
5
+
6
+ templatelib.ftpupload(jtffci);
@@ -0,0 +1,6 @@
1
+ const templatelib = require('@jtff/miztemplate-lib');
2
+
3
+ const config = require("../../config.json");
4
+ const jtffci = new templatelib.MizTemplateCI(config);
5
+
6
+ templatelib.gdriveupload(jtffci);
@@ -0,0 +1,6 @@
1
+ const templatelib = require('@jtff/miztemplate-lib');
2
+
3
+ const config = require("../../config.json");
4
+ const jtffci = new templatelib.MizTemplateCI(config);
5
+
6
+ templatelib.getmizfiles(jtffci);
@@ -0,0 +1,10 @@
1
+ const templatelib = require('@jtff/miztemplate-lib');
2
+
3
+ const config = require("../../config.json");
4
+ const jtffci = new templatelib.MizTemplateCI(config);
5
+
6
+ if (process.argv.slice(2).length > 0) {
7
+ templatelib.setVersion(jtffci, process.argv.slice(2)[0], "./config.json");
8
+ } else {
9
+ templatelib.getVersion(jtffci);
10
+ }
@@ -0,0 +1,5 @@
1
+ const templatelib = require('@jtff/miztemplate-lib');
2
+ const config = require("../../config.json");
3
+ const jtffci = new templatelib.MizTemplateCI(config);
4
+
5
+ templatelib.injectScripts(jtffci, process.env.npm_config_mission);
@@ -0,0 +1,5 @@
1
+ const templatelib = require('@jtff/miztemplate-lib');
2
+ const config = require("../../config.json");
3
+ const jtffci = new templatelib.MizTemplateCI(config);
4
+
5
+ templatelib.nextversionPrepare(jtffci, "./config.json");
package/ci/release.js ADDED
@@ -0,0 +1,5 @@
1
+ const templatelib = require('@jtff/miztemplate-lib');
2
+ const config = require("../../config.json");
3
+ const jtffci = new templatelib.MizTemplateCI(config);
4
+
5
+ templatelib.release(jtffci, "./config.json");
@@ -0,0 +1,5 @@
1
+ const templatelib = require('@jtff/miztemplate-lib');
2
+ const config = require("../../config.json");
3
+ const jtffci = new templatelib.MizTemplateCI(config);
4
+
5
+ templatelib.templateUpdate(jtffci);
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  const MizTemplateCI = require("./lib/jtff-lib-ci.js");
2
- const mizlib = require("./lib/mizlib.js");
2
+ const Mizlib = require("./lib/mizlib.js");
3
3
  const build = require("./scripts/build.js");
4
4
  const clean = require("./scripts/clean.js");
5
5
  const ftpupload = require("./scripts/ftpupload.js");
@@ -13,6 +13,7 @@ const templateUpdate = require("./scripts/template-update.js");
13
13
 
14
14
  module.exports = {
15
15
  MizTemplateCI: MizTemplateCI,
16
+ Mizlib: Mizlib,
16
17
  build:build,
17
18
  clean:clean,
18
19
  ftpupload:ftpupload,
@@ -24,5 +25,4 @@ module.exports = {
24
25
  nextversionPrepare:nextversionPrepare,
25
26
  release:release,
26
27
  templateUpdate:templateUpdate,
27
- mizlib: mizlib,
28
28
  };
@@ -4,10 +4,12 @@ const fs = require("fs");
4
4
  const path = require("path");
5
5
  const { google } = require("googleapis");
6
6
  const ftpClient = require('ftp');
7
+ const Mizlib = require("./mizlib");
7
8
 
8
9
  class MizTemplateCI{
9
10
  constructor(config) {
10
- this.config = config
11
+ this.config = config;
12
+ this.mizlib = new Mizlib();
11
13
  }
12
14
 
13
15
  getVersion() {
@@ -57,7 +59,7 @@ class MizTemplateCI{
57
59
  return newVersionObject;
58
60
  }
59
61
 
60
- getDestinationMizFilePaths() {
62
+ getDestinationMizFilePathArrayFromConfig() {
61
63
  const returnArray = this.config.missionTemplates.map(missionTemplate => {
62
64
  return this.config.general.missionFolder + '/'
63
65
  + this.config.general.missionPrefix + '_'
@@ -68,6 +70,16 @@ class MizTemplateCI{
68
70
  return returnArray;
69
71
  }
70
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
+
71
83
  getGeneratedMizFilePaths() {
72
84
  return fs.readdirSync(this.config.general.missionFolder + '/')
73
85
  .filter(file => file.endsWith((".miz")))
@@ -185,6 +197,66 @@ class MizTemplateCI{
185
197
  }
186
198
  });
187
199
  }
200
+
201
+ async generateConfigJsonFileFromZipObject(zip,filename) {
202
+ let theatreString = (await this.mizlib.getMissionObjectFromZipObject(zip)).theatre;
203
+ return {
204
+ "general": {
205
+ "missionFolder": "dist",
206
+ "missionPrefix": path.parse(filename).name,
207
+ "missionSuffix": "",
208
+ "missionVersion": "1.0.0-snapshot"
209
+ },
210
+ "google": {
211
+ "scopes": [
212
+ "https://www.googleapis.com/auth/drive"
213
+ ],
214
+ "tokenPath": "dist/gtoken.json"
215
+ },
216
+ "missionTemplates": [
217
+ {
218
+ "theatre": theatreString,
219
+ "filename": filename,
220
+ "destFolderId": "1pK_0I2iEzhEiqWicu8hsX7VPZuKGnKoW"
221
+ }
222
+ ]
223
+ };
224
+ }
225
+
226
+ async generatePackageJsonFile(missionName) {
227
+ return {
228
+ "name": missionName,
229
+ "version": "1.0.0-snapshot",
230
+ "description": "build jtff-style missions",
231
+ "main": "none",
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"
242
+ },
243
+ "author": "Sebastien LONGO",
244
+ "license": "GPL-3.0-or-later",
245
+ "dependencies": {
246
+ "@jtff/miztemplate-lib": "latest"
247
+ }
248
+ };
249
+ }
250
+
251
+ async InjectCiScriptsIntoWorkspace(workspacePath) {
252
+ fs.cpSync('node_modules/@jtff/miztemplate-lib/ci',workspacePath + '/.workspace/src/nodejs',{recursive: true});
253
+ }
254
+
255
+ async deployCIScriptsFromZipObjectIntoWorkspace(workspacePath, mizObject, mizFilePath) {
256
+ fs.writeFileSync(workspacePath + '/config.json', JSON.stringify(await this.generateConfigJsonFileFromZipObject(mizObject, path.basename(mizFilePath)), null, 4));
257
+ fs.writeFileSync(workspacePath + '/package.json', JSON.stringify(await this.generatePackageJsonFile(path.parse(mizFilePath).name), null, 4));
258
+ await this.InjectCiScriptsIntoWorkspace(workspacePath);
259
+ }
188
260
  }
189
261
 
190
262