How to use the to-vfile.read function in to-vfile

To help you get started, we’ve selected a few to-vfile examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github 0xProject / 0x-monorepo / packages / website / scripts / algolia_helpers.ts View on Github external
async function processMdxAsync(algoliaIndex: any, file: File, indexName: string): Promise {
    const content = await read(file.path);

    await remark()
        .use(slug) // slugify heading text as ids
        .use(mdx)
        .use(() => async (tree: Node[]) => {
            await processContentTreeAsync(tree, file, algoliaIndex, indexName);
        })
        .process(content);
}
github 0xProject / 0x-monorepo / packages / website / ts / utils / algolia_helpers.ts View on Github external
async function processMdxAsync(indexName: string, file: File): Promise {
    const content = await read(file.path);

    await remark()
        .use(slug) // slugify heading text as ids
        .use(mdx)
        .use(() => (tree: Node[]) => processContentTree(tree, file, indexName))
        .process(content);
}
github Symbitic / markbook / src / book / summary.js View on Github external
const readFile = filename =>
  vfile.read(filename).catch(() => reject('SUMMARY.md not found', __filename))
github Symbitic / markbook / src / common / files.js View on Github external
export const readVFile = filename =>
  vfile.read(filename).catch(() => reject(`Error reading ${filename}`))
github WeTrustPlatform / paramount / scripts / convertDoczToKitchenSink.js View on Github external
const convertDoczToKitchenSink = async () => {
  const path = './src/components/KitchenSink/KitchenSink.tsx';
  const mdxFilePaths = await getMdxFiles();

  let content = '';
  const imports = [];

  for (const mdxFilePath of mdxFilePaths) {
    const file = await read(mdxFilePath);

    const result = await remark()
      .use(collectImports(imports))
      .use(mdx)
      .use(removeUnused)
      .use(transformHeadings)
      .process(file);

    content += result.contents + '\n';
  }

  const data = combine(content, imports);
  fs.writeFileSync(path, data, { encoding: 'utf-8' });
};
github geut / chan / packages / chan / cmds / release.js View on Github external
allowPrerelease,
  mergePrerelease,
  ghrelease,
  git,
  verbose,
  stdout
}) {
  const { report, success, info, warn, error } = createLogger({ scope: 'release', verbose, stdout });
  const version = semver.valid(userVersion);

  try {
    if (!version) {
      throw new Error('Version release is not valid.');
    }

    const file = await toVFile.read(resolve(path, 'CHANGELOG.md'));

    let gitParsed = null;

    if (git) {
      gitParsed = await gitUrlParse({ url: gitUrl }).catch(() => null);
    }

    if (git && !gitTemplate) {
      if (gitParsed) {
        gitTemplate = gitParsed.template;
        gitBranch = gitBranch || gitParsed.branch;
      } else {
        file.message(`Missing url to compare releases.`);
      }
    }

to-vfile

vfile utility to read and write to the file system

MIT
Latest version published 1 year ago

Package Health Score

59 / 100
Full package analysis