|
|
|
@@ -374,14 +374,14 @@ describe('loadPortableTemplateConfig', () => {
|
|
|
|
|
},
|
|
|
|
|
node_modules: Object.fromEntries(
|
|
|
|
|
defaultTemplates.map(t => {
|
|
|
|
|
// Match the real behavior: both frontend-plugin and legacy-frontend-plugin
|
|
|
|
|
// have the same template name "frontend-plugin"
|
|
|
|
|
const name = t.endsWith('/legacy-frontend-plugin')
|
|
|
|
|
? 'frontend-plugin'
|
|
|
|
|
? 'frontend-plugin-legacy'
|
|
|
|
|
: basename(t);
|
|
|
|
|
return [
|
|
|
|
|
t,
|
|
|
|
|
{ [TEMPLATE_FILE_NAME]: `name: ${name}\nrole: web-library\n` },
|
|
|
|
|
{
|
|
|
|
|
[TEMPLATE_FILE_NAME]: `name: ${name}\nrole: web-library\n`,
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
@@ -398,14 +398,7 @@ describe('loadPortableTemplateConfig', () => {
|
|
|
|
|
expect(templateNames).toContain('frontend-plugin-module');
|
|
|
|
|
expect(templateNames).toContain('backend-plugin');
|
|
|
|
|
// Legacy template should be filtered out
|
|
|
|
|
expect(templateNames).not.toContain('legacy-frontend-plugin');
|
|
|
|
|
|
|
|
|
|
// The frontend-plugin in the list should be from the new template, not legacy
|
|
|
|
|
const frontendPlugin = config.templatePointers.find(
|
|
|
|
|
t => t.name === 'frontend-plugin',
|
|
|
|
|
);
|
|
|
|
|
expect(frontendPlugin?.target).toContain('/frontend-plugin/');
|
|
|
|
|
expect(frontendPlugin?.target).not.toContain('/legacy-frontend-plugin/');
|
|
|
|
|
expect(templateNames).not.toContain('frontend-plugin-legacy');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should filter out new frontend templates for legacy frontend system apps', async () => {
|
|
|
|
@@ -424,11 +417,13 @@ describe('loadPortableTemplateConfig', () => {
|
|
|
|
|
node_modules: Object.fromEntries(
|
|
|
|
|
defaultTemplates.map(t => {
|
|
|
|
|
const name = t.endsWith('/legacy-frontend-plugin')
|
|
|
|
|
? 'frontend-plugin'
|
|
|
|
|
? 'frontend-plugin-legacy'
|
|
|
|
|
: basename(t);
|
|
|
|
|
return [
|
|
|
|
|
t,
|
|
|
|
|
{ [TEMPLATE_FILE_NAME]: `name: ${name}\nrole: web-library\n` },
|
|
|
|
|
{
|
|
|
|
|
[TEMPLATE_FILE_NAME]: `name: ${name}\nrole: web-library\n`,
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
@@ -441,17 +436,12 @@ describe('loadPortableTemplateConfig', () => {
|
|
|
|
|
expect(config.isUsingDefaultTemplates).toBe(true);
|
|
|
|
|
|
|
|
|
|
const templateNames = config.templatePointers.map(t => t.name);
|
|
|
|
|
// Legacy template should be present (shown as "frontend-plugin")
|
|
|
|
|
expect(templateNames).toContain('frontend-plugin');
|
|
|
|
|
// Legacy template should be present
|
|
|
|
|
expect(templateNames).toContain('frontend-plugin-legacy');
|
|
|
|
|
expect(templateNames).toContain('backend-plugin');
|
|
|
|
|
// New frontend templates should be filtered out
|
|
|
|
|
expect(templateNames).not.toContain('frontend-plugin');
|
|
|
|
|
expect(templateNames).not.toContain('frontend-plugin-module');
|
|
|
|
|
|
|
|
|
|
// The frontend-plugin in the list should be from the legacy template
|
|
|
|
|
const frontendPlugin = config.templatePointers.find(
|
|
|
|
|
t => t.name === 'frontend-plugin',
|
|
|
|
|
);
|
|
|
|
|
expect(frontendPlugin?.target).toContain('/legacy-frontend-plugin/');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should not filter templates when using explicit configuration', async () => {
|
|
|
|
|