1.3.0 • Published 9 months ago

readmeq v1.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

readmeq

Just another one solution for modifying your README.md (not only) file.

Can be useful if you want to modify some parts of your README.md (not only) file on any step of build, commit, pre-comit, etc.

Usage:

  1. put some sections to any place of your README.md file like this:
<!--READMEQ:someKey-->someData<!--/READMEQ:someKey-->

or like this:

<!--READMEQ:someKey-->
any **data** _between_
and <a href="https://kostix.dev">anything</a> else
<!--/READMEQ:someKey-->
  1. use modifyReadmeqSingle method like this:
await modifyReadmeqSingle('someKey', 'someOtherData(MODIFIED)', { n : true });
  1. the result in your file will be:
<!--READMEQ:someKey-->
someOtherData(MODIFIED)
<!--/READMEQ:someKey-->

Documantation:

Check documentation here

Type Aliases

Functions

Type Aliases

BackupOptions

Ƭ BackupOptions: Object

Backup options.

Type declaration

NameTypeDescription
backupSuffixstringbackup file suffix (file.ext => file${backupSuffix}.ext) Default _backup${Date.now()}
backupSuffixMatchstringbackup file suffing pattern (RegEx), where ([0-9]+) - uniq time-based integer (!important) id of its backup version Default _backup([0-9]+)
backupsPathstringprojects base/root path Default ${path.join(basePath,'.readmeqBackups')}
basePathstringprojects base/root path Default ${process.cwd()}

Defined in

index.ts:17


FilePath

Ƭ FilePath: string

filePath data type (string)

Defined in

index.ts:96


ModifyOptions

Ƭ ModifyOptions: Object

Modify options.

Type declaration

NameTypeDescription
backupbooleanapply backupReadmeq method mefore modifying Default ts false
backupOptionsBackupOptionsapplying to backupReadmeq method if backup=true Default ts backupOptions
filePathstringpath to modified file Default ts './README.md'
nbooleaninsert newData from new line (\n on start/end) Default ts false
sectionEndstringsection end pattern, where KEY_NAME (!important) - your section key Default ts '<!--/READMEQ:KEY_VALUE-->'
sectionStartstringsection start pattern, where KEY_NAME (!important) - your section key Default ts '<!--READMEQ:KEY_VALUE-->'

Defined in

index.ts:51


Result

Ƭ Result<T>: { status: "ok" ; value: T } | { error: Error ; status: "error" }

Result to return

Type parameters

NameDescription
Tvalue type of status: 'ok'

Defined in

index.ts:102

Functions

backupReadmeq

backupReadmeq(filePath, options?): Promise<Result<string>>

Backup readmeq modified file. Use this method when its important to have previous versions of modified file. Or any other cases when its needed. Use this method on your own risk.

Parameters

NameTypeDescription
filePathstringpath to file
options?Partial<BackupOptions>-

Returns

Promise<Result<string>>

backup file path (or throw some error)

Async

Defined in

index.ts:194


modifyReadmeqSingle

modifyReadmeqSingle(key, newData, options?): Promise<Result<boolean>>

Modify single key section.

Parameters

NameTypeDescription
keystringsection key
newDatastringsection data
options?Partial<ModifyOptions>-

Returns

Promise<Result<boolean>>

file modified (or throw some error)

Async

Defined in

index.ts:124


restoreReadmeqFromPath

restoreReadmeqFromPath(filePath, backupFilePath, backupBeforeRestore?, options?): Promise<Result<boolean>>

Restore version of readmeq modified file from specific path. Use this method on your own risk.

Parameters

NameTypeDefault valueDescription
filePathstringundefinedpath to file
backupFilePathstringundefinedpath to its backup file
backupBeforeRestorebooleantrue-
options?Partial<BackupOptions>undefined-

Returns

Promise<Result<boolean>>

file restored (or throw some error)

Async

Defined in

index.ts:329


restoreReadmeqLatest

restoreReadmeqLatest(filePath, backupBeforeRestore?, options?): Promise<Result<boolean>>

Restore latest version of readmeq modified file. Based on its backup suffix. Use this method on your own risk.

Parameters

NameTypeDefault valueDescription
filePathstringundefinedpath to file
backupBeforeRestorebooleantrue-
options?Partial<BackupOptions>undefined-

Returns

Promise<Result<boolean>>

file restored (or throw some error)

Async

Defined in

index.ts:244

TODO:

  • mk mass modifying
  • move backup/restore to separate module

© kostix.dev

1.3.0

9 months ago

1.2.0

9 months ago

1.1.0

9 months ago

1.0.0

9 months ago