@taiyosen/easy-svn
TypeScript icon, indicating that this package has built-in type declarations

1.0.29 • Public • Published

easy-svn

Make it easy to use svn in nodejs.

Install

First, make sure a command SVN has been installed, such as CollabNetSunversion.

Then~

npm i @taiyosen/easy-svn

How to use

let svn = new SVNClient();
// config is optional.
svn.setConfig({
    repository: 'svn://your-svn-repository', 
    username: 'your-svn-username', 
    password: 'your-svn-password', 
    cwd: 'E:/your-svn-workspace', 
    silent: true
});

// show the log messages for any incoming changes
await svn.log(['.'], { revision: 'BASE:HEAD', verbose: true });
// or
await svn.log('.', '-r', 'BASE:HEAD', '-v');

await svn.cleanup();  // cleanup E:/your-svn-workspace
await svn.cleanup(true, 'E:/foo');  // cleanup E:/foo

await svn.revert();  // revert E:/your-svn-workspace
await svn.revert('E:/foo', 'E:/bar');  // revert E:/foo & E:/bar

await svn.update();  // update E:/your-svn-workspace

await svn.addUnversioned('.');  // add unversioned files in .

await svn.checkout('svn://your-svn-repository/some-folder');  // check out into some-folder
await svn.checkout('svn://your-svn-repository/some-folder', 'the-specified-folder');  // check out into a specified folder
// you can also checkout a single file, like:
await svn.checkout('svn://your-svn-repository/some-folder/some-file.ts');

Set a default configuration

  • [repository] - works if no url given when calling checkout
  • [username] - --username option will be enabled
  • [password] - --password option will be enabled
  • [cwd] - works as the default path when calling checkout/update/commit/...
  • [silent] - no log or error details if set true
SVNConfig {
    repository?: string;
    username?: string;
    password?: string;
    cwd?: string;
    silent?: boolean;
}

Check out

async checkout(url?: string | string[], path?: string, option?: CheckoutOption): Promise<string>;

update

async update(paths: string[], option?: UpdateOption): Promise<string>;
/**@deprecated */
async update(...paths: string[]): Promise<string>;

commit

async commit(paths: string[], option?: CommitOption): Promise<string>;
/**@deprecated */
async commit(msg: string, ...paths: string[]): Promise<string>;

add

async add(paths: string[], option?: AddOption): Promise<string>;
/**@deprecated */
async add(...paths: string[]): Promise<string>;

del

async delete(paths: string | string[], option?: DeleteOption): Promise<string>;
/**@deprecated */
async del(msg: string, ...paths: string[]): Promise<string>;

info

async info(targets: string[], option?: InfoOption): Promise<string>;
/**@deprecated */
async info(...targets: string[]): Promise<string>;

status

async status(paths: string[], option?: StatusOption): Promise<string>;
/**@deprecated */
async status(...paths: string[]): Promise<string>;

log

async log(paths: string[], option?: LogOption): Promise<string>;
/**@deprecated */
async log(path?: string, ...options: string[]): Promise<string>;

revert

async revert(...paths: string[]): Promise<string>;

cleanup

async cleanup(rmUnversioned?: boolean, ...wcpaths: string[]): Promise<string>;

addUnversioned

async addUnversioned(...paths: string[]): Promise<string>;

getRevision

async getRevision(url?: string): Promise<number>;

ignore

async ignore(wcRoot: string, ...ignoreList: string[]): Promise<boolean>;

copy

async copy(src: string, dst: string, option?: CopyOption): Promise<string>;

list

async list(target: string | string[], option?: ListOption): Promise<string>

lock

async lock(target: string | string[], option?: LockOption): Promise<string>

unlock

async unlock(target: string | string[], option?: UnlockOption): Promise<string>

any command

async cmd(command: string, params?: string[], options?: SpawnOptionsWithoutStdio): Promise<string>

for example:

import { SVNClient } from "@taiyosen/easy-svn";

const svn = new SVNClient();
await svn.cmd('add', ['--force', '--parents', '--no-ignore', '.']);

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.2955latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.2955
1.0.281
1.0.270
1.0.260
1.0.250
1.0.240
1.0.230
1.0.220
1.0.210
1.0.200
1.0.190
1.0.181
1.0.170
1.0.160
1.0.150
1.0.140
1.0.131
1.0.120
1.0.110
1.0.100
1.0.91
1.0.80
1.0.70
1.0.60
1.0.50
1.0.40

Package Sidebar

Install

npm i @taiyosen/easy-svn

Weekly Downloads

52

Version

1.0.29

License

ISC

Unpacked Size

88.2 kB

Total Files

10

Last publish

Collaborators

  • taiyosen