Registry / web-framework / sails-generate-api

sails-generate-api

JSON →
library0.10.1jsnpmunverified

sails-generate-api is a command-line interface (CLI) generator for the Sails.js framework, designed to scaffold boilerplate files for API models and controllers. Specifically, it creates `api/models/Foo.js` and `api/controllers/FooController.js` for a given API name. This package is from the 0.x era of Sails.js, with its last publication being 9 years ago and current version 0.10.1. The current stable version of Sails.js is 1.5.x, which introduced significant breaking changes from its 0.x predecessors, including a revamped generator architecture. Therefore, `sails-generate-api` is not compatible with modern Sails.js applications (v1.x and above) and should be considered abandoned.

npm install sails-generate-api
INSTALL
IMPORT
SIG · SAILS-GENERATE-API
S
sails-generate-api
web-frameworkjavascriptv0.10.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

generatorDefinition
const generatorDefinition = require('sails-generate-api');
This package is a CommonJS module from the 0.x era. It exports an object defining the generator's behavior (e.g., targets, templates). Direct programmatic use is uncommon as it's primarily consumed by the Sails CLI system.
generate
const { generate } = require('sails-generate-api'); // If an internal `generate` function were exposed
import { generate } from 'sails-generate-api';
While a generator typically defines a 'generate' process, direct named export of such a function is not standard for this type of Sails 0.x generator module. This illustrates accessing a hypothetical internal method via CommonJS destructuring. ESM imports (`import`) are not supported.
ApiGeneratorModule
// No direct application-level import for CLI generators. // Configured via .sailsrc instead.
import ApiGeneratorModule from 'sails-generate-api';
Sails generators are integrated by configuring the `.sailsrc` file to map a generator name (e.g., 'api') to its npm package. There is no typical 'default import' symbol for developers to use in their application code; the Sails CLI internally handles loading the generator module.

Demonstrates how to install, configure, and use the `sails-generate-api` generator to create new API files in a Sails 0.x project.

{ "generators": { "modules": { "api": "sails-generate-api" } } } // Save the above JSON to ./.sailsrc in your project directory // or ~/.sailsrc for global use. // Then, from your Sails project directory: // $ npm install sails-generate-api // $ sails generate api foobar // This will create: // - api/models/Foobar.js // - api/controllers/FoobarController.js
Debug
Known issues
breakingThis package is designed for Sails.js versions 0.x and is incompatible with Sails.js v1.x and later. Major architectural changes, especially regarding the generator system, occurred in Sails v1.0.
fix
For Sails v1.x+, use the built-in `sails generate api` command, or implement a custom generator following the v1.x generator conventions which are significantly different.
affects: >=1.0.0 of Sails.js
deprecatedThe `sails-generate-api` package has not been updated in 9 years and is considered abandoned. Its dependencies and internal logic may rely on outdated Node.js features or insecure third-party packages.
fix
Avoid using this package in new projects. For existing Sails 0.x projects, consider migrating to a newer Sails version or manually creating the required API files.
affects: >=0.10.1
gotchaThe `.sailsrc` configuration method for overriding or adding generators, as described in this package's README, is primarily for Sails 0.x. While `.sailsrc` still exists in Sails v1.x, the generator module structure and registration process have changed substantially.
fix
Refer to the official Sails.js v1.x documentation for current generator configuration and extension practices.
affects: >=0.10.1
Errors
Common errors & fixes
Error: sails-generate-api@0.10.1 requires a peer of sails@~0.10.0 but none was installed.
Attempting to install or use `sails-generate-api` with a newer version of Sails.js (e.g., v1.x+) or without any Sails.js installation, which is a peer dependency.
fix
Ensure you are using Sails.js v0.x (specifically, within the ~0.10.0 range) with this generator. For example, `npm install sails@~0.10.0` globally or locally alongside the generator.
Error: sails-generate-api not found. Error: Generator "api" could not be loaded from "sails-generate-api"
The `sails-generate-api` package was installed but the `.sailsrc` file was not correctly configured to point to it, or it was configured for a local installation but `sails generate` was run in a different directory.
fix
Verify that `sails-generate-api` is installed and that your `.sailsrc` file (either local `./.sailsrc` or global `~/.sailsrc`) correctly maps `"api": "sails-generate-api"` within the `generators.modules` section. Ensure the `sails generate` command is executed from a directory where the `.sailsrc` configuration is active.
Upgrade
Version history
0.10.1latest on npm
Audit
Dependencies
sailsrequiredRuntime dependency as it's a generator specifically for the Sails.js framework. Requires a pre-1.0 version of Sails.js.
Agent activity
8 hits · last 30 days
node
6
OpenAI (training)
1
Resources
sails-generate-api — npm install sails-generate-api · libregistry