@app-config/exec
Advanced tools
Comparing version 3.0.0-alpha.3 to 3.0.0-alpha.4
import { parseRawString, guessFileType, AppConfigError } from '@app-config/core'; | ||
import { forKey, validateOptions } from '@app-config/extension-utils'; | ||
import { named, forKey, validateOptions } from '@app-config/extension-utils'; | ||
import { resolveFilepath } from '@app-config/node'; | ||
@@ -14,7 +14,7 @@ import { exec } from 'child_process'; | ||
function execParsingExtension() { | ||
return forKey('$exec', validateOptions((SchemaBuilder) => SchemaBuilder.oneOf(SchemaBuilder.stringSchema(), SchemaBuilder.emptySchema() | ||
return named('$exec', forKey('$exec', validateOptions((SchemaBuilder) => SchemaBuilder.oneOf(SchemaBuilder.stringSchema(), SchemaBuilder.emptySchema() | ||
.addString('command') | ||
.addBoolean('failOnStderr', {}, false) | ||
.addBoolean('parseOutput', {}, false) | ||
.addBoolean('trimWhitespace', {}, false)), (value) => async (parse, _, context) => { | ||
.addBoolean('trimWhitespace', {}, false)), (value) => async (parse, _, source) => { | ||
let options; | ||
@@ -29,3 +29,3 @@ if (typeof value === 'string') { | ||
try { | ||
const dir = resolveFilepath(context, '.'); | ||
const dir = resolveFilepath(source, '.'); | ||
const { stdout, stderr } = await execAsync(command, { cwd: dir }); | ||
@@ -54,3 +54,3 @@ if (failOnStderr && stderr) { | ||
} | ||
})); | ||
}))); | ||
} | ||
@@ -57,0 +57,0 @@ /** |
@@ -16,7 +16,7 @@ "use strict"; | ||
function execParsingExtension() { | ||
return extension_utils_1.forKey('$exec', extension_utils_1.validateOptions((SchemaBuilder) => SchemaBuilder.oneOf(SchemaBuilder.stringSchema(), SchemaBuilder.emptySchema() | ||
return extension_utils_1.named('$exec', extension_utils_1.forKey('$exec', extension_utils_1.validateOptions((SchemaBuilder) => SchemaBuilder.oneOf(SchemaBuilder.stringSchema(), SchemaBuilder.emptySchema() | ||
.addString('command') | ||
.addBoolean('failOnStderr', {}, false) | ||
.addBoolean('parseOutput', {}, false) | ||
.addBoolean('trimWhitespace', {}, false)), (value) => async (parse, _, context) => { | ||
.addBoolean('trimWhitespace', {}, false)), (value) => async (parse, _, source) => { | ||
let options; | ||
@@ -31,3 +31,3 @@ if (typeof value === 'string') { | ||
try { | ||
const dir = node_1.resolveFilepath(context, '.'); | ||
const dir = node_1.resolveFilepath(source, '.'); | ||
const { stdout, stderr } = await execAsync(command, { cwd: dir }); | ||
@@ -56,3 +56,3 @@ if (failOnStderr && stderr) { | ||
} | ||
})); | ||
}))); | ||
} | ||
@@ -59,0 +59,0 @@ /** |
{ | ||
"name": "@app-config/exec", | ||
"description": "Generate config by running arbitrary programs", | ||
"version": "3.0.0-alpha.3", | ||
"version": "3.0.0-alpha.4", | ||
"license": "MPL-2.0", | ||
@@ -33,9 +33,9 @@ "author": { | ||
"dependencies": { | ||
"@app-config/core": "^3.0.0-alpha.3", | ||
"@app-config/extension-utils": "^3.0.0-alpha.3", | ||
"@app-config/node": "^3.0.0-alpha.3", | ||
"@app-config/utils": "^3.0.0-alpha.3" | ||
"@app-config/core": "^3.0.0-alpha.4", | ||
"@app-config/extension-utils": "^3.0.0-alpha.4", | ||
"@app-config/node": "^3.0.0-alpha.4", | ||
"@app-config/utils": "^3.0.0-alpha.4" | ||
}, | ||
"devDependencies": { | ||
"@app-config/main": "^3.0.0-alpha.3" | ||
"@app-config/main": "^3.0.0-alpha.4" | ||
}, | ||
@@ -42,0 +42,0 @@ "prettier": "@lcdev/prettier", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
12963