{ "id": "174760", "key": "ALOY-1722", "fields": { "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false }, "project": { "id": "11113", "key": "ALOY", "name": "Alloy", "projectCategory": { "id": "10400", "description": "Tools for developing applications", "name": "Tooling" } }, "fixVersions": [], "resolution": null, "resolutiondate": null, "created": "2020-02-24T19:57:09.000+0000", "epic": { "id": 174738, "key": "ALOY-1719", "name": "Alloy Modularization", "summary": "Split out Alloy monolith into separate packages", "color": { "key": "color_7" }, "done": false }, "priority": { "name": "None", "id": "6" }, "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "updated": "2020-03-09T11:20:45.000+0000", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [], "description": "The alloy plugin seems to support requiring alloy via require('alloy') but it errors out as the args are not properly configured.\r\n\r\nThe alloy executable should be creating a new instance of alloy and using that so that no matter if you are calling alloy from CLI or programmatically via require('alloy'), they would both behave the same way.\r\n\r\nTitanium CLI should also behave the same way but that should be a separate ticket.", "attachment": [], "flagged": false, "summary": "Cannot make calls to alloy programmatically via require", "creator": { "name": "bhouse", "key": "bhouse", "displayName": "Brenton House", "active": true, "timeZone": "America/Chicago" }, "subtasks": [], "reporter": { "name": "bhouse", "key": "bhouse", "displayName": "Brenton House", "active": true, "timeZone": "America/Chicago" }, "environment": null, "comment": { "comments": [ { "id": "454402", "author": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "body": "[~bhouse] this is something we are aiming towards, but I don't think it should be classed as a bug as Alloy wasn't designed in this way. There's an open improvement ticket (ALOY-879) to expose Alloy as a module, and the work [~jvennemann] is doing will help us get there.", "updateAuthor": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "created": "2020-02-24T21:33:09.000+0000", "updated": "2020-02-24T21:33:09.000+0000" }, { "id": "454403", "author": { "name": "bhouse", "key": "bhouse", "displayName": "Brenton House", "active": true, "timeZone": "America/Chicago" }, "body": "[~eharris] - I changed it to \"New Feature\". I am not sure if the work the Jan is doing will help as I am not sure that is focused on non-webpack usage.", "updateAuthor": { "name": "bhouse", "key": "bhouse", "displayName": "Brenton House", "active": true, "timeZone": "America/Chicago" }, "created": "2020-02-24T21:52:58.000+0000", "updated": "2020-02-24T21:52:58.000+0000" }, { "id": "454404", "author": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "body": "[~bhouse], that work will be folded back into the main alloy package, see https://github.com/appcelerator/alloy/pull/952. ", "updateAuthor": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "created": "2020-02-24T22:02:43.000+0000", "updated": "2020-02-24T22:02:43.000+0000" }, { "id": "454543", "author": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~bhouse], do you have specific use case what you want to do with Alloy programmatically? I was only interested in using the Alloy compiler, so that's the only thing i worked on and made that available as a standalone package.\r\n\r\nAs Ewan already mentioned, the compiler is fully compatible with existing Alloy code and will be folded back into the main repo. I just added Webpack support on top of it.", "updateAuthor": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "created": "2020-03-04T13:12:49.000+0000", "updated": "2020-03-04T13:12:49.000+0000" }, { "id": "454548", "author": { "name": "bhouse", "key": "bhouse", "displayName": "Brenton House", "active": true, "timeZone": "America/Chicago" }, "body": "Inside the Titanium plugin that executes alloy, I want to require alloy (instead of opening it in a new process). ", "updateAuthor": { "name": "bhouse", "key": "bhouse", "displayName": "Brenton House", "active": true, "timeZone": "America/Chicago" }, "created": "2020-03-04T15:34:32.000+0000", "updated": "2020-03-04T15:34:32.000+0000" }, { "id": "454573", "author": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "body": "Some more info would be great. Why do you want to require it? Just to avoid spawning a new process? And then kick off an Alloy build as usual?", "updateAuthor": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "created": "2020-03-06T13:32:58.000+0000", "updated": "2020-03-06T13:39:06.000+0000" }, { "id": "454577", "author": { "name": "bhouse", "key": "bhouse", "displayName": "Brenton House", "active": true, "timeZone": "America/Chicago" }, "body": ":D \"Just\" \r\n\r\nA lot of this goes to following best practices and correcting old mistakes. We never should have built a tool that we would have to spawn a new process for and have to serialize all input when it was going into a Titanium plugin. This can be avoided by always having your alloy cli code call require on the main alloy file. That way the alloy cli supports both. As it is right now, we have no context sharing between Titanium and Alloy. Titanium knows all kinds of info about native modules, etc and the only way for Alloy to get that information is to reparse files and recreate the work that was done in Titanium.", "updateAuthor": { "name": "bhouse", "key": "bhouse", "displayName": "Brenton House", "active": true, "timeZone": "America/Chicago" }, "created": "2020-03-06T16:14:27.000+0000", "updated": "2020-03-06T16:14:27.000+0000" }, { "id": "454581", "author": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "body": "That \"just\" was indeed a huge understatement, but i was only interested if thats \"all\" you wanted to do or anything else was going on ;)\r\n\r\nSo, yeah, ideally Alloy would have a Node API that the CLI just wraps and passes all info into. The thing is that Alloy does not really has such an API and everything is designed around Alloy being called as a CLI as the main entry. As Ewan already mentioned, this is something we are aiming towards, but there is a long way ahead of us. This could be something for ALOY-1719.", "updateAuthor": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "created": "2020-03-06T16:46:16.000+0000", "updated": "2020-03-06T16:46:16.000+0000" }, { "id": "454595", "author": { "name": "bhouse", "key": "bhouse", "displayName": "Brenton House", "active": true, "timeZone": "America/Chicago" }, "body": "It's not very complicated. Give me an hour or less and I will create a PR for it. ", "updateAuthor": { "name": "bhouse", "key": "bhouse", "displayName": "Brenton House", "active": true, "timeZone": "America/Chicago" }, "created": "2020-03-06T20:46:47.000+0000", "updated": "2020-03-06T20:46:47.000+0000" }, { "id": "454596", "author": { "name": "bhouse", "key": "bhouse", "displayName": "Brenton House", "active": true, "timeZone": "America/Chicago" }, "body": "[~jvennemann] [~eharris] PR done: https://github.com/appcelerator/alloy/pull/956", "updateAuthor": { "name": "bhouse", "key": "bhouse", "displayName": "Brenton House", "active": true, "timeZone": "America/Chicago" }, "created": "2020-03-06T21:24:45.000+0000", "updated": "2020-03-06T21:24:45.000+0000" } ], "maxResults": 10, "total": 10, "startAt": 0 } } }