hapi pal CLI

raw JSON →
2.6.0 verified Thu Apr 23 auth: no javascript

hpal is the command-line interface (CLI) for the hapi pal ecosystem, designed to streamline the development of Hapi.js applications. Currently at version 2.6.0, hpal offers tools for rapidly scaffolding new Hapi projects based on the official pal boilerplate, generating common application components like routes, models (using schwifty), and services (using schmervice) through haute-couture conventions, and providing a command-line interface to search Hapi and related package documentation (e.g., Joi, Toys). It also enables the execution of custom commands defined by Hapi server plugins. The tool is maintained as part of the hapipal initiative, focusing on convention over configuration for Hapi development, and is primarily intended for use via npx as a development dependency.

error hpal: command not found
cause The hpal CLI is not globally installed or `npx` is not being used to invoke a locally installed `hpal` within a project's `node_modules`.
fix
Install hpal as a dev dependency (npm install --save-dev hpal) and then run commands using npx hpal <command>.
error Error: hpal make expects a .hc.js file in the project root or specified plugin directory.
cause Attempting to use `hpal make` in a project that does not have a `.hc.js` configuration file, which is essential for haute-couture based file generation.
fix
Create a .hc.js file in your project's root, even if empty, or scaffold your project using npx hpal new which includes this configuration.
error Error: Plugin 'my-plugin' requires hapi version '20.x.x' but found '17.x.x'.
cause While not a direct hpal error, this often arises when hpal is used in a project with an older Hapi.js version that's incompatible with a plugin or boilerplate generated by hpal.
fix
Update your project's Hapi.js dependency to match the requirements of the generated code or plugins.
gotcha hpal is designed for use with Hapi.js v17+ and Node.js v8+ environments. Using it with older versions of Hapi or Node.js may lead to unexpected behavior or errors.
fix Ensure your project's Hapi.js version is 17 or higher and your Node.js runtime is 8 or higher.
gotcha The recommended installation method for hpal is as a development dependency, invoked via `npx`. Avoid global installation (`npm install -g hpal`) to prevent version conflicts and ensure projects use their specified hpal version.
fix Install with `npm install --save-dev hpal` and run using `npx hpal <command>`.
gotcha The `hpal make` command requires a `.hc.js` file to be present in your project's root or the specified plugin directory. This file dictates the haute-couture conventions for file generation.
fix Ensure your project is configured for haute-couture with a `.hc.js` file. Projects scaffolded with `hpal new` are pre-configured.
npm install hpal
yarn add hpal
pnpm add hpal

Installs hpal as a dev dependency and then uses npx to search the Hapi.js documentation for the `h.response` method specific to version 18.1.0.

npm install --save-dev hpal
npx hpal docs --ver 18.1.0 h.response