How to use the fs-extra.copy function in fs-extra

To help you get started, we’ve selected a few fs-extra 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 Tangerine-Community / Tangerine / server / src / modules / class / index.js View on Github external
return new Promise(async (resolve, reject) => {
        const {groupName, appConfig} = data
        clog("Setting homeUrl to dashboard and uploadUnlockedFormReponses to true.")
        appConfig.homeUrl =  "dashboard"
        appConfig.uploadUnlockedFormReponses =  true
        // copy the class forms
        try {
          await fs.copy('/tangerine/server/src/modules/class/', `/tangerine/client/content/groups/${groupName}`)
          clog("Copied class module forms.")
        } catch (err) {
          console.error(err)
        }
        resolve(data)
      })
    },
github jaredpalmer / tsdx / index.js View on Github external
async function moveTypes() {
  try {
    // Move the typescript types to the base of the ./dist folder
    await fs.copy(paths.appDist + '/src', paths.appDist, {
      overwrite: true,
    });
    await fs.remove(paths.appDist + '/src');
  } catch (e) {}
}
github taurusai / kungfu / app / src / main / base.js View on Github external
if(!existsSync(BASE_DB_DIR)) addFile('', BASE_DB_DIR, 'folder');

    //循环建立表
    Object.keys(initGlobalDB).forEach((dbName) => {
        const db = new sqlite3.Database(path.join(BASE_DB_DIR, `${dbName}.db`));
        const tables = initGlobalDB[dbName];
        db.serialize(() => {
            tables.forEach((table) => {
                db.run(table.sql)
            })
        })	
        db.close();
    })

    //commission.db
    fse.copy(path.join(__resources, 'default', 'commission.db'), path.join(BASE_DB_DIR, 'commission.db'), err => {
        if(err) logger.error(err);
    })

    // //holidays.db
    // fse.copy(path.join(__resources, 'default', 'holidays.db'), path.join(BASE_DB_DIR, 'holidays.db'), err => {
    //     if(err) logger.error(err);
    // })
}
github sghall / react-compound-slider / scripts / copy-files.js View on Github external
return new Promise(resolve => {
    fse.copy(src, buildPath, err => {
      if (err) {
        throw err
      }
      resolve()
    })
  }).then(() => console.log(`Copied ${src} to ${buildPath}`))
}
github 06wj / pokemon / tools / download.js View on Github external
});
    }

    const modelExist = await fs.pathExists(`${finalModelPath}model`);
    if (!modelExist) {
        console.log(`downloadStart:${name}`.info);
        await download(downloadUrl, finalModelPath, {
            filename:'model',
            extract:true
        });
        console.log(`downloadEnd:${name}`.info);

        let realPath = `${finalModelPath}Pokemon XY/${realName}/`;
        if(await fs.pathExists(realPath)){
            console.log(`copy...${name}`);
            await fs.copy(realPath, `${finalModelPath}model/`)
            await fs.remove(`${finalModelPath}Pokemon XY`);
        }

        realPath = `${finalModelPath}${realName}/`;
        if(await fs.pathExists(realPath)){
            console.log(`copy...${name}`);
            await fs.copy(realPath, `${finalModelPath}model/`)
            await fs.remove(realPath);
        }

        realPath = `${finalModelPath}${modelNum}. ${realName}/`;
        if(await fs.pathExists(realPath)){
            console.log(`copy...${name}`);
            await fs.copy(realPath, `${finalModelPath}model/`)
            await fs.remove(realPath);
        }
github blengerich / GenAMap / src / frontend / webapp.js View on Github external
dataList.marker.filetype = 'markerFile'
        dataList.marker.path = markerval_fullPath
        fs.copy(originmarkervaluefile, markerval_fullPath, function (err) {
            if (err) return console.error(err)
        })

        dataList.traitLabel.filetype = 'traitLabelFile'
        dataList.traitLabel.path = traitLabel_fullPath
        fs.copy(origintraitlabelfile, traitLabel_fullPath, function (err) {
            if (err) return console.error(err)
        })

        dataList.trait.filetype = 'traitFile'
        dataList.trait.path = traitval_fullPath
        fs.copy(origintraitvaluefile, traitval_fullPath, function (err) {
            if (err) return console.error(err)
        })

    }
github elexis-eu / lexonomy / website / ops.js View on Github external
makeDict: function (dictID, template, title, blurb, email, callnext) {
    if (!title) title = "?";
    if (!blurb) blurb = "Yet another Lexonomy dictionary.";
    if (prohibitedDictIDs.indexOf(dictID) > -1 || module.exports.dictExists(dictID)) {
      callnext(false);
    } else {
      fs.copy("dictTemplates/" + template + ".sqlite", path.join(siteconfig.dataDir, "dicts/" + dictID + ".sqlite"), function (err) {
        var users = {}; users[email] = { "canEdit": true, "canConfig": true, "canDownload": true, "canUpload": true };
        var dictDB = module.exports.getDB(dictID);
        dictDB.run("update configs set json=$json where id='users'", { $json: JSON.stringify(users, null, "\t") }, function (err) {
          if (err) console.log(err);
          var ident = { "title": title, "blurb": blurb };
          dictDB.run("update configs set json=$json where id='ident'", { $json: JSON.stringify(ident, null, "\t") }, function (err) {
            if (err) console.log(err);
            module.exports.attachDict(dictDB, dictID, function () {
              dictDB.close();
              callnext(true);
            });
          });
        });
      });
    }
  },
github channg / coir / src / utils.js View on Github external
function copyDir(src, dist, callback) {
  fse.copy()
}
github carbon-design-system / carbon / tasks / examples.js View on Github external
spawn.sync('yarn', ['install'], {
              stdio: 'ignore',
              cwd: example.filepath,
            });
            spawn.sync('yarn', ['build'], {
              stdio: 'ignore',
              cwd: example.filepath,
            });
          }

          if (await fs.pathExists(exampleBuildDir)) {
            await fs.copy(exampleBuildDir, exampleDir);
            return;
          }

          await fs.copy(example.filepath, exampleDir, {
            filter(src, dest) {
              const relativePath = path.relative(example.filepath, src);
              if (relativePath.includes('node_modules')) {
                return false;
              }
              if (relativePath[0] === '.') {
                return false;
              }
              return true;
            },
          });
          reporter.success(
            `Built example \`${example.name}\` in package \`${pkg.name}\``
          );
        })
      );