-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat(cli): add Alloy app to create menu #14387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from 9 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
1c1e0ef
feat(cli): add Alloy app to create menu
m1ga 2606200
refactor code
m1ga 32a647d
fix lint issue
m1ga a1433c2
fix: add alloy check, move app_alloy to alloy, use numbers in create
m1ga 13a8645
fix: try/catch around alloy create
m1ga fd2b33c
Merge branch 'main' into cliAlloy
m1ga 243e49f
Update cli/commands/create.js
m1ga 1ccaf4d
Update cli/commands/create.js
m1ga 2aff15f
fix: move check into success branch
m1ga 3cce7bc
move success after error
m1ga 103024a
move success after error
m1ga e6c199c
Merge branch 'cliAlloy' of https://github.com/tidev/titanium-sdk into…
m1ga 03d8f1b
remove duplicated message
m1ga 6c6c352
optimize success message
m1ga ae9a4c7
fix linter
m1ga File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| /** | ||
| * @overview | ||
| * Logic for creating new Titanium apps. | ||
| * | ||
| * @copyright | ||
| * Copyright TiDev, Inc. 04/07/2022-Present | ||
| * | ||
| * @license | ||
| * Licensed under the terms of the Apache Public License | ||
| * Please see the LICENSE included with this distribution for details. | ||
| */ | ||
|
|
||
| import { BaseAppCreator } from './base_app.js'; | ||
| import { execSync } from 'node:child_process'; | ||
|
|
||
| /** | ||
| * Creates application projects. | ||
| * | ||
| * @module lib/creators/app | ||
| */ | ||
| export class AppCreator extends BaseAppCreator { | ||
| /** | ||
| * Constructs the app creator. | ||
| * @class | ||
| * @classdesc Creates an app project. | ||
| * @constructor | ||
| * @param {Object} logger - The logger instance | ||
| * @param {Object} config - The CLI config | ||
| * @param {Object} cli - The CLI instance | ||
| */ | ||
| constructor(logger, config, cli) { // eslint-disable-line no-unused-vars | ||
| super(logger, config, cli, { | ||
| title: 'Titanium App (Alloy)', | ||
| titleOrder: 2, | ||
| type: 'alloy' | ||
| }); | ||
| } | ||
m1ga marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| init() { | ||
| // check if alloy is installed | ||
| try { | ||
| execSync('alloy --version'); | ||
| } catch (err) { | ||
| throw new Error('Alloy is not installed'); | ||
| } | ||
| return super.init(); | ||
| } | ||
| } | ||
|
|
||
| export default AppCreator; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be moved before the "Project created successfully".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vs
Not sure if we should end with the error message or not. I see the argument that in the first one it will be more visible that the project is created.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think what I am trying to suggest is we have multiple sad paths and one happy path.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trying to move it above the message "Project created successfully" but I'm having troubles with github at the moment 😞
update: looks like it worked, guess it was some caching.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking we should
process.exit(1), but now I'm wondering we should throw and let the CLI catch it and exit w/ code 1.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've pushed an update that will show the
Project created successfullymessage ONLY if it's really created.So:
ti create --alloywithout Alloy installed will now just show theERRORmessage as you wanted to have an Alloy project and it's not "successful".All other cases (alloy installed or creating a classic project) will show
Project created successfullyat the end.