Last active
November 13, 2019 15:44
-
-
Save ndugger/b9c6b687207287af22499c2a2daf8dfb to your computer and use it in GitHub Desktop.
react-cli & react-commander are internally built libraries, so you won't find them on NPM (yet)
This file contains 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
import * as React from 'react'; | |
import * as Commander from 'react-commander'; | |
import { Logo } from 'this/components/Logo'; | |
import { CreateAction } from 'this/components/actions/CreateAction'; | |
import { LaunchAction } from 'this/components/actions/LaunchAction'; | |
import { UpdateAction } from 'this/components/actions/UpdateAction'; | |
export const Application: React.FC = () => { | |
return ( | |
<React.Fragment> | |
<Logo/> | |
<Commander.Program arguments={ global.process.argv }> | |
<Commander.Command name='create' description='Create new project in current directory'> | |
<Commander.Action> | |
<CreateAction/> | |
</Commander.Action> | |
</Commander.Command> | |
<Commander.Command name='launch' description='Launch application in development mode'> | |
<Commander.Option name='port' flag='p' input defaultValue='8080'/> | |
<Commander.Action> | |
<LaunchAction/> | |
</Commander.Action> | |
</Commander.Command> | |
<Commander.Command name='update' description='Update project in current directory'> | |
<Commander.Option name='version' flag='v' input defaultValue='latest'/> | |
<Commander.Action> | |
<UpdateAction/> | |
</Commander.Action> | |
</Commander.Command> | |
</Commander.Program> | |
</React.Fragment> | |
); | |
}; |
This file contains 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
import * as React from 'react'; | |
import * as CommandLine from 'react-cli'; | |
import * as Commander from 'react-commander'; | |
import { CreateCommand } from 'this/commands/CreateCommand'; | |
export const CreateAction: React.FC = () => { | |
const command = Commander.useCommand<CreateCommand>(); | |
return ( | |
<React.Fragment> | |
<CommandLine.X flexDirection='column'> | |
<CommandLine.Text bold> | |
[{ command.name.toUpperCase() }] { command.description } | |
</CommandLine.Text> | |
<CommandLine.X flexDirection='column'> | |
<CommandLine.Text color={ [125, 125, 125] }> | |
The following form is used to generate your project and its configuration | |
</CommandLine.Text> | |
<CommandLine.Text color={ [125, 125, 125] }> | |
You may change any and all of these values afterwards, so don't worry if you make a mistake | |
</CommandLine.Text> | |
</CommandLine.X> | |
</CommandLine.X> | |
<CommandLine.Form> | |
<CommandLine.Input label='Project Name' name='project_name'/> | |
<CommandLine.Input label='Project Description' name='project_description'/> | |
<CommandLine.Input label='Application CI (Blossom)' name='application_ci'/> | |
</CommandLine.Form> | |
</React.Fragment> | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment