diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index f240513..252aedf 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -38,4 +38,3 @@ jobs: run: | cd ./app/launch/ npm test -- --watchAll=false - npm run start:local \ No newline at end of file diff --git a/README.md b/README.md index 836b568..7a1cda5 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ npm run start:local ## Running a Grails Forge API locally to dev against -If you want to run against a version of the starter api (Micronaut Starter Api)[https://github.com/grails/grails-forge] +If you want to run against a version of the starter api (Grails Starter Api)[https://github.com/grails/grails-forge] Outside of this project pull down that repo diff --git a/app/launch/src/components/Application/__tests__/useApplicationForm.test.jsx b/app/launch/src/components/Application/__tests__/useApplicationForm.test.jsx index b70eb67..eb75dca 100644 --- a/app/launch/src/components/Application/__tests__/useApplicationForm.test.jsx +++ b/app/launch/src/components/Application/__tests__/useApplicationForm.test.jsx @@ -12,8 +12,8 @@ const TestView = () => { <>
{`${form.type}`}
{`${form.test}`}
-
{`${form.build}`}
-
{`${form.lang}`}
+
{`${form.servlet}`}
+
{`${form.gorm}`}
{`${form.javaVersion}`}
{`${form.name}`}
{`${form.package}`}
@@ -49,12 +49,12 @@ TEST_DATA.forEach(({ initialData }) => { `${initialData.test || ''}`, ]) - expect(testInstance.findByProps({ className: 'build' }).children).toEqual([ - `${initialData.build || ''}`, + expect(testInstance.findByProps({ className: 'servlet' }).children).toEqual([ + `${initialData.servlet || ''}`, ]) - expect(testInstance.findByProps({ className: 'lang' }).children).toEqual([ - `${initialData.lang || ''}`, + expect(testInstance.findByProps({ className: 'gorm' }).children).toEqual([ + `${initialData.gorm || ''}`, ]) expect( diff --git a/app/launch/src/components/CodePreview/CodePreview.js b/app/launch/src/components/CodePreview/CodePreview.js index d43f540..4cd9e4f 100644 --- a/app/launch/src/components/CodePreview/CodePreview.js +++ b/app/launch/src/components/CodePreview/CodePreview.js @@ -34,7 +34,7 @@ import CopyToClipboard from '../CopyToClipboard' import TooltipButton, { TooltipWrapper } from '../TooltipButton' const CodePreview = ({ theme = 'light', disabled, onLoad, onClose }, ref) => { - const { lang, build } = useStarterForm() + const { gorm, servlet } = useStarterForm() const sharable = useSharableLink() const [showing, setShowing] = useState(null) @@ -194,10 +194,9 @@ const CodePreview = ({ theme = 'light', disabled, onLoad, onClose }, ref) => { { - const { lang, build } = useStarterForm() + const { gorm, servlet } = useStarterForm() const [diff, setDiff] = useState(null) useKeyboardShortcuts(DIFF_SHORTCUT.keys, onLoad, disabled) @@ -67,10 +67,8 @@ const Diff = ({ theme = 'light', disabled, onLoad, onClose }, ref) => { { >

- Micronaut Launch is a web application that allows you to create - Micronaut projects through an interface instead of using the console + Grails Forge is a web application that allows you to create + Grails projects through an interface instead of using the console CLI. You can set the application type, the project name, the - language (Java, Kotlin, Groovy), the build tool (Maven, Gradle), the + GORM implementation (Hibernate5, MongoDB, Neo4J), the embedded servlet (Tomcat, Jetty, Undertow, or None), the Java version and the features you need to develop your software.

diff --git a/app/launch/src/components/Links/GitHubLink.js b/app/launch/src/components/Links/GitHubLink.js index 674df8e..d2d5f32 100644 --- a/app/launch/src/components/Links/GitHubLink.js +++ b/app/launch/src/components/Links/GitHubLink.js @@ -7,9 +7,9 @@ export const GitHubLink = ({ className, theme }) => { return ( { if (!createCommand) return [] return [ - { link: createCommand.toCli(), title: 'Using the Micronaut CLI' }, + { link: createCommand.toCli(), title: 'Using the Grails CLI' }, { link: createCommand.toCurl(), title: 'Using cURL' }, ] }, [createCommand]) diff --git a/app/launch/src/components/StarterForm/StarterForm.js b/app/launch/src/components/StarterForm/StarterForm.js index 5d7ea67..1e2b1f6 100644 --- a/app/launch/src/components/StarterForm/StarterForm.js +++ b/app/launch/src/components/StarterForm/StarterForm.js @@ -4,12 +4,12 @@ import Col from 'react-materialize/lib/Col' import Row from 'react-materialize/lib/Row' import StarterFormApplicationType from './StarterFormApplicationType' -import StarterFormBuild from './StarterFormBuild' import StarterFormGorm from "./StarterFormGorm"; import StarterFormJavaVersion from './StarterFormJavaVersion' import StarterFormMicronautVersion from './StarterFormMicronautVersion' import StarterFormName from './StarterFormName' import StarterFormPackage from './StarterFormPackage' +import StarterFormServlet from './StarterFormServlet' import StarterFormTestFramework from './StarterFormTestFramework' const StarterForm = ({ onError }) => { @@ -34,7 +34,7 @@ const StarterForm = ({ onError }) => { - + diff --git a/app/launch/src/components/StarterForm/StarterFormServlet.js b/app/launch/src/components/StarterForm/StarterFormServlet.js new file mode 100644 index 0000000..fa95591 --- /dev/null +++ b/app/launch/src/components/StarterForm/StarterFormServlet.js @@ -0,0 +1,32 @@ +import { NEXT_BUILD_SHORTCUT } from '../../constants/shortcuts' +import useKeyboardShortcuts from '../../hooks/useKeyboardShortcuts' +import { useServlet } from '../../state/store' +import RadioGroup from '../RadioGroup' +import { useOptHandler } from './useStarterFormKeyboardEvents' + +export default function StarterFormServlet() { + const [value, setter, select] = useServlet() + const handleChange = (event) => setter(event.target.value) + + const next = useOptHandler( + 'servlet', + value, + select?.options ?? [], + handleChange + ) + useKeyboardShortcuts(NEXT_BUILD_SHORTCUT.keys, next) + + return ( + + ) +} diff --git a/app/launch/src/constants/shortcuts.js b/app/launch/src/constants/shortcuts.js index 609cc30..a85fd9a 100644 --- a/app/launch/src/constants/shortcuts.js +++ b/app/launch/src/constants/shortcuts.js @@ -7,6 +7,7 @@ import { KEY_CODE_J, KEY_CODE_L, KEY_CODE_P, + KEY_CODE_S, KEY_CODE_QUESTION, KEY_CODE_SHIFT, KEY_CODE_T, @@ -40,7 +41,7 @@ export const GENERATE_SHORTCUT = { } export const NEXT_VERSION_SHORTCUT = { - label: 'Toggle to the Next Micronaut Version', + label: 'Toggle to the Next Grails Version', textValue: SHIFT_TEXT + ' + V', keys: [KEY_CODE_SHIFT, KEY_CODE_V], } @@ -75,6 +76,12 @@ export const NEXT_BUILD_SHORTCUT = { keys: [KEY_CODE_SHIFT, KEY_CODE_B], } +export const NEXT_SERVLET_SHORTCUT = { + label: 'Toggle to the Servlet Build', + textValue: SHIFT_TEXT + ' + S', + keys: [KEY_CODE_SHIFT, KEY_CODE_S], +} + export const NEXT_TEST_SHORTCUT = { label: 'Toggle to the Next Test Framework', textValue: SHIFT_TEXT + ' + T', diff --git a/app/launch/src/micronaut/CreateCommand.js b/app/launch/src/micronaut/CreateCommand.js index e7e1fbe..969d3e3 100644 --- a/app/launch/src/micronaut/CreateCommand.js +++ b/app/launch/src/micronaut/CreateCommand.js @@ -4,14 +4,14 @@ import ToUrl from './creators/ToUrl' export class CreateCommand { constructor( - { type, javaVersion, build, gorm, test, name, package: _package, features }, + { type, javaVersion, servlet, gorm, test, name, package: _package, features }, baseUrl = '' ) { this.type = type this.javaVersion = javaVersion this.name = name this.gorm = gorm - this.build = build + this.servlet = servlet this.test = test this.package = _package this.features = features diff --git a/app/launch/src/micronaut/FeatureCommand.js b/app/launch/src/micronaut/FeatureCommand.js index 5baed93..2da2c56 100644 --- a/app/launch/src/micronaut/FeatureCommand.js +++ b/app/launch/src/micronaut/FeatureCommand.js @@ -2,11 +2,11 @@ import ToUrl from './creators/ToUrl' export class FeatureCommand { constructor( - { javaVersion, build, gorm, test }, + { javaVersion, servlet, gorm, test }, featuresUrl = '' ) { this.javaVersion = javaVersion - this.build = build + this.servlet = servlet this.gorm = gorm this.test = test this.baseUrl = featuresUrl diff --git a/app/launch/src/micronaut/creators/ToCli.js b/app/launch/src/micronaut/creators/ToCli.js index 6c3fb93..e72a069 100644 --- a/app/launch/src/micronaut/creators/ToCli.js +++ b/app/launch/src/micronaut/creators/ToCli.js @@ -16,13 +16,13 @@ function buildFeaturesArgs(features) { export default class ToCli { static make(createCommand) { - const { lang, build, test, javaVersion } = createCommand + const { gorm, servlet, test, javaVersion } = createCommand const jdk = javaVersion ? javaVersion.replace('JDK_', '') : null const command = deriveCommand(createCommand.type) const applicationName = createCommand.applicationName() const features = buildFeaturesArgs(createCommand.features) - const opts = { build, jdk, lang, test, features } + const opts = { servlet, jdk, gorm, test, features } const args = Object.keys(opts).reduce((acc, key) => { const value = opts[key] if (value) { @@ -31,6 +31,6 @@ export default class ToCli { return acc }, []) - return ['mn', command, ...args, applicationName].join(' ').toLowerCase() + return ['grails', command, ...args, applicationName].join(' ').toLowerCase() } } diff --git a/app/launch/src/micronaut/creators/ToUrl.js b/app/launch/src/micronaut/creators/ToUrl.js index 7b1a322..fcbcc8c 100644 --- a/app/launch/src/micronaut/creators/ToUrl.js +++ b/app/launch/src/micronaut/creators/ToUrl.js @@ -12,14 +12,14 @@ export default class ToUrl { static makeFeaturesUrl(featureCommand, baseUrl) { const { javaVersion, - build, + servlet, gorm, test, } = featureCommand const query = [ gorm && `gorm=${featureCommand.gorm}`, - build && `build=${featureCommand.build}`, + servlet && `servlet=${featureCommand.servlet}`, test && `test=${featureCommand.test}`, javaVersion && `javaVersion=${featureCommand.javaVersion}`, ].filter((i) => i) @@ -36,7 +36,7 @@ export default class ToUrl { const { type, gorm, - build, + servlet, test, javaVersion, features, @@ -48,7 +48,7 @@ export default class ToUrl { const query = [ gorm && `gorm=${gorm}`, - build && `build=${build}`, + servlet && `servlet=${servlet}`, test && `test=${test}`, javaVersion && `javaVersion=${javaVersion}`, ].filter((i) => i) diff --git a/app/launch/src/state/factories/initializeState.js b/app/launch/src/state/factories/initializeState.js index 7cfe85b..b861f24 100644 --- a/app/launch/src/state/factories/initializeState.js +++ b/app/launch/src/state/factories/initializeState.js @@ -8,11 +8,11 @@ import { StarterSDK } from './StarterSDK' export const INITIAL_FORM_DATA_STORAGE_KEY = 'INITIAL_FORM_DATA' const initialForm = (initialData) => { - const { javaVersion, lang, build, test, features } = initialData + const { javaVersion, gorm, servlet, test, features } = initialData const parsed = { javaVersion: typeof javaVersion === 'string' ? javaVersion : '', // This is specifically "" to work with the SelectOption component - lang: typeof lang === 'string' ? lang : '', - build: typeof build === 'string' ? build : '', + servlet: typeof servlet === 'string' ? servlet : '', + gorm: typeof gorm === 'string' ? gorm : '', test: typeof test === 'string' ? test : '', features: StarterSDK.reconstructFeatures(features), [ACTIVITY_KEY]: initialData[ACTIVITY_KEY], diff --git a/app/launch/src/state/store.js b/app/launch/src/state/store.js index 3550914..09c1a46 100644 --- a/app/launch/src/state/store.js +++ b/app/launch/src/state/store.js @@ -126,6 +126,11 @@ export const buildState = atom({ default: defaultValueSelectorFactory('build'), }) +export const servletState = atom({ + key: 'SERVLET_STATE', + default: defaultValueSelectorFactory('servlet'), +}) + export const gormState = atom({ key: 'GORM_STATE', default: defaultValueSelectorFactory('gorm'), @@ -172,7 +177,7 @@ export const starterFormState = selector({ const type = get(appTypeState) const name = get(nameState) const pkg = get(packageState) - const build = get(buildState) + const servlet = get(servletState) const gorm = get(gormState) const test = get(testState) const javaVersion = get(javaVersionState) @@ -187,7 +192,7 @@ export const starterFormState = selector({ package: pkg, javaVersion, gorm, - build, + servlet, test, features, }) @@ -392,6 +397,13 @@ export const useBuild = () => { return [value, setter, select] } +export const useServlet = () => { + const [value, setter] = useRecoilState(servletState) + const select = useSelectOptionsForType('servlet') + useDerivedDefultsEffect(select, setter) + return [value, setter, select] +} + export const useGorm = () => { const [value, setter] = useRecoilState(gormState) const select = useSelectOptionsForType('gorm') @@ -431,7 +443,7 @@ export const useResetStarterForm = () => { set(packageState, resets.package) set(appTypeState, options.type.defaultOption.value) - set(buildState, options.build.defaultOption.value) + set(servletState, options.servlet.defaultOption.value) set(gormState, options.gorm.defaultOption.value) set(testState, options.test.defaultOption.value) set(javaVersionState, options.jdkVersion.defaultOption.value)