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

Commit 7a79300

Browse files
authored
Merge pull request #73 from netlify/addDetectorTypeField
add detector type field
2 parents d947f1a + 6e31435 commit 7a79300

File tree

9 files changed

+17
-6
lines changed

9 files changed

+17
-6
lines changed

src/commands/dev/index.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,13 @@ function startDevServer(settings, log, error) {
9494
log('Server listening to', settings.proxyPort)
9595
})
9696
return
97+
} else {
98+
log(`Starting netlify dev with ${settings.type}`)
99+
const ps = execa(settings.command, settings.args, { env: settings.env, stdio: 'inherit', shell: true })
100+
ps.on('close', code => process.exit(code))
101+
ps.on('SIGINT', process.exit)
102+
ps.on('SIGTERM', process.exit)
97103
}
98-
99-
const ps = execa(settings.command, settings.args, { env: settings.env, stdio: 'inherit', shell: true })
100-
ps.on('close', code => process.exit(code))
101-
ps.on('SIGINT', process.exit)
102-
ps.on('SIGTERM', process.exit)
103104
}
104105

105106
class DevCommand extends Command {
@@ -151,9 +152,11 @@ class DevCommand extends Command {
151152
}
152153

153154
const url = await startProxy(settings, addonUrls)
155+
154156
// Todo hoist this telemetry `command` to CLI hook
155157
track('command', {
156-
command: 'dev'
158+
command: 'dev',
159+
projectType: settings.type || 'custom'
157160
})
158161

159162
const banner = chalk.bold(`Netlify dev server is now ready on ${url}`)

src/detectors/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
```ts
88
{
9+
type: String, // e.g. gatsby, vue-cli
910
command: String, // e.g. yarn, npm
1011
port: Number, // e.g. 8888
1112
proxyPort: Number, // e.g. 3000

src/detectors/cra.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ module.exports = function() {
2020

2121
const yarnExists = existsSync('yarn.lock')
2222
return {
23+
type: 'create-react-app',
2324
command: yarnExists ? 'yarn' : 'npm',
2425
port: 8888,
2526
proxyPort: 3000,

src/detectors/eleventy.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ module.exports = function() {
66
}
77

88
return {
9+
type: 'eleventy',
910
port: 8888,
1011
proxyPort: 8080,
1112
env: { ...process.env },

src/detectors/gatsby.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ module.exports = function() {
2929

3030
const yarnExists = existsSync('yarn.lock')
3131
return {
32+
type: 'gatsby',
3233
command: yarnExists ? 'yarn' : 'npm',
3334
port: 8888,
3435
proxyPort: 8000,

src/detectors/hugo.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ module.exports = function() {
66
}
77

88
return {
9+
type: 'hugo',
910
port: 8888,
1011
proxyPort: 1313,
1112
env: { ...process.env },

src/detectors/jekyll.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ module.exports = function() {
66
}
77

88
return {
9+
type: 'jekyll',
910
port: 8888,
1011
proxyPort: 4000,
1112
env: { ...process.env },

src/detectors/react-static.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ module.exports = function() {
2929

3030
const yarnExists = existsSync('yarn.lock')
3131
return {
32+
type: 'react-static',
3233
command: yarnExists ? 'yarn' : 'npm',
3334
port: 8888,
3435
proxyPort: 3000,

src/detectors/vue.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ module.exports = function() {
2020

2121
const yarnExists = existsSync('yarn.lock')
2222
return {
23+
type: 'vue-cli',
2324
command: yarnExists ? 'yarn' : 'npm',
2425
port: 8888,
2526
proxyPort: 8080,

0 commit comments

Comments
 (0)