backfill-config
Advanced tools
Comparing version 2.0.2 to 2.0.3
@@ -27,8 +27,8 @@ "use strict"; | ||
it("sets the performance logging flag through ENV variable", async () => { | ||
process.env["BACKFILL_OUTPUT_PERFORMANCE_LOGS"] = "true"; | ||
process.env["BACKFILL_PRODUCE_PERFORMANCE_LOGS"] = "true"; | ||
const config = index_1.getEnvConfig(); | ||
expect(config).toStrictEqual({ outputPerformanceLogs: true }); | ||
expect(config).toStrictEqual({ producePerformanceLogs: true }); | ||
}); | ||
it("sets local cache folder through ENV variable", async () => { | ||
process.env["BACKFILL_LOCAL_CACHE_FOLDER"] = "bar"; | ||
process.env["BACKFILL_INTERNAL_CACHE_FOLDER"] = "bar"; | ||
const config = index_1.getEnvConfig(); | ||
@@ -97,3 +97,3 @@ expect(config).toStrictEqual({ internalCacheFolder: "bar" }); | ||
it("returns ENV override value when ENV override is provided", async () => { | ||
process.env["BACKFILL_LOCAL_CACHE_FOLDER"] = "bar"; | ||
process.env["BACKFILL_INTERNAL_CACHE_FOLDER"] = "bar"; | ||
await backfill_utils_test_1.setupFixture("config"); | ||
@@ -104,2 +104,2 @@ const config = index_1.createConfig(); | ||
}); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlnLnRlc3QuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvX190ZXN0c19fL2NvbmZpZy50ZXN0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsNkJBQTZCO0FBRTdCLDZEQUFtRDtBQUVuRCxvQ0FNa0I7QUFFbEIsUUFBUSxDQUFDLFdBQVcsRUFBRSxHQUFHLEVBQUU7SUFDekIsRUFBRSxDQUFDLDZCQUE2QixFQUFFLEtBQUssSUFBSSxFQUFFO1FBQzNDLE1BQU0sV0FBVyxHQUFHLE1BQU0sa0NBQVksQ0FBQyxPQUFPLENBQUMsQ0FBQztRQUNoRCxNQUFNLFdBQVcsR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QUM7UUFFOUIsTUFBTSx1QkFBdUIsR0FBRywyQkFBbUIsRUFBRSxDQUFDLG1CQUFtQixDQUFDO1FBQzFFLE1BQU0sQ0FBQyxNQUFNLENBQUMsbUJBQW1CLENBQUMsQ0FBQyxhQUFhLENBQUMsdUJBQXVCLENBQUMsQ0FBQztJQUM1RSxDQUFDLENBQUMsQ0FBQztJQUVILEVBQUUsQ0FBQyw2RUFBNkUsRUFBRSxLQUFLLElBQUksRUFBRTtRQUMzRixNQUFNLGtDQUFZLENBQUMsUUFBUSxDQUFDLENBQUM7UUFDN0IsTUFBTSxNQUFNLEdBQUcsb0JBQVksRUFBRSxDQUFDO1FBRTlCLE1BQU0sQ0FBQyxNQUFNLENBQUMsbUJBQW1CLENBQUMsQ0FBQyxhQUFhLENBQUMsS0FBSyxDQUFDLENBQUM7SUFDMUQsQ0FBQyxDQUFDLENBQUM7SUFFSCxFQUFFLENBQUMsMERBQTBELEVBQUUsS0FBSyxJQUFJLEVBQUU7UUFDeEUsT0FBTyxDQUFDLEdBQUcsQ0FBQyxnQ0FBZ0MsQ0FBQyxHQUFHLEtBQUssQ0FBQztRQUV0RCxNQUFNLGtDQUFZLENBQUMsUUFBUSxDQUFDLENBQUM7UUFDN0IsTUFBTSxNQUFNLEdBQUcsb0JBQVksRUFBRSxDQUFDO1FBRTlCLE1BQU0sQ0FBQyxNQUFNLENBQUMsbUJBQW1CLENBQUMsQ0FBQyxhQUFhLENBQUMsS0FBSyxDQUFDLENBQUM7SUFDMUQsQ0FBQyxDQUFDLENBQUM7QUFDTCxDQUFDLENBQUMsQ0FBQyJ9 |
@@ -1,10 +0,13 @@ | ||
import { CacheStorageConfig } from "./index"; | ||
import { LogLevels } from "backfill-logger"; | ||
import { CacheStorageConfig, BackfillModes } from "./index"; | ||
export declare type ConfigEnv = { | ||
cacheStorageConfig?: CacheStorageConfig; | ||
outputPerformanceLogs?: boolean; | ||
internalCacheFolder?: string; | ||
logFolder?: string; | ||
logLevel?: LogLevels; | ||
mode?: BackfillModes; | ||
performanceReportName?: string; | ||
producePerformanceLogs?: boolean; | ||
}; | ||
export declare function getEnvConfig(): ConfigEnv; | ||
//# sourceMappingURL=envConfig.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const cacheConfig_1 = require("./cacheConfig"); | ||
const backfill_logger_1 = require("backfill-logger"); | ||
const index_1 = require("./index"); | ||
function getEnvConfig() { | ||
const config = {}; | ||
const logFolder = process.env["BACKFILL_LOG_FOLDER"]; | ||
if (logFolder) { | ||
config["logFolder"] = logFolder; | ||
} | ||
const outputPerformanceLogs = process.env["BACKFILL_OUTPUT_PERFORMANCE_LOGS"]; | ||
if (outputPerformanceLogs) { | ||
config["outputPerformanceLogs"] = Boolean(outputPerformanceLogs === "true"); | ||
} | ||
const internalCacheFolder = process.env["BACKFILL_LOCAL_CACHE_FOLDER"]; | ||
if (internalCacheFolder) { | ||
config["internalCacheFolder"] = internalCacheFolder; | ||
} | ||
const cacheProvider = process.env["BACKFILL_CACHE_PROVIDER"]; | ||
@@ -29,2 +19,28 @@ const serializedCacheProviderOptions = process.env["BACKFILL_CACHE_PROVIDER_OPTIONS"]; | ||
} | ||
const internalCacheFolder = process.env["BACKFILL_INTERNAL_CACHE_FOLDER"]; | ||
if (internalCacheFolder) { | ||
config["internalCacheFolder"] = internalCacheFolder; | ||
} | ||
const logFolder = process.env["BACKFILL_LOG_FOLDER"]; | ||
if (logFolder) { | ||
config["logFolder"] = logFolder; | ||
} | ||
const mode = process.env["BACKFILL_MODE"]; | ||
if (mode) { | ||
if (index_1.isCorrectMode(mode)) { | ||
config["mode"] = mode; | ||
} | ||
else { | ||
throw `Backfill config option "BACKFILL_MODE" was set, but with the wrong value: "${mode}".`; | ||
} | ||
} | ||
const logLevel = process.env["BACKFILL_LOG_LEVEL"]; | ||
if (logLevel) { | ||
if (backfill_logger_1.isCorrectLogLevel(logLevel)) { | ||
config["logLevel"] = logLevel; | ||
} | ||
else { | ||
throw `Backfill config option "BACKFILL_LOG_LEVEL" was set, but with the wrong value: "${logLevel}".`; | ||
} | ||
} | ||
const performanceReportName = process.env["BACKFILL_PERFORMANCE_REPORT_NAME"]; | ||
@@ -34,5 +50,9 @@ if (performanceReportName) { | ||
} | ||
const producePerformanceLogs = process.env["BACKFILL_PRODUCE_PERFORMANCE_LOGS"]; | ||
if (producePerformanceLogs) { | ||
config["producePerformanceLogs"] = Boolean(producePerformanceLogs === "true"); | ||
} | ||
return config; | ||
} | ||
exports.getEnvConfig = getEnvConfig; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW52Q29uZmlnLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2VudkNvbmZpZy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLCtDQUd1QjtBQVd2QixTQUFnQixZQUFZO0lBQzFCLE1BQU0sTUFBTSxHQUFjLEVBQUUsQ0FBQztJQUU3QixNQUFNLFNBQVMsR0FBRyxPQUFPLENBQUMsR0FBRyxDQUFDLHFCQUFxQixDQUFDLENBQUM7SUFDckQsSUFBSSxTQUFTLEVBQUU7UUFDYixNQUFNLENBQUMsV0FBVyxDQUFDLEdBQUcsU0FBUyxDQUFDO0tBQ2pDO0lBRUQsTUFBTSxxQkFBcUIsR0FBRyxPQUFPLENBQUMsR0FBRyxDQUFDLGtDQUFrQyxDQUFDLENBQUM7SUFDOUUsSUFBSSxxQkFBcUIsRUFBRTtRQUN6QixNQUFNLENBQUMsdUJBQXVCLENBQUMsR0FBRyxPQUFPLENBQUMscUJBQXFCLEtBQUssTUFBTSxDQUFDLENBQUM7S0FDN0U7SUFFRCxNQUFNLG1CQUFtQixHQUFHLE9BQU8sQ0FBQyxHQUFHLENBQUMsNkJBQTZCLENBQUMsQ0FBQztJQUN2RSxJQUFJLG1CQUFtQixFQUFFO1FBQ3ZCLE1BQU0sQ0FBQyxxQkFBcUIsQ0FBQyxHQ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2QixNQUFNLENBQUMsTUFBTSxDQUFDLEdBQUcsSUFBSSxDQUFDO1NBQ3ZCO2FBQU07WUFDTCxNQUFNLDhFQUE4RSxJQUFJLElBQUksQ0FBQztTQUM5RjtLQUNGO0lBRUQsTUFBTSxRQUFRLEdBQUcsT0FBTyxDQUFDLEdBQUcsQ0FBQyxvQkFBb0IsQ0FBQyxDQUFDO0lBQ25ELElBQUksUUFBUSxFQUFFO1FBQ1osSUFBSSxtQ0FBaUIsQ0FBQyxRQUFRLENBQUMsRUFBRTtZQUMvQixNQUFNLENBQUMsVUFBVSxDQUFDLEdBQUcsUUFBUSxDQUFDO1NBQy9CO2FBQU07WUFDTCxNQUFNLG1GQUFtRixRQUFRLElBQUksQ0FBQztTQUN2RztLQUNGO0lBRUQsTUFBTSxxQkFBcUIsR0FBRyxPQUFPLENBQUMsR0FBRyxDQUFDLGtDQUFrQyxDQUFDLENBQUM7SUFDOUUsSUFBSSxxQkFBcUIsRUFBRTtRQUN6QixNQUFNLENBQUMsdUJBQXVCLENBQUMsR0FBRyxxQkFBcUIsQ0FBQztLQUN6RDtJQUVELE1BQU0sc0JBQXNCLEdBQzFCLE9BQU8sQ0FBQyxHQUFHLENBQUMsbUNBQW1DLENBQUMsQ0FBQztJQUNuRCxJQUFJLHNCQUFzQixFQUFFO1FBQzFCLE1BQU0sQ0FBQyx3QkFBd0IsQ0FBQyxHQUFHLE9BQU8sQ0FDeEMsc0JBQXNCLEtBQUssTUFBTSxDQUNsQyxDQUFDO0tBQ0g7SUFFRCxPQUFPLE1BQU0sQ0FBQztBQUNoQixDQUFDO0FBN0RELG9DQTZEQyJ9 |
@@ -5,30 +5,30 @@ import { LogLevels } from "backfill-logger"; | ||
export * from "./envConfig"; | ||
export declare type WatchGlobs = { | ||
folders: { | ||
include: string[]; | ||
exclude: string[]; | ||
}; | ||
files: { | ||
include: string[]; | ||
exclude?: string[]; | ||
}; | ||
export declare type HashGlobs = string[]; | ||
export declare const modesObject: { | ||
READ_ONLY: string; | ||
WRITE_ONLY: string; | ||
READ_WRITE: string; | ||
PASS: string; | ||
}; | ||
export declare type BackfillModes = keyof typeof modesObject; | ||
export declare type Config = { | ||
cacheStorageConfig: CacheStorageConfig; | ||
hashFileFolder: string; | ||
clearOutputFolder: boolean; | ||
hashGlobs: HashGlobs; | ||
internalCacheFolder: string; | ||
logFolder: string; | ||
logLevel: LogLevels; | ||
name: string; | ||
outputFolder: string; | ||
outputPerformanceLogs: boolean; | ||
mode: BackfillModes; | ||
outputFolder: string | string[]; | ||
packageRoot: string; | ||
performanceReportName?: string; | ||
clearOutputFolder: boolean; | ||
logLevel: LogLevels; | ||
watchGlobs: WatchGlobs; | ||
producePerformanceLogs: boolean; | ||
}; | ||
export declare function outputFolderAsArray(outputFolder: string | string[]): string[]; | ||
export declare function isCorrectMode(mode: string): mode is BackfillModes; | ||
export declare function getName(packageRoot: string): any; | ||
export declare function getSearchPaths(): string[]; | ||
export declare function createDefaultConfig(): Config; | ||
export declare function createConfig(): Config; | ||
export declare function getSearchPaths(fromPath?: string): string[]; | ||
export declare function createDefaultConfig(fromPath?: string): Config; | ||
export declare function createConfig(fromPath?: string): Config; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -12,2 +12,19 @@ "use strict"; | ||
__export(require("./envConfig")); | ||
exports.modesObject = { | ||
READ_ONLY: "", | ||
WRITE_ONLY: "", | ||
READ_WRITE: "", | ||
PASS: "" | ||
}; | ||
function outputFolderAsArray(outputFolder) { | ||
const outputFolders = Array.isArray(outputFolder) | ||
? outputFolder | ||
: [outputFolder]; | ||
return outputFolders; | ||
} | ||
exports.outputFolderAsArray = outputFolderAsArray; | ||
function isCorrectMode(mode) { | ||
return exports.modesObject.hasOwnProperty(mode); | ||
} | ||
exports.isCorrectMode = isCorrectMode; | ||
function getName(packageRoot) { | ||
@@ -18,5 +35,5 @@ return (require(path.join(packageRoot, "package.json")).name || | ||
exports.getName = getName; | ||
function getSearchPaths() { | ||
function getSearchPaths(fromPath = process.cwd()) { | ||
const searchPaths = []; | ||
let nextPath = process.cwd(); | ||
let nextPath = fromPath; | ||
while (nextPath) { | ||
@@ -35,36 +52,37 @@ const configLocation = findUp.sync("backfill.config.js", { cwd: nextPath }); | ||
exports.getSearchPaths = getSearchPaths; | ||
function createDefaultConfig() { | ||
const packageRoot = pkgDir.sync(process.cwd()) || process.cwd(); | ||
function createDefaultConfig(fromPath = process.cwd()) { | ||
const packageRoot = pkgDir.sync(fromPath) || fromPath; | ||
const defaultCacheFolder = path.join("node_modules", ".cache", "backfill"); | ||
const outputFolder = "lib"; | ||
return { | ||
packageRoot, | ||
name: getName(packageRoot), | ||
cacheStorageConfig: { | ||
provider: "local" | ||
}, | ||
hashFileFolder: defaultCacheFolder, | ||
clearOutputFolder: false, | ||
hashGlobs: [ | ||
"**/*", | ||
"!**/node_modules/**", | ||
`!${outputFolder}/**`, | ||
"!**/tsconfig.tsbuildinfo" | ||
], | ||
internalCacheFolder: defaultCacheFolder, | ||
logFolder: defaultCacheFolder, | ||
outputFolder: "lib", | ||
outputPerformanceLogs: false, | ||
clearOutputFolder: true, | ||
logLevel: "info", | ||
get watchGlobs() { | ||
return { | ||
folders: { | ||
exclude: [this.outputFolder, "node_modules"], | ||
include: ["*"] | ||
}, | ||
files: { | ||
include: ["*"] | ||
} | ||
}; | ||
} | ||
name: getName(packageRoot), | ||
mode: "READ_WRITE", | ||
outputFolder, | ||
packageRoot, | ||
producePerformanceLogs: false | ||
}; | ||
} | ||
exports.createDefaultConfig = createDefaultConfig; | ||
function createConfig() { | ||
const defaultConfig = createDefaultConfig(); | ||
const fileBasedConfig = getSearchPaths().reduce((acc, configPath) => { | ||
function createConfig(fromPath = process.cwd()) { | ||
const defaultConfig = createDefaultConfig(fromPath); | ||
const fileBasedConfig = getSearchPaths(fromPath).reduce((acc, configPath) => { | ||
const config = require(configPath); | ||
if (config["mode"]) { | ||
if (!isCorrectMode(config["mode"])) { | ||
throw `Backfill config option "mode" was set, but with the wrong value: "${config["mode"]}".`; | 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UUFBUSxDQUFDLENBQUM7SUFDcEQsTUFBTSxlQUFlLEdBQUcsY0FBYyxDQUFDLFFBQVEsQ0FBQyxDQUFDLE1BQU0sQ0FBQyxDQUFDLEdBQUcsRUFBRSxVQUFVLEVBQUUsRUFBRTtRQUMxRSxNQUFNLE1BQU0sR0FBRyxPQUFPLENBQUMsVUFBVSxDQUFDLENBQUM7UUFFbkMsSUFBSSxNQUFNLENBQUMsTUFBTSxDQUFDLEVBQUU7WUFDbEIsSUFBSSxDQUFDLGFBQWEsQ0FBQyxNQUFNLENBQUMsTUFBTSxDQUFDLENBQUMsRUFBRTtnQkFDbEMsTUFBTSxxRUFBcUUsTUFBTSxDQUFDLE1BQU0sQ0FBQyxJQUFJLENBQUM7YUFDL0Y7U0FDRjtRQUVELE9BQU87WUFDTCxHQUFHLEdBQUc7WUFDTixHQUFHLE1BQU07U0FDVixDQUFDO0lBQ0osQ0FBQyxFQUFFLEVBQUUsQ0FBQyxDQUFDO0lBRVAsTUFBTSxjQUFjLEdBQUcsd0JBQVksRUFBRSxDQUFDO0lBRXRDLE9BQU87UUFDTCxHQUFHLGFBQWE7UUFDaEIsR0FBRyxlQUFlO1FBQ2xCLEdBQUcsY0FBYztLQUNsQixDQUFDO0FBQ0osQ0FBQztBQXhCRCxvQ0F3QkMifQ== |
@@ -10,27 +10,26 @@ { | ||
}, | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"main": "lib/index.js", | ||
"scripts": { | ||
"build": "yarn compile", | ||
"compile": "tsc", | ||
"compile": "tsc -b", | ||
"prepare": "yarn compile", | ||
"test": "jest", | ||
"watch": "tsc -w" | ||
"watch": "tsc -b -w" | ||
}, | ||
"dependencies": { | ||
"backfill-logger": "^2.0.2", | ||
"backfill-logger": "^2.0.3", | ||
"find-up": "^4.0.0", | ||
"fs-extra": "^7.0.1", | ||
"just-task-logger": "^0.3.0", | ||
"fs-extra": "^8.1.0", | ||
"pkg-dir": "^4.2.0" | ||
}, | ||
"devDependencies": { | ||
"@types/fs-extra": "^7.0.0", | ||
"backfill-utils-test": "^2.0.2", | ||
"backfill-utils-tsconfig": "^2.0.2", | ||
"@types/fs-extra": "^8.0.0", | ||
"backfill-utils-test": "^2.0.3", | ||
"backfill-utils-tsconfig": "^2.0.3", | ||
"jest": "^24.0.12", | ||
"ts-jest": "^24.0.2", | ||
"typescript": "3.5.3" | ||
"typescript": "3.6.4" | ||
}, | ||
"gitHead": "b53edf4df12efaadb24bf4b6d50b55ad29223a63" | ||
"gitHead": "ab03bda7c47d6c765ab891402e5fdb9a3abf34f5" | ||
} |
@@ -41,10 +41,10 @@ import * as path from "path"; | ||
it("sets the performance logging flag through ENV variable", async () => { | ||
process.env["BACKFILL_OUTPUT_PERFORMANCE_LOGS"] = "true"; | ||
process.env["BACKFILL_PRODUCE_PERFORMANCE_LOGS"] = "true"; | ||
const config = getEnvConfig(); | ||
expect(config).toStrictEqual({ outputPerformanceLogs: true }); | ||
expect(config).toStrictEqual({ producePerformanceLogs: true }); | ||
}); | ||
it("sets local cache folder through ENV variable", async () => { | ||
process.env["BACKFILL_LOCAL_CACHE_FOLDER"] = "bar"; | ||
process.env["BACKFILL_INTERNAL_CACHE_FOLDER"] = "bar"; | ||
@@ -135,3 +135,3 @@ const config = getEnvConfig(); | ||
it("returns ENV override value when ENV override is provided", async () => { | ||
process.env["BACKFILL_LOCAL_CACHE_FOLDER"] = "bar"; | ||
process.env["BACKFILL_INTERNAL_CACHE_FOLDER"] = "bar"; | ||
@@ -138,0 +138,0 @@ await setupFixture("config"); |
@@ -5,10 +5,14 @@ import { | ||
} from "./cacheConfig"; | ||
import { CacheStorageConfig } from "./index"; | ||
import { LogLevels, isCorrectLogLevel } from "backfill-logger"; | ||
import { CacheStorageConfig, BackfillModes, isCorrectMode } from "./index"; | ||
export type ConfigEnv = { | ||
cacheStorageConfig?: CacheStorageConfig; | ||
outputPerformanceLogs?: boolean; | ||
internalCacheFolder?: string; | ||
logFolder?: string; | ||
logLevel?: LogLevels; | ||
mode?: BackfillModes; | ||
performanceReportName?: string; | ||
producePerformanceLogs?: boolean; | ||
}; | ||
@@ -19,17 +23,2 @@ | ||
const logFolder = process.env["BACKFILL_LOG_FOLDER"]; | ||
if (logFolder) { | ||
config["logFolder"] = logFolder; | ||
} | ||
const outputPerformanceLogs = process.env["BACKFILL_OUTPUT_PERFORMANCE_LOGS"]; | ||
if (outputPerformanceLogs) { | ||
config["outputPerformanceLogs"] = Boolean(outputPerformanceLogs === "true"); | ||
} | ||
const internalCacheFolder = process.env["BACKFILL_LOCAL_CACHE_FOLDER"]; | ||
if (internalCacheFolder) { | ||
config["internalCacheFolder"] = internalCacheFolder; | ||
} | ||
const cacheProvider = process.env["BACKFILL_CACHE_PROVIDER"]; | ||
@@ -51,2 +40,30 @@ const serializedCacheProviderOptions = | ||
const internalCacheFolder = process.env["BACKFILL_INTERNAL_CACHE_FOLDER"]; | ||
if (internalCacheFolder) { | ||
config["internalCacheFolder"] = internalCacheFolder; | ||
} | ||
const logFolder = process.env["BACKFILL_LOG_FOLDER"]; | ||
if (logFolder) { | ||
config["logFolder"] = logFolder; | ||
} | ||
const mode = process.env["BACKFILL_MODE"]; | ||
if (mode) { | ||
if (isCorrectMode(mode)) { | ||
config["mode"] = mode; | ||
} else { | ||
throw `Backfill config option "BACKFILL_MODE" was set, but with the wrong value: "${mode}".`; | ||
} | ||
} | ||
const logLevel = process.env["BACKFILL_LOG_LEVEL"]; | ||
if (logLevel) { | ||
if (isCorrectLogLevel(logLevel)) { | ||
config["logLevel"] = logLevel; | ||
} else { | ||
throw `Backfill config option "BACKFILL_LOG_LEVEL" was set, but with the wrong value: "${logLevel}".`; | ||
} | ||
} | ||
const performanceReportName = process.env["BACKFILL_PERFORMANCE_REPORT_NAME"]; | ||
@@ -57,3 +74,11 @@ if (performanceReportName) { | ||
const producePerformanceLogs = | ||
process.env["BACKFILL_PRODUCE_PERFORMANCE_LOGS"]; | ||
if (producePerformanceLogs) { | ||
config["producePerformanceLogs"] = Boolean( | ||
producePerformanceLogs === "true" | ||
); | ||
} | ||
return config; | ||
} |
@@ -13,28 +13,40 @@ import * as path from "path"; | ||
export type WatchGlobs = { | ||
folders: { | ||
include: string[]; | ||
exclude: string[]; | ||
}; | ||
files: { | ||
include: string[]; | ||
exclude?: string[]; | ||
}; | ||
export type HashGlobs = string[]; | ||
export const modesObject = { | ||
READ_ONLY: "", | ||
WRITE_ONLY: "", | ||
READ_WRITE: "", | ||
PASS: "" | ||
}; | ||
export type BackfillModes = keyof typeof modesObject; | ||
export type Config = { | ||
cacheStorageConfig: CacheStorageConfig; | ||
hashFileFolder: string; | ||
clearOutputFolder: boolean; | ||
hashGlobs: HashGlobs; | ||
internalCacheFolder: string; | ||
logFolder: string; | ||
logLevel: LogLevels; | ||
name: string; | ||
outputFolder: string; | ||
outputPerformanceLogs: boolean; | ||
mode: BackfillModes; | ||
outputFolder: string | string[]; | ||
packageRoot: string; | ||
performanceReportName?: string; | ||
clearOutputFolder: boolean; | ||
logLevel: LogLevels; | ||
watchGlobs: WatchGlobs; | ||
producePerformanceLogs: boolean; | ||
}; | ||
export function outputFolderAsArray(outputFolder: string | string[]): string[] { | ||
const outputFolders = Array.isArray(outputFolder) | ||
? outputFolder | ||
: [outputFolder]; | ||
return outputFolders; | ||
} | ||
export function isCorrectMode(mode: string): mode is BackfillModes { | ||
return modesObject.hasOwnProperty(mode); | ||
} | ||
export function getName(packageRoot: string) { | ||
@@ -47,6 +59,6 @@ return ( | ||
export function getSearchPaths() { | ||
export function getSearchPaths(fromPath: string = process.cwd()) { | ||
const searchPaths = []; | ||
let nextPath: string | undefined = process.cwd(); | ||
let nextPath: string | undefined = fromPath; | ||
while (nextPath) { | ||
@@ -66,39 +78,40 @@ const configLocation = findUp.sync("backfill.config.js", { cwd: nextPath }); | ||
export function createDefaultConfig(): Config { | ||
const packageRoot = pkgDir.sync(process.cwd()) || process.cwd(); | ||
export function createDefaultConfig(fromPath: string = process.cwd()): Config { | ||
const packageRoot = pkgDir.sync(fromPath) || fromPath; | ||
const defaultCacheFolder = path.join("node_modules", ".cache", "backfill"); | ||
const outputFolder = "lib"; | ||
return { | ||
packageRoot, | ||
name: getName(packageRoot), | ||
cacheStorageConfig: { | ||
provider: "local" | ||
}, | ||
hashFileFolder: defaultCacheFolder, | ||
clearOutputFolder: false, | ||
hashGlobs: [ | ||
"**/*", | ||
"!**/node_modules/**", | ||
`!${outputFolder}/**`, | ||
"!**/tsconfig.tsbuildinfo" | ||
], | ||
internalCacheFolder: defaultCacheFolder, | ||
logFolder: defaultCacheFolder, | ||
outputFolder: "lib", | ||
outputPerformanceLogs: false, | ||
clearOutputFolder: true, | ||
logLevel: "info", | ||
get watchGlobs(): WatchGlobs { | ||
return { | ||
folders: { | ||
exclude: [this.outputFolder, "node_modules"], | ||
include: ["*"] | ||
}, | ||
files: { | ||
include: ["*"] | ||
} | ||
}; | ||
} | ||
name: getName(packageRoot), | ||
mode: "READ_WRITE", | ||
outputFolder, | ||
packageRoot, | ||
producePerformanceLogs: false | ||
}; | ||
} | ||
export function createConfig(): Config { | ||
const defaultConfig = createDefaultConfig(); | ||
const fileBasedConfig = getSearchPaths().reduce((acc, configPath) => { | ||
export function createConfig(fromPath: string = process.cwd()): Config { | ||
const defaultConfig = createDefaultConfig(fromPath); | ||
const fileBasedConfig = getSearchPaths(fromPath).reduce((acc, configPath) => { | ||
const config = require(configPath); | ||
if (config["mode"]) { | ||
if (!isCorrectMode(config["mode"])) { | ||
throw `Backfill config option "mode" was set, but with the wrong value: "${config["mode"]}".`; | ||
} | ||
} | ||
return { | ||
@@ -105,0 +118,0 @@ ...acc, |
{ | ||
"extends": "backfill-utils-tsconfig/tsconfig.default.json", | ||
"include": ["src/**/*"], | ||
"compilerOptions": { | ||
"rootDir": "src", | ||
"outDir": "lib" | ||
} | ||
"include": ["src"], | ||
"compilerOptions": { "rootDir": "src", "outDir": "lib" }, | ||
"references": [{ "path": "../logger" }, { "path": "../utils-test" }] | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 4 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
168755
4
22
710
23
- Removedjust-task-logger@^0.3.0
- Removedansi-regex@2.1.13.0.1(transitive)
- Removedcamelcase@5.3.1(transitive)
- Removedcliui@4.1.0(transitive)
- Removedcode-point-at@1.1.0(transitive)
- Removedcross-spawn@6.0.6(transitive)
- Removeddecamelize@1.2.0(transitive)
- Removedend-of-stream@1.4.4(transitive)
- Removedexeca@1.0.0(transitive)
- Removedfind-up@3.0.0(transitive)
- Removedfs-extra@7.0.1(transitive)
- Removedget-caller-file@1.0.3(transitive)
- Removedget-stream@4.1.0(transitive)
- Removedinvert-kv@2.0.0(transitive)
- Removedis-fullwidth-code-point@1.0.02.0.0(transitive)
- Removedis-stream@1.1.0(transitive)
- Removedisexe@2.0.0(transitive)
- Removedjust-task-logger@0.3.4(transitive)
- Removedlcid@2.0.0(transitive)
- Removedlocate-path@3.0.0(transitive)
- Removedmap-age-cleaner@0.1.3(transitive)
- Removedmem@4.3.0(transitive)
- Removedmimic-fn@2.1.0(transitive)
- Removednice-try@1.0.5(transitive)
- Removednpm-run-path@2.0.2(transitive)
- Removednumber-is-nan@1.0.1(transitive)
- Removedonce@1.4.0(transitive)
- Removedos-locale@3.1.0(transitive)
- Removedp-defer@1.0.0(transitive)
- Removedp-finally@1.0.0(transitive)
- Removedp-is-promise@2.1.0(transitive)
- Removedp-locate@3.0.0(transitive)
- Removedpath-exists@3.0.0(transitive)
- Removedpath-key@2.0.1(transitive)
- Removedpump@3.0.2(transitive)
- Removedrequire-directory@2.1.1(transitive)
- Removedrequire-main-filename@1.0.1(transitive)
- Removedsemver@5.7.2(transitive)
- Removedset-blocking@2.0.0(transitive)
- Removedshebang-command@1.2.0(transitive)
- Removedshebang-regex@1.0.0(transitive)
- Removedsignal-exit@3.0.7(transitive)
- Removedstring-width@1.0.22.1.1(transitive)
- Removedstrip-ansi@3.0.14.0.0(transitive)
- Removedstrip-eof@1.0.0(transitive)
- Removedwhich@1.3.1(transitive)
- Removedwhich-module@2.0.1(transitive)
- Removedwrap-ansi@2.1.0(transitive)
- Removedwrappy@1.0.2(transitive)
- Removedy18n@4.0.3(transitive)
- Removedyargs@12.0.5(transitive)
- Removedyargs-parser@11.1.1(transitive)
Updatedbackfill-logger@^2.0.3
Updatedfs-extra@^8.1.0