@useoptic/cli-config
Advanced tools
Comparing version 8.4.0 to 8.4.1-beta
@@ -16,4 +16,5 @@ import { parseRule, parseIgnore, IIgnoreRunnable } from './helpers/ignore-parser'; | ||
command?: string; | ||
baseUrl: string; | ||
baseUrl?: string; | ||
proxy?: string; | ||
useTask?: string; | ||
targetUrl?: string; | ||
@@ -55,2 +56,4 @@ } | ||
} | ||
export declare class RunsWithTaskNotFoundError extends Error { | ||
} | ||
export interface IOpticCaptureConfig { | ||
@@ -95,2 +98,5 @@ persistenceEngine: 'fs' | 's3'; | ||
} | ||
export declare function isTestTask(aliasedTask: IOpticTaskAliased): boolean; | ||
export declare function isRecommendedTask(aliasedTask: IOpticTaskAliased): boolean; | ||
export declare function isManualTask(aliasedTask: IOpticTaskAliased): boolean; | ||
export declare function TaskToStartConfig(aliasedTask: IOpticTaskAliased): Promise<IOpticTaskRunnerConfig>; | ||
@@ -103,2 +109,3 @@ export interface IPathMapping { | ||
gitignorePath: string; | ||
opticIgnorePath: string; | ||
capturesPath: string; | ||
@@ -119,3 +126,8 @@ exampleRequestsPath: string; | ||
} | ||
export declare enum Modes { | ||
Recommended = "Recommended", | ||
Manual = "Manual", | ||
Test = "Test" | ||
} | ||
export { parseIgnore, parseRule, IIgnoreRunnable }; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -25,3 +25,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.parseRule = exports.parseIgnore = exports.createFileTree = exports.getPathsRelativeToCwd = exports.pathsFromCwd = exports.getPathsRelativeToConfig = exports.TaskToStartConfig = exports.TaskNotFoundError = exports.TargetPortUnavailableError = exports.CommandExecutionFailure = exports.OpticConfigurationLocationFailure = exports.InvalidOpticConfigurationSyntaxError = exports.readTestingConfig = exports.readApiConfig = void 0; | ||
exports.parseRule = exports.parseIgnore = exports.Modes = exports.createFileTree = exports.getPathsRelativeToCwd = exports.pathsFromCwd = exports.getPathsRelativeToConfig = exports.TaskToStartConfig = exports.isManualTask = exports.isRecommendedTask = exports.isTestTask = exports.RunsWithTaskNotFoundError = exports.TaskNotFoundError = exports.TargetPortUnavailableError = exports.CommandExecutionFailure = exports.OpticConfigurationLocationFailure = exports.InvalidOpticConfigurationSyntaxError = exports.readTestingConfig = exports.readApiConfig = void 0; | ||
const fs_extra_1 = __importDefault(require("fs-extra")); | ||
@@ -37,2 +37,3 @@ const path_1 = __importDefault(require("path")); | ||
const deprecations_1 = __importStar(require("./deprecations")); | ||
const default_ignore_rules_1 = require("./helpers/default-ignore-rules"); | ||
var deprecations_2 = require("./deprecations"); | ||
@@ -73,2 +74,5 @@ Object.defineProperty(exports, "deprecationLogger", { enumerable: true, get: function () { return deprecations_2.deprecationLogger; } }); | ||
exports.TaskNotFoundError = TaskNotFoundError; | ||
class RunsWithTaskNotFoundError extends Error { | ||
} | ||
exports.RunsWithTaskNotFoundError = RunsWithTaskNotFoundError; | ||
function randomLowerBound() { | ||
@@ -79,2 +83,14 @@ const max = 3500; | ||
} | ||
function isTestTask(aliasedTask) { | ||
return Boolean(aliasedTask.useTask && aliasedTask.command); | ||
} | ||
exports.isTestTask = isTestTask; | ||
function isRecommendedTask(aliasedTask) { | ||
return Boolean(aliasedTask.command && (aliasedTask.inboundUrl || aliasedTask.baseUrl)); | ||
} | ||
exports.isRecommendedTask = isRecommendedTask; | ||
function isManualTask(aliasedTask) { | ||
return Boolean((aliasedTask.inboundUrl || aliasedTask.baseUrl) && aliasedTask.targetUrl); | ||
} | ||
exports.isManualTask = isManualTask; | ||
async function TaskToStartConfig(aliasedTask) { | ||
@@ -121,4 +137,7 @@ const task = normalizeTask(aliasedTask); | ||
const baseUrl = aliased.baseUrl || aliased.inboundUrl; | ||
if (!baseUrl) | ||
if (!baseUrl && !aliased.useTask) | ||
throw new Error('Task definition must have baseUrl (aliases: inboundUrl)'); | ||
if (aliased.useTask && (baseUrl || aliased.targetUrl)) { | ||
throw new Error('Task definitions with useTask should not include an inboundUrl or targetUrl '); | ||
} | ||
return Object.assign(Object.assign({}, aliased), { baseUrl }); | ||
@@ -140,2 +159,3 @@ } | ||
const gitignorePath = path_1.default.join(basePath, '.gitignore'); | ||
const opticIgnorePath = path_1.default.join(basePath, 'ignore'); | ||
const specStorePath = path_1.default.join(basePath, 'api', 'specification.json'); | ||
@@ -150,2 +170,3 @@ const exampleRequestsPath = path_1.default.join(basePath, 'api', 'example-requests'); | ||
gitignorePath, | ||
opticIgnorePath, | ||
specStorePath, | ||
@@ -166,3 +187,3 @@ exampleRequestsPath, | ||
async function createFileTree(config, basePath) { | ||
const { specStorePath, configPath, gitignorePath, capturesPath, } = await getPathsRelativeToCwd(basePath); | ||
const { specStorePath, configPath, gitignorePath, opticIgnorePath, capturesPath, } = await getPathsRelativeToCwd(basePath); | ||
const files = [ | ||
@@ -176,2 +197,6 @@ { | ||
{ | ||
path: opticIgnorePath, | ||
contents: default_ignore_rules_1.defaultIgnoreFile, | ||
}, | ||
{ | ||
path: specStorePath, | ||
@@ -199,1 +224,7 @@ contents: JSON.stringify([]), | ||
exports.createFileTree = createFileTree; | ||
var Modes; | ||
(function (Modes) { | ||
Modes["Recommended"] = "Recommended"; | ||
Modes["Manual"] = "Manual"; | ||
Modes["Test"] = "Test"; | ||
})(Modes = exports.Modes || (exports.Modes = {})); |
{ | ||
"name": "@useoptic/cli-config", | ||
"version": "8.4.0", | ||
"version": "8.4.1-beta", | ||
"scripts": { | ||
"ws:test": "echo config", | ||
"ws:test": "jest", | ||
"ws:build": "yarn run tsc -b --verbose", | ||
@@ -25,3 +25,6 @@ "ws:clean": "rm -rf build/*" | ||
"@types/find-up": "^4.0.0", | ||
"@types/js-yaml": "^3.12.1" | ||
"@types/js-yaml": "^3.12.1", | ||
"@types/jest": "^26.0.9", | ||
"jest": "^26.4.0", | ||
"ts-jest": "^26.2.0" | ||
}, | ||
@@ -28,0 +31,0 @@ "files": [ |
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
26161
16
561
5
2
2