1 Custom template modules
Samuel Attard редактировал(а) эту страницу 2016-12-30 16:25:55 +13:00

Use Case

If you want to provide a template to get people going with electron-forge and framework-xyz then you can provide your own electron-forge-template-* module.

Naming

Please be logical in the naming of your module. It must always be prefixed with electron-forge-template- so names that make sense would include.

  • electron-forge-template-react
  • electron-forge-template-polymer

Etc.

API

Your module's main file must export an object that looks like this.

const path = require('path');

module.exports = {
  dependencies: ['react', 'react-dom'],                 // Production Dependencies
  devDependencies: [],                                  // Development Dependencies
  templateDirectory: path.resolve(__dirname, './tmpl'), // Absolute path to a directory containing template files
  postCopy: (initDir, ora, lintStyle) => {
    // This function will be executed after we have installed dependencies and finished copying your templates
    // If you need to do asynchronous work return a Promise and we will wait for it to resolve.
    // For any long running tasks you should use the "ora" module provided to indicate the task in progress
  },
};