cli/new: move owner out of template values
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -44,8 +44,8 @@ export async function executePortableTemplate(
|
||||
|
||||
await installNewPackage(input);
|
||||
|
||||
if (input.builtInParams.owner) {
|
||||
await addCodeownersEntry(targetDir, input.builtInParams.owner);
|
||||
if (input.owner) {
|
||||
await addCodeownersEntry(targetDir, input.owner);
|
||||
}
|
||||
|
||||
await Task.forCommand('yarn install', {
|
||||
|
||||
@@ -42,12 +42,12 @@ describe('writeTemplateContents', () => {
|
||||
id: 'test',
|
||||
files: [],
|
||||
role: 'frontend-plugin',
|
||||
parameters: {},
|
||||
templateValues: {},
|
||||
},
|
||||
{
|
||||
...baseConfig,
|
||||
roleParams: { role: 'frontend-plugin', pluginId: 'test' },
|
||||
builtInParams: {},
|
||||
packageName: '@internal/plugin-test',
|
||||
packagePath: 'plugins/plugin-test',
|
||||
},
|
||||
@@ -77,12 +77,12 @@ describe('writeTemplateContents', () => {
|
||||
},
|
||||
],
|
||||
role: 'frontend-plugin',
|
||||
parameters: {},
|
||||
templateValues: {},
|
||||
},
|
||||
{
|
||||
...baseConfig,
|
||||
roleParams: { role: 'frontend-plugin', pluginId: 'test' },
|
||||
builtInParams: {},
|
||||
packageName: '@internal/plugin-test',
|
||||
packagePath: 'out',
|
||||
},
|
||||
|
||||
@@ -41,7 +41,6 @@ export async function writeTemplateContents(
|
||||
const templater = await PortableTemplater.create({
|
||||
values: {
|
||||
...roleValues,
|
||||
...input.builtInParams,
|
||||
packageName: input.packageName,
|
||||
privatePackage: input.private,
|
||||
packageVersion: input.version,
|
||||
|
||||
@@ -34,6 +34,7 @@ describe('collectTemplateParams', () => {
|
||||
templatePath: '/test',
|
||||
role: 'frontend-plugin' as const,
|
||||
files: [],
|
||||
parameters: {},
|
||||
templateValues: {},
|
||||
},
|
||||
prefilledParams: {
|
||||
@@ -48,9 +49,7 @@ describe('collectTemplateParams', () => {
|
||||
role: 'frontend-plugin',
|
||||
pluginId: 'test',
|
||||
},
|
||||
builtInParams: {
|
||||
owner: 'me',
|
||||
},
|
||||
owner: 'me',
|
||||
version: '0.1.0',
|
||||
license: 'Apache-2.0',
|
||||
private: true,
|
||||
@@ -72,9 +71,7 @@ describe('collectTemplateParams', () => {
|
||||
role: 'frontend-plugin',
|
||||
pluginId: 'other',
|
||||
},
|
||||
builtInParams: {
|
||||
owner: undefined,
|
||||
},
|
||||
owner: undefined,
|
||||
version: '0.1.0',
|
||||
license: 'Apache-2.0',
|
||||
private: true,
|
||||
|
||||
@@ -20,7 +20,6 @@ import { paths } from '../../paths';
|
||||
import {
|
||||
PortableTemplateConfig,
|
||||
PortableTemplateInput,
|
||||
PortableTemplateInputBuiltInParams,
|
||||
PortableTemplateInputRoleParams,
|
||||
PortableTemplateParams,
|
||||
PortableTemplateRole,
|
||||
@@ -83,9 +82,7 @@ export async function collectPortableTemplateInput(
|
||||
|
||||
return {
|
||||
roleParams,
|
||||
builtInParams: {
|
||||
owner: answers.owner,
|
||||
} as PortableTemplateInputBuiltInParams,
|
||||
owner: answers.owner as string | undefined,
|
||||
license: config.license,
|
||||
version: config.version,
|
||||
private: config.private,
|
||||
|
||||
@@ -20,14 +20,13 @@ import { withLogCollector } from '@backstage/test-utils';
|
||||
import { selectTemplateInteractively } from './selectTemplateInteractively';
|
||||
|
||||
describe('selectTemplateInteractively', () => {
|
||||
const mockConfig: PortableTemplateConfig = {
|
||||
const mockConfig = {
|
||||
isUsingDefaultTemplates: false,
|
||||
templatePointers: [
|
||||
{ id: 'template1', target: 'path/to/template1' },
|
||||
{ id: 'template2', target: 'path/to/template2' },
|
||||
],
|
||||
globals: {},
|
||||
};
|
||||
} as PortableTemplateConfig;
|
||||
|
||||
beforeEach(() => {
|
||||
jest.resetAllMocks();
|
||||
|
||||
@@ -102,13 +102,10 @@ export type PortableTemplateInputRoleParams =
|
||||
moduleId: string;
|
||||
};
|
||||
|
||||
export type PortableTemplateInputBuiltInParams = {
|
||||
owner?: string;
|
||||
};
|
||||
|
||||
export type PortableTemplateInput = {
|
||||
roleParams: PortableTemplateInputRoleParams;
|
||||
builtInParams: PortableTemplateInputBuiltInParams;
|
||||
|
||||
owner?: string;
|
||||
|
||||
license: string;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user