當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。