Skip to content
This repository has been archived by the owner on Jan 31, 2023. It is now read-only.

added support for react-static #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions renderer/CreateForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class CreateForm extends React.Component {
const { name, type, dirname } = this.state
const appType = appTypes[type]
const { install } = appType
const args = [ ...install.split(' '), name ]
const args = [ ...install(name).split(' ') ]
update(pushLog([ 'npx', ...args ].join(' ')))
update(pushLog(''))
const promise = run('npx', args, {
Expand Down Expand Up @@ -209,7 +209,7 @@ class CreateForm extends React.Component {
h(Text, { fontSize: 1, my: 2 },
'This will run: ',
h(Code, { color: 'cyan' },
[ 'npx', appType.install, name].join(' ')
[ 'npx', appType.install(name)].join(' ')
)
),
pending && h(Text, { color: 'blue' }, 'Creating App...'),
Expand Down
21 changes: 15 additions & 6 deletions renderer/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const modes = {
const appTypes = {
react: {
name: 'React App',
install: 'create-react-app',
install: (name) => `create-react-app ${name}`,
defaults: {
type: 'create-react-app',
port: 3000,
Expand All @@ -22,7 +22,7 @@ const appTypes = {
},
next: {
name: 'Next.js App',
install: 'create-next-app',
install: (name) => `create-next-app ${name}`,
defaults: {
type: 'create-next-app',
port: 3000,
Expand All @@ -31,7 +31,7 @@ const appTypes = {
},
gatsby: {
name: 'Gatsby App',
install: 'gatsby-cli new',
install: (name) => `gatsby-cli new ${name}`,
defaults: {
type: 'gatsby-cli',
port: 8000,
Expand All @@ -40,7 +40,7 @@ const appTypes = {
},
razzle: {
name: 'Razzle App',
install: 'create-razzle-app',
install: (name) => `create-razzle-app ${name}`,
defaults: {
type: 'create-razzle-app',
port: 3000,
Expand All @@ -49,7 +49,7 @@ const appTypes = {
},
nuxt: {
name: 'Vue App',
install: 'vue create -d',
install: (name) => `vue create -d ${name}`,
defaults: {
type: 'create-vue-app',
port: 8080,
Expand All @@ -58,12 +58,21 @@ const appTypes = {
},
preact: {
name: 'Preact App',
install: 'preact-cli create default',
install: (name) => `preact-cli create default ${name}`,
defaults: {
type: 'preact-cli',
port: 8080,
run: 'run start'
}
},
reactStatic: {
name: 'React Static',
install: (name) => `react-static create --template=blank --name=${name}`,
defaults: {
type: 'react-static',
port: 3000,
run: 'run start'
}
}
}

Expand Down