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

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

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

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



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

示例1: it

 it('throws an error when all is set', async () => {
   let packageJSON = await readRawPackageJson(dir);
   packageJSON.config.forge.packagerConfig.all = true;
   await fs.writeJson(path.join(dir, 'package.json'), packageJSON);
   await expect(forge.package({ dir })).to.eventually.be.rejectedWith(/packagerConfig\.all is not supported by Electron Forge/);
   packageJSON = await readRawPackageJson(dir);
   delete packageJSON.config.forge.packagerConfig.all;
   await fs.writeJson(path.join(dir, 'package.json'), packageJSON);
 });
开发者ID:balloonzzq,项目名称:electron-forge,代码行数:9,代码来源:api_spec_slow.ts


示例2: readMutatedPackageJson

 afterCopyHooks.push(async (buildPath, electronVersion, pPlatform, pArch, done) => {
   const copiedPackageJSON = await readMutatedPackageJson(buildPath, forgeConfig);
   if (copiedPackageJSON.config && copiedPackageJSON.config.forge) {
     delete copiedPackageJSON.config.forge;
   }
   await fs.writeJson(path.resolve(buildPath, 'package.json'), copiedPackageJSON, { spaces: 2 });
   done();
 });
开发者ID:balloonzzq,项目名称:electron-forge,代码行数:8,代码来源:package.ts


示例3: updateSeriesAsync

export async function updateSeriesAsync(series: mio.IScraperSeries) {
  let seriesImage = await series.imageAsync();
  let metaSeriesPath = shared.path.normal(series.providerName, series.title + shared.extension.json);
  let metaSeries = transformMetadata(series, seriesImage);
  await fs.ensureDir(path.dirname(metaSeriesPath));
  await fs.writeJson(metaSeriesPath, metaSeries, {spaces: 2})
  return true;
}
开发者ID:Deathspike,项目名称:mangarack,代码行数:8,代码来源:update.ts


示例4: createSeriesAsync

export async function createSeriesAsync(series: mio.IScraperSeries) {
  let metaProviderPath = shared.path.normal(series.providerName + shared.extension.json);
  let metaProviderExists = await fs.pathExists(metaProviderPath);
  let metaProvider = metaProviderExists ? await fs.readJson(metaProviderPath) as shared.IMetaProvider : {};
  metaProvider[series.url] = series.title;
  await mio.commands.updateSeriesAsync(series);
  await fs.writeJson(metaProviderPath, metaProvider, {spaces: 2});
}
开发者ID:Deathspike,项目名称:mangarack,代码行数:8,代码来源:create.ts


示例5: asyncOra

  await asyncOra('Initializing NPM Module', async () => {
    const packageJSON = await readPackageJSON(path.resolve(__dirname, '../../../tmpl'));
    packageJSON.productName = packageJSON.name = path.basename(dir).toLowerCase();
    packageJSON.author = await username();
    setInitialForgeConfig(packageJSON);

    packageJSON.scripts.lint = 'echo "No linting configured"';

    d('writing package.json to:', dir);
    await fs.writeJson(path.resolve(dir, 'package.json'), packageJSON, { spaces: 2 });
  });
开发者ID:jangocheng,项目名称:electron-forge,代码行数:11,代码来源:init-npm.ts


示例6: generatePackageJson

/**
 * Generate a super minimal package.json from an existing bower.json, and adds
 * `node_modules` to `.gitignore` if needed. Does nothing if there's already a
 * package.json.
 */
async function generatePackageJson(element: ElementRepo): Promise<void> {
  const npmConfigPath = path.join(element.dir, 'package.json');
  if (await fse.pathExists(npmConfigPath)) {
    console.log(`${element.ghRepo.name} already has a package.json, skipping.`);
    return;
  }

  const bowerConfigPath = path.join(element.dir, 'bower.json');
  if (!await fse.pathExists(bowerConfigPath)) {
    throw new Error(`${element.ghRepo.name} has no bower.json.`);
  }
  const bowerConfig: BowerConfig = await fse.readJson(bowerConfigPath);

  const npmConfig: NpmConfig = {
    // This is the style of name we're using for the 3.0 elements on NPM. Might
    // as well be consistent, even though this is a 2.0 package.json.
    name: `@polymer/${bowerConfig.name}`,

    // Make sure we don't accidentally publish this repo.
    private: true,

    // Note that we exclude version because the bower version might not be well
    // maintained, plus it won't get updated here going forward if we do more
    // releases.

    // npm warns if any of these fields aren't set.
    description: bowerConfig.description,
    repository: bowerConfig.repository,
    license: 'BSD-3-Clause'
  };

  // Since we're an NPM package now, we might get some dependencies installed,
  // which we don't want to commit.
  const gitIgnorePath = path.join(element.dir, '.gitignore');
  let gitIgnore = '';
  if (await fse.pathExists(gitIgnorePath)) {
    gitIgnore = (await fse.readFile(gitIgnorePath)).toString();
  }
  if (!gitIgnore.includes('node_modules')) {
    if (!gitIgnore.endsWith('\n')) {
      gitIgnore += '\n';
    }
    gitIgnore += 'node_modules\n';
    await fse.writeFile(gitIgnorePath, gitIgnore);
  }

  await fse.writeJson(npmConfigPath, npmConfig, {spaces: 2});

  await makeCommit(
      element,
      ['package.json', '.gitignore'],
      'Generate minimal package.json from bower.json');
}
开发者ID:TimvdLippe,项目名称:tedium,代码行数:58,代码来源:package-json.ts


示例7: function

export default async function({ dry, pkg }) {
  const memoGetDependants = memo(getDependants);

  for (const w of await getWorkspaces()) {
    const wName = w.name;
    const wVersion = w.config.version;
    const deps = await memoGetDependants(w.name);

    if (!deps.length) {
      continue;
    }

    const logger = logOnce();
    for (const dep of deps) {
      if (pkg && pkg !== dep) {
        continue;
      }

      const depw = await getWorkspace(dep);
      const depwConf = depw.config;
      const depwDeps = depwConf.dependencies;
      const depwDevs = depwConf.devDependencies;
      const depwOpts = depwConf.optionalDependencies;
      const depwPeer = depwConf.peerDependencies;
      const depwMerged = { ...depwDeps, ...depwDevs, ...depwOpts, ...depwPeer };

      updateVersion(wName, wVersion, depwDeps);
      updateVersion(wName, wVersion, depwDevs);
      updateVersion(wName, wVersion, depwOpts);
      updateVersion(wName, wVersion, depwPeer);

      if (depwMerged[wName] !== wVersion) {
        logger(EOL + wName);
        console.log(`  ${depw.name}: ${depwMerged[wName]} -> ${wVersion}`);

        if (!dry) {
          writeJson(path.join(depw.dir, 'package.json'), depwConf, {
            spaces: 2
          });
        }
      }
    }
  }
}
开发者ID:skatejs,项目名称:skatejs,代码行数:44,代码来源:bump.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript fs-extra.writeJsonSync函数代码示例发布时间:2022-05-25
下一篇:
TypeScript fs-extra.writeJSONSync函数代码示例发布时间: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