npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@yarn-tool/sort-lerna-json

v3.0.10

Published

Sort lerna.json configuration file with consistent key ordering / 排序 lerna.json 配置檔案,確保鍵值順序一致

Downloads

786

Readme

@yarn-tool/sort-lerna-json

Sort lerna.json configuration file with consistent key ordering 排序 lerna.json 配置檔案,確保鍵值順序一致

NPM version License

Description / 描述

This module provides utilities for sorting lerna.json configuration files. It ensures consistent key ordering for better readability and version control.

此模組提供排序 lerna.json 配置檔案的工具函式。 確保鍵值順序一致,提高可讀性和版本控制友好性。

Installation / 安裝

# Using yarn
yarn add @yarn-tool/sort-lerna-json

# Using yarn-tool
yarn-tool add @yarn-tool/sort-lerna-json

# Using yt (yarn-tool alias)
yt add @yarn-tool/sort-lerna-json

# Using npm
npm install @yarn-tool/sort-lerna-json

Usage / 使用方式

sortLernaJson(json)

Sort a lerna.json configuration object.

排序 lerna.json 配置物件。

import sortLernaJson from '@yarn-tool/sort-lerna-json';

const lernaConfig = {
  version: '1.0.0',
  packages: ['packages/*'],
  npmClient: 'yarn',
  command: {
    version: { bump: 'minor' },
    publish: { concurrency: 4 },
  },
};

const sorted = sortLernaJson(lernaConfig);
// Returns object with keys in order: workspaces, packages, command, npmClient, useWorkspaces, version

sortLernaJsonFile(file)

Sort a lerna.json file and write it back.

排序 lerna.json 檔案並寫回。

import { sortLernaJsonFile } from '@yarn-tool/sort-lerna-json';

// Sort lerna.json in the current directory
sortLernaJsonFile('./lerna.json');

sortLernaJsonCommand(value)

Sort the command section of lerna.json.

排序 lerna.json 的 command 區段。

import { sortLernaJsonCommand } from '@yarn-tool/sort-lerna-json';

const command = {
  version: { bump: 'minor' },
  publish: { concurrency: 4 },
};

const sorted = sortLernaJsonCommand(command);
// Returns object with keys in order: publish, version, run, exec

sortLernaJsonCommandEntry(value)

Sort a lerna command entry object.

排序 lerna 命令項物件。

import { sortLernaJsonCommandEntry } from '@yarn-tool/sort-lerna-json';

const entry = {
  bump: 'minor',
  concurrency: 4,
  stream: true,
};

const sorted = sortLernaJsonCommandEntry(entry);
// Returns object with keys in order: concurrency, stream, loglevel, ignoreChanges, message, bump, ...

Key Ordering / 鍵值順序

Top-level keys / 頂層鍵

  1. workspaces
  2. packages
  3. command
  4. npmClient
  5. useWorkspaces
  6. version

Command keys / 命令鍵

  1. publish
  2. version
  3. run
  4. exec

Command entry keys / 命令項鍵

  1. concurrency
  2. stream
  3. loglevel
  4. ignoreChanges
  5. message
  6. bump
  7. noPrivate
  8. conventionalCommits
  9. conventionalGraduate
  10. changelogPreset

API Reference / API 參考

| Function | Description | |----------|-------------| | sortLernaJson(json) | Sort a lerna.json configuration object | | sortLernaJsonFile(file) | Sort a lerna.json file and write it back | | sortLernaJsonCommand(value) | Sort the command section of lerna.json | | sortLernaJsonCommandEntry(value) | Sort a lerna command entry object |

Related / 相關套件

License / 授權

ISC © bluelovers