How to use trash - 10 common examples

To help you get started, we’ve selected a few trash 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 doczjs / docz / packages / playgrood / src / utils / bundle.ts View on Github external
export const createBundle = async (html: string, main: string) => {
  await trash(DIST_PATH)
  await trash(THEME_PATH)
  await tempFile(INDEX_JS, main)
  await tempFile(INDEX_HTML, html)

  const bundler = new Bundler(INDEX_HTML, {
    cacheDir: CACHE_PATH,
    outDir: DIST_PATH,
    publicURL: '/',
    outFile: 'index',
  })

  try {
    return await bundler.bundle()
  } catch (err) {
    console.log(err)
    return null
  }
github doczjs / docz / packages / playgrood / src / utils / bundle.ts View on Github external
export const createBundle = async (html: string, main: string) => {
  await trash(DIST_PATH)
  await trash(THEME_PATH)
  await tempFile(INDEX_JS, main)
  await tempFile(INDEX_HTML, html)

  const bundler = new Bundler(INDEX_HTML, {
    cacheDir: CACHE_PATH,
    outDir: DIST_PATH,
    publicURL: '/',
    outFile: 'index',
  })

  try {
    return await bundler.bundle()
  } catch (err) {
    console.log(err)
    return null
github denali-js / core / lib / cli / destroy-blueprint.js View on Github external
let templateSrc = read(absolutepath);
    let compiled = template(templateSrc);
    let destFileIsNotDirty = read(destAbsolutepath) === compiled(data);

    if (destFileIsNotDirty) {
      console.log(`  ${ chalk.red('destroy') } ${ destRelativepath }`);
    } else {
      console.log(`  ${ chalk.blue('skipped') } ${ destRelativepath }`);
    }

    return destFileIsNotDirty;
  }).map(({ destAbsolutepath }) => {
    return destAbsolutepath;
  });

  trash(filesToDelete, () => {
    runWithCwd(options.dest, blueprint.postUninstall, data, options);
  });
}
github ArkEcosystem / desktop-wallet / src / main / plugin-manager.js View on Github external
ipcMain.on(prefix + 'install', async (_, { pluginId, pluginPath }) => {
    try {
      if (pluginPath) {
        await trash(pluginPath)
      }

      pluginPath = [pluginsPath, pluginId].join('/')
      await decompress(savePath, pluginPath, {
        map: file => {
          file.path = file.path.split('/').slice(1).join('/')
          return file
        }
      })

      await trash(savePath)

      sendToWindow(prefix + 'plugin-installed', pluginPath)
    } catch (error) {
      sendToWindow(prefix + 'error', error)
    }
github solvedDev / bridge. / src / renderer / components / sidebar / content / explorer / Toolbar.vue View on Github external
new ConfirmWindow(async () => {
                                let lw = new LoadingWindow();
                                await trash(CURRENT.PROJECT_PATH);
                                EventBus.trigger("bridge:findDefaultPack", true);
                                lw.close();
                            }, null, "Do you really want to delete this project?");
                        }
github storybookjs / storybook / scripts / reset.js View on Github external
.forEach(i => {
        const [, uri] = i.match(/Would remove (.*)$/) || [];

        if (uri) {
          if (
            uri.match(/node_modules/) ||
            uri.match(/dist/) ||
            uri.match(/\.cache/) ||
            uri.match(/dll/)
          ) {
            del(uri).then(() => {
              logger.log(`deleted ${uri}`);
            });
          } else {
            trash(uri)
              .then(() => {
                logger.log(`trashed ${uri}`);
              })
              .catch(e => {
                logger.log('failed to trash, will try permanent delete');
                trash(uri);
              });
          }
        }
      });
  }
github mjmlio / mjml-app / src / actions / projects.js View on Github external
return dispatch => {
    dispatch({ type: 'PROJECT_REMOVE', payload: p })
    dispatch(saveSettings())
    if (shouldDeleteFolder) {
      trash(p)
    }
  }
}
github solvedDev / bridge. / src / renderer / scripts / contextMenus / File.ts View on Github external
async () => {
                        await trash(file_path);
                        file.remove();
                    }, 
                    () => {},
github solvedDev / bridge. / src / renderer / components / sidebar / content / explorer / Toolbar.vue View on Github external
}, async (project_name) => {
                                //Make sure that the resource pack can be loaded
                                if(!CURRENT.RESOURCE_PACK)
                                    return new InformationWindow("No Resource Pack", "Please connect a resource pack before packaging the whole project.");

                                //Package whole project
                                let lw = new LoadingWindow();
                                await fs.mkdir(join(MOJANG_PATH, "bridge_proj_tmp"), { recursive: true });
                                await Promise.all([
                                    zip(CURRENT.PROJECT_PATH, join(MOJANG_PATH, "bridge_proj_tmp", `${CURRENT.PROJECT}.mcpack`)),
                                    zip(CURRENT.RP_PATH, join(MOJANG_PATH, "bridge_proj_tmp", `${CURRENT.RESOURCE_PACK}.mcpack`))
                                ]);
                                await zip(join(MOJANG_PATH, "bridge_proj_tmp"), join(MOJANG_PATH, `${project_name}.mcaddon`));
                                await trash(join(MOJANG_PATH, "bridge_proj_tmp"));
                                lw.close();

                                //Notify user the packaging is complete
                                const ready_push = new Notification({
                                    display_icon: "mdi-package-variant-closed",
                                    display_name: "Package ready!",
                                    color: "info",
                                    action: () => {
                                        ready_push.remove();
                                        remote.shell.showItemInFolder(join(MOJANG_PATH, `${project_name}.mcaddon`));
                                    }
                                }).send();
                            });
                        }
github storybookjs / storybook / scripts / reset.js View on Github external
.catch(e => {
                logger.log('failed to trash, will try permanent delete');
                trash(uri);
              });
          }

trash

Move files and folders to the trash

MIT
Latest version published 1 year ago

Package Health Score

56 / 100
Full package analysis

Popular trash functions