Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Jul 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions packages/kbn-plugin-generator/sao_template/sao.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -86,9 +85,9 @@ module.exports = function({ name }) {
Object.assign(
{
templateVersion: pkg.version,
kebabCase,
startCase,
camelCase,
snakeCase,
name,
},
answers
Expand Down
6 changes: 3 additions & 3 deletions packages/kbn-plugin-generator/sao_template/sao.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand All @@ -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 () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ extends: "@elastic/kibana"
settings:
import/resolver:
'@elastic/eslint-import-resolver-kibana':
rootPackageName: '<%= kebabCase(name) %>'
rootPackageName: '<%= snakeCase(name) %>'
6 changes: 3 additions & 3 deletions packages/kbn-plugin-generator/sao_template/template/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ 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'),
<%_ } -%>
},
<%_ } -%>
<%_ if (generateHack) { -%>
hacks: [
'plugins/<%= kebabCase(name) %>/hack'
'plugins/<%= snakeCase(name) %>/hack'
]
<%_ } -%>
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "<%= kebabCase(name) %>",
"name": "<%= snakeCase(name) %>",
"version": "0.0.0",
"description": "<%= description %>",
"main": "index.js",
Expand Down