Skip to content
This repository was archived by the owner on Sep 12, 2019. It is now read-only.

add detector type field #73

Merged
merged 2 commits into from
Apr 3, 2019
Merged
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
15 changes: 9 additions & 6 deletions src/commands/dev/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,13 @@ function startDevServer(settings, log, error) {
log('Server listening to', settings.proxyPort)
})
return
} else {
log(`Starting netlify dev with ${settings.type}`)
const ps = execa(settings.command, settings.args, { env: settings.env, stdio: 'inherit', shell: true })
ps.on('close', code => process.exit(code))
ps.on('SIGINT', process.exit)
ps.on('SIGTERM', process.exit)
}

const ps = execa(settings.command, settings.args, { env: settings.env, stdio: 'inherit', shell: true })
ps.on('close', code => process.exit(code))
ps.on('SIGINT', process.exit)
ps.on('SIGTERM', process.exit)
}

class DevCommand extends Command {
Expand Down Expand Up @@ -151,9 +152,11 @@ class DevCommand extends Command {
}

const url = await startProxy(settings, addonUrls)

// Todo hoist this telemetry `command` to CLI hook
track('command', {
command: 'dev'
command: 'dev',
projectType: settings.type || 'custom'
})

const banner = chalk.bold(`Netlify dev server is now ready on ${url}`)
Expand Down
1 change: 1 addition & 0 deletions src/detectors/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

```ts
{
type: String, // e.g. gatsby, vue-cli
command: String, // e.g. yarn, npm
port: Number, // e.g. 8888
proxyPort: Number, // e.g. 3000
Expand Down
1 change: 1 addition & 0 deletions src/detectors/cra.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module.exports = function() {

const yarnExists = existsSync('yarn.lock')
return {
type: 'create-react-app',
command: yarnExists ? 'yarn' : 'npm',
port: 8888,
proxyPort: 3000,
Expand Down
1 change: 1 addition & 0 deletions src/detectors/eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module.exports = function() {
}

return {
type: 'eleventy',
port: 8888,
proxyPort: 8080,
env: { ...process.env },
Expand Down
1 change: 1 addition & 0 deletions src/detectors/gatsby.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ module.exports = function() {

const yarnExists = existsSync('yarn.lock')
return {
type: 'gatsby',
command: yarnExists ? 'yarn' : 'npm',
port: 8888,
proxyPort: 8000,
Expand Down
1 change: 1 addition & 0 deletions src/detectors/hugo.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module.exports = function() {
}

return {
type: 'hugo',
port: 8888,
proxyPort: 1313,
env: { ...process.env },
Expand Down
1 change: 1 addition & 0 deletions src/detectors/jekyll.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module.exports = function() {
}

return {
type: 'jekyll',
port: 8888,
proxyPort: 4000,
env: { ...process.env },
Expand Down
1 change: 1 addition & 0 deletions src/detectors/react-static.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ module.exports = function() {

const yarnExists = existsSync('yarn.lock')
return {
type: 'react-static',
command: yarnExists ? 'yarn' : 'npm',
port: 8888,
proxyPort: 3000,
Expand Down
1 change: 1 addition & 0 deletions src/detectors/vue.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module.exports = function() {

const yarnExists = existsSync('yarn.lock')
return {
type: 'vue-cli',
command: yarnExists ? 'yarn' : 'npm',
port: 8888,
proxyPort: 8080,
Expand Down