LinuxCommandLibrary

sails

Generate command-line interfaces from a specification

TLDR

Start Sails

$ sails lift
copy

Create new Sails project
$ sails new [projectName]
copy

Generate Sails API
$ sails generate [name]
copy

Generate Sails Controller
$ sails generate controller [name]
copy

Generate Sails Model
$ sails generate model [name]
copy

SYNOPSIS

sails <command> [options]
sails <command> [arguments]

PARAMETERS

new <project-name>
    Creates a new Sails.js project in a directory named project-name.

lift
    Lifts (starts) the Sails.js application in the current directory.

generate <blueprint> [name]
    Generates a new file based on a blueprint (e.g., controller, model, service).

console
    Opens an interactive Node.js REPL (Read-Eval-Print Loop) with access to the Sails.js application's global variables and models.

version
    Displays the installed Sails CLI version.

--help, -h
    Displays help information for the main command or a specific subcommand.

--port <number>
    (Used with lift) Specifies the port on which to run the server.

--prod
    (Used with lift) Lifts the application in production mode, optimizing performance and logging.

--no-install
    (Used with new) Skips the 'npm install' step after creating a new project.

DESCRIPTION

The sails command-line interface (CLI) is the primary tool for interacting with the Sails.js web framework. Sails.js is a Model-View-Controller (MVC) framework for Node.js, designed to streamline the development of custom enterprise-grade Node.js applications, aiming to replicate the rapid development experience of Ruby on Rails. The sails command enables developers to scaffold new projects, generate controllers, models, and services, lift (start) the application server, run database migrations, and manage other aspects of a Sails.js application. It significantly boosts developer productivity by automating repetitive setup tasks and providing powerful code generation capabilities. While not a native Linux utility, it is widely used in environments where Node.js web applications are developed and deployed.

CAVEATS

The sails command is not a standard Linux system utility. It requires Node.js and npm (Node Package Manager) to be installed on your system. It is specifically designed for developing and managing applications built with the Sails.js framework, and its functionality is entirely dependent on the context of a Sails.js project.

INSTALLATION

To use the sails command, you must first install it globally via npm:
npm install -g sails
This makes the sails command available in your system's PATH.

PROJECT CONTEXT

Many sails commands (e.g., lift, generate, console) must be executed within the root directory of an existing Sails.js project for them to function correctly.

HISTORY

The Sails.js framework, and consequently its CLI tool, was first released in 2012 by Mike McNeil. It was conceived to provide a more structured and rapid development experience for Node.js web applications, drawing inspiration from established frameworks like Ruby on Rails. Over the years, the sails CLI has evolved alongside the framework, incorporating new features and streamlining workflows for generating code, managing dependencies, and deploying applications, making it an indispensable tool for Sails.js developers.

SEE ALSO

node(1), npm(1)

Copied to clipboard