How to use the gluegun.filesystem.exists function in gluegun

To help you get started, we’ve selected a few gluegun examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SplitmediaLabsLimited / devctl / src / commands / compile.js View on Github external
// compile the final docker-compose
      finalDockerCompose = {
        ...finalDockerCompose,
        ...compose,
      };

      if (!dotenv) {
        return;
      }

      const dotenvPath = filesystem.resolve(path, '.env');

      let finalDotEnv = {};

      const exists = await filesystem.exists(dotenvPath);

      if (exists) {
        const raw = await filesystem.read(dotenvPath);
        finalDotEnv = parseEnv(raw);
      }

      finalDotEnv = {
        ...finalDotEnv,
        ...dotenv,
      };

      await filesystem.write(dotenvPath, stringifyToEnv(finalDotEnv));
    });
github pixeloven / pixeloven / packages / pixeloven / cli / src / toolbox / get-config-path.ts View on Github external
function getConfigPath(fileName: string, strict: boolean = false) {
    const configPath = filesystem.path(fileName);
    if (filesystem.exists(configPath)) {
        print.info(`Configuration file found ${configPath}`);
        return configPath;
    }
    if (strict) {
        throw new FileNotFoundException(`File not found ${configPath}`);
    } else {
        print.warning(
            `Unable to find "${fileName}" reverting to default configuration`,
        );
    }
    return false;
}
github SplitmediaLabsLimited / devctl / src / utils / dockerCompose.js View on Github external
async function getLastComposeFile() {
  const exists = await filesystem.exists(lastDCPath);

  if (!exists) {
    return null;
  }

  return filesystem.read(lastDCPath);
}