1.0.29 • Published 4 months ago
@taiyosen/easy-svn v1.0.29
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', '.']);
1.0.29
4 months ago
1.0.28
4 months ago
1.0.27
1 year ago
1.0.26
2 years ago
1.0.25
2 years ago
1.0.24
2 years ago
1.0.23
2 years ago
1.0.22
2 years ago
1.0.21
2 years ago
1.0.20
2 years ago
1.0.19
2 years ago
1.0.18
2 years ago
1.0.17
2 years ago
1.0.16
2 years ago
1.0.15
2 years ago
1.0.14
3 years ago
1.0.11
3 years ago
1.0.10
3 years ago
1.0.9
3 years ago
1.0.13
3 years ago
1.0.12
3 years ago
1.0.8
4 years ago
1.0.7
4 years ago
1.0.6
4 years ago
1.0.5
4 years ago
1.0.4
4 years ago