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

@mcswift/svn

v1.0.19

Published

[English](#english) | [中文](#中文)

Readme

@mcswift/svn

English | 中文


中文

封装了常见的 SVN (Subversion) 命令行操作,便于在 Node.js 中快速获取 SVN 仓库信息、状态以及执行提交和更新操作。

安装

npm install @mcswift/svn
# or
pnpm add @mcswift/svn

注意: 使用该包需要在运行环境中已经安装并配置好了 svn 命令行工具。

使用指南及接口文档

所有操作都通过 Svn 类的静态属性或方法来完成,默认以当前工作目录(process.cwd())作为操作目标。

1. 获取 SVN 信息

你可以获取当前目录的 SVN 版本信息和详细的 info 数据:

import { Svn } from "@mcswift/svn";

// 获取当前 SVN 版本号 (Revision)
console.log(Svn.revision);

// 获取详细的 SVN 仓库信息
const info = Svn.info;
console.log("URL:", info.URL);
console.log("Last Changed Author:", info.LastChangedAuthor);

类型注释:

type SvnInfo = {
  Path: string;
  WorkingCopyRootPath: string;
  URL: string;
  RelativeURL: string;
  RepositoryRoot: string;
  RepositoryUUID: string;
  Revision: string;
  NodeKind: string;
  Schedule: string;
  LastChangedAuthor: string;
  LastChangedRev: string;
  LastChangedDate: string;
  raw: string;
};

class Svn {
  static get info(): SvnInfo;
  static get revision(): string;
}

2. 获取文件状态 (Status)

获取工作副本的变更状态,包括未跟踪、已修改等文件列表及数量统计:

import { Svn } from "@mcswift/svn";

const statusInfo = Svn.status;

console.log("总变更数:", statusInfo.counts.total);
console.log("详细状态列表:", statusInfo.status);

类型注释:

type SvnStatusRecord = {
  type: string;
  path: string;
  absolute: string;
};

type SvnStatusResult = {
  counts: {
    total: number;
    [type: string]: number;
  };
  status: SvnStatusRecord[];
  raw: string;
};

class Svn {
  static get status(): SvnStatusResult;
}

3. 更新与提交

支持在代码中直接执行 SVN 的更新与提交:

import { Svn } from "@mcswift/svn";

// 执行 svn update
Svn.update();

// 执行 svn commit
const filesToCommit = ["src/index.ts", "package.json"];
const commitMessage = "fix: update configurations";

Svn.commit(filesToCommit, commitMessage);

类型注释:

class Svn {
  static update(root?: string): void;
  static commit(fileList: string[], message: string, root?: string): void;
}

English

Encapsulates common SVN (Subversion) command-line operations, making it easy to quickly retrieve SVN repository information, status, and execute commit/update operations in Node.js.

Installation

npm install @mcswift/svn
# or
pnpm add @mcswift/svn

Note: Using this package requires the svn command-line tool to be installed and configured in your runtime environment.

Usage Guide & API Documentation

All operations are performed through static properties or methods of the Svn class, defaulting to the current working directory (process.cwd()) as the target.

1. Retrieve SVN Information

You can get the SVN revision and detailed info data for the current directory:

import { Svn } from "@mcswift/svn";

// Get the current SVN revision
console.log(Svn.revision);

// Get detailed SVN repository info
const info = Svn.info;
console.log("URL:", info.URL);
console.log("Last Changed Author:", info.LastChangedAuthor);

Type Annotations:

type SvnInfo = {
  Path: string;
  WorkingCopyRootPath: string;
  URL: string;
  RelativeURL: string;
  RepositoryRoot: string;
  RepositoryUUID: string;
  Revision: string;
  NodeKind: string;
  Schedule: string;
  LastChangedAuthor: string;
  LastChangedRev: string;
  LastChangedDate: string;
  raw: string;
};

class Svn {
  static get info(): SvnInfo;
  static get revision(): string;
}

2. Get File Status

Get the modification status of the working copy, including a list of untracked/modified files and count statistics:

import { Svn } from "@mcswift/svn";

const statusInfo = Svn.status;

console.log("Total changes:", statusInfo.counts.total);
console.log("Detailed status list:", statusInfo.status);

Type Annotations:

type SvnStatusRecord = {
  type: string;
  path: string;
  absolute: string;
};

type SvnStatusResult = {
  counts: {
    total: number;
    [type: string]: number;
  };
  status: SvnStatusRecord[];
  raw: string;
};

class Svn {
  static get status(): SvnStatusResult;
}

3. Update and Commit

Supports directly executing SVN update and commit from your code:

import { Svn } from "@mcswift/svn";

// Execute svn update
Svn.update();

// Execute svn commit
const filesToCommit = ["src/index.ts", "package.json"];
const commitMessage = "fix: update configurations";

Svn.commit(filesToCommit, commitMessage);

Type Annotations:

class Svn {
  static update(root?: string): void;
  static commit(fileList: string[], message: string, root?: string): void;
}