How to use the gluegun/filesystem.filesystem.remove 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 aws-amplify / amplify-cli / packages / awsmobile-cli / src / extensions / awsmobile-helpers / update-awsmobile-meta.js View on Github external
const awsmobileMetaFilePath = pathManager.getCurentBackendCloudAwsmobileMetaFilePath();
  const awsmobileMeta = JSON.parse(fs.readFileSync(awsmobileMetaFilePath));

  const resourceDir = path.normalize(path.join(
    pathManager.getCurrentCloudBackendDirPath(),
    category,
    resourceName,
  ));

  if (awsmobileMeta[category][resourceName] !== undefined) {
    delete awsmobileMeta[category][resourceName];
  }

  const jsonString = JSON.stringify(awsmobileMeta, null, '\t');
  fs.writeFileSync(awsmobileMetaFilePath, jsonString, 'utf8');
  filesystem.remove(resourceDir);
}
github aws-amplify / amplify-cli / packages / amplify-cli / src / extensions / amplify-helpers / update-amplify-meta.js View on Github external
for (let i = 0; i < resources.length; i += 1) {
    const sourceDir = path.normalize(path.join(
      pathManager.getBackendDirPath(),
      resources[i].category,
      resources[i].resourceName,
    ));

    const targetDir = path.normalize(path.join(
      pathManager.getCurrentCloudBackendDirPath(),
      resources[i].category,
      resources[i].resourceName,
    ));

    if (fs.pathExistsSync(targetDir)) {
      filesystem.remove(targetDir);
    }

    fs.ensureDirSync(targetDir);

    fs.copySync(sourceDir, targetDir);
  }

  fs.copySync(amplifyMetaFilePath, amplifyCloudMetaFilePath, { overwrite: true });
  fs.copySync(backendConfigFilePath, backendConfigCloudFilePath, { overwrite: true });
}
github aws-amplify / amplify-cli / packages / amplify-cli / src / extensions / amplify-helpers / update-amplify-meta.js View on Github external
const amplifyMetaFilePath = pathManager.getCurentAmplifyMetaFilePath();
  const amplifyMeta = JSON.parse(fs.readFileSync(amplifyMetaFilePath));

  const resourceDir = path.normalize(path.join(
    pathManager.getCurrentCloudBackendDirPath(),
    category,
    resourceName,
  ));

  if (amplifyMeta[category] && amplifyMeta[category][resourceName] !== undefined) {
    delete amplifyMeta[category][resourceName];
  }

  const jsonString = JSON.stringify(amplifyMeta, null, '\t');
  fs.writeFileSync(amplifyMetaFilePath, jsonString, 'utf8');
  filesystem.remove(resourceDir);
}