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


TypeScript sander.writeFile函数代码示例

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


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

示例1: Promise

 return new Promise((res, rej) => {
     Promise.all([
       // settings
       sander.writeFile(join(workingDir, "bits", bitName, `${bitName}.bitSettings.js`), manifest.bits[bitName].settings),
       // script
       sander.writeFile(join(workingDir, "bits", bitName, manifest.bits[bitName].script.file), manifest.bits[bitName].script.contents),
       // style
       sander.writeFile(join(workingDir, "bits", bitName, manifest.bits[bitName].style.file), manifest.bits[bitName].style.contents),
       // html
       sander.writeFile(join(workingDir, "bits", bitName, manifest.bits[bitName].html.file), manifest.bits[bitName].html.contents)
     ]).then(res).catch(rej);
 });
开发者ID:tbtimes,项目名称:lede-cli,代码行数:12,代码来源:install.ts

示例2: installCommand

export async function installCommand(config: Config, args) {
  const path = args["p"] || args["path"] || process.cwd();
  const fname = args["f"] || args["fetcher"] || "default";
  const FETCHER = config.fetchers[fname];
  let ledeModulesToInstall: string[] = args["_"];
  let addToPackageJson = true;
  const workingDir = await searchForProjectDir(path);
  if (ledeModulesToInstall.length === 0) {
    ledeModulesToInstall = await loadFromPackage(workingDir);
    addToPackageJson = false;
  }

  await Promise.all(ledeModulesToInstall.map(install.bind({ fetcher: FETCHER, workingDir: join(workingDir, config.caches.DEP_CACHE) })))

  if (addToPackageJson) {
    let p = await sander.readFile(join(workingDir, "package.json"), {encoding: "utf8"});
    p = JSON.parse(p);
    if (p.ledeModules && Array.isArray(p.ledeModules)) {
      p.ledeModules.concat(ledeModulesToInstall)
    } else {
      p.ledeModules = ledeModulesToInstall;
    }
    await sander.writeFile(join(workingDir, "package.json"), JSON.stringify(p, null, 2));
  }
  ledeModulesToInstall.forEach(m => config.logger.info(`Finished installing ${m}`));
}
开发者ID:tbtimes,项目名称:lede-cli,代码行数:26,代码来源:install.ts

示例3: deploy

  async deploy(page: CompiledPage): Promise<any> {
    const files = page.files.map(f => {
      if (f.content) {
        return sander.writeFile(join(this.deployDir, page.path, f.name), f.content);
      }
      return sander.copyFile(f.path).to(join(this.deployDir, page.path, f.overridableName || f.name));
    });

    return Promise.all([
      sander.writeFile(join(this.deployDir, page.path, "index.html"), page.renderedPage),
      ...files
    ]);
  }
开发者ID:tbtimes,项目名称:lede,代码行数:13,代码来源:FileSystemDeployer.ts

示例4: function

 return function(file) {
   return sander.writeFile(join(workingDir, type, file.file), file.contents)
 }
开发者ID:tbtimes,项目名称:lede-cli,代码行数:3,代码来源:install.ts

示例5:

 Promise.all(manifest.blocks.map(block => {
   return sander.writeFile(join(workingDir, "blocks", block.file), block.contents)
 })).then(resolve)
开发者ID:tbtimes,项目名称:lede-cli,代码行数:3,代码来源:install.ts

示例6:

 const files = page.files.map(f => {
   if (f.content) {
     return sander.writeFile(join(this.deployDir, page.path, f.name), f.content);
   }
   return sander.copyFile(f.path).to(join(this.deployDir, page.path, f.overridableName || f.name));
 });
开发者ID:tbtimes,项目名称:lede,代码行数:6,代码来源:FileSystemDeployer.ts


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