Rename urlReader to reader
Co-authored-by: Ben Lambert <ben@blam.sh> Co-authored-by: Patrik Oldsberg <poldsberg@gmail.com> Signed-off-by: Johan Haals <johan.haals@gmail.com>
This commit is contained in:
@@ -58,6 +58,6 @@ export default async function createPlugin({
|
||||
dockerClient,
|
||||
database,
|
||||
catalogClient,
|
||||
urlReader: reader,
|
||||
reader,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -26,11 +26,11 @@ import { fetchContents } from './helpers';
|
||||
|
||||
export function createFetchCookiecutterAction(options: {
|
||||
dockerClient: Docker;
|
||||
urlReader: UrlReader;
|
||||
reader: UrlReader;
|
||||
integrations: ScmIntegrations;
|
||||
templaters: TemplaterBuilder;
|
||||
}): TemplateAction<{ url: string; targetPath?: string; values: JsonObject }> {
|
||||
const { dockerClient, urlReader, templaters, integrations } = options;
|
||||
const { dockerClient, reader, templaters, integrations } = options;
|
||||
|
||||
return {
|
||||
id: 'fetch:cookiecutter',
|
||||
@@ -68,7 +68,7 @@ export function createFetchCookiecutterAction(options: {
|
||||
const resultDir = resolvePath(workDir, 'result');
|
||||
|
||||
await fetchContents({
|
||||
urlReader,
|
||||
reader,
|
||||
integrations,
|
||||
baseUrl: ctx.baseUrl,
|
||||
fetchUrl: ctx.parameters.url,
|
||||
|
||||
@@ -21,13 +21,13 @@ import { ScmIntegrations } from '@backstage/integration';
|
||||
import { JsonValue } from '@backstage/config';
|
||||
|
||||
export async function fetchContents({
|
||||
urlReader,
|
||||
reader,
|
||||
integrations,
|
||||
baseUrl,
|
||||
fetchUrl = '.',
|
||||
outputPath,
|
||||
}: {
|
||||
urlReader: UrlReader;
|
||||
reader: UrlReader;
|
||||
integrations: ScmIntegrations;
|
||||
baseUrl?: string;
|
||||
fetchUrl?: JsonValue;
|
||||
@@ -79,7 +79,7 @@ export async function fetchContents({
|
||||
);
|
||||
}
|
||||
|
||||
const res = await urlReader.readTree(readUrl);
|
||||
const res = await reader.readTree(readUrl);
|
||||
await fs.ensureDir(outputPath);
|
||||
await res.dir({ targetDir: outputPath });
|
||||
}
|
||||
|
||||
@@ -21,10 +21,10 @@ import { TemplateAction } from '../../types';
|
||||
import { fetchContents } from './helpers';
|
||||
|
||||
export function createFetchPlainAction(options: {
|
||||
urlReader: UrlReader;
|
||||
reader: UrlReader;
|
||||
integrations: ScmIntegrations;
|
||||
}): TemplateAction<{ url: string; targetPath?: string }> {
|
||||
const { urlReader, integrations } = options;
|
||||
const { reader, integrations } = options;
|
||||
|
||||
return {
|
||||
id: 'fetch:plain',
|
||||
@@ -59,7 +59,7 @@ export function createFetchPlainAction(options: {
|
||||
}
|
||||
|
||||
await fetchContents({
|
||||
urlReader,
|
||||
reader,
|
||||
integrations,
|
||||
baseUrl: ctx.baseUrl,
|
||||
fetchUrl: ctx.parameters.url,
|
||||
|
||||
@@ -72,7 +72,7 @@ export interface RouterOptions {
|
||||
|
||||
logger: Logger;
|
||||
config: Config;
|
||||
urlReader: UrlReader;
|
||||
reader: UrlReader;
|
||||
dockerClient: Docker;
|
||||
database: PluginDatabaseManager;
|
||||
catalogClient: CatalogApi;
|
||||
@@ -105,7 +105,7 @@ export async function createRouter(
|
||||
publishers,
|
||||
logger: parentLogger,
|
||||
config,
|
||||
urlReader,
|
||||
reader,
|
||||
dockerClient,
|
||||
database,
|
||||
catalogClient,
|
||||
@@ -137,13 +137,13 @@ export async function createRouter(
|
||||
});
|
||||
actionRegistry.register(
|
||||
createFetchPlainAction({
|
||||
urlReader,
|
||||
reader,
|
||||
integrations,
|
||||
}),
|
||||
);
|
||||
actionRegistry.register(
|
||||
createFetchCookiecutterAction({
|
||||
urlReader,
|
||||
reader,
|
||||
integrations,
|
||||
dockerClient,
|
||||
templaters,
|
||||
|
||||
Reference in New Issue
Block a user