diff --git a/gdf.js b/gdf.js index 4f6eb87..72d5877 100755 --- a/gdf.js +++ b/gdf.js @@ -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 @@ -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 } @@ -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' @@ -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) { diff --git a/test/gdf.test.js b/test/gdf.test.js index fe074c5..2e175da 100644 --- a/test/gdf.test.js +++ b/test/gdf.test.js @@ -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'], @@ -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']], @@ -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)