How to use the @yarnpkg/parsers.stringifySyml function in @yarnpkg/parsers

To help you get started, we’ve selected a few @yarnpkg/parsers 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 yarnpkg / berry / packages / yarnpkg-core / sources / Project.ts View on Github external
compatibilityMode: false,
        }),

        linkType: pkg.linkType.toLowerCase(),

        resolution: structUtils.stringifyLocator(pkg),
        checksum: this.storedChecksums.get(pkg.locatorHash),
      };
    }

    const header = `${[
      `# This file is generated by running "yarn install" inside your project.\n`,
      `# Manual changes might be lost - proceed with caution!\n`,
    ].join(``)}\n`;

    return header + stringifySyml(optimizedLockfile);
  }
github yarnpkg / berry / packages / plugin-essentials / sources / commands / install.ts View on Github external
throw new ReportError(MessageName.AUTOMERGE_IMMUTABLE, `Cannot autofix a lockfile when running an immutable install`);

  const [left, right] = getVariants(file);

  let parsedLeft;
  let parsedRight;

  try {
    parsedLeft = parseSyml(left);
    parsedRight = parseSyml(right);
  } catch (error) {
    throw new ReportError(MessageName.AUTOMERGE_FAILED_TO_PARSE, `The individual variants of the lockfile failed to parse`);
  }

  const merged = Object.assign({}, parsedLeft, parsedRight);
  const serialized = stringifySyml(merged);

  await xfs.changeFilePromise(lockfilePath, serialized);

  return true;
}
github yarnpkg / berry / packages / yarnpkg-core / sources / Configuration.ts View on Github external
const nextValue = typeof patch[key] === `function`
        ? patch[key](currentValue)
        : patch[key];

      if (currentValue === nextValue)
        continue;

      current[key] = nextValue;
      patched = true;
    }

    if (!patched)
      return;

    await xfs.changeFilePromise(configurationPath, stringifySyml(current));
  }

@yarnpkg/parsers

BSD-2-Clause
Latest version published 8 months ago

Package Health Score

93 / 100
Full package analysis

Similar packages