TechDocs: Clarify differences in sourceFile Path among publishers
This commit is contained in:
@@ -23,10 +23,11 @@ import path from 'path';
|
||||
|
||||
const rootDir = os.platform() === 'win32' ? 'C:\\rootDir' : '/rootDir';
|
||||
/**
|
||||
* @param sourceFile contains either / or \ as file separator depending upon OS.
|
||||
* @param sourceFile Relative path to entity root dir. Contains either / or \ as file separator
|
||||
* depending upon the OS.
|
||||
*/
|
||||
const checkFileExists = async (sourceFile: string): Promise<boolean> => {
|
||||
// sourceFile will always have / as file separator irrespective of OS since S3 expects /.
|
||||
// sourceFile will always have / as file separator irrespective of OS since Azure expects /.
|
||||
// Normalize sourceFile to OS specific path before checking if file exists.
|
||||
const relativeFilePath = sourceFile.split(path.posix.sep).join(path.sep);
|
||||
const filePath = path.join(rootDir, sourceFile);
|
||||
|
||||
@@ -21,10 +21,10 @@ type storageOptions = {
|
||||
};
|
||||
|
||||
/**
|
||||
* @param sourceFile contains either / or \ as file separator depending upon OS.
|
||||
* @param sourceFile Absolute path. Contains either / or \ as file separator depending upon the OS.
|
||||
*/
|
||||
const checkFileExists = async (sourceFile: string): Promise<boolean> => {
|
||||
// sourceFile will always have / as file separator irrespective of OS since S3 expects /.
|
||||
// sourceFile will always have / as file separator irrespective of OS since GCS expects /.
|
||||
// Normalize sourceFile to OS specific path before checking if file exists.
|
||||
const filePath = sourceFile.split(path.posix.sep).join(path.sep);
|
||||
|
||||
|
||||
@@ -22,7 +22,8 @@ import path from 'path';
|
||||
const rootDir = os.platform() === 'win32' ? 'C:\\rootDir' : '/rootDir';
|
||||
|
||||
/**
|
||||
* @param Key contains either / or \ as file separator depending upon OS.
|
||||
* @param Key Relative path to entity root dir. Contains either / or \ as file separator
|
||||
* depending upon the OS.
|
||||
*/
|
||||
const checkFileExists = async (Key: string): Promise<boolean> => {
|
||||
// Key will always have / as file separator irrespective of OS since S3 expects /.
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
import type { Entity, EntityName } from '@backstage/catalog-model';
|
||||
import { ConfigReader } from '@backstage/config';
|
||||
import mockFs from 'mock-fs';
|
||||
import * as os from 'os';
|
||||
import * as path from 'path';
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
import * as winston from 'winston';
|
||||
import { AwsS3Publish } from './awsS3';
|
||||
import { PublisherBase, TechDocsMetadata } from './types';
|
||||
|
||||
Reference in New Issue
Block a user