generator-nuxeo

4.0.6 • Public • Published

Build Status npm version npm downloads Dependency Status devDependency Status

About

Yeoman Generator for Nuxeo Platform

The generator-nuxeo provides Nuxeo components scaffolding. It lets you easily scaffold common Nuxeo components like empty projects, Nuxeo Packages, Automation Operations, Nuxeo Services... This saves you time writing boilerplate code to focus on your code instead of the structure.

The generated components all come with unit tested sample code; for instance the Operation generator adds an Operation with some sample code that highlights how to inject context objects, how to specify a parameter and how to unit test that operation.

That tool is based on Yeoman (a scaffolding tool for the web).

Generator Features

  • Trigger the Hot reload which allows you to update the deployed bundles without restarting the Nuxeo Server.
  • Connect your project to a Studio's one
  • Discover some sample Nuxeo Projects.
  • Bootstrap an empty Nuxeo Project with multi modules support.
  • Bootstrap a single empty Nuxeo Project.
  • Initiate an empty component or an empty unit test
  • Add a Nuxeo Package module to distribute your Project (Marketplace)
  • Add a ready-to-use empty Polymer or Angular2 Application.
  • Create your own business rules or logic as an Automation Operation.
  • Enrich REST API responses using a content-enricher.
  • Manipulate Business Object using a Document Adapter
  • Declare your new Nuxeo Service
  • Plug your logic to the event bus using an Event Listener

Supported Nuxeo Platform Versions

  • Nuxeo Platform 7.10 and newer
  • If you are using Nuxeo Platform 5.8 or 6.0, code templates are available in Nuxeo IDE using the Nuxeo wizard.

Local Installation

Requirements

[DEPRECATED] - Install

We strongly recommend you to use our new tool Nuxeo CLI instead of the generator. It embbed all generator's features in a more friendly command line interface.

First, install Yeoman and generator-nuxeo:

# Global NPM registry install
npm install -g yo generator-nuxeo

OR

# Install from master
npm install -g yo nuxeo/generator-nuxeo

Quickstart

Discover Sample Projects

Using the generator let you have access to some ready to use Nuxeo Code Sample:

yo nuxeo:sample

Hot Reload

Using the generator let you trigger a Hot Reload on your Server which allows you to update the deployed bundles without restarting the Nuxeo Server. To be done, it requires to enable the sdk template in your nuxeo.conf file.

First step is to associate a Nuxeo Server with your project root. It will ask you the distribution path and if you want to let the generator-nuxeo configure the file for you. Reexecute it to change the distribution path.

yo nuxeo:hotreload configure

Then, you will be able to trigger it using:

yo nuxeo:hotreload

Synchronize

Using this generator lets you synchronize two folders, and automatically create folder/copy/delete files from a source folder to a destination folder. It helps you automatically copying web resources from your source code to the a running server for previewing your changes live.

First step is to configure the synchronize command for relying either on Docker implementation, or a Local one depending on how you deploy your Nuxeo Server. You'll be prompted to configure a pattern of file matching the synchronize in order to prevent you from copying files you don't need (temp file, zip, ...). The default value is: *.+(js|html|jpg|gif|svg|png|json|jsp).

yo nuxeo:synchronize configure

For starting files changes and synchronize two folders, execute:

yo nuxeo:synchronize

Studio Connection

Connect your Java project let you have your Studio Project exposed as a dependency and be able to tests anything declared in it, like your Automation Scripting, listeners, Document Types, ...

Link your project to Studio:

yo nuxeo:studio [link]

Unlink your project:

yo nuxeo:studio unlink

Generate a Java Constant class with Studio's freatures

yo nuxeo:studio import

Release your studio project

yo nuxeo:studio release

Bootstrap an Empty Nuxeo Project with Multi Modules Support

To bootstrap an empty Nuxeo Project (based on a Maven multi-module project), execute the following lines:

mkdir my-project
cd my-project
yo nuxeo

Default values are fine for a quick start. You will have to specify at least your project group ID (for instance org.company.)

Usage

You can generate several features at once like:

yo nuxeo [options] [<generator>..]

Options

  -h,   --help          # Print the generator's options and usage
        --skip-cache    # Do not remember prompt answers                         Default: false
        --skip-install  # Do not automatically install dependencies              Default: false
  -m,   --meta          # Branch of `nuxeo/generator-nuxeo-meta`                 Default: stable
  -l,   --localPath     # Path to a local clone of `nuxeo/generator-nuxeo-meta`
  -n,   --nologo        # Disable welcome logo                                   Default: false
  -t,   --type          # Set module target's type                               Default: core
  -s,   --skipInstall   # Skip external commands installation                    Default: false
  -f,   --force         # Force conflict when generate an existing file          Default: false
  -d,   --dirname       # Set parent folder prefix name                          Default: <PWD>
        --skipPomUpdate # Skip the pom(s) updates when attaching Studio project  Default: false

Available Generators

The main Generator can render templates defined in https://github.com/nuxeo/generator-nuxeo-meta/.

Terminology

  • ADD: Add a dedicated module to your project. For instance, in a myapp project, a Polymer Application will add a myapp-web submodule.
  • CREATE: Create the files needed for the feature, without specifying a --type option, the generation will occurs in the myapp-core submodule. When using the --type option, files will be generated to a (new) module named myapp-{type};

Bootstrap an Empty Nuxeo Project with Multi Modules

Set up an empty Nuxeo Bundle using Maven multi module support.

yo nuxeo multi-module

multi-module is the default generator when none is given as a parameter to yo nuxeo

Parameters:

  • Use a parent artifact: Parent artifact makes your project inherit dependencies, properties and other fields from another project. We recommend to keep the default value and use org.nuxeo.ecm.distribution:nuxeo-distribution.
  • Nuxeo Version: Asked only if no parent specified, it specify which Nuxeo version of the dependency management will be imported.

Important Notes

Using a Maven multi module architecture is the recommended way to bootstrap a new project: it allows to generate a Nuxeo Package afterwards to easily deploy your code on a Nuxeo Platform instance. On the other hand, when a project has been generated using a single module architecture, the Nuxeo Package needs to be created manually.

Bootstrap a Single Empty Nuxeo Bundle

Sets up an empty Nuxeo bundle.

yo nuxeo single-module

Parameters:

  • Parent Group / Artifact: Like in multi-module, having a parent artifact make project inheritance. If you are in a multi-module, you must set your parent module. If not, you can use org.nuxeo.ecm.distribution:nuxeo-distribution or org.nuxeo:nuxeo-addons-parent
  • Nuxeo Version: Asked only if needed, it specify which Nuxeo version of the dependency management will be imported.

Important Notes

This option should not be called directly to bootstrap a new project; use the multi-module option instead so that you can generate a Nuxeo Package later on.

Create an Empty Unit Test

Add an empty Unit Test

yo nuxeo test-empty

Create a Bare Component

Add an empty Contribution

yo nuxeo contribution

Create Your Own Business Rules or Logic - Automation Operation

Adds an empty Automation Operation along with a corresponding unit test.

yo nuxeo operation

Create an Event Bus Listener

Adds a listener with its test class, the events will be asked during the generation process. Both existing and custom events can be declared. You can create any listener type: pre-commit, post-commit, synchronous and asynchronous.

yo nuxeo listener

Parameters:

  • Trigger on events: List of some common events to bind to your listener.
  • Custom Events: In case you select 'custom events' in the previous list; comma separate list of other events.
  • Asynchronous Listener: if you need to run after the transaction has committed, in a new transaction and a separate thread. This is useful for any long-running operations whose result doesn't have to be seen immediately in the user interface.
  • Post-commit Listener: if you need to run after the transaction has committed, in a new transaction but in the same thread, this is useful for logging.

Create a Service

Adds a Nuxeo component exposed as a Nuxeo service.

yo nuxeo service

Create a REST API Response Enricher

Creates a Content Enricher that enriches with more information a REST response.

yo nuxeo enricher

Create a Business Object - Document Adapter

Creates a Document Adapter that turn DocumentModel object into business objects.

yo nuxeo adapter

Add an Empty Polymer Application

Add an application based on Polymer Starter Kit bundled as a Nuxeo Project.

yo nuxeo polymer
# npm and bower install must be executed automatically, otherwise:
# cd *-web && npm install && bower install

# To run the application in dev mode; with file changes watch:
cd *-web && npm run serve

Warning

Common bundle's files like MANIFEST.MF and OSGI-INF/* are stored inside a nuxeo folder.

Add an Empty Angular2 Application

Add an application using Angular2 bundled as a Nuxeo Project.

yo nuxeo angular2
# npm and bower install must be executed automatically, otherwise:
# cd *-web && npm install && bower install

# To run the application in dev mode; with file changes watch:
cd *-web && npm run dev

Add a Nuxeo Package Module

Creates a module to handle a Nuxeo Package generation of your project. Can only be called in a Maven multi-module architecture, hence make sure to bootstrap your project using yo nuxeo or yo nuxeo multi-module. If you used yo nuxeo single-module to bootstrap your project, you won't be able to call that option afterwards.

yo nuxeo package

Test locally the generator

To test the generator; you should clone the repository and link it to your local NPM registry:

git clone https://github.com/nuxeo/generator-nuxeo
cd generator-nuxeo
npm link

It will install dependencies and symlink the module to your local registry. After that, you can use the generator as described below.

Licensing

Apache License, Version 2.0

About Nuxeo

Nuxeo dramatically improves how content-based applications are built, managed and deployed, making customers more agile, innovative and successful. Nuxeo provides a next generation, enterprise ready platform for building traditional and cutting-edge content oriented applications. Combining a powerful application development environment with SaaS-based tools and a modular architecture, the Nuxeo Platform and Products provide clear business value to some of the most recognizable brands including Verizon, Electronic Arts, Sharp, FICO, the U.S. Navy, and Boeing. Nuxeo is headquartered in New York and Paris. More information is available at www.nuxeo.com.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
4.0.68latest

Version History

VersionDownloads (Last 7 Days)Published
4.0.68
4.0.51
4.0.42
4.0.32
4.0.25
4.0.11
4.0.01
3.0.15
3.0.01
2.9.21
2.9.11
2.9.01
2.8.12
2.8.02
2.7.01
2.6.11
2.6.02
2.5.01
2.4.21
2.4.11
2.4.01
2.3.12
2.3.02
2.2.01
2.1.01
2.0.21
2.0.11
2.0.01
1.1.21
1.1.11
1.1.01
1.0.12
1.0.01

Package Sidebar

Install

npm i generator-nuxeo

Weekly Downloads

56

Version

4.0.6

License

Apache-2.0

Unpacked Size

161 kB

Total Files

62

Last publish

Collaborators

  • nuxeo