From be619784d8224fa68febba1a85bee59a495cad00 Mon Sep 17 00:00:00 2001 From: Yogendra Shelke Date: Wed, 11 Feb 2026 17:03:50 +0530 Subject: [PATCH 01/16] fix: update LICENSE file --- LICENSE | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/LICENSE b/LICENSE index 51dfbf50d..d0579ce07 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Apache License + Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -186,7 +186,7 @@ Apache License same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2020 Mendix Technology BV + Copyright 2022 Mendix Technology B.V. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -198,4 +198,4 @@ Apache License distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and - limitations under the License. + limitations under the License. \ No newline at end of file From ee59087620b4cb2d435997ac33d3793f5703810d Mon Sep 17 00:00:00 2001 From: undefined Date: Wed, 11 Feb 2026 18:01:17 +0530 Subject: [PATCH 02/16] feat: add LICENSE file for NMR and Atlas Content Native --- .../jsActions/mobile-resources-native/LICENSE | 201 ++++++++++++++++++ packages/modules/atlas-content-native/LICENSE | 201 ++++++++++++++++++ 2 files changed, 402 insertions(+) create mode 100644 packages/jsActions/mobile-resources-native/LICENSE create mode 100644 packages/modules/atlas-content-native/LICENSE diff --git a/packages/jsActions/mobile-resources-native/LICENSE b/packages/jsActions/mobile-resources-native/LICENSE new file mode 100644 index 000000000..d0579ce07 --- /dev/null +++ b/packages/jsActions/mobile-resources-native/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2022 Mendix Technology B.V. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/packages/modules/atlas-content-native/LICENSE b/packages/modules/atlas-content-native/LICENSE new file mode 100644 index 000000000..d0579ce07 --- /dev/null +++ b/packages/modules/atlas-content-native/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2022 Mendix Technology B.V. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file From 16fb5b34622a5dd3a2dbfe9732939f53cafb7941 Mon Sep 17 00:00:00 2001 From: undefined Date: Thu, 12 Feb 2026 09:40:26 +0530 Subject: [PATCH 03/16] feat: add Apache License files for mobile resources, nanoflow actions, and atlas content modules --- .../{LICENSE => License.txt} | 2 +- .../nanoflow-actions-native/License.txt | 201 ++++++++++++++++++ .../modules/atlas-content-native/License.txt | 201 ++++++++++++++++++ 3 files changed, 403 insertions(+), 1 deletion(-) rename packages/jsActions/mobile-resources-native/{LICENSE => License.txt} (99%) create mode 100644 packages/jsActions/nanoflow-actions-native/License.txt create mode 100644 packages/modules/atlas-content-native/License.txt diff --git a/packages/jsActions/mobile-resources-native/LICENSE b/packages/jsActions/mobile-resources-native/License.txt similarity index 99% rename from packages/jsActions/mobile-resources-native/LICENSE rename to packages/jsActions/mobile-resources-native/License.txt index d0579ce07..8c705ebe1 100644 --- a/packages/jsActions/mobile-resources-native/LICENSE +++ b/packages/jsActions/mobile-resources-native/License.txt @@ -1,4 +1,4 @@ - Apache License + Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ diff --git a/packages/jsActions/nanoflow-actions-native/License.txt b/packages/jsActions/nanoflow-actions-native/License.txt new file mode 100644 index 000000000..8c705ebe1 --- /dev/null +++ b/packages/jsActions/nanoflow-actions-native/License.txt @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2022 Mendix Technology B.V. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/packages/modules/atlas-content-native/License.txt b/packages/modules/atlas-content-native/License.txt new file mode 100644 index 000000000..8c705ebe1 --- /dev/null +++ b/packages/modules/atlas-content-native/License.txt @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2022 Mendix Technology B.V. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file From d34919c716bc5c28c6ba7c76ff12b6a0e2bd98dd Mon Sep 17 00:00:00 2001 From: Yogendra Shelke <25844542+YogendraShelke@users.noreply.github.com> Date: Thu, 12 Feb 2026 20:43:01 +0530 Subject: [PATCH 04/16] feat: implement Build MPK workflow and add build script for native modules --- .github/workflows/BuildMpk.yml | 52 +++++ package.json | 1 + .../jsActions/nanoflow-actions-native/LICENSE | 202 ------------------ packages/modules/atlas-content-native/LICENSE | 201 ----------------- .../modules/atlas-content-native/License.txt | 201 ----------------- scripts/release/buildMpk.js | 135 ++++++++++++ scripts/release/module-automation/commons.js | 54 ++++- 7 files changed, 241 insertions(+), 605 deletions(-) create mode 100644 .github/workflows/BuildMpk.yml delete mode 100644 packages/jsActions/nanoflow-actions-native/LICENSE delete mode 100644 packages/modules/atlas-content-native/LICENSE delete mode 100644 packages/modules/atlas-content-native/License.txt create mode 100644 scripts/release/buildMpk.js diff --git a/.github/workflows/BuildMpk.yml b/.github/workflows/BuildMpk.yml new file mode 100644 index 000000000..b2a95cb32 --- /dev/null +++ b/.github/workflows/BuildMpk.yml @@ -0,0 +1,52 @@ +name: Build MPK + +on: + workflow_dispatch: + inputs: + module: + description: "Select the module to create MPK for" + required: true + type: choice + options: + - mobile-resources-native + - nanoflow-actions-native + version: + description: "Version to increase" + required: true + type: choice + default: patch + options: + - patch + - minor + - major + +jobs: + publish_release: + name: "Build MPK" + runs-on: ubuntu-latest + + steps: + - name: "Checking-out code" + uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3 + with: + submodules: false + - name: "Defining node version" + uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3 + with: + node-version-file: ".nvmrc" + - name: "Setup pnpm" + uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4 + - name: "Installing dependencies" + run: pnpm install + - name: "Bumping version" + id: bump_version + run: + NEW_VER=$(npm --prefix ./packages/jsActions/${{ inputs.module }} version ${{ inputs.version }} --no-git-tag-version) + echo "VERSION=$NEW_VER" >> $GITHUB_OUTPUT + - name: "Building native widgets and js actions" + run: pnpm -r run release + - name: "Updating Native Mobile Resources project" + run: pnpm run build-mpk + env: + MODULE: ${{ inputs.module }} + VERSION: ${{ steps.bump_version.outputs.VERSION }} diff --git a/package.json b/package.json index e5461d2d7..1c8fa2375 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "release:marketplace": "pnpm -r run release:marketplace", "release-github:widget": "node ./scripts/release/createWidgetRelease.js", "create-modules": "node ./scripts/release/createNativeModules.js", + "build-mpk": "node ./scripts/release/buildMpk.js", "version": "ts-node --project ./scripts/tsconfig.json ./scripts/release/BumpVersion.ts", "validate-staged-widget-versions": "node scripts/validation/validate-versions-staged-files.js", "setup-mobile": "pnpm setup-android && pnpm setup-ios", diff --git a/packages/jsActions/nanoflow-actions-native/LICENSE b/packages/jsActions/nanoflow-actions-native/LICENSE deleted file mode 100644 index 564e56569..000000000 --- a/packages/jsActions/nanoflow-actions-native/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ -Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2019 Mendix BV - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - \ No newline at end of file diff --git a/packages/modules/atlas-content-native/LICENSE b/packages/modules/atlas-content-native/LICENSE deleted file mode 100644 index d0579ce07..000000000 --- a/packages/modules/atlas-content-native/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2022 Mendix Technology B.V. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. \ No newline at end of file diff --git a/packages/modules/atlas-content-native/License.txt b/packages/modules/atlas-content-native/License.txt deleted file mode 100644 index 8c705ebe1..000000000 --- a/packages/modules/atlas-content-native/License.txt +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2022 Mendix Technology B.V. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. \ No newline at end of file diff --git a/scripts/release/buildMpk.js b/scripts/release/buildMpk.js new file mode 100644 index 000000000..5ba1c24ce --- /dev/null +++ b/scripts/release/buildMpk.js @@ -0,0 +1,135 @@ +const { basename, join, dirname } = require("path"); +const { readdir, copyFile, rm, mkdir } = require("fs/promises"); +const { + execShellCommand, + getFiles, + getPackageInfo, + cloneRepo, + createMPK, + exportModuleWithWidgets, + regex, + copyFilesToMpk, + getOssFiles +} = require("./module-automation/commons"); + +const repoRootPath = join(__dirname, "../../"); + +const moduleFolderNameInRepo = process.env.MODULE; +const version = process.env.VERSION.split("v")[1]; + +main().catch(e => { + console.error(e); + process.exit(1); +}); + +async function main() { + const modules = ["mobile-resources-native", "nanoflow-actions-native"]; + if (!modules.includes(moduleFolderNameInRepo) || !version) { + return; + } + + switch (moduleFolderNameInRepo) { + case "mobile-resources-native": + await createNativeMobileResourcesModule(); + break; + case "nanoflow-actions-native": + await createNanoflowCommonsModule(); + break; + } +} + +async function createNativeMobileResourcesModule() { + console.log("Creating the Native Mobile Resource module."); + const moduleFolder = join(repoRootPath, "packages/jsActions", moduleFolderNameInRepo); + const ossFiles = await getOssFiles(moduleFolder, true); + const tmpFolder = join(repoRootPath, "tmp", moduleFolderNameInRepo); + const widgetFolders = await readdir(join(repoRootPath, "packages/pluggableWidgets")); + const nativeWidgetFolders = widgetFolders + .filter(folder => folder.includes("-native")) + .map(folder => join(repoRootPath, "packages/pluggableWidgets", folder)); + const moduleInfo = { + ...(await getPackageInfo(moduleFolder)), + moduleNameInModeler: "NativeMobileResources", + moduleFolderNameInModeler: "nativemobileresources" + }; + await updateNativeComponentsTestProject(moduleInfo, tmpFolder, nativeWidgetFolders); + const mpkOutput = await createMPK(tmpFolder, moduleInfo, regex.excludeFiles); + await exportModuleWithWidgets(moduleInfo.moduleNameInModeler, mpkOutput, nativeWidgetFolders, ossFiles); + // TODO: mpk as an artifact to download from CI job + console.log("Done."); +} + +async function createNanoflowCommonsModule() { + console.log("Creating the Nanoflow Commons module."); + const moduleFolder = join(repoRootPath, "packages/jsActions", moduleFolderNameInRepo); + const ossFiles = await getOssFiles(moduleFolder, true); + const tmpFolder = join(repoRootPath, "tmp", moduleFolderNameInRepo); + const moduleInfo = { + ...(await getPackageInfo(moduleFolder)), + moduleNameInModeler: "NanoflowCommons", + moduleFolderNameInModeler: "nanoflowcommons" + }; + + await updateNativeComponentsTestProject(moduleInfo, tmpFolder); + const mpkOutput = await createMPK(tmpFolder, moduleInfo, regex.excludeFiles); + await copyFilesToMpk(ossFiles, mpkOutput, moduleInfo.moduleNameInModeler); + // TODO: mpk as an artifact to download from CI job + console.log("Done."); +} + +// Update test project with latest changes and update version in themesource +async function updateNativeComponentsTestProject(moduleInfo, tmpFolder, nativeWidgetFolders) { + const jsActionsPath = join(repoRootPath, `packages/jsActions/${moduleFolderNameInRepo}/dist`); + const jsActions = await getFiles(jsActionsPath); + const tmpFolderActions = join(tmpFolder, `javascriptsource/${moduleInfo.moduleFolderNameInModeler}/actions`); + + console.log("Updating NativeComponentsTestProject..."); + await cloneRepo(moduleInfo.testProjectUrl, tmpFolder); + + console.log("Deleting existing JS Actions from test project..."); + await rm(tmpFolderActions, { force: true, recursive: true }); // this is useful to avoid retaining stale dependencies in the test project. + await mkdir(tmpFolderActions); + console.log("Copying widget resources JS actions into test project..."); + await Promise.all([ + ...jsActions.map(async file => { + const dest = join(tmpFolderActions, file.replace(jsActionsPath, "")); + await mkdir(dirname(dest), { recursive: true }); + await copyFile(file, dest); + }) + ]); + if (nativeWidgetFolders) { + console.log("Deleting existing widgets from test project..."); + const widgetsDir = join(tmpFolder, "widgets"); + + // backup two web widgets that are used in the test project + const tempBackup = join(tmpFolder, "widgets-backup"); + await mkdir(tempBackup); + + const htmlSnippetWidgetName = "HTMLSnippet.mpk"; + const htmlSnippetTempPath = join(tempBackup, htmlSnippetWidgetName); + const htmlSnippetPath = join(widgetsDir, htmlSnippetWidgetName); + await copyFile(htmlSnippetPath, htmlSnippetTempPath); + + const sprintrFeedbackWidgetName = "SprintrFeedbackWidget.mpk"; + const sprintFeedbackTempPath = join(tempBackup, sprintrFeedbackWidgetName); + const sprintrFeedbackPath = join(widgetsDir, sprintrFeedbackWidgetName); + await copyFile(sprintrFeedbackPath, sprintFeedbackTempPath); + + await rm(widgetsDir, { force: true, recursive: true }); // this is useful to avoid retaining stale widgets in the test project. + await mkdir(widgetsDir); + + await copyFile(htmlSnippetTempPath, htmlSnippetPath); + await copyFile(sprintFeedbackTempPath, sprintrFeedbackPath); + await rm(tempBackup, { force: true, recursive: true }); + + console.log("Copying widget resources widgets into test project..."); + await Promise.all([ + ...nativeWidgetFolders.map(async folder => { + const src = (await getFiles(folder, [`.mpk`]))[0]; + const dest = join(widgetsDir, basename(src)); + await copyFile(src, dest); + }) + ]); + } + await execShellCommand(`echo ${version} > themesource/${moduleInfo.moduleFolderNameInModeler}/.version`, tmpFolder); +} diff --git a/scripts/release/module-automation/commons.js b/scripts/release/module-automation/commons.js index e51de0002..8e724ec93 100644 --- a/scripts/release/module-automation/commons.js +++ b/scripts/release/module-automation/commons.js @@ -1,6 +1,7 @@ const { basename, extname, join, resolve } = require("path"); const { access, readdir, copyFile, readFile, writeFile, rename, rm, mkdir, chmod } = require("fs/promises"); const { exec } = require("child_process"); +const { globSync } = require("glob"); const regex = { changelogs: /(?<=## \[unreleased\]\n)((?!## \[\d+\.\d+\.\d+\])\W|\w)*/i, @@ -260,8 +261,53 @@ function unzip(src, dest) { return execShellCommand(`unzip "${src}" -d "${dest}"`); } +async function getOssFiles(folderPath, skipOssReadme) { + if (!folderPath || typeof folderPath !== "string") { + throw new TypeError(`Invalid folderPath: ${folderPath}`); + } + + const licenseFile = join(folderPath, `License.txt`); + try { + await access(licenseFile); + } catch { + throw new Error(`License file not found at expected location: ${licenseFile}`); + } + + if (skipOssReadme) { + return [{ src: licenseFile, dest: basename(licenseFile) }]; + } + + const readmeossPattern = "*__*__READMEOSS_*.html"; + const readmeossFiles = globSync(readmeossPattern, { cwd: folderPath, absolute: true, ignore: "**/.*/**" }); + + if (readmeossFiles.length === 0) { + throw new Error(`No OSS README file found in ${folderPath} matching ${readmeossPattern}`); + } + + const ossReadmeFile = readmeossFiles[0]; + + return [ + { src: licenseFile, dest: basename(licenseFile) }, + { src: ossReadmeFile, dest: basename(ossReadmeFile) } + ]; +} + +async function copyFilesToMpk(filesToAdd, mpkOutput, moduleName) { + const projectPath = mpkOutput.replace(".mpk", ""); + // Unzip the mpk + await unzip(mpkOutput, projectPath); + await rm(mpkOutput, { recursive: true, force: true }); + // Add additional files to the MPK + for await (const file of filesToAdd) { + await copyFile(file.src, join(projectPath, file.dest)); + } + // Re-zip and rename + await zip(projectPath, moduleName); + await rename(`${projectPath}.zip`, mpkOutput); +} + // Unzip the module, copy the widget and update package.xml -async function exportModuleWithWidgets(moduleName, mpkOutput, widgetsFolders) { +async function exportModuleWithWidgets(moduleName, mpkOutput, widgetsFolders, filesToAdd) { console.log(`Adding ${widgetsFolders.length} widgets to module ${moduleName}`); const projectPath = mpkOutput.replace(".mpk", ""); const packageXmlFile = join(projectPath, "package.xml"); @@ -298,6 +344,10 @@ async function exportModuleWithWidgets(moduleName, mpkOutput, widgetsFolders) { } catch (e) { throw new Error(`Including widgets in module failed. package.xml of widget/module ${moduleName} not found`); } + // Add additional files to the MPK + for await (const file of filesToAdd) { + await copyFile(file.src, join(projectPath, file.dest)); + } // Re-zip and rename await zip(projectPath, moduleName); await rename(`${projectPath}.zip`, mpkOutput); @@ -324,5 +374,7 @@ module.exports = { zip, unzip, exportModuleWithWidgets, + copyFilesToMpk, + getOssFiles, regex }; From 98bd32f0ab9cedc0d29014278847f756a592620d Mon Sep 17 00:00:00 2001 From: Yogendra Shelke Date: Thu, 12 Feb 2026 21:26:47 +0530 Subject: [PATCH 05/16] fix: add artifact upload and cleanup steps in Build MPK workflow --- .github/workflows/BuildMpk.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/BuildMpk.yml b/.github/workflows/BuildMpk.yml index b2a95cb32..8551849c1 100644 --- a/.github/workflows/BuildMpk.yml +++ b/.github/workflows/BuildMpk.yml @@ -50,3 +50,14 @@ jobs: env: MODULE: ${{ inputs.module }} VERSION: ${{ steps.bump_version.outputs.VERSION }} + + - name: "Upload MPK artifact" + uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 #v4 + with: + name: ${{ inputs.module }}-${{ steps.bump_version.outputs.VERSION }}.mpk + path: tmp/${{ inputs.module }}/**/*.mpk + if-no-files-found: error + + - name: "Cleanup tmp folder" + if: ${{ always() }} + run: rm -rf tmp From 2ec269f2b80602576ac549d08f466af2be87811e Mon Sep 17 00:00:00 2001 From: Yogendra Shelke Date: Thu, 12 Feb 2026 21:45:08 +0530 Subject: [PATCH 06/16] fix: format version bumping step in Build MPK workflow --- .github/workflows/BuildMpk.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/BuildMpk.yml b/.github/workflows/BuildMpk.yml index 8551849c1..48d5c17a5 100644 --- a/.github/workflows/BuildMpk.yml +++ b/.github/workflows/BuildMpk.yml @@ -40,9 +40,9 @@ jobs: run: pnpm install - name: "Bumping version" id: bump_version - run: - NEW_VER=$(npm --prefix ./packages/jsActions/${{ inputs.module }} version ${{ inputs.version }} --no-git-tag-version) - echo "VERSION=$NEW_VER" >> $GITHUB_OUTPUT + run: | + NEW_VER=$(npm --prefix "./packages/jsActions/${{ inputs.module }}" version "${{ inputs.version }}" --no-git-tag-version) + echo "VERSION=${NEW_VER}" >> "$GITHUB_OUTPUT" - name: "Building native widgets and js actions" run: pnpm -r run release - name: "Updating Native Mobile Resources project" From e71550035e019a034dcf5bffee5dd2bb9267aa71 Mon Sep 17 00:00:00 2001 From: Yogendra Shelke Date: Thu, 12 Feb 2026 22:07:47 +0530 Subject: [PATCH 07/16] fix: update artifact upload path for MPK based on module type --- .github/workflows/BuildMpk.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/BuildMpk.yml b/.github/workflows/BuildMpk.yml index 48d5c17a5..bdcbdb25c 100644 --- a/.github/workflows/BuildMpk.yml +++ b/.github/workflows/BuildMpk.yml @@ -55,9 +55,10 @@ jobs: uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 #v4 with: name: ${{ inputs.module }}-${{ steps.bump_version.outputs.VERSION }}.mpk - path: tmp/${{ inputs.module }}/**/*.mpk + path: ${{ inputs.module == 'mobile-resources-native' && 'tmp/mobile-resources-native/NativeMobileResources.mpk' || 'tmp/nanoflow-actions-native/NanoflowCommons.mpk' }} if-no-files-found: error - name: "Cleanup tmp folder" if: ${{ always() }} - run: rm -rf tmp + run: | + sudo rm -rf tmp || true From d02c965e653af039792bbacfcd408026c2d7aa69 Mon Sep 17 00:00:00 2001 From: Yogendra Shelke Date: Thu, 12 Feb 2026 22:26:44 +0530 Subject: [PATCH 08/16] fix: correct MPK artifact upload name and path handling in Build MPK workflow --- .github/workflows/BuildMpk.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/BuildMpk.yml b/.github/workflows/BuildMpk.yml index bdcbdb25c..b6d5690eb 100644 --- a/.github/workflows/BuildMpk.yml +++ b/.github/workflows/BuildMpk.yml @@ -54,7 +54,7 @@ jobs: - name: "Upload MPK artifact" uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 #v4 with: - name: ${{ inputs.module }}-${{ steps.bump_version.outputs.VERSION }}.mpk + name: ${{ inputs.module }}-${{ steps.bump_version.outputs.VERSION }} path: ${{ inputs.module == 'mobile-resources-native' && 'tmp/mobile-resources-native/NativeMobileResources.mpk' || 'tmp/nanoflow-actions-native/NanoflowCommons.mpk' }} if-no-files-found: error From 1377ef6d03974dbff652d9a1be20c9c81afa1a6c Mon Sep 17 00:00:00 2001 From: Yogendra Shelke Date: Fri, 13 Feb 2026 10:31:21 +0530 Subject: [PATCH 09/16] feat: implement build-mpk script and update workflow for artifact handling --- .github/workflows/BuildMpk.yml | 4 +- package.json | 2 +- scripts/release/build-mpk.ts | 218 ++++++++++++++++++ scripts/release/buildMpk.js | 135 ----------- .../release/module-automation/commons.d.ts | 28 +++ scripts/tsconfig.json | 7 + 6 files changed, 256 insertions(+), 138 deletions(-) create mode 100644 scripts/release/build-mpk.ts delete mode 100644 scripts/release/buildMpk.js create mode 100644 scripts/release/module-automation/commons.d.ts create mode 100644 scripts/tsconfig.json diff --git a/.github/workflows/BuildMpk.yml b/.github/workflows/BuildMpk.yml index b6d5690eb..4a3019af7 100644 --- a/.github/workflows/BuildMpk.yml +++ b/.github/workflows/BuildMpk.yml @@ -54,8 +54,8 @@ jobs: - name: "Upload MPK artifact" uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 #v4 with: - name: ${{ inputs.module }}-${{ steps.bump_version.outputs.VERSION }} - path: ${{ inputs.module == 'mobile-resources-native' && 'tmp/mobile-resources-native/NativeMobileResources.mpk' || 'tmp/nanoflow-actions-native/NanoflowCommons.mpk' }} + name: ${{ env.ARTIFACT_NAME }} + path: ${{ env.ARTIFACT_PATH }} if-no-files-found: error - name: "Cleanup tmp folder" diff --git a/package.json b/package.json index 1c8fa2375..74d64789b 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "release:marketplace": "pnpm -r run release:marketplace", "release-github:widget": "node ./scripts/release/createWidgetRelease.js", "create-modules": "node ./scripts/release/createNativeModules.js", - "build-mpk": "node ./scripts/release/buildMpk.js", + "build-mpk": "ts-node --project ./scripts/tsconfig.json ./scripts/release/build-mpk.ts", "version": "ts-node --project ./scripts/tsconfig.json ./scripts/release/BumpVersion.ts", "validate-staged-widget-versions": "node scripts/validation/validate-versions-staged-files.js", "setup-mobile": "pnpm setup-android && pnpm setup-ios", diff --git a/scripts/release/build-mpk.ts b/scripts/release/build-mpk.ts new file mode 100644 index 000000000..728f93d99 --- /dev/null +++ b/scripts/release/build-mpk.ts @@ -0,0 +1,218 @@ +import { basename, join, dirname } from "path"; +import { readdir, copyFile, rm, mkdir } from "fs/promises"; +import { + execShellCommand, + getFiles, + getPackageInfo, + cloneRepo, + createMPK, + exportModuleWithWidgets, + regex, + copyFilesToMpk, + getOssFiles +} from "./module-automation/commons"; + +const repoRootPath = join(__dirname, "../../"); + +const LOG_PREFIX = "[buildMpk]"; +function log(message: string): void { + console.log(`${LOG_PREFIX} ${message}`); +} + +type ArtifactResult = { + artifactPath: string; + artifactName: string; +}; + +type InputVariables = { + module: string; + version: string; +}; + +const inputs: InputVariables = { + module: "", + version: "" +}; + +main() + .then(writeArtifactEnvVariable) + .catch(e => { + console.error(e); + process.exit(1); + }); + +function writeArtifactEnvVariable(artifact: ArtifactResult): void { + if (!artifact?.artifactPath || !artifact?.artifactName) { + throw new Error(`${LOG_PREFIX} Expected an artifact result from main(), but got: ${JSON.stringify(artifact)}`); + } + + log(`Setting environment variable ARTIFACT_PATH=${artifact.artifactPath}`); + process.env.ARTIFACT_PATH = artifact.artifactPath; + log(`Setting environment variable ARTIFACT_NAME=${artifact.artifactName}`); + process.env.ARTIFACT_NAME = artifact.artifactName; + log("Artifact environment variables set successfully."); +} + +function validateInput(): void { + const moduleName = process.env.MODULE; + let version = process.env.VERSION; + + const modules = ["mobile-resources-native", "nanoflow-actions-native"]; + if (!moduleName || !modules.includes(moduleName)) { + throw new Error(`${LOG_PREFIX} Invalid MODULE="${moduleName}". Expected one of: ${modules.join(", ")}`); + } + if (!version) { + throw new Error(`${LOG_PREFIX} Invalid VERSION="${version}"`); + } + if (version?.startsWith("v")) { + version = version.split("v")[1]; + } + inputs.module = moduleName; + inputs.version = version; + log(`Starting (MODULE=${inputs.module}, VERSION=${inputs.version})`); +} + +async function main(): Promise { + validateInput(); + switch (inputs.module) { + case "mobile-resources-native": + return createNativeMobileResourcesModule(); + case "nanoflow-actions-native": + return createNanoflowCommonsModule(); + } + throw new Error(`${LOG_PREFIX} No implementation for MODULE="${inputs.module}"`); +} + +async function createNativeMobileResourcesModule(): Promise { + log("Creating the Native Mobile Resource module..."); + const moduleFolder = join(repoRootPath, "packages/jsActions", inputs.module); + log(`Module folder: ${moduleFolder}`); + const ossFiles = await getOssFiles(moduleFolder, true); + log(`OSS files to include: ${ossFiles.length}`); + const tmpFolder = join(repoRootPath, "tmp", inputs.module); + log(`Temp folder: ${tmpFolder}`); + const widgetFolders = await readdir(join(repoRootPath, "packages/pluggableWidgets")); + const nativeWidgetFolders = widgetFolders + .filter(folder => folder.includes("-native")) + .map(folder => join(repoRootPath, "packages/pluggableWidgets", folder)); + log(`Native widget folders found: ${nativeWidgetFolders.length}`); + const moduleInfo = { + ...(await getPackageInfo(moduleFolder)), + moduleNameInModeler: "NativeMobileResources", + moduleFolderNameInModeler: "nativemobileresources" + }; + log( + `Module info: nameWithSpace=${moduleInfo.nameWithSpace ?? ""}, minimumMXVersion=${ + moduleInfo.minimumMXVersion ?? "" + }, moduleNameInModeler=${moduleInfo.moduleNameInModeler}` + ); + await updateNativeComponentsTestProject(moduleInfo, tmpFolder, nativeWidgetFolders); + log("Creating MPK..."); + const mpkOutput = await createMPK(tmpFolder, moduleInfo, regex.excludeFiles); + log(`MPK created at: ${mpkOutput}`); + log("Exporting module with widgets into MPK..."); + await exportModuleWithWidgets(moduleInfo.moduleNameInModeler, mpkOutput, nativeWidgetFolders, ossFiles); + return { + artifactPath: mpkOutput, + artifactName: moduleInfo.moduleNameInModeler + }; +} + +async function createNanoflowCommonsModule(): Promise { + log("Creating the Nanoflow Commons module..."); + const moduleFolder = join(repoRootPath, "packages/jsActions", inputs.module); + log(`Module folder: ${moduleFolder}`); + const ossFiles = await getOssFiles(moduleFolder, true); + log(`OSS files to include: ${ossFiles.length}`); + const tmpFolder = join(repoRootPath, "tmp", inputs.module); + log(`Temp folder: ${tmpFolder}`); + const moduleInfo = { + ...(await getPackageInfo(moduleFolder)), + moduleNameInModeler: "NanoflowCommons", + moduleFolderNameInModeler: "nanoflowcommons" + }; + + log( + `Module info: nameWithSpace=${moduleInfo.nameWithSpace ?? ""}, minimumMXVersion=${ + moduleInfo.minimumMXVersion ?? "" + }, moduleNameInModeler=${moduleInfo.moduleNameInModeler}` + ); + + await updateNativeComponentsTestProject(moduleInfo, tmpFolder); + log("Creating MPK..."); + const mpkOutput = await createMPK(tmpFolder, moduleInfo, regex.excludeFiles); + log(`MPK created at: ${mpkOutput}`); + log("Copying OSS files into MPK..."); + await copyFilesToMpk(ossFiles, mpkOutput, moduleInfo.moduleNameInModeler); + return { + artifactPath: mpkOutput, + artifactName: moduleInfo.moduleNameInModeler + }; +} + +// Update test project with latest changes and update version in themesource +async function updateNativeComponentsTestProject( + moduleInfo: any, + tmpFolder: string, + nativeWidgetFolders?: string[] +): Promise { + const jsActionsPath = join(repoRootPath, `packages/jsActions/${inputs.module}/dist`); + const jsActions: string[] = await getFiles(jsActionsPath); + const tmpFolderActions = join(tmpFolder, `javascriptsource/${moduleInfo.moduleFolderNameInModeler}/actions`); + + log(`Updating NativeComponentsTestProject (repo=${moduleInfo.testProjectUrl ?? ""})...`); + log(`JS actions dist path: ${jsActionsPath}`); + log(`JS actions files found: ${jsActions.length}`); + await cloneRepo(moduleInfo.testProjectUrl, tmpFolder); + + log(`Deleting existing JS Actions from test project: ${tmpFolderActions}`); + await rm(tmpFolderActions, { force: true, recursive: true }); // this is useful to avoid retaining stale dependencies in the test project. + await mkdir(tmpFolderActions); + log("Copying widget resources JS actions into test project..."); + await Promise.all([ + ...jsActions.map(async file => { + const dest = join(tmpFolderActions, file.replace(jsActionsPath, "")); + await mkdir(dirname(dest), { recursive: true }); + await copyFile(file, dest); + }) + ]); + if (nativeWidgetFolders) { + log(`Deleting existing widgets from test project (widgets=${nativeWidgetFolders.length})...`); + const widgetsDir = join(tmpFolder, "widgets"); + + // backup two web widgets that are used in the test project + const tempBackup = join(tmpFolder, "widgets-backup"); + await mkdir(tempBackup); + + const htmlSnippetWidgetName = "HTMLSnippet.mpk"; + const htmlSnippetTempPath = join(tempBackup, htmlSnippetWidgetName); + const htmlSnippetPath = join(widgetsDir, htmlSnippetWidgetName); + await copyFile(htmlSnippetPath, htmlSnippetTempPath); + + const sprintrFeedbackWidgetName = "SprintrFeedbackWidget.mpk"; + const sprintFeedbackTempPath = join(tempBackup, sprintrFeedbackWidgetName); + const sprintrFeedbackPath = join(widgetsDir, sprintrFeedbackWidgetName); + await copyFile(sprintrFeedbackPath, sprintFeedbackTempPath); + + await rm(widgetsDir, { force: true, recursive: true }); // this is useful to avoid retaining stale widgets in the test project. + await mkdir(widgetsDir); + + await copyFile(htmlSnippetTempPath, htmlSnippetPath); + await copyFile(sprintFeedbackTempPath, sprintrFeedbackPath); + await rm(tempBackup, { force: true, recursive: true }); + + log("Copying widget resources widgets into test project..."); + await Promise.all([ + ...nativeWidgetFolders.map(async folder => { + const src = (await getFiles(folder, [`.mpk`]))[0]; + const dest = join(widgetsDir, basename(src)); + await copyFile(src, dest); + }) + ]); + } + log(`Writing themesource version file for ${moduleInfo.moduleFolderNameInModeler}...`); + await execShellCommand( + `echo ${inputs.version} > themesource/${moduleInfo.moduleFolderNameInModeler}/.version`, + tmpFolder + ); +} diff --git a/scripts/release/buildMpk.js b/scripts/release/buildMpk.js deleted file mode 100644 index 5ba1c24ce..000000000 --- a/scripts/release/buildMpk.js +++ /dev/null @@ -1,135 +0,0 @@ -const { basename, join, dirname } = require("path"); -const { readdir, copyFile, rm, mkdir } = require("fs/promises"); -const { - execShellCommand, - getFiles, - getPackageInfo, - cloneRepo, - createMPK, - exportModuleWithWidgets, - regex, - copyFilesToMpk, - getOssFiles -} = require("./module-automation/commons"); - -const repoRootPath = join(__dirname, "../../"); - -const moduleFolderNameInRepo = process.env.MODULE; -const version = process.env.VERSION.split("v")[1]; - -main().catch(e => { - console.error(e); - process.exit(1); -}); - -async function main() { - const modules = ["mobile-resources-native", "nanoflow-actions-native"]; - if (!modules.includes(moduleFolderNameInRepo) || !version) { - return; - } - - switch (moduleFolderNameInRepo) { - case "mobile-resources-native": - await createNativeMobileResourcesModule(); - break; - case "nanoflow-actions-native": - await createNanoflowCommonsModule(); - break; - } -} - -async function createNativeMobileResourcesModule() { - console.log("Creating the Native Mobile Resource module."); - const moduleFolder = join(repoRootPath, "packages/jsActions", moduleFolderNameInRepo); - const ossFiles = await getOssFiles(moduleFolder, true); - const tmpFolder = join(repoRootPath, "tmp", moduleFolderNameInRepo); - const widgetFolders = await readdir(join(repoRootPath, "packages/pluggableWidgets")); - const nativeWidgetFolders = widgetFolders - .filter(folder => folder.includes("-native")) - .map(folder => join(repoRootPath, "packages/pluggableWidgets", folder)); - const moduleInfo = { - ...(await getPackageInfo(moduleFolder)), - moduleNameInModeler: "NativeMobileResources", - moduleFolderNameInModeler: "nativemobileresources" - }; - await updateNativeComponentsTestProject(moduleInfo, tmpFolder, nativeWidgetFolders); - const mpkOutput = await createMPK(tmpFolder, moduleInfo, regex.excludeFiles); - await exportModuleWithWidgets(moduleInfo.moduleNameInModeler, mpkOutput, nativeWidgetFolders, ossFiles); - // TODO: mpk as an artifact to download from CI job - console.log("Done."); -} - -async function createNanoflowCommonsModule() { - console.log("Creating the Nanoflow Commons module."); - const moduleFolder = join(repoRootPath, "packages/jsActions", moduleFolderNameInRepo); - const ossFiles = await getOssFiles(moduleFolder, true); - const tmpFolder = join(repoRootPath, "tmp", moduleFolderNameInRepo); - const moduleInfo = { - ...(await getPackageInfo(moduleFolder)), - moduleNameInModeler: "NanoflowCommons", - moduleFolderNameInModeler: "nanoflowcommons" - }; - - await updateNativeComponentsTestProject(moduleInfo, tmpFolder); - const mpkOutput = await createMPK(tmpFolder, moduleInfo, regex.excludeFiles); - await copyFilesToMpk(ossFiles, mpkOutput, moduleInfo.moduleNameInModeler); - // TODO: mpk as an artifact to download from CI job - console.log("Done."); -} - -// Update test project with latest changes and update version in themesource -async function updateNativeComponentsTestProject(moduleInfo, tmpFolder, nativeWidgetFolders) { - const jsActionsPath = join(repoRootPath, `packages/jsActions/${moduleFolderNameInRepo}/dist`); - const jsActions = await getFiles(jsActionsPath); - const tmpFolderActions = join(tmpFolder, `javascriptsource/${moduleInfo.moduleFolderNameInModeler}/actions`); - - console.log("Updating NativeComponentsTestProject..."); - await cloneRepo(moduleInfo.testProjectUrl, tmpFolder); - - console.log("Deleting existing JS Actions from test project..."); - await rm(tmpFolderActions, { force: true, recursive: true }); // this is useful to avoid retaining stale dependencies in the test project. - await mkdir(tmpFolderActions); - console.log("Copying widget resources JS actions into test project..."); - await Promise.all([ - ...jsActions.map(async file => { - const dest = join(tmpFolderActions, file.replace(jsActionsPath, "")); - await mkdir(dirname(dest), { recursive: true }); - await copyFile(file, dest); - }) - ]); - if (nativeWidgetFolders) { - console.log("Deleting existing widgets from test project..."); - const widgetsDir = join(tmpFolder, "widgets"); - - // backup two web widgets that are used in the test project - const tempBackup = join(tmpFolder, "widgets-backup"); - await mkdir(tempBackup); - - const htmlSnippetWidgetName = "HTMLSnippet.mpk"; - const htmlSnippetTempPath = join(tempBackup, htmlSnippetWidgetName); - const htmlSnippetPath = join(widgetsDir, htmlSnippetWidgetName); - await copyFile(htmlSnippetPath, htmlSnippetTempPath); - - const sprintrFeedbackWidgetName = "SprintrFeedbackWidget.mpk"; - const sprintFeedbackTempPath = join(tempBackup, sprintrFeedbackWidgetName); - const sprintrFeedbackPath = join(widgetsDir, sprintrFeedbackWidgetName); - await copyFile(sprintrFeedbackPath, sprintFeedbackTempPath); - - await rm(widgetsDir, { force: true, recursive: true }); // this is useful to avoid retaining stale widgets in the test project. - await mkdir(widgetsDir); - - await copyFile(htmlSnippetTempPath, htmlSnippetPath); - await copyFile(sprintFeedbackTempPath, sprintrFeedbackPath); - await rm(tempBackup, { force: true, recursive: true }); - - console.log("Copying widget resources widgets into test project..."); - await Promise.all([ - ...nativeWidgetFolders.map(async folder => { - const src = (await getFiles(folder, [`.mpk`]))[0]; - const dest = join(widgetsDir, basename(src)); - await copyFile(src, dest); - }) - ]); - } - await execShellCommand(`echo ${version} > themesource/${moduleInfo.moduleFolderNameInModeler}/.version`, tmpFolder); -} diff --git a/scripts/release/module-automation/commons.d.ts b/scripts/release/module-automation/commons.d.ts new file mode 100644 index 000000000..7e925b40f --- /dev/null +++ b/scripts/release/module-automation/commons.d.ts @@ -0,0 +1,28 @@ +export const regex: { + excludeFiles: RegExp; +}; + +export function execShellCommand(command: string, cwd?: string): Promise; + +export function getFiles(folder: string, extensions?: string[]): Promise; + +export function getPackageInfo(folder: string): Promise; + +export function cloneRepo(githubUrl: string, localFolder: string): Promise; + +export function createMPK(tmpFolder: string, moduleInfo: any, excludeFilesRegExp: RegExp): Promise; + +export function exportModuleWithWidgets( + moduleNameInModeler: string, + mpkOutput: string, + nativeWidgetFolders: string[], + ossFiles?: Array<{ src: string; dest: string }> +): Promise; + +export function copyFilesToMpk( + files: Array<{ src: string; dest: string }>, + mpkOutput: string, + moduleNameInModeler: string +): Promise; + +export function getOssFiles(folderPath: string, skipOssReadme: boolean): Promise>; diff --git a/scripts/tsconfig.json b/scripts/tsconfig.json new file mode 100644 index 000000000..90f5c1494 --- /dev/null +++ b/scripts/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "@mendix/pluggable-widgets-tools/configs/tsconfig.base", + "compilerOptions": { + "module": "commonjs" + }, + "include": ["./**/*.ts"] +} From 85b825583b6498fad36ffcb495a8eb957af74abc Mon Sep 17 00:00:00 2001 From: Yogendra Shelke Date: Fri, 13 Feb 2026 11:05:21 +0530 Subject: [PATCH 10/16] feat: export artifact variables to GitHub Actions environment and output --- scripts/release/build-mpk.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/scripts/release/build-mpk.ts b/scripts/release/build-mpk.ts index 728f93d99..2c43f506d 100644 --- a/scripts/release/build-mpk.ts +++ b/scripts/release/build-mpk.ts @@ -1,5 +1,6 @@ import { basename, join, dirname } from "path"; import { readdir, copyFile, rm, mkdir } from "fs/promises"; +import { appendFileSync } from "fs"; import { execShellCommand, getFiles, @@ -24,6 +25,22 @@ type ArtifactResult = { artifactName: string; }; +function setGithubActionsVars(artifact: ArtifactResult): void { + const githubEnvPath = process.env.GITHUB_ENV; + if (githubEnvPath) { + appendFileSync(githubEnvPath, `ARTIFACT_PATH=${artifact.artifactPath}\n`); + appendFileSync(githubEnvPath, `ARTIFACT_NAME=${artifact.artifactName}\n`); + log(`Exported ARTIFACT_PATH and ARTIFACT_NAME to GITHUB_ENV`); + } + + const githubOutputPath = process.env.GITHUB_OUTPUT; + if (githubOutputPath) { + appendFileSync(githubOutputPath, `artifact_path=${artifact.artifactPath}\n`); + appendFileSync(githubOutputPath, `artifact_name=${artifact.artifactName}\n`); + log(`Exported artifact_path and artifact_name to GITHUB_OUTPUT`); + } +} + type InputVariables = { module: string; version: string; @@ -51,6 +68,8 @@ function writeArtifactEnvVariable(artifact: ArtifactResult): void { log(`Setting environment variable ARTIFACT_NAME=${artifact.artifactName}`); process.env.ARTIFACT_NAME = artifact.artifactName; log("Artifact environment variables set successfully."); + + setGithubActionsVars(artifact); } function validateInput(): void { From 52ef5556f9be93755594f86622c88bf0ca6932f7 Mon Sep 17 00:00:00 2001 From: Yogendra Shelke Date: Fri, 13 Feb 2026 11:18:46 +0530 Subject: [PATCH 11/16] refactor: update getOssFiles function to clarify parameter naming and logic --- scripts/release/build-mpk.ts | 4 ++-- .../release/module-automation/commons.d.ts | 5 ++++- scripts/release/module-automation/commons.js | 20 +++++++++---------- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/scripts/release/build-mpk.ts b/scripts/release/build-mpk.ts index 2c43f506d..6f6fd4468 100644 --- a/scripts/release/build-mpk.ts +++ b/scripts/release/build-mpk.ts @@ -106,7 +106,7 @@ async function createNativeMobileResourcesModule(): Promise { log("Creating the Native Mobile Resource module..."); const moduleFolder = join(repoRootPath, "packages/jsActions", inputs.module); log(`Module folder: ${moduleFolder}`); - const ossFiles = await getOssFiles(moduleFolder, true); + const ossFiles = await getOssFiles(moduleFolder, false); log(`OSS files to include: ${ossFiles.length}`); const tmpFolder = join(repoRootPath, "tmp", inputs.module); log(`Temp folder: ${tmpFolder}`); @@ -141,7 +141,7 @@ async function createNanoflowCommonsModule(): Promise { log("Creating the Nanoflow Commons module..."); const moduleFolder = join(repoRootPath, "packages/jsActions", inputs.module); log(`Module folder: ${moduleFolder}`); - const ossFiles = await getOssFiles(moduleFolder, true); + const ossFiles = await getOssFiles(moduleFolder, false); log(`OSS files to include: ${ossFiles.length}`); const tmpFolder = join(repoRootPath, "tmp", inputs.module); log(`Temp folder: ${tmpFolder}`); diff --git a/scripts/release/module-automation/commons.d.ts b/scripts/release/module-automation/commons.d.ts index 7e925b40f..4b5735f21 100644 --- a/scripts/release/module-automation/commons.d.ts +++ b/scripts/release/module-automation/commons.d.ts @@ -25,4 +25,7 @@ export function copyFilesToMpk( moduleNameInModeler: string ): Promise; -export function getOssFiles(folderPath: string, skipOssReadme: boolean): Promise>; +export function getOssFiles( + folderPath: string, + isOssReadmeRequired: boolean +): Promise>; diff --git a/scripts/release/module-automation/commons.js b/scripts/release/module-automation/commons.js index 8e724ec93..0f93c0eb3 100644 --- a/scripts/release/module-automation/commons.js +++ b/scripts/release/module-automation/commons.js @@ -261,7 +261,7 @@ function unzip(src, dest) { return execShellCommand(`unzip "${src}" -d "${dest}"`); } -async function getOssFiles(folderPath, skipOssReadme) { +async function getOssFiles(folderPath, isOssReadmeRequired) { if (!folderPath || typeof folderPath !== "string") { throw new TypeError(`Invalid folderPath: ${folderPath}`); } @@ -273,17 +273,17 @@ async function getOssFiles(folderPath, skipOssReadme) { throw new Error(`License file not found at expected location: ${licenseFile}`); } - if (skipOssReadme) { - return [{ src: licenseFile, dest: basename(licenseFile) }]; - } - const readmeossPattern = "*__*__READMEOSS_*.html"; const readmeossFiles = globSync(readmeossPattern, { cwd: folderPath, absolute: true, ignore: "**/.*/**" }); - if (readmeossFiles.length === 0) { + if (isOssReadmeRequired && readmeossFiles.length === 0) { throw new Error(`No OSS README file found in ${folderPath} matching ${readmeossPattern}`); } + if (readmeossFiles.length === 0) { + return [{ src: licenseFile, dest: basename(licenseFile) }]; + } + const ossReadmeFile = readmeossFiles[0]; return [ @@ -292,13 +292,13 @@ async function getOssFiles(folderPath, skipOssReadme) { ]; } -async function copyFilesToMpk(filesToAdd, mpkOutput, moduleName) { +async function copyFilesToMpk(files, mpkOutput, moduleName) { const projectPath = mpkOutput.replace(".mpk", ""); // Unzip the mpk await unzip(mpkOutput, projectPath); await rm(mpkOutput, { recursive: true, force: true }); // Add additional files to the MPK - for await (const file of filesToAdd) { + for await (const file of files) { await copyFile(file.src, join(projectPath, file.dest)); } // Re-zip and rename @@ -307,7 +307,7 @@ async function copyFilesToMpk(filesToAdd, mpkOutput, moduleName) { } // Unzip the module, copy the widget and update package.xml -async function exportModuleWithWidgets(moduleName, mpkOutput, widgetsFolders, filesToAdd) { +async function exportModuleWithWidgets(moduleName, mpkOutput, widgetsFolders, additionalFiles) { console.log(`Adding ${widgetsFolders.length} widgets to module ${moduleName}`); const projectPath = mpkOutput.replace(".mpk", ""); const packageXmlFile = join(projectPath, "package.xml"); @@ -345,7 +345,7 @@ async function exportModuleWithWidgets(moduleName, mpkOutput, widgetsFolders, fi throw new Error(`Including widgets in module failed. package.xml of widget/module ${moduleName} not found`); } // Add additional files to the MPK - for await (const file of filesToAdd) { + for await (const file of additionalFiles) { await copyFile(file.src, join(projectPath, file.dest)); } // Re-zip and rename From 75413a787831433fc6a7ad0c05646b4ce9e87ca7 Mon Sep 17 00:00:00 2001 From: Yogendra Shelke Date: Fri, 13 Feb 2026 11:26:28 +0530 Subject: [PATCH 12/16] fix: align Apache License header in License.txt files --- packages/jsActions/mobile-resources-native/License.txt | 2 +- packages/jsActions/nanoflow-actions-native/License.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/jsActions/mobile-resources-native/License.txt b/packages/jsActions/mobile-resources-native/License.txt index 8c705ebe1..d0579ce07 100644 --- a/packages/jsActions/mobile-resources-native/License.txt +++ b/packages/jsActions/mobile-resources-native/License.txt @@ -1,4 +1,4 @@ - Apache License + Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ diff --git a/packages/jsActions/nanoflow-actions-native/License.txt b/packages/jsActions/nanoflow-actions-native/License.txt index 8c705ebe1..d0579ce07 100644 --- a/packages/jsActions/nanoflow-actions-native/License.txt +++ b/packages/jsActions/nanoflow-actions-native/License.txt @@ -1,4 +1,4 @@ - Apache License + Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ From 6cb0ff7e5fedebcd327356df5caa06dc432162f2 Mon Sep 17 00:00:00 2001 From: Yogendra Shelke Date: Fri, 13 Feb 2026 12:17:15 +0530 Subject: [PATCH 13/16] refactor: move getOssFiles and copyFilesToMpk functions to utils.ts for better organization --- scripts/release/build-mpk.ts | 5 +- scripts/release/module-automation/commons.js | 48 ------------ scripts/release/module-automation/utils.ts | 78 ++++++++++++++++++++ 3 files changed, 80 insertions(+), 51 deletions(-) create mode 100644 scripts/release/module-automation/utils.ts diff --git a/scripts/release/build-mpk.ts b/scripts/release/build-mpk.ts index 6f6fd4468..db54aedf8 100644 --- a/scripts/release/build-mpk.ts +++ b/scripts/release/build-mpk.ts @@ -8,10 +8,9 @@ import { cloneRepo, createMPK, exportModuleWithWidgets, - regex, - copyFilesToMpk, - getOssFiles + regex } from "./module-automation/commons"; +import { copyFilesToMpk, getOssFiles } from "./module-automation/utils"; const repoRootPath = join(__dirname, "../../"); diff --git a/scripts/release/module-automation/commons.js b/scripts/release/module-automation/commons.js index 0f93c0eb3..4ee138377 100644 --- a/scripts/release/module-automation/commons.js +++ b/scripts/release/module-automation/commons.js @@ -1,7 +1,6 @@ const { basename, extname, join, resolve } = require("path"); const { access, readdir, copyFile, readFile, writeFile, rename, rm, mkdir, chmod } = require("fs/promises"); const { exec } = require("child_process"); -const { globSync } = require("glob"); const regex = { changelogs: /(?<=## \[unreleased\]\n)((?!## \[\d+\.\d+\.\d+\])\W|\w)*/i, @@ -261,51 +260,6 @@ function unzip(src, dest) { return execShellCommand(`unzip "${src}" -d "${dest}"`); } -async function getOssFiles(folderPath, isOssReadmeRequired) { - if (!folderPath || typeof folderPath !== "string") { - throw new TypeError(`Invalid folderPath: ${folderPath}`); - } - - const licenseFile = join(folderPath, `License.txt`); - try { - await access(licenseFile); - } catch { - throw new Error(`License file not found at expected location: ${licenseFile}`); - } - - const readmeossPattern = "*__*__READMEOSS_*.html"; - const readmeossFiles = globSync(readmeossPattern, { cwd: folderPath, absolute: true, ignore: "**/.*/**" }); - - if (isOssReadmeRequired && readmeossFiles.length === 0) { - throw new Error(`No OSS README file found in ${folderPath} matching ${readmeossPattern}`); - } - - if (readmeossFiles.length === 0) { - return [{ src: licenseFile, dest: basename(licenseFile) }]; - } - - const ossReadmeFile = readmeossFiles[0]; - - return [ - { src: licenseFile, dest: basename(licenseFile) }, - { src: ossReadmeFile, dest: basename(ossReadmeFile) } - ]; -} - -async function copyFilesToMpk(files, mpkOutput, moduleName) { - const projectPath = mpkOutput.replace(".mpk", ""); - // Unzip the mpk - await unzip(mpkOutput, projectPath); - await rm(mpkOutput, { recursive: true, force: true }); - // Add additional files to the MPK - for await (const file of files) { - await copyFile(file.src, join(projectPath, file.dest)); - } - // Re-zip and rename - await zip(projectPath, moduleName); - await rename(`${projectPath}.zip`, mpkOutput); -} - // Unzip the module, copy the widget and update package.xml async function exportModuleWithWidgets(moduleName, mpkOutput, widgetsFolders, additionalFiles) { console.log(`Adding ${widgetsFolders.length} widgets to module ${moduleName}`); @@ -374,7 +328,5 @@ module.exports = { zip, unzip, exportModuleWithWidgets, - copyFilesToMpk, - getOssFiles, regex }; diff --git a/scripts/release/module-automation/utils.ts b/scripts/release/module-automation/utils.ts new file mode 100644 index 000000000..0af7eff17 --- /dev/null +++ b/scripts/release/module-automation/utils.ts @@ -0,0 +1,78 @@ +import { access, copyFile, rename, rm } from "fs/promises"; +import { basename, join } from "path"; +import { globSync } from "glob"; +import { exec } from "child_process"; + +export async function getOssFiles( + folderPath: string, + isOssReadmeRequired: boolean +): Promise> { + if (!folderPath || typeof folderPath !== "string") { + throw new TypeError(`Invalid folderPath: ${folderPath}`); + } + + const licenseFile = join(folderPath, `License.txt`); + try { + await access(licenseFile); + } catch { + throw new Error(`License file not found at expected location: ${licenseFile}`); + } + + const readmeossPattern = "*__*__READMEOSS_*.html"; + const readmeossFiles = globSync(readmeossPattern, { cwd: folderPath, absolute: true, ignore: "**/.*/**" }); + + if (isOssReadmeRequired && readmeossFiles.length === 0) { + throw new Error(`No OSS README file found in ${folderPath} matching ${readmeossPattern}`); + } + + if (readmeossFiles.length === 0) { + return [{ src: licenseFile, dest: basename(licenseFile) }]; + } + + const ossReadmeFile = readmeossFiles[0]; + + return [ + { src: licenseFile, dest: basename(licenseFile) }, + { src: ossReadmeFile, dest: basename(ossReadmeFile) } + ]; +} + +type FilePathPair = { src: string; dest: string }; + +export async function copyFilesToMpk(files: FilePathPair[], mpkOutput: string, moduleName: string): Promise { + const projectPath = mpkOutput.replace(".mpk", ""); + // Unzip the mpk + await unzip(mpkOutput, projectPath); + await rm(mpkOutput, { recursive: true, force: true }); + // Add additional files to the MPK + for await (const file of files) { + await copyFile(file.src, join(projectPath, file.dest)); + } + // Re-zip and rename + await zip(projectPath, moduleName); + await rename(`${projectPath}.zip`, mpkOutput); +} + +export function zip(src: string, fileName: string): Promise { + return execShellCommand(`cd "${src}" && zip -r ../${fileName} .`); +} + +export function unzip(src: string, dest: string): Promise { + return execShellCommand(`unzip "${src}" -d "${dest}"`); +} + +function execShellCommand(cmd: string, workingDirectory = process.cwd()): Promise { + return new Promise((resolve, reject) => { + exec(cmd, { cwd: workingDirectory }, (error, stdout, stderr) => { + if (error) { + console.warn(stderr); + console.warn(stdout); + reject(error); + } + if (stderr) { + console.warn(stderr); + } + resolve(stdout); + }); + }); +} From c0419df6be7622ca38900bc84b696fbc3597f280 Mon Sep 17 00:00:00 2001 From: Yogendra Shelke Date: Fri, 13 Feb 2026 12:19:08 +0530 Subject: [PATCH 14/16] refactor: remove unused copyFilesToMpk and getOssFiles functions from commons.d.ts fix: ensure additionalFiles is an array before processing in exportModuleWithWidgets --- scripts/release/module-automation/commons.d.ts | 11 ----------- scripts/release/module-automation/commons.js | 6 ++++-- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/scripts/release/module-automation/commons.d.ts b/scripts/release/module-automation/commons.d.ts index 4b5735f21..24bed53ac 100644 --- a/scripts/release/module-automation/commons.d.ts +++ b/scripts/release/module-automation/commons.d.ts @@ -18,14 +18,3 @@ export function exportModuleWithWidgets( nativeWidgetFolders: string[], ossFiles?: Array<{ src: string; dest: string }> ): Promise; - -export function copyFilesToMpk( - files: Array<{ src: string; dest: string }>, - mpkOutput: string, - moduleNameInModeler: string -): Promise; - -export function getOssFiles( - folderPath: string, - isOssReadmeRequired: boolean -): Promise>; diff --git a/scripts/release/module-automation/commons.js b/scripts/release/module-automation/commons.js index 4ee138377..717dde883 100644 --- a/scripts/release/module-automation/commons.js +++ b/scripts/release/module-automation/commons.js @@ -299,8 +299,10 @@ async function exportModuleWithWidgets(moduleName, mpkOutput, widgetsFolders, ad throw new Error(`Including widgets in module failed. package.xml of widget/module ${moduleName} not found`); } // Add additional files to the MPK - for await (const file of additionalFiles) { - await copyFile(file.src, join(projectPath, file.dest)); + if (Array.isArray(additionalFiles)) { + for await (const file of additionalFiles) { + await copyFile(file.src, join(projectPath, file.dest)); + } } // Re-zip and rename await zip(projectPath, moduleName); From 7a85ec249f30324f9e33593d4b37210ad13d4226 Mon Sep 17 00:00:00 2001 From: undefined Date: Fri, 13 Feb 2026 12:30:23 +0530 Subject: [PATCH 15/16] feat: update create-modules script to use ts-node and enhance module creation with OSS files --- package.json | 2 +- scripts/release/createNativeModules.js | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 74d64789b..c76cb7919 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "release": "pnpm -r run release", "release:marketplace": "pnpm -r run release:marketplace", "release-github:widget": "node ./scripts/release/createWidgetRelease.js", - "create-modules": "node ./scripts/release/createNativeModules.js", + "create-modules": "ts-node --project ./scripts/tsconfig.json ./scripts/release/createNativeModules.js", "build-mpk": "ts-node --project ./scripts/tsconfig.json ./scripts/release/build-mpk.ts", "version": "ts-node --project ./scripts/tsconfig.json ./scripts/release/BumpVersion.ts", "validate-staged-widget-versions": "node scripts/validation/validate-versions-staged-files.js", diff --git a/scripts/release/createNativeModules.js b/scripts/release/createNativeModules.js index 1c464bfe1..a9cc484d0 100644 --- a/scripts/release/createNativeModules.js +++ b/scripts/release/createNativeModules.js @@ -15,7 +15,7 @@ const { exportModuleWithWidgets, regex } = require("./module-automation/commons"); - +const { getOssFiles, copyFilesToMpk } = require("./module-automation/utils"); const repoRootPath = join(__dirname, "../../"); const [moduleFolderNameInRepo, version] = process.env.TAG.split("-v"); @@ -46,6 +46,7 @@ async function main() { async function createNativeMobileResourcesModule() { console.log("Creating the Native Mobile Resource module."); const moduleFolder = join(repoRootPath, "packages/jsActions", moduleFolderNameInRepo); + const ossFiles = await getOssFiles(moduleFolder, true); const tmpFolder = join(repoRootPath, "tmp", moduleFolderNameInRepo); const widgetFolders = await readdir(join(repoRootPath, "packages/pluggableWidgets")); const nativeWidgetFolders = widgetFolders @@ -63,7 +64,7 @@ async function createNativeMobileResourcesModule() { await commitAndCreatePullRequest(moduleInfo); await updateNativeComponentsTestProject(moduleInfo, tmpFolder, nativeWidgetFolders); const mpkOutput = await createMPK(tmpFolder, moduleInfo, regex.excludeFiles); - await exportModuleWithWidgets(moduleInfo.moduleNameInModeler, mpkOutput, nativeWidgetFolders); + await exportModuleWithWidgets(moduleInfo.moduleNameInModeler, mpkOutput, nativeWidgetFolders, ossFiles); await createGithubRelease(moduleInfo, moduleChangelogs, mpkOutput); if (process.env.CI !== "true") { try { @@ -78,6 +79,7 @@ async function createNativeMobileResourcesModule() { async function createNanoflowCommonsModule() { console.log("Creating the Nanoflow Commons module."); const moduleFolder = join(repoRootPath, "packages/jsActions", moduleFolderNameInRepo); + const ossFiles = await getOssFiles(moduleFolder, true); const tmpFolder = join(repoRootPath, "tmp", moduleFolderNameInRepo); let moduleInfo = { ...(await getPackageInfo(moduleFolder)), @@ -91,6 +93,7 @@ async function createNanoflowCommonsModule() { await commitAndCreatePullRequest(moduleInfo); await updateNativeComponentsTestProject(moduleInfo, tmpFolder); const mpkOutput = await createMPK(tmpFolder, moduleInfo, regex.excludeFiles); + await copyFilesToMpk(ossFiles, mpkOutput, moduleInfo.moduleNameInModeler); await createGithubRelease(moduleInfo, moduleChangelogs, mpkOutput); if (process.env.CI !== "true") { try { From afcbc1c74d756bf1d8dabd6a0e09b2a3cca5a6b9 Mon Sep 17 00:00:00 2001 From: Yogendra Shelke Date: Fri, 13 Feb 2026 13:35:21 +0530 Subject: [PATCH 16/16] refactor: update oss readme validation criteria --- scripts/release/build-mpk.ts | 4 +- scripts/release/createNativeModules.js | 10 ++- scripts/release/module-automation/utils.ts | 78 ++++++++++++++++------ 3 files changed, 67 insertions(+), 25 deletions(-) diff --git a/scripts/release/build-mpk.ts b/scripts/release/build-mpk.ts index db54aedf8..37c013f62 100644 --- a/scripts/release/build-mpk.ts +++ b/scripts/release/build-mpk.ts @@ -105,7 +105,7 @@ async function createNativeMobileResourcesModule(): Promise { log("Creating the Native Mobile Resource module..."); const moduleFolder = join(repoRootPath, "packages/jsActions", inputs.module); log(`Module folder: ${moduleFolder}`); - const ossFiles = await getOssFiles(moduleFolder, false); + const ossFiles = await getOssFiles(moduleFolder); log(`OSS files to include: ${ossFiles.length}`); const tmpFolder = join(repoRootPath, "tmp", inputs.module); log(`Temp folder: ${tmpFolder}`); @@ -140,7 +140,7 @@ async function createNanoflowCommonsModule(): Promise { log("Creating the Nanoflow Commons module..."); const moduleFolder = join(repoRootPath, "packages/jsActions", inputs.module); log(`Module folder: ${moduleFolder}`); - const ossFiles = await getOssFiles(moduleFolder, false); + const ossFiles = await getOssFiles(moduleFolder); log(`OSS files to include: ${ossFiles.length}`); const tmpFolder = join(repoRootPath, "tmp", inputs.module); log(`Temp folder: ${tmpFolder}`); diff --git a/scripts/release/createNativeModules.js b/scripts/release/createNativeModules.js index a9cc484d0..8d8d58e66 100644 --- a/scripts/release/createNativeModules.js +++ b/scripts/release/createNativeModules.js @@ -46,7 +46,6 @@ async function main() { async function createNativeMobileResourcesModule() { console.log("Creating the Native Mobile Resource module."); const moduleFolder = join(repoRootPath, "packages/jsActions", moduleFolderNameInRepo); - const ossFiles = await getOssFiles(moduleFolder, true); const tmpFolder = join(repoRootPath, "tmp", moduleFolderNameInRepo); const widgetFolders = await readdir(join(repoRootPath, "packages/pluggableWidgets")); const nativeWidgetFolders = widgetFolders @@ -59,6 +58,10 @@ async function createNativeMobileResourcesModule() { }; moduleInfo = await bumpVersionInPackageJson(moduleFolder, moduleInfo); + const ossFiles = await getOssFiles(moduleFolder, { + package: moduleInfo.moduleNameInModeler, + version: moduleInfo.version + }); await githubAuthentication(moduleInfo); const moduleChangelogs = await updateChangelogs(nativeWidgetFolders, moduleInfo); await commitAndCreatePullRequest(moduleInfo); @@ -79,7 +82,6 @@ async function createNativeMobileResourcesModule() { async function createNanoflowCommonsModule() { console.log("Creating the Nanoflow Commons module."); const moduleFolder = join(repoRootPath, "packages/jsActions", moduleFolderNameInRepo); - const ossFiles = await getOssFiles(moduleFolder, true); const tmpFolder = join(repoRootPath, "tmp", moduleFolderNameInRepo); let moduleInfo = { ...(await getPackageInfo(moduleFolder)), @@ -87,6 +89,10 @@ async function createNanoflowCommonsModule() { moduleFolderNameInModeler: "nanoflowcommons" }; moduleInfo = await bumpVersionInPackageJson(moduleFolder, moduleInfo); + const ossFiles = await getOssFiles(moduleFolder, { + package: moduleInfo.moduleNameInModeler, + version: moduleInfo.version + }); await githubAuthentication(moduleInfo); const moduleChangelogs = await updateModuleChangelogs(moduleInfo); diff --git a/scripts/release/module-automation/utils.ts b/scripts/release/module-automation/utils.ts index 0af7eff17..b7ff2ab57 100644 --- a/scripts/release/module-automation/utils.ts +++ b/scripts/release/module-automation/utils.ts @@ -3,38 +3,32 @@ import { basename, join } from "path"; import { globSync } from "glob"; import { exec } from "child_process"; +type OssReadMeValidationCriteria = { + package: string; + version: string; +}; + export async function getOssFiles( folderPath: string, - isOssReadmeRequired: boolean + validationCriteria?: OssReadMeValidationCriteria ): Promise> { if (!folderPath || typeof folderPath !== "string") { throw new TypeError(`Invalid folderPath: ${folderPath}`); } - const licenseFile = join(folderPath, `License.txt`); + const license = join(folderPath, `License.txt`); try { - await access(licenseFile); + await access(license); } catch { - throw new Error(`License file not found at expected location: ${licenseFile}`); + throw new Error(`License file not found at expected location: ${license}`); } - const readmeossPattern = "*__*__READMEOSS_*.html"; - const readmeossFiles = globSync(readmeossPattern, { cwd: folderPath, absolute: true, ignore: "**/.*/**" }); - - if (isOssReadmeRequired && readmeossFiles.length === 0) { - throw new Error(`No OSS README file found in ${folderPath} matching ${readmeossPattern}`); + const readmePattern = "*__*__READMEOSS_*.html"; + const readme = globSync(readmePattern, { cwd: folderPath, absolute: true, ignore: "**/.*/**" })[0]; + if (validationCriteria) { + validateOssReadme(readme, validationCriteria); } - - if (readmeossFiles.length === 0) { - return [{ src: licenseFile, dest: basename(licenseFile) }]; - } - - const ossReadmeFile = readmeossFiles[0]; - - return [ - { src: licenseFile, dest: basename(licenseFile) }, - { src: ossReadmeFile, dest: basename(ossReadmeFile) } - ]; + return [{ src: license, dest: basename(license) }, ...(readme ? [{ src: readme, dest: basename(readme) }] : [])]; } type FilePathPair = { src: string; dest: string }; @@ -61,7 +55,7 @@ export function unzip(src: string, dest: string): Promise { return execShellCommand(`unzip "${src}" -d "${dest}"`); } -function execShellCommand(cmd: string, workingDirectory = process.cwd()): Promise { +export function execShellCommand(cmd: string, workingDirectory = process.cwd()): Promise { return new Promise((resolve, reject) => { exec(cmd, { cwd: workingDirectory }, (error, stdout, stderr) => { if (error) { @@ -76,3 +70,45 @@ function execShellCommand(cmd: string, workingDirectory = process.cwd()): Promis }); }); } + +export function validateOssReadme(ossReadme: string, validationCriteria: OssReadMeValidationCriteria): void { + if (!ossReadme || typeof ossReadme !== "string") { + throw new TypeError(`Invalid OSS README path/name: ${ossReadme}`); + } + if (!validationCriteria.version || typeof validationCriteria.version !== "string") { + throw new TypeError(`Invalid version: ${validationCriteria.version}`); + } + if (!validationCriteria.package || typeof validationCriteria.package !== "string") { + throw new TypeError(`Invalid package name: ${validationCriteria.package}`); + } + + const fileName = basename(ossReadme); + const expectedPackage = validationCriteria.package.trim(); + const expectedVersion = validationCriteria.version.trim(); + + // File name pattern: SiemensMendix____READMEOSS_*.html + // Example: SiemensMendixNanoflowCommons__6.3.1__READMEOSS_2026-02-10__04-28-37.html + const parsed = fileName.match(/^SiemensMendix(.+?)__(.+?)__READMEOSS_(.+)\.html$/); + + if (!parsed) { + throw new Error( + `OSS README validation failed: '${fileName}' does not match expected pattern ` + + `'SiemensMendix____READMEOSS_*.html'.` + ); + } + + const foundPackage = parsed[1]; + const foundVersion = parsed[2]; + + if (foundPackage !== expectedPackage) { + throw new Error( + `OSS README validation failed: expected package '${expectedPackage}' but found '${foundPackage}' in '${fileName}'.` + ); + } + + if (foundVersion !== expectedVersion) { + throw new Error( + `OSS README validation failed: expected version '${expectedVersion}' but found '${foundVersion}' in '${fileName}'.` + ); + } +}