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

[7.9] [Plugin Generator] Generate tsconfig and useDefaultBehaviors (#72040) #72446

Merged
merged 1 commit into from
Jul 22, 2020
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
6 changes: 6 additions & 0 deletions packages/kbn-plugin-generator/sao_template/sao.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ module.exports = function ({ name, targetPath }) {
return !customPath;
},
},
generateTsconfig: {
type: 'confirm',
message: 'Would you like to use a custom tsconfig file?',
default: true,
},
},
filters: {
'public/**/index.scss': 'generateScss',
Expand All @@ -128,6 +133,7 @@ module.exports = function ({ name, targetPath }) {
'translations/**/*': 'generateTranslations',
'i18nrc.json': 'generateTranslations',
'eslintrc.js': 'generateEslint',
'tsconfig.json': 'generateTsconfig',
},
move: {
'eslintrc.js': '.eslintrc.js',
Expand Down
3 changes: 3 additions & 0 deletions packages/kbn-plugin-generator/sao_template/sao.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,14 @@ describe('plugin generator sao integration', () => {
generateApi: true,
generateScss: false,
generateEslint: false,
generateTsconfig: false,
});

// check output files
expect(res.fileList).toContain('public/plugin.ts');
expect(res.fileList).not.toContain('public/index.scss');
expect(res.fileList).not.toContain('.eslintrc.js');
expect(res.fileList).not.toContain('tsconfig.json');
});

it('plugin package has correct title', async () => {
Expand Down Expand Up @@ -136,6 +138,7 @@ describe('plugin generator sao integration', () => {

it('includes dotfiles', async () => {
const res = await sao.mockPrompt(template);
expect(res.files['tsconfig.json']).toBeTruthy();
expect(res.files['.eslintrc.js']).toBeTruthy();
expect(res.files['.i18nrc.json']).toBeTruthy();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const <%= upperCamelCaseName %>App = ({ basename, notifications, http, na
<Router basename={basename}>
<I18nProvider>
<>
<navigation.ui.TopNavMenu appName={ PLUGIN_ID } showSearchBar={true} />
<navigation.ui.TopNavMenu appName={ PLUGIN_ID } showSearchBar={true} useDefaultBehaviors={true}/>
<EuiPage restrictWidth="1000px">
<EuiPageBody>
<EuiPageHeader>
Expand Down
16 changes: 16 additions & 0 deletions packages/kbn-plugin-generator/sao_template/template/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true
},
"include": [
"index.ts",
"common/**/*.ts",
"public/**/*.ts",
"public/**/*.tsx",
"server/**/*.ts",
"../../typings/**/*",
],
"exclude": []
}