From caa6bbd26dc66281c6b120cb47ca24aca411832b Mon Sep 17 00:00:00 2001 From: Brent Jackson Date: Tue, 5 Jun 2018 23:17:32 -0400 Subject: [PATCH] Add support for preact --- README.md | 3 ++- renderer/Project.js | 59 +++++++++++++++++++++++-------------------- renderer/constants.js | 9 +++++++ 3 files changed, 42 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 05ee5ac..4ac9b7f 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ RAM includes support for the following app types: - [Gatsby][gatsby] - [Razzle][razzle] - [Vue.js][vuejs] +- [Preact][preact] To add support for another app, please [open a pull request](#contributing). @@ -86,7 +87,6 @@ Some alternatives to this particular Electron setup include: - [ ] Abstract create form to a more general purpose utility - [ ] npm depencendy management -- [ ] Preact CLI support ## Contributing @@ -123,3 +123,4 @@ No Babel transpilation is used, so be sure to use Electron-compatible modules an [gatsby]: https://github.com/gatsbyjs/gatsby [razzle]: https://github.com/jaredpalmer/razzle [vuejs]: https://github.com/vuejs/vue +[preact]: https://github.com/developit/preact diff --git a/renderer/Project.js b/renderer/Project.js index b7863ee..e7354a1 100644 --- a/renderer/Project.js +++ b/renderer/Project.js @@ -240,34 +240,37 @@ class Project extends React.Component { }, 'Stop') ), h(Flex, { alignItems: 'baseline', mb: 4 }, - h(Pre, { fontSize: 0 }, - dirname, - ' ', - h(RebassLink, { - fontSize: 0, - href: '#!', - onClick: e => { - e.preventDefault() - open(`file://${dirname}`) - } - }, 'Open in Finder'), - ' ', - h(RebassLink, { - fontSize: 0, - href: '#!', - onClick: e => { - e.preventDefault() - launchEditor(dirname, 1) - } - }, 'Open in Editor'), - ' ', - h(RebassLink, { - href: '#!', - disabled: !listening, - color: listening ? 'cyan' : 'darken', - onClick: e => openBrowser(url), - children: url - }) + h(Box, null, + h(Pre, { fontSize: 0 }, + dirname, + ), + h(Pre, { fontSize: 0 }, + h(RebassLink, { + fontSize: 0, + href: '#!', + onClick: e => { + e.preventDefault() + open(`file://${dirname}`) + } + }, 'Open in Finder'), + ' ', + h(RebassLink, { + fontSize: 0, + href: '#!', + onClick: e => { + e.preventDefault() + launchEditor(dirname, 1) + } + }, 'Open in Editor'), + ' ', + h(RebassLink, { + href: '#!', + disabled: !listening, + color: listening ? 'cyan' : 'darken', + onClick: e => openBrowser(url), + children: url + }) + ) ), h(Box, { mx: 'auto' }), h(Text, { fontSize: 1, my: 2 }, diff --git a/renderer/constants.js b/renderer/constants.js index 7cbd115..a6970fc 100644 --- a/renderer/constants.js +++ b/renderer/constants.js @@ -55,6 +55,15 @@ const appTypes = { port: 8080, run: 'run serve' } + }, + preact: { + name: 'Preact App', + install: 'preact-cli create default', + defaults: { + type: 'preact-cli', + port: 8080, + run: 'run start' + } } }