'use strict';
import GenBase from '../genBase';
import path from 'path';

module.exports = class Generator extends GenBase {
  constructor(...args) {
    super(...args);
  }

  get prompting() {
    return function () {
      this.askForModuleName();
    };
  }

  get writing() {
    return async function () {
      const done = this.async();

      let config = await this.getConfig();

      config.templateUrl = config.modulePath;

      if (config.structure === 'module-type') {
        config.templateUrl = path.join(config.modulePath, 'directives');
      }
      config.templateUrl = config.templateUrl.replace(/\\/g, '/');

      if (config.directiveTemplateUrl) {
        await this.copyMarkupFile('directive', config);
      }

      await Promise.all([
        this.copySrcFile('directive', config),
        this.copyUnitTest('directive', config)
      ]);

      done();
    };
  }
};

'use strict';
import genBase from '../genBase';
import path from 'path';

module.exports = genBase.extend({
  prompting() {
    this.askForModuleName();
  },

  async writing() {
    const done = this.async();

    let config = await this.getConfig();

    config.templateUrl = config.modulePath;

    if (config.structure === 'module-type') {
      config.templateUrl = path.join(config.modulePath, 'directives');
    }
    config.templateUrl = config.templateUrl.replace(/\\/g, '/');

    if (config.directiveTemplateUrl) {
      await this.copyMarkupFile('directive', config);
    }

    await Promise.all([
      this.copySrcFile('directive', config),
      this.copyUnitTest('directive', config)
    ]);

    done();
  }
});

convert class to object