Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports = async (context, opts) => {
const {cwd, env} = context;
const {config, filepath} = (await cosmiconfig(CONFIG_NAME, {searchPlaces: CONFIG_FILES}).search(cwd)) || {};
debug('load config from: %s', filepath);
// Merge config file options and CLI/API options
let options = {...config, ...opts};
if (options.ci === false) {
options.noCi = true;
}
const pluginsPath = {};
let extendPaths;
({extends: extendPaths, ...options} = options);
if (extendPaths) {
// If `extends` is defined, load and merge each shareable config with `options`
options = {
...castArray(extendPaths).reduce((result, extendPath) => {
import { Command } from "@oclif/command";
const { cosmiconfig } = require("cosmiconfig");
const explorer = cosmiconfig("mycli");
var debug = require("debug")("mycli:base");
type ConfigType = {
name?: string;
};
const updateNotifier = require("update-notifier");
const pkg = require("../package.json");
export default abstract class Base extends Command {
static config: null | ConfigType;
async init() {
const notifier = updateNotifier({
pkg,
updateCheckInterval: 1000,
shouldNotifyInNpmScript: true
});
#!/usr/bin/env node
const { cosmiconfig } = require("cosmiconfig");
const meow = require("meow");
const generateResources = require("../src");
const explorer = cosmiconfig("terranext");
const cli = meow(
`
Usage
$ terranext
Options
--gateway-key, -g The API Gateway key of the project. Default is "Terranext"
--next-app-dir, -d The path that Terraform CLI has to follow to reach the nextjs project.
--provider The Cloud provider to use when exporting the configuration
--env A way for passing environment variables to the lambdas
Examples
$ terranext
$ terranext --gateway-key=CustomKey --next-app-dir=../../nextjs-project/
$ terranext --provider=AWS --next-app-dir=../../nextjs-project/
async function _load(configPath: string, transform: Transform): Promise> {
let loader = cosmiconfig("css-blocks", {
transform,
});
let result = await loader.load(configPath);
return result!.config as Partial;
}
async run(
argv: string[],
{
stdin = process.stdin,
stdout = process.stdout,
cwd = process.cwd(),
debug = false
}: {
stdin?: typeof process.stdin;
stdout?: typeof process.stdout;
cwd?: string;
debug?: boolean;
} = {}
) {
let rc: Maybe = null;
const result = await cosmiconfig(this.name, { loaders }).search();
if (result != null) {
rc = RC.decode(result.config).fold(
es => new RCError(es),
value => value as RC
);
}
const { command, args } = this.commands.get(argv);
const instance = render(
,
{
stdout,
constructor() {
this.configExplorer = cosmiconfig(this.cosmiconfigModuleName);
}
export async function search(searchDirectory?: string): Promise | null> {
let loader = cosmiconfig("css-blocks", {
transform: transformFinal,
searchPlaces: [
"package.json",
"css-blocks.config.json",
"css-blocks.config.js",
],
});
let result = await loader.search(searchDirectory);
return result && result.config as Partial;
}
async function retrieveConfiguration() {
const explorer = cosmiconfig("terranext");
try {
const result = await explorer.search();
return result.config;
} catch (error) {
return undefined;
}
}