[Plugin Generator] Generate tsconfig and useDefaultBehaviors (#72040)
* improve test stability * add a tsconfig file and useDefaultBehaviors Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
parent
7ac5fc4e1f
commit
6c3b900d11
|
@ -120,6 +120,11 @@ module.exports = function ({ name, targetPath }) {
|
||||||
return !customPath;
|
return !customPath;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
generateTsconfig: {
|
||||||
|
type: 'confirm',
|
||||||
|
message: 'Would you like to use a custom tsconfig file?',
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
filters: {
|
filters: {
|
||||||
'public/**/index.scss': 'generateScss',
|
'public/**/index.scss': 'generateScss',
|
||||||
|
@ -128,6 +133,7 @@ module.exports = function ({ name, targetPath }) {
|
||||||
'translations/**/*': 'generateTranslations',
|
'translations/**/*': 'generateTranslations',
|
||||||
'i18nrc.json': 'generateTranslations',
|
'i18nrc.json': 'generateTranslations',
|
||||||
'eslintrc.js': 'generateEslint',
|
'eslintrc.js': 'generateEslint',
|
||||||
|
'tsconfig.json': 'generateTsconfig',
|
||||||
},
|
},
|
||||||
move: {
|
move: {
|
||||||
'eslintrc.js': '.eslintrc.js',
|
'eslintrc.js': '.eslintrc.js',
|
||||||
|
|
|
@ -80,12 +80,14 @@ describe('plugin generator sao integration', () => {
|
||||||
generateApi: true,
|
generateApi: true,
|
||||||
generateScss: false,
|
generateScss: false,
|
||||||
generateEslint: false,
|
generateEslint: false,
|
||||||
|
generateTsconfig: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
// check output files
|
// check output files
|
||||||
expect(res.fileList).toContain('public/plugin.ts');
|
expect(res.fileList).toContain('public/plugin.ts');
|
||||||
expect(res.fileList).not.toContain('public/index.scss');
|
expect(res.fileList).not.toContain('public/index.scss');
|
||||||
expect(res.fileList).not.toContain('.eslintrc.js');
|
expect(res.fileList).not.toContain('.eslintrc.js');
|
||||||
|
expect(res.fileList).not.toContain('tsconfig.json');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('plugin package has correct title', async () => {
|
it('plugin package has correct title', async () => {
|
||||||
|
@ -136,6 +138,7 @@ describe('plugin generator sao integration', () => {
|
||||||
|
|
||||||
it('includes dotfiles', async () => {
|
it('includes dotfiles', async () => {
|
||||||
const res = await sao.mockPrompt(template);
|
const res = await sao.mockPrompt(template);
|
||||||
|
expect(res.files['tsconfig.json']).toBeTruthy();
|
||||||
expect(res.files['.eslintrc.js']).toBeTruthy();
|
expect(res.files['.eslintrc.js']).toBeTruthy();
|
||||||
expect(res.files['.i18nrc.json']).toBeTruthy();
|
expect(res.files['.i18nrc.json']).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
|
@ -73,7 +73,7 @@ export const <%= upperCamelCaseName %>App = ({ basename, notifications, http, na
|
||||||
<Router basename={basename}>
|
<Router basename={basename}>
|
||||||
<I18nProvider>
|
<I18nProvider>
|
||||||
<>
|
<>
|
||||||
<navigation.ui.TopNavMenu appName={ PLUGIN_ID } showSearchBar={true} />
|
<navigation.ui.TopNavMenu appName={ PLUGIN_ID } showSearchBar={true} useDefaultBehaviors={true}/>
|
||||||
<EuiPage restrictWidth="1000px">
|
<EuiPage restrictWidth="1000px">
|
||||||
<EuiPageBody>
|
<EuiPageBody>
|
||||||
<EuiPageHeader>
|
<EuiPageHeader>
|
||||||
|
|
|
@ -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": []
|
||||||
|
}
|
Loading…
Reference in a new issue