This package has been deprecated

Author message:

This package is no longer being maintained.

generator-pistacheo

1.0.0-beta • Public • Published

Pistacheo Generator Build Status NPM version Coverage Status

A Yeoman generator that scaffolds out Express API and Server applications.

Table of Contents

What can I create with Pistacheo?

  • Build out Express server applications using Jade or Swig templates.
  • Create an Express API server application.

Check out the features section to see everything this generator has to offer.

Getting Started

This generator utilizes Yeoman and Grunt to Scaffold out projects, automate tasks, and manage front-end dependencies respectively. If this is your first time here, it is recommended you read about these tools before proceeding.

Installation

There are a few dependencies that this project relies on:

Node.js

Check to see if you already have Node installed. Do this by bringing up a terminal/command prompt and type node -v. If the response shows a version at or above v0.12.x, you are all set and can proceed to installing Yeoman, Grunt, and Bower. If you see an error and/or your version is too low, navigate to the Node.js website and install Node from there.

Yeoman & Grunt

Once you have Node installed, make sure you have these tools by opening up a terminal/command prompt and entering following commands:

Command Response
yo -v at or above v1.2.1
grunt -V grunt-cli at or above v0.1.10

If you get any errors and/or you're version(s) are too low, you should run npm install -g yo grunt-cli. This will install both tools and update them to their latest versions.

Pistacheo

Now that you have all the needed dependencies, you can install this generator with the following command: npm install -g generator-pistacheo

That completes installation! So at this point you should have all the needed tools to start working Pistacheo.

Usage

When starting a new project, you will want to: open up a terminal/command prompt, make a new directory, and navigate into it.

mkdir my-new-project && cd $_

then, run the Pistacheo generator.

yo pistacheo

Optionally, you can skip the automated installation of npm packages by passing in --skip-install. The main reason to use this is if you have spotty/no internet connection, but would still like to generate your project.

yo pistacheo --skip-install

Follow all the prompts and choose what suits you most for the project you would like to create. When you finish with all of the prompts, your project scaffold will be created and all dependencies will be installed.

NOTE: If you used the --skip-install option, no dependencies will have been installed. You will need to run npm install in your project's root directory in order to get started running automated tasks

Now you can run:

  • grunt for testing and building a production version of your site.
  • grunt serve for previewing your site/app on a development server.
  • grunt serve:dist for previewing a production version of your site/app.

You can learn more about what tasks are available in the grunt tasks section.

IMPORTANT: SVN users should choose the 'SVN' version control option when running the generator. Then be sure to run the svn-init.sh (Linux, OSX) or svn-init.bat (Window) script in order to correctly setup ignores for your project. These scripts will be located in the root of your project folder. It is recommended that you do this before committing any code.

Congratulations! You should now have successfully created a Pistacheo project and are ready to start building out your site/app.

Features

Included in every project

  • Built in preview server with LiveReload
  • .editorconfig for consistent coding styles within text editors
  • Automated build process that includes: compilation of preprocessors (Jade, Sass, etc), minification of CSS and HTML, uglification of Javascript, optimization of images, and processing of usemin blocks
  • Sourcemaps for JavaScript and Stylesheets (Except Stylus. Waiting on PR)
  • JavaScript Linting with ESLint

Available Options

Express Server Options

Grunt Workflow

grunt

Runs both grunt test and grunt build.

grunt serve

Starts up a development server that watches files and automatically reloads them to the browser when a change is detected.

Extra Task Target(s)

Tasks Description
grunt serve:dist runs grunt build and starts up a server that loads the optimized files

NOTE: you can add the --allow-remote option to any of these commands to allow remote devices on the same network to view your site/app

grunt build

Builds out an optimized site through compilation of preprocessors (Jade, Sass, etc), minification of CSS and HTML, uglification of Javascript, optimization of images, and processing of usemin blocks. All files created from this task are put in the {project root}/dist/ folder.

grunt test

Runs ESLint and Karma to lint and run JavaScript tests, respectively.

Extra Task Target(s)

Tasks Description
grunt test:watch runs grunt test, but also watches test files and auto runs tests when changes are detected.

NOTE: you can add the --allow-remote option to any of these commands to allow remote devices on the same network to view/run your tests

Sub-Generators

Note: Generators need to be run from the root directory of your app.

API

Creates a new API route.

Example:

yo pistacheo:api data
? Where would you like to create api files? (src/api)

Produces:

src/api/index.js
src/api/data.model.js
src/api/data.controller.js
src/api/__tests__/data.spec.js

This will create a new route: /api/data.

Page

Creates a new Page route.

Example:

yo pistacheo:page contact
? Where would you like to create this page? (src/pages)
? What layout would you like to extend from? (src/layouts/base

Produces:

src/pages/index.js
src/pages/contact.jade
src/pages/contact.controller.js
src/pages/__tests__/contact.spec.js

This will create a new route: /contact.

Testing

To run unit tests, you have a couple options:

  • npm test: This will run all unit tests with Mocha and send the report to coveralls.io to be processed. (Don't run this for local testing)
  • npm run localtest: This is the same as npm test only it doesn't send anything to coveralls.io. (Use this for local testing)
  • npm run localtest-report: This is the same as npm run localtest, but it also generates an HTML report of the current code coverage.

Roadmap

Check out the Roadmap to see what's coming down the development pipeline.

Contributing

Anyone and everyone is welcome to contribute. Please take a moment to review the guidelines for contributing.

Release History

See Changelog

License

MIT License - © Jake Larson

Package Sidebar

Install

npm i generator-pistacheo

Weekly Downloads

1

Version

1.0.0-beta

License

none

Last publish

Collaborators

  • larsonjj