Skip to content
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
9 changes: 9 additions & 0 deletions gdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,10 @@ export class GDF {
return !!this.#pj.dependencies?.['meteor-node-stubs']
}

get waku() {
return !!this.#pj.dependencies?.waku
}

// Does this application use next.js?
get nextjs() {
return !!this.#pj.dependencies?.next
Expand Down Expand Up @@ -480,6 +484,8 @@ export class GDF {
if (this.postgres) env.DB_CONNECTION = 'pg'
}

if (this.waku) env.PORT = '3000'

if (this.puppeteer) env.PUPPETEER_EXECUTABLE_PATH = '/usr/bin/chromium'

return { ...this.options.vars.deploy, ...env }
Expand Down Expand Up @@ -812,6 +818,7 @@ export class GDF {
if (this.remix) runtime = 'Remix'
if (this.meteor) runtime = 'Meteor'
if (this.nextjs) runtime = 'Next.js'
if (this.waku) runtime = 'Waku'
if (this.nuxtjs) runtime = 'Nuxt'
if (this.tanstackStart) runtime = 'TanStack'
if (this.nestjs) runtime = 'NestJS'
Expand Down Expand Up @@ -865,6 +872,8 @@ export class GDF {
return [this.npx, 'srvx', '--prod', '-s', '../client', 'dist/server/server.js']
} else if (this.meteor) {
return ['node', 'main.js']
} else if (this.waku) {
return ['node', 'dist/serve-node.js']
} else if (this.gatsby) {
return [this.npx, 'gatsby', 'serve', '-H', '0.0.0.0']
} else if (this.vite || this.astroStatic) {
Expand Down
8 changes: 8 additions & 0 deletions test/gdf.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ describe('gdf: framework detection', function() {
['remix (legacy package)', { dependencies: { remix: '^1' } }, 'Remix'],
['meteor', { dependencies: { 'meteor-node-stubs': '^1' } }, 'Meteor'],
['next', { dependencies: { next: '13.0.0' }, scripts: {} }, 'Next.js'],
['waku', { dependencies: { waku: '1.0.0-rc.4' } }, 'Waku'],
['nuxt', { dependencies: { nuxt: '^3' } }, 'Nuxt'],
['nest', { dependencies: { '@nestjs/core': '^10' } }, 'NestJS'],
['gatsby', { dependencies: { gatsby: '^5' } }, 'Gatsby'],
Expand Down Expand Up @@ -632,6 +633,7 @@ describe('gdf: start command and port', function() {
['vite', { scripts: { dev: 'vite' } }, ['/usr/sbin/nginx', '-g', 'daemon off;']],
['astro static', { dependencies: { astro: '*' } }, ['/usr/sbin/nginx', '-g', 'daemon off;']],
['astro ssr', { dependencies: { astro: '*', '@astrojs/node': '*' } }, ['node', './dist/server/entry.mjs']],
['waku', { dependencies: { waku: '*' } }, ['node', 'dist/serve-node.js']],
['sveltekit', { devDependencies: { '@sveltejs/kit': '*' } }, ['node', './build/index.js']],
['remix-serve', { dependencies: { '@remix-run/node': '*' }, scripts: { start: 'remix-serve build' } }, ['npx', 'remix-serve', './build/index.js']],
['fastify', { scripts: { start: 'fastify start app.js' } }, ['npx', 'fastify', 'start', '--address', '0.0.0.0', 'app.js']],
Expand Down Expand Up @@ -712,6 +714,12 @@ describe('gdf: start command and port', function() {
})
}

it('sets PORT for the Waku production server', async function() {
const gdf = await sandbox().run({ dependencies: { waku: '*' } })
expect(gdf.port).to.equal(3000)
expect(gdf.deployEnv.PORT).to.equal('3000')
})

it('--port overrides the port', async function() {
const gdf = await sandbox().run({ dependencies: { gatsby: '*' } }, { port: 9999 })
expect(gdf.port).to.equal(9999)
Expand Down