Skip to content

Commit

Permalink
add a tsconfig file and useDefaultBehaviors
Browse files Browse the repository at this point in the history
  • Loading branch information
Liza K committed Jul 16, 2020
1 parent 7b2a45c commit 440ca57
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
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": []
}

0 comments on commit 440ca57

Please sign in to comment.