当前位置: 首页>>代码示例>>TypeScript>>正文


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

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


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


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