• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript fs-extra.copySync函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中fs-extra.copySync函数的典型用法代码示例。如果您正苦于以下问题:TypeScript copySync函数的具体用法?TypeScript copySync怎么用?TypeScript copySync使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了copySync函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: Error

 schemas.forEach(schema => {
   const file = path.basename(schema);
   if (file === 'package.json') {
     throw new Error('Cannot use name "package.json" for schema file');
   }
   fs.copySync(schema, path.join(destination, file));
 });
开发者ID:dalejung,项目名称:jupyterlab,代码行数:7,代码来源:build.ts


示例2: assertDirsEqual

function assertDirsEqual(actual: string, expected: string, basedir = actual) {
  if (process.env['UPDATE_POLYMER_CLI_GOLDENS']) {
    fsExtra.emptyDirSync(expected);
    fsExtra.copySync(actual, expected);
    throw new Error('Goldens updated, test failing for your safety.');
  }

  const actualNames = fs.readdirSync(actual).sort();
  const expectedNames = fs.readdirSync(expected).sort();
  assert.deepEqual(
      actualNames,
      expectedNames,
      `expected files in directory ${path.relative(basedir, actual)}`);
  for (const fn of actualNames) {
    const subActual = path.join(actual, fn);
    const subExpected = path.join(expected, fn);
    const stat = fs.statSync(subActual);
    if (stat.isDirectory()) {
      assertDirsEqual(subActual, subExpected, basedir);
    } else {
      const actualContents = fs.readFileSync(subActual, 'utf-8').trim();
      const expectedContents = fs.readFileSync(subExpected, 'utf-8').trim();
      assert.deepEqual(
          actualContents,
          expectedContents,
          `expected contents of ${path.relative(basedir, subActual)}`);
    }
  }
}
开发者ID:Polymer,项目名称:tools,代码行数:29,代码来源:build_test.ts


示例3: updateGhPagesAsync

    static async updateGhPagesAsync(
        repoUrl: string,
        siteFolder: string,
        docfxExe: string,
        docfxJson: string,
        gitUserName: string,
        gitUserEmail: string,
        gitCommitMessage: string) {

        Guard.argumentNotNullOrEmpty(repoUrl, "repoUrl");
        Guard.argumentNotNullOrEmpty(siteFolder, "siteFolder");
        Guard.argumentNotNullOrEmpty(docfxExe, "docfxExe");
        Guard.argumentNotNullOrEmpty(docfxJson, "docfxJson");
        Guard.argumentNotNullOrEmpty(gitUserName, "gitUserName");
        Guard.argumentNotNullOrEmpty(gitUserEmail, "gitUserEmail");
        Guard.argumentNotNullOrEmpty(gitCommitMessage, "gitCommitMessage");

        await Common.execAsync(docfxExe, [docfxJson]);

        let branch = "gh-pages";
        let targetDir = "docfxsite";

        this.cleanGitInfo(siteFolder);

        await Common.execAsync("git", ["clone", repoUrl, "-b", branch, targetDir]);
        fs.mkdirsSync(path.join(siteFolder, ".git"));
        fs.copySync(path.join(targetDir, ".git"), path.join(siteFolder, ".git"));

        await Common.execAsync("git", ["config", "user.name", gitUserName], siteFolder);
        await Common.execAsync("git", ["config", "user.email", gitUserEmail], siteFolder);
        await Common.execAsync("git", ["add", "."], siteFolder);
        await Common.execAsync("git", ["commit", "-m", gitCommitMessage], siteFolder);
        return Common.execAsync("git", ["push", "origin", branch], siteFolder);
    }
开发者ID:DuncanmaMSFT,项目名称:docfx,代码行数:34,代码来源:github.ts


示例4: isAbsolute

		files.forEach((fileName) => {
			const sourcePath = isAbsolute(fileName) ? fileName : resolve(path, fileName);
			const destFileName = isAbsolute(fileName) ? basename(fileName) : fileName;
			const destPath = resolve(cwd, copiedFilesDir, commandName, destFileName);

			console.log(` ${yellow('creating')} ${destPath.replace(cwd, '.')}`);
			copySync(sourcePath, destPath);
		});
开发者ID:dojo,项目名称:cli,代码行数:8,代码来源:eject.ts


示例5: async

const copyPublicFolder = async (dest: string): Promise<void> => {
  if (await fs.pathExists(paths.appPublic)) {
    await fs.copySync(paths.appPublic, paths.distPublic(dest), {
      dereference: true,
      filter: file => file !== paths.indexHtml,
    })
  }
}
开发者ID:leslieSie,项目名称:docz,代码行数:8,代码来源:build.ts


示例6: generateMission

export function generateMission(terrainId: string): Mission.GeneratedMission {
    var mission = defaultMission(terrainId);
    var generatedMission = Mission.generateMission(mission);
    updateMissionSqm(`${generatedMission.missionDir}/mission.sqm`);
    updateDescriptionExt(`${generatedMission.missionDir}/description.ext`);
    fs.copySync(`${TS_HOME}/blufor_briefing.sqf`, `${generatedMission.missionDir}/hull3/briefing/blufor.sqf`);
    return generatedMission;
}
开发者ID:Cyruz143,项目名称:shipyard,代码行数:8,代码来源:TownSweep.ts


示例7: Promise

 return new Promise((resolve, reject) => {
   try {
     fse.copySync(srcDir, destDir, options);
     resolve();
   } catch (e) {
     reject(e);
   }
 });
开发者ID:jkuri,项目名称:ng2-cli,代码行数:8,代码来源:dir.ts


示例8:

        .then(() => {
            FS.copySync(tmpPackagePath, packagePath);

            let metadataJSON = JSON.stringify(metadata, undefined, 4);
            FS.writeFileSync(metadataFilePath, metadataJSON);

            return packagePath;
        });
开发者ID:vilic,项目名称:rvm,代码行数:8,代码来源:index.ts


示例9: copy

export function copy(src: string, dest: string) {
    // Log.info(`./> cp ${src} ${dest}`);
    try {
        fse.copySync(src, dest);
    } catch (e) {
        Log.error(`copy: ${e.message}`);
    }
}
开发者ID:VestaRayanAfzar,项目名称:vesta,代码行数:8,代码来源:FsUtil.ts


示例10: generateMission

export function generateMission(terrainId: string): Mission.GeneratedMission {
    var mission = defaultMission(terrainId);
    var generatedMission = Mission.generateMission(mission);
    var missionSqmPath = `${generatedMission.missionDir}/mission.sqm`;
    var missionAst = updateMissionSqm(missionSqmPath);
    var maxPlayers = Mission.getPlayableUnitCount(missionAst);
    var fullMissionName = `ark_${Mission.missionTypeToMissionNamePrefix(Mission.stringToMissionType(mission.missionTypeName))}${maxPlayers}_${mission.briefingName.toLowerCase()}`;
    updateDescriptionExt(`${generatedMission.missionDir}/description.ext`, maxPlayers);

    generatedMission.downloadMissionName = `${fullMissionName}.${mission.terrainId}`;
    Ast.select(missionAst, 'ScenarioData.Header.maxPlayers')[0].value = maxPlayers;
    Ast.select(missionAst, 'Mission.Intel.briefingName')[0].value = fullMissionName;

    fs.writeFileSync(missionSqmPath, PrettyPrinter.create('\t').print(missionAst), 'UTF-8');
    fs.copySync(`${RE_HOME}/blufor_briefing.sqf`, `${generatedMission.missionDir}/hull3/briefing/blufor.sqf`);
    fs.copySync(`${RE_HOME}/opfor_briefing.sqf`, `${generatedMission.missionDir}/hull3/briefing/opfor.sqf`);

    return generatedMission;
}
开发者ID:Cyruz143,项目名称:shipyard,代码行数:19,代码来源:RandomEngagements.ts


示例11: html

export function html(dest: string = '.') {
  const templateDir = path.resolve(
    path.join(__dirname, '..', 'templates', 'html')
  );

  const destDir = path.resolve(dest);
  fs.copySync(templateDir, destDir, {
    filter: fileCopyFilter
  });
}
开发者ID:SkygearIO,项目名称:skycli,代码行数:10,代码来源:template.ts


示例12:

 .action(function (dir, options) {
   let sdir = dir;
   dir = cmd.emptydir(dir);
   fs.copySync(path.join(Setting.test_items_dir, 'example'), dir);
   fs.removeSync(path.join(dir,'__check__'));
   console.log(`Project successfully created.`);
   console.log(`To use: '${program.name()} --indir ${sdir} --outdir <outdir>'`);
   console.log(`We recommend add in a file 'package.json' => script: {"build-mcgen": "${program.name()} --indir ${sdir} --outdir <outdir>"}`);
   process.exit(0);
 });
开发者ID:do5,项目名称:mcgen,代码行数:10,代码来源:mcgen.ts


示例13: copySound

	async copySound(platform: string, from: string, to: string, options: any) {
		if (options.quality < 1) {
			fs.ensureDirSync(path.join(this.options.to, this.sysdir(), this.safename, 'app', 'src', 'main', 'assets', path.dirname(to)));
			let ogg = await convert(from, path.join(this.options.to, this.sysdir(), this.safename, 'app', 'src', 'main', 'assets', to + '.ogg'), this.options.ogg);
			return [to + '.ogg'];
		}
		else {
			fs.copySync(from.toString(), path.join(this.options.to, this.sysdir(), this.safename, 'app', 'src', 'main', 'assets', to + '.wav'), { overwrite: true });
			return [to + '.wav'];
		}
	}
开发者ID:juakob,项目名称:khamake,代码行数:11,代码来源:AndroidExporter.ts


示例14: generate

 public generate() {
     this.cloneTemplate();
     const dir = this.config.name;
     const templateRepo = PlatformConfig.getRepository();
     const templateProjectName = GitGen.getRepoName(templateRepo.client);
     const replacePattern = { [templateProjectName]: dir };
     copySync(`${dir}/resources/gitignore/variantConfig.ts`, `${dir}/src/config/variantConfig.ts`);
     // for installing plugins this folder must exist
     mkdirSync(`${dir}/vesta/cordova/www`);
     findInFileAndReplace(`${dir}/vesta/cordova/config.xml`, replacePattern);
 }
开发者ID:VestaRayanAfzar,项目名称:vesta,代码行数:11,代码来源:ClientAppGen.ts


示例15: copyProjectConfig

  /**
   * 拷贝小程序项目配置文件
   *
   * @private
   * @memberof Xcx
   */
  private copyProjectConfig () {
    let src = path.join(config.cwd, MINI_PROGRAM_CONFIG_FILE_NAME)
    let dest = config.getPath('dest', MINI_PROGRAM_CONFIG_FILE_NAME)

    if (!fs.existsSync(src)) {
      return
    }

    log.newline()
    log.msg(LogType.COPY, MINI_PROGRAM_CONFIG_FILE_NAME)
    fs.copySync(src, dest)
  }
开发者ID:bbxyard,项目名称:bbxyard,代码行数:18,代码来源:Xcx.ts


示例16: build

 .then((previousFileSizes: Object) => {
   // Remove all content but keep the directory so that
   // if you're in it, you don't end up in Trash
   fs.emptyDirSync(paths.appBuild);
   // Merge with the public folder
   fs.copySync(paths.appPublic, paths.appBuild, {
     dereference: true,
     filter: file => file !== paths.appHtml,
   });
   // Start the webpack build
   return build(previousFileSizes);
 })
开发者ID:heydoctor,项目名称:medpack,代码行数:12,代码来源:build.ts


示例17: zipdir

export const exportForWeb = (event, params) => {
  fsExtra.removeSync(`${WEB_PATH[process.platform]}`);

  Object.keys(params.model).forEach(key => {
    if ((key === 'data' || key.indexOf('data_') === 0) && typeof params.model[key] === 'object') {
      const pathKeys = params.model[key].path.split(path.sep);
      const pathKey = pathKeys[pathKeys.length - 1];

      fsExtra.copySync(params.model[key].path, `${WEB_PATH[process.platform]}/data/${pathKey}`);

      params.model[key].path = `./data/${pathKey}`;
      params.model[key].ddfPath = `./data/${pathKey}`;

      if (params.model[key].reader === 'ddf1-csv-ext') {
        params.model[key].reader = 'ddf';
      }
    }
  });

  params.model.chartType = params.chartType;
  params.model.locale.filePath = 'assets/translation/';

  const config = `var CONFIG = ${JSON.stringify(params.model, null, ' ')};`;

  fsExtra.copySync(`${WEB_RESOURCE_PATH[process.platform]}`, `${WEB_PATH[process.platform]}`);
  fsExtra.outputFileSync(`${WEB_PATH[process.platform]}/config.js`, config);

  let indexContent = fs.readFileSync(`${WEB_RESOURCE_PATH[process.platform]}/index.html`).toString();

  indexContent = indexContent.replace(/#chartType#/, params.chartType);

  fs.writeFileSync(`${WEB_PATH[process.platform]}/index.html`, indexContent, 'utf8');

  dialog.showSaveDialog({
    title: 'Export current chart as ...',
    filters: [{name: 'ZIP', extensions: ['zip']}]
  }, fileName => {
    if (!fileName) {
      return;
    }

    zipdir(`${WEB_PATH[process.platform]}`, {saveTo: fileName}, err => {
      if (err) {
        dialog.showMessageBox({message: 'This chart has NOT been exported.', buttons: ['OK']});
        ga.error('Export for Web was NOT completed: ' + err.toString());
        return;
      }

      dialog.showMessageBox({message: 'This chart has been exported.', buttons: ['OK']});
    });
  });
};
开发者ID:VS-work,项目名称:gapminder-offline,代码行数:52,代码来源:file-management.ts


示例18: cloudcode

export function cloudcode(name: string, dest: string = '.') {
  const templateDir = path.resolve(
    path.join(__dirname, '..', 'templates', `cloudcode-${name}`)
  );
  if (!fs.pathExistsSync(templateDir)) {
    throw new Error(`Template directory ${templateDir} not found.`);
  }

  const destDir = path.resolve(dest);
  fs.copySync(templateDir, destDir, {
    filter: fileCopyFilter
  });
}
开发者ID:SkygearIO,项目名称:skycli,代码行数:13,代码来源:template.ts


示例19: task

task('e2e-app:copy-release', () => {
  copySync(join(releasesDir, 'cdk'), join(outDir, 'cdk'));
  copySync(join(releasesDir, 'material'), join(outDir, 'material'));
  copySync(join(releasesDir, 'cdk-experimental'), join(outDir, 'cdk-experimental'));
  copySync(join(releasesDir, 'material-experimental'), join(outDir, 'material-experimental'));
  copySync(join(releasesDir, 'material-examples'), join(outDir, 'material-examples'));
  copySync(join(releasesDir, 'material-moment-adapter'), join(outDir, 'material-moment-adapter'));
});
开发者ID:davidgabrichidze,项目名称:material2,代码行数:8,代码来源:e2e.ts


示例20: moveAnalysisFiles

function moveAnalysisFiles() {
  const rendererReport = 'renderer.report.html'
  const analysisSource = path.join(outRoot, rendererReport)
  if (fs.existsSync(analysisSource)) {
    const distRoot = getDistRoot()
    const destination = path.join(distRoot, rendererReport)
    fs.mkdirpSync(distRoot)
    // there's no moveSync API here, so let's do it the old fashioned way
    //
    // unlinkSync below ensures that the analysis file isn't bundled into
    // the app by accident
    fs.copySync(analysisSource, destination, { overwrite: true })
    fs.unlinkSync(analysisSource)
  }
}
开发者ID:soslanashkhotov,项目名称:desktop,代码行数:15,代码来源:build.ts



注:本文中的fs-extra.copySync函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript fs-extra.createFile函数代码示例发布时间:2022-05-25
下一篇:
TypeScript fs-extra.copy函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap