Extending the seed project

Deprecated Deprecated: This feature is deprecated starting with Finsemble 6.1. It is no longer supported and will likely go away in the future.

This tutorial shows you how to extend the functionality of the Finsemble seed project.

Extending gulpfile

Deprecated Deprecated: This feature is deprecated starting with Finsemble 6.1. It is no longer supported and will likely go away in the future. You can modify and extend the gulpfile's functionality by creating a gulpfile-extensions.js file at the same level as the gulpfile.js. This method avoids complications introduced from modifying the gulpfile directly and needing to merge upgrades into the updated gulpfile. The gulpfile-extensions.js file should define a function that takes in the object containing all of the methods called by the gulpfile, including pre and post methods that can be used to redefine variables and add additional tasks.

These methods are defined in the taskMethods object:

  • buildSass - Builds the SASS for the application.
  • buildWebpack - Performs the webpack build for the application.
  • clean - Cleans the project folder (deletes dist).
  • copyStaticFiles - Copies static files to the dist folder.
  • launchApplication - Launches the Finsemble application.
  • post - Called after all of the tasks have been defined.
  • pre - Called before all of the tasks have been defined.
  • startServer - Starts the server based on NODE_ENV environment variable ("dev" or "prod").
  • watchFiles - Watches files for changes to kick off buildSASS or buildWebpack.

These tasks are defined in gulpfile.js:

  • npm run dev - This is used most commonly while developing. Fast build, runs a local node-server, launches Finsemble.
  • npm run dev:fresh - Same as npm run dev except that it cleans out any cached files. This is similar to a rebuild all.
  • npm run build:dev - This is a fast build. Doesn't launch the server. Doesn't launch Finsemble.
  • npm run dev:nolaunch - This is a fast build that runs the server. Doesn't launch Finsemble.
  • npm run server:dev - This runs the server. Doesn't launch Finsemble. Doesn't build.
  • npm run prod - Build for production. This is a full rebuild with minification. It will take a while. Then, this runs the server and launches Finsemble. This is the production equivalent of npm run dev. Use this to test production mode on your local machine.
  • npm run build:prod - Build for production but don't run anything. Use this to create a production build for deployment.
  • npm run prod:nolaunch - Build for production and run the node-server.
  • npm run server:prod - This runs the server in production mode. Doesn't build. Doesn't launch Finsemble.

Extending server functionality (deprecated)

In version 5.4 and earlier, the Finsemble seed project provided a custom Express server for use as a local development server, along with the ability to extend it within the server-extensions.js file. In Finsemble 6, the server was moved into the Finsemble-Electron-Adapter and the seed project's build was simplified so that it produces a single directory of static assets (./public/ in finsemble-seed) to be deployed.

While Finsemble is now meant to have no embedded server-side components in the majority of implementations, existing Finsemble implementations can still use the Express and http objects returned by the FEA.Server.start method in the startServer task within gulpfile.js. See Express API documentation for details.

If you already have a customized server-extensions.js file, it will still be recognized and loaded if it's in the root project directory (the ./server/ directory has been removed). This functionality will be removed in a future version.

See also

If you extend the gulpfile, check out how the Build Process works.