[kbn-plugin-generator] Fix plugin naming inconsistency (#20808)

<!--
Thank you for your interest in and contributing to Kibana! There
are a few simple things to check before submitting your pull request
that can help with the review process. You should delete these items
from your submission, but they are here to help bring them to your
attention.

- Have you signed the [contributor license agreement](https://www.elastic.co/contributor-agreement)?
- Have you followed the [contributor guidelines](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md)?
- If submitting code, have you included unit tests that cover the changes?
- If submitting code, have you tested and built your code locally prior to submission with `yarn test && yarn build`?
- If submitting code, is your pull request against master? Unless there is a good reason otherwise, we prefer pull requests against master and will backport as needed.
-->
Make relevant generated files use snakeCase instead of kebabCase
Closes #20524
This commit is contained in:
Hanqing Zhao 2018-07-17 14:01:52 -05:00 committed by Spencer
parent 1a65b3577a
commit 17eebb9ba3
5 changed files with 9 additions and 10 deletions

View file

@ -19,7 +19,6 @@
const { resolve, relative, dirname } = require('path');
const kebabCase = require('lodash.kebabcase');
const startCase = require('lodash.startcase');
const camelCase = require('lodash.camelcase');
const snakeCase = require('lodash.snakecase');
@ -86,9 +85,9 @@ module.exports = function({ name }) {
Object.assign(
{
templateVersion: pkg.version,
kebabCase,
startCase,
camelCase,
snakeCase,
name,
},
answers

View file

@ -128,8 +128,8 @@ describe('plugin generator sao integration', () => {
const nameLine = indexContents.match('name: (.*)')[1];
const mainLine = indexContents.match('main: (.*)')[1];
expect(nameLine).toContain('some-fancy-plugin');
expect(mainLine).toContain('plugins/some-fancy-plugin/app');
expect(nameLine).toContain('some_fancy_plugin');
expect(mainLine).toContain('plugins/some_fancy_plugin/app');
});
it('plugin package has correct name', async () => {
@ -142,7 +142,7 @@ describe('plugin generator sao integration', () => {
const packageContents = getFileContents(res.files['package.json']);
const pkg = JSON.parse(packageContents);
expect(pkg.name).toBe('some-fancy-plugin');
expect(pkg.name).toBe('some_fancy_plugin');
});
it('package has version "kibana" with master', async () => {

View file

@ -4,4 +4,4 @@ extends: "@elastic/kibana"
settings:
import/resolver:
'@elastic/eslint-import-resolver-kibana':
rootPackageName: '<%= kebabCase(name) %>'
rootPackageName: '<%= snakeCase(name) %>'

View file

@ -5,13 +5,13 @@ import exampleRoute from './server/routes/example';
export default function (kibana) {
return new kibana.Plugin({
require: ['elasticsearch'],
name: '<%= kebabCase(name) %>',
name: '<%= snakeCase(name) %>',
uiExports: {
<%_ if (generateApp) { -%>
app: {
title: '<%= startCase(name) %>',
description: '<%= description %>',
main: 'plugins/<%= kebabCase(name) %>/app',
main: 'plugins/<%= snakeCase(name) %>/app',
<%_ if (generateScss) { -%>
styleSheetPath: require('path').resolve(__dirname, 'public/app.scss'),
<%_ } -%>
@ -19,7 +19,7 @@ export default function (kibana) {
<%_ } -%>
<%_ if (generateHack) { -%>
hacks: [
'plugins/<%= kebabCase(name) %>/hack'
'plugins/<%= snakeCase(name) %>/hack'
]
<%_ } -%>
},

View file

@ -1,5 +1,5 @@
{
"name": "<%= kebabCase(name) %>",
"name": "<%= snakeCase(name) %>",
"version": "0.0.0",
"description": "<%= description %>",
"main": "index.js",