@americanexpress/generator-one-app-module

generator for One App Modules

Usage no npm install needed!

<script type="module">
  import americanexpressGeneratorOneAppModule from 'https://cdn.skypack.dev/@americanexpress/generator-one-app-module';
</script>

README

@americanexpress/generator-one-app-module

yeoman generator for a bare-bones One App holocron Module

๐Ÿคนโ€ Usage

Assuming you have npx installed (comes with npm on versions 5.2.0 and above):

npx -p yo -p @americanexpress/generator-one-app-module -- yo @americanexpress/one-app-module

The generator will start up and prompt you with the following questions:

Optional Flags

--setupInternationalizationByDefault

If you'd like to include internationalization in your module without being prompted, you can pass in the --setupInternationalizationByDefault flag. Your command will look as follows:

yo @americanexpress/one-app-module --setupInternationalizationByDefault

Alternatively, if you choose to compose generator-one-app-module with another generator, you can pass the setupInternationalizationByDefault value in an object as the second argument to the Yeoman ComposeWith function, like so:

const CustomExtension = require.resolve('./path-to-custom-extension');

module.exports = class extends Generator {
  initializing() {
    this.composeWith(require.resolve('@americanexpress/generator-one-app-module/generators/app'), 
    { setupInternationalizationByDefault: true });
    this.composeWith(CustomExtension);
  }
};

Doing this, you're able to extend the generator-one-app-module generator, enable internationalization by default, and add additional prompts and logic in your custom extension.

More on composing generators here.

Bundling modules

For more information about what happens after bundling your module, read Bundling modules

๐Ÿ† Contributing

After making changes to the generator, test your changes locally:

  1. Install yeoman globally: npm install --global yo
  2. Link your local generator module so it is used instead of the repo version: npm link
  3. Switch to a temp directory and run: yo @americanexpress/one-app-module
  4. When you are done, unlink the local module : npm unlink

Please see our contributing guide for more details.