@harperdb/nextjs
Advanced tools
Comparing version 1.0.0-1 to 1.0.0-2
@@ -44,2 +44,3 @@ #!/usr/bin/env node | ||
console.log('Unknown command:', command); | ||
// eslint-disable-next-line no-fallthrough | ||
case 'help': | ||
@@ -46,0 +47,0 @@ console.log(HELP); |
@@ -0,1 +1,4 @@ | ||
/* eslint-env node */ | ||
/* global logger */ | ||
import { existsSync, statSync, readFileSync, openSync, writeSync, unlinkSync } from 'node:fs'; | ||
@@ -161,3 +164,3 @@ import { join } from 'node:path'; | ||
if (config.buildOnly) { | ||
await build(config, componentPath); | ||
await build(config, componentPath, options.server); | ||
logger.info('@harperdb/nextjs extension build only mode is enabled, exiting'); | ||
@@ -193,3 +196,3 @@ process.exit(0); | ||
// Prebuilt mode requires validating the `.next` directory exists | ||
if (config.prebuilt && !existsSync(path.join(componentPath, '.next'))) { | ||
if (config.prebuilt && !existsSync(join(componentPath, '.next'))) { | ||
throw new HarperDBNextJSExtensionError('Prebuilt mode is enabled, but the .next folder does not exist'); | ||
@@ -202,7 +205,7 @@ } | ||
if (!config.prebuilt && !config.dev) { | ||
await build(config, componentPath); | ||
await build(config, componentPath, options.server); | ||
} | ||
// Start the Next.js server | ||
await serve(config, componentPath); | ||
await serve(config, componentPath, options.server); | ||
@@ -220,4 +223,5 @@ return true; | ||
* @param {string} componentPath | ||
* @param {unknown} server | ||
*/ | ||
async function build(config, componentPath) { | ||
async function build(config, componentPath, server) { | ||
// Theoretically, all threads should have roughly the same start time | ||
@@ -309,3 +313,3 @@ const startTime = Date.now(); | ||
*/ | ||
async function serve(config, componentPath) { | ||
async function serve(config, componentPath, server) { | ||
const componentRequire = createRequire(componentPath); | ||
@@ -312,0 +316,0 @@ |
{ | ||
"name": "@harperdb/nextjs", | ||
"version": "1.0.0-1", | ||
"version": "1.0.0-2", | ||
"type": "module", | ||
@@ -37,3 +37,4 @@ "description": "A HarperDB Component for running Next.js apps.", | ||
"format:check": "npm run format -- --check", | ||
"format:fix": "npm run format -- --write" | ||
"format:fix": "npm run format -- --write", | ||
"lint": "eslint extension.js cli.js" | ||
}, | ||
@@ -44,3 +45,6 @@ "dependencies": { | ||
"devDependencies": { | ||
"@eslint/js": "^9.17.0", | ||
"@harperdb/code-guidelines": "^0.0.2", | ||
"eslint": "^9.17.0", | ||
"globals": "^15.14.0", | ||
"prettier": "^3.4.2" | ||
@@ -47,0 +51,0 @@ }, |
17675
326
5