{ "id": "173225", "key": "TIMOB-26920", "fields": { "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": null, "resolutiondate": null, "created": "2019-03-22T15:12:50.000+0000", "priority": { "name": "None", "id": "6" }, "labels": [ "cb-tooling", "engTriage" ], "versions": [], "issuelinks": [ { "id": "58224", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "174317", "key": "DAEMON-301", "fields": { "summary": "@appcd/plugin-titanium: ti create command with template option", "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" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "7", "description": "gh.issue.story.desc", "name": "Story", "subtask": false } } } } ], "assignee": { "name": "amukherjee", "key": "amukherjee", "displayName": "Abir Mukherjee", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2020-11-23T17:53:16.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": "I think there have been similar tickets in the past but this feature is focused on the ability to create a new Titanium mobile app (using Alloy or another framework) from any source.\r\n\r\n- Local directory\r\n- Tarball (url)\r\n- npm package\r\n- Git repo (GitHub, Bitbucket, GitLab, etc)\r\n\r\nThis would significantly expand the options for developers that are creating new apps and allow Axway (and others) to provide templates for many different kinds of apps (with variations).\r\n\r\nOne way to achieve this is to take advantage of npm and the power it has to do almost all this already. The Titanium CLI can simply spawn npm to install from any of these sources and then template the newly installed app based on parameters from CLI or config. It could also provide the option for installing from local directory where no package.json file exists by just copying the files locally.\r\n\r\n", "attachment": [], "flagged": false, "summary": "Add ability to create new app from a template", "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": "447084", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "So, some thoughts:\r\n- We have this general idea in Studio where you have sample projects/templates and here it's more outwardly exposed to the user as they have to select one at project creation\r\n- We have project templates in alloy and classic apps, but it's just sort of baked in.\r\n\r\nI agree, we should move this to a behavior that's easier to consume via npm packages so that we can use it in Atom/VSCode/CLI.\r\n\r\nAs for how it occurs, that'd be something we'd need to try out - do we pass a special arg to {{ti create}}/{{appc new}}? Do we have users run something like {{npx my-awesome-template}} in the root of a project and it just modifies the project in-place?", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2019-03-22T16:41:23.000+0000", "updated": "2019-03-22T16:41:23.000+0000" }, { "id": "447085", "author": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "body": "Titanium CLI already supports creating new apps using a built-in template by name, a local path to a directory containing a template project, a local path to a zip file, or a URL to a zip file to download. We could easily add support to https://github.com/appcelerator/titanium_mobile/blob/master/cli/lib/creator.js for installing a template from npm or a git repo. To be clear, this functionality goes in the Titanium SDK today, but eventually in titaniumlib.", "updateAuthor": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "created": "2019-03-22T16:46:33.000+0000", "updated": "2019-03-22T16:46:33.000+0000" }, { "id": "447086", "author": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "body": "I think we should prefer git repos over publishing to npm here, it seems unnatural to publish templates to npm to me (I'm not aware of any project that does this today).\r\n\r\nIt is super simple to fetch archives (zips or tarballs) from git hosting services, I built [targit|https://github.com/ewanharris/targit] to achieve this with amplify pm, it definitely supports GitHub, and should be fine with Bitbucket and GitLab (assuming I can read their docs just fine), I've had it on the backburner for a while to improve the testing there. You can reference by tags or branches for these services so you even get versioning for free!\r\n\r\nOne thing in addition here that I think would be crucial to have is {{ti create --type template}}, that chucks all the needed stuff in a directory rather than leaving people blind as to what's needed, that could even take an existing project and then convert it to a template if we're feeling super adventurous.", "updateAuthor": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "created": "2019-03-22T16:47:30.000+0000", "updated": "2019-03-22T16:47:30.000+0000" }, { "id": "447087", "author": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "body": "It also might not be a bad idea to consider supporting installing templates via the AMPLIFY CLI Package Manager since that front-ends the marketplace (in addition to GitHub and npm).", "updateAuthor": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "created": "2019-03-22T16:51:22.000+0000", "updated": "2019-03-22T16:51:22.000+0000" }, { "id": "447088", "author": { "name": "bhouse", "key": "bhouse", "displayName": "Brenton House", "active": true, "timeZone": "America/Chicago" }, "body": "Here is a link to a simple tool I created that does something like this: https://www.npmjs.com/package/@geek/mobile#mobile-appcreate-name-template\r\n\r\nI think templating variable in the template would be important but optional for the developer. A template could be just an existing app and it could just reset the GUID, ID, and name on it. Installing a template from npm, as well as GitHub, will then easily support versioning of templates. If a developer wants to use a specific version of a template (for one reason or another), they can do that. \r\n\r\nUsing post-install scripts with npm could also be very handy for doing any template-specific transformations necessary for the new mobile app.", "updateAuthor": { "name": "bhouse", "key": "bhouse", "displayName": "Brenton House", "active": true, "timeZone": "America/Chicago" }, "created": "2019-03-22T16:56:46.000+0000", "updated": "2019-03-22T16:56:46.000+0000" }, { "id": "447089", "author": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "body": "[~bhouse] I fail to understand why you created yet another CLI instead of just helping us improve our own products. You have great ideas and the team is open to your input and help.\r\n\r\nHow about spending the time coming up with a spec that takes into account what other project are doing, handles downloading from various sources, file placement, file renaming, variable replacing, file generation, etc. What is the template install lifecycle? Why would we spawn {{npm}} instead of just using {{libnpm}}? Should we be responsible for installing npm dependencies or the app developer? How are we going to handle conflicts? There are several scenarios and details to be worked out. Once we know what it is we want to build, then we can add it the Titanium CLI and all of our users can benefit.", "updateAuthor": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "created": "2019-03-22T17:24:46.000+0000", "updated": "2019-03-22T17:24:46.000+0000" }, { "id": "447090", "author": { "name": "bhouse", "key": "bhouse", "displayName": "Brenton House", "active": true, "timeZone": "America/Chicago" }, "body": "[~cbarber] Sorry! I wrote the tool as a temporary solution to an existing need I had and I didn't mean to create a problem. I was going to keep it to myself but thought it might be good to share with community as well. This tool just took a couple of hours to write so there is not much invested in it. By taking advantage of pre-existing libraries, there was actually very little code I had to write. This was intended to be more along the lines of open-source projects like https://github.com/jasonkneen/tn, https://github.com/jasonkneen/TiTh, https://github.com/jasonkneen/TiCons-CLI, https://github.com/propelics/tiapp-updater, https://github.com/jasonkneen/RESTe, and other tools that enhance the developer experience of working with Titanium.\r\n\r\nI will reach out to you and others offline to see what I can do to help with creating a spec and helping to get these features into the Titanium CLI. \r\n\r\n- on npmlib: I don't think libnpm supports installing but we could probably just spawn npm to do it. \r\n- on npm dependencies: Not sure what we want for Titanium CLI but the tool is running npm install to install dependencies right after creation of project.\r\n- on conflicts: I am not exactly sure which conflicts we need to handle but I agree, we should work out details and rules.\r\n\r\n", "updateAuthor": { "name": "bhouse", "key": "bhouse", "displayName": "Brenton House", "active": true, "timeZone": "America/Chicago" }, "created": "2019-03-22T18:19:23.000+0000", "updated": "2019-03-22T18:19:23.000+0000" }, { "id": "447113", "author": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "body": "libnpm is the pieces that you can put together to make {{npm install}}, so for example you'd fetch the tarball via this and then call the extract function if you'd want (or just use a custom one). This would avoid having to do things like\r\n\r\n* shelling out to the npm cli where you'd be taking a hit on performance and having to code around handling their error codes\r\n* running {{npm install