From d0d38990c73ef232c7d88ed8d163e4cd12df037e Mon Sep 17 00:00:00 2001 From: Chaim Lev-Ari Date: Thu, 18 Mar 2021 22:03:26 +0200 Subject: [PATCH] chore(plop): use templates as in style guide (#4916) * chore(plop): use templates as in style guide fix [CE-483] * chore(plop): export component and add to module --- plop-templates/component-controller.js.hbs | 2 +- plop-templates/component.js.hbs | 13 ++++++++----- plopfile.js | 4 ++-- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/plop-templates/component-controller.js.hbs b/plop-templates/component-controller.js.hbs index 29f87870b..1546fb808 100644 --- a/plop-templates/component-controller.js.hbs +++ b/plop-templates/component-controller.js.hbs @@ -3,4 +3,4 @@ class {{properCase name}}Controller { constructor() {} } -export default {{properCase name}}Controller; \ No newline at end of file +export default {{properCase name}}Controller; diff --git a/plop-templates/component.js.hbs b/plop-templates/component.js.hbs index a29c3e518..0fdf32622 100644 --- a/plop-templates/component.js.hbs +++ b/plop-templates/component.js.hbs @@ -1,6 +1,9 @@ -import {{properCase name}}Controller from './{{dashCase name}}/{{camelCase name}}Controller.js' +import angular from 'angular'; +import controller from './{{dashCase name}}.controller.js' -angular.module('portainer.{{module}}').component('{{camelCase name}}', { - templateUrl: './{{camelCase name}}.html', - controller: {{properCase name}}Controller, -}); \ No newline at end of file +export const {{camelCase name}} = { + templateUrl: './{{dashCase name}}.html', + controller, +}; + +angular.module('portainer.{{module}}').component('{{camelCase name}}', {{camelCase name}}) diff --git a/plopfile.js b/plopfile.js index a5c23a347..1a36df383 100644 --- a/plopfile.js +++ b/plopfile.js @@ -25,12 +25,12 @@ module.exports = function (plop) { }, { type: 'add', - path: `{{cwd}}/{{dashCase name}}/{{camelCase name}}Controller.js`, + path: `{{cwd}}/{{dashCase name}}/{{dashCase name}}.controller.js`, templateFile: './plop-templates/component-controller.js.hbs', }, { type: 'add', - path: `{{cwd}}/{{dashCase name}}/{{camelCase name}}.html`, + path: `{{cwd}}/{{dashCase name}}/{{dashCase name}}.html`, templateFile: './plop-templates/component.html.hbs', }, ], // array of actions