2023-04-10 15:36:59 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
|
|
*/
|
|
|
|
|
2021-12-28 15:52:15 +00:00
|
|
|
/* eslint-disable ember/no-string-prototype-extensions */
|
2020-01-21 21:46:32 +00:00
|
|
|
const getPathOption = require('ember-cli-get-component-path-option');
|
|
|
|
const stringUtil = require('ember-cli-string-utils');
|
|
|
|
const path = require('path');
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
description: 'generates a story for storybook',
|
|
|
|
|
2021-12-28 14:45:20 +00:00
|
|
|
fileMapTokens: function () {
|
2020-01-21 21:46:32 +00:00
|
|
|
let { project } = this;
|
|
|
|
return {
|
2021-12-28 14:45:20 +00:00
|
|
|
__path__: function () {
|
2020-01-21 21:46:32 +00:00
|
|
|
return path.relative(project.root, project.root);
|
|
|
|
},
|
2021-12-28 14:45:20 +00:00
|
|
|
__markdownname__: function (options) {
|
2020-01-21 21:46:32 +00:00
|
|
|
return options.dasherizedModuleName;
|
|
|
|
},
|
2021-12-28 14:45:20 +00:00
|
|
|
__name__: function (options) {
|
2020-01-21 21:46:32 +00:00
|
|
|
return options.dasherizedModuleName;
|
|
|
|
},
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
2021-12-28 14:45:20 +00:00
|
|
|
locals: function (options) {
|
2020-01-21 21:46:32 +00:00
|
|
|
let contents = '';
|
|
|
|
|
|
|
|
return {
|
|
|
|
contents: contents,
|
|
|
|
path: getPathOption(options),
|
|
|
|
header: stringUtil
|
|
|
|
.dasherize(options.entity.name)
|
|
|
|
.split('-')
|
2021-12-28 14:45:20 +00:00
|
|
|
.map((word) => stringUtil.capitalize(word))
|
2020-01-21 21:46:32 +00:00
|
|
|
.join(' '),
|
|
|
|
};
|
|
|
|
},
|
|
|
|
};
|