|
1 | 1 | #! /usr/bin/env python3 |
2 | 2 | # Requirements: python3 |
3 | 3 |
|
4 | | -import os, shutil |
| 4 | +import os, shutil, json |
5 | 5 |
|
6 | 6 | import scripts.python.upi_utility as utility |
7 | 7 | import scripts.python.upi_toolchain as toolchain |
@@ -392,9 +392,9 @@ def ValidateProjectVersions(self): |
392 | 392 | else: |
393 | 393 | CTX.printer.ErrorMessage("No Unity installations are being tracked. Please check your Unity installation root path or install the Unity Editor.") |
394 | 394 |
|
395 | | - # Packs plug-ins with npm and moves the resulting package to the currently configured build output folder. |
| 395 | + # Packs plug-ins with tar and moves the resulting package to the currently configured build output folder. |
396 | 396 | def GeneratePlugInPackages(self) -> None: |
397 | | - # Cache to return; npm should be invoked from the folder containing the associated package.json |
| 397 | + # Cache to return; tar should be invoked from the folder containing the associated package.json |
398 | 398 | working_dir = os.getcwd() |
399 | 399 | for plugin_id, native_plugin in self.native_unity_plugin_table.items(): |
400 | 400 | CTX.printer.StatusMessageWithContext("Packing plug-in: ", f"{plugin_id}", "\n") |
@@ -424,8 +424,15 @@ def GeneratePlugInPackages(self) -> None: |
424 | 424 | utility.RunCommand(["mv", curr_demo_path, dest_demo_path]) |
425 | 425 | utility.RunCommand(["mv", curr_demo_meta_path, dest_demo_meta_path]) |
426 | 426 |
|
427 | | - pack_command = ["npm", "pack", f"{target_package_json_path.parent}", "--pack-destination", f"{CTX.build_output_path}"] |
428 | | - |
| 427 | + # get the package name and version |
| 428 | + package_json_file = open(target_package_json_path) |
| 429 | + package_json_data = json.load(package_json_file) |
| 430 | + tgz_filename = f"{package_json_data['name']}" "-" f"{package_json_data['version']}" ".tgz" |
| 431 | + package_json_file.close() |
| 432 | + |
| 433 | + # using tar: |
| 434 | + pack_command = ["tar", "--auto-compress", "--create", "--file", f"{CTX.build_output_path.joinpath(tgz_filename)}", "--directory", f"{target_package_json_path.parent}", "-s", "/./package/", "." ] |
| 435 | + |
429 | 436 | CTX.printer.MessageWithContext("Project package.json path: ", f"{target_package_json_path}", CTX.printer.Indent(1)) |
430 | 437 | CTX.printer.MessageWithContext("Pack command: ", f"{(' '.join(pack_command))}", CTX.printer.Indent(1)) |
431 | 438 |
|
|
0 commit comments