[6.x] [kbn-plugin-generator] Fix plugin naming inconsistency (#20808) (#20898)

Backports the following commits to 6.x:
 - [kbn-plugin-generator] Fix plugin naming inconsistency  (#20808)
This commit is contained in:
Spencer 2018-07-17 17:36:53 -07:00 committed by GitHub
parent 2747d5e848
commit 215c41c4dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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",