Edit Page

Best Practices

There are many undocumented best practices and workflow improvements for developing on Sails that contributors have developed over years. This section is an attempt to document some of the basics, but be sure and pop in to Gitter if you ever have a question about how to set things up, or want to share your own tool chain.

The best way to work with Sails core is to fork the repository, git clone it to your filesystem, and then run npm link. In addition to writing tests, you'll often want to use a sample project as a harness-- to do that, cd into the sample app and run npm link sails. This will create a symbolic link in the node_modules directory of your sample app that points to your local cloned version of sails. This keeps you from having to copy the framework over every time you make a change. You can force your sample app to use the local sails dependency by running node app instead of sails lift (although sails lift should use the local dependency, if one exists). If you need to test the command line tool this way, you can access it from your sample app as node node_modules/sails/bin/sails. For example, if you were working on sails new, and you wanted to test it manually, you could run node node_modules/sails/bin/sails new testProj.

Installing different versions of Sails

Release Install Command Build Status
v0.12.x npm install [email protected] Build Status
stable npm install sails Build Status
beta npm install sails@beta Build Status
edge npm install sails@git://github.com/balderdashy/sails.git Build Status

Installing an unreleased branch for testing

In general, you can npm install sails directly from Github as follows:

# Install an unreleased branch of Sails in the current directory's `node_modules`
$ npm install sails@git://github.com/balderdashy/sails.git#nameOfDesiredBranch

This is useful for testing/installing hot-fixes, and just a good thing to know how to do in general. Here's how you'd install a few different branches:

Release Install Command
v0.12.x npm install sails@git://github.com/balderdashy/sails.git#0.12
stable npm install sails@git://github.com/balderdashy/sails.git#stable
beta npm install sails@git://github.com/balderdashy/sails.git#beta
edge npm install sails@git://github.com/balderdashy/sails.git

Submitting Pull Requests

  1. If this is your first time forking and submitting a PR, follow our instructions here.
  2. Fork the repo.
  3. Add a test for your change. Only refactoring and documentation changes require no new tests. If you are adding functionality or fixing a bug, we need a test!
  4. Make the tests pass and make sure you follow our syntax guidelines.
  5. Add a line of what you did to CHANGELOG.md (right under master).
  6. Push to your fork and submit a pull request to the appropriate branch:
    • 0.12
      • corresponds with the "v0.12.x" version. Pull requests for 0.12.x should be sent here
    • master
      • corresponds with the "edge" version-- the latest, not-yet-released version of Sails. Most pull requests should be sent here
    • stable
      • corresponds with the latest stable release on npm (i.e. if you have a high-priority hotfix, send the PR here)

Using Sails at work?

If your company has the budget, consider purchasing Flagship support. It's a great way to support the ongoing development of the open source tools you use every day. And it gives you an extra lifeline to the Sails core team.

Sails logo
  • Home
  • Get started
  • Support
  • Documentation
  • Documentation

For a better experience on sailsjs.com, update your browser.

Documentation

Reference Concepts App structure | Upgrading Contribution guide | Tutorials More

Contribution guide

  • Code of Conduct
  • Code Submission Guidelines
    • Best Practices
    • Sending Pull Requests
    • Writing Tests
  • Contributing to the Docs
  • Contributor's Pledge
  • Core Maintainers
  • Issue Contributions
  • Proposing Features/Enhancements
    • Submitting a Proposal

Built with Love

The Sails framework is maintained by a web & mobile studio in Austin, TX, with the help of our contributors. We created Sails in 2012 to assist us on Node.js projects. Naturally we open-sourced it. We hope it makes your life a little bit easier!

Sails:
  • What is Sails?
  • Treeline IDE
  • Contribute
  • Logos/artwork
About:
  • The Sails Company
  • Security
  • News
  • Legal
Help:
  • Get started
  • Documentation
  • Docs
  • Enterprise
  • Hire us

© 2012-2018 The Sails Company. 
The Sails framework is free and open-source under the MIT License.