Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: changes implementation #8

Merged
merged 3 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
authors = ["Miguel Ramos <miguel.ramos@websublime.dev>"]
edition = "2021"
name = "websublime_workspace-tools"
version = "0.7.3"
version = "0.7.4"
exclude = ["tests/*", "examples/*", "node_modules/*", "target/*"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand All @@ -12,8 +12,12 @@ crate-type = ["cdylib"]

[dependencies]
napi-derive = "2.16.9"
napi = { version = "2.16.8", default-features = false, features = ["napi9", "serde-json", "tokio_rt"] }
workspace-node-tools = { version = "1.0.6", features = ["napi", "napi-derive"] }
napi = { version = "2.16.8", default-features = false, features = [
"napi9",
"serde-json",
"tokio_rt",
] }
workspace-node-tools = { version = "1.0.8", features = ["napi", "napi-derive"] }

[build-dependencies]
napi-build = "2"
Expand Down
59 changes: 32 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,38 @@ This package offer a set of functions to retrieve information about the monorepo

## API


| ###Function | ###Description |
|---|---|
| `getProjectRootPath(root?: string): string or undefined` | Get the root path of the project. |
| `getDefinedPackageManager(root?: string): string or undefined` | Get the package manager defined in the project. |
| `detectPackageManager(root: string): PackageManager or undefined` | Detect the package manager defined in the project. |
| `getPackages(cwd?: string): Array<PackageInfo>` | Get the list of packages in the monorepo. |
| `getChangedPackages(sha?: string, cwd: string): Array<PackageInfo>` | Get the list of packages that have changed since the given sha ('main'). |
| `gitFetchAll(cwd?: string, fetch_tags?: boolean): boolean` | Execute a `fetch` command to get the latest changes from the remote repository. You can also retrieve tags |
| `gitCommit(message: string, body?: string, footer?: string cwd?: string): boolean` | Commit the changes. |
| `gitTag(tag: string, message?: string, cwd?: string): boolean` | Tag the repository with the given tag. |
| `gitPush(cwd?: string, follow_tags?: boolean): boolean` | Push the changes to the remote repository, including optional tags. |
| `gitCurrentBranch(cwd?: string): string or undefined` | Get the current branch name. |
| `gitCurrentSha(cwd?: string): string` | Get's the current commit id. |
| `gitPreviousSha(cwd?: string): string or undefined` | Get's the previous commit id. |
| `gitFirstSha(cwd?: string, branch?: string): string or undefined` | Get's the first commit id in a branch. Compare is done between branch..Head, and it should be used as main..HEAD |
| `isWorkdirUnclean(cwd?: string): boolean` | Check if the workdir is unclean (uncommited changes). |
| `gitCommitBranchName(sha: string, cwd?: string): string or undefined` | Get the branch name for the commit id. |
| `gitAllFilesChangedSinceSha(sha: string, cwd?: string): Array<String>` | Get all files changed sinc branch, commit id etc. |
| `getDivergedCommit(sha: string, cwd?: string): string or undefined` | Get the diverged commit from the given sha (main). |
| `getCommitsSince(cwd?: string, since?: string, relative?: string): Array<Commit>` | Get the commits since the given sha (main) for a particular package. |
| `getAllFilesChangedSinceBranch(package_info: Array<PackageInfo>, branch: string, cwd?: string): Array<String>` | Get all the files changed for a branch (main). |
| `getLastKnownPublishTagInfoForPackage(package_info: PackageInfo, cwd?: string): Array<PublishTagInfo>` | Get the last known publish tag info for a particular package. |
| `getLastKnownPublishTagInfoForAllPackages(package_info: Array<PackageInfo>, cwd?: string): Array<PublishTagInfo>` | Get the last known publish tag info for all packages. |
| `getRemoteOrLocalTags(cwd?: string, local?: boolean): Array<RemoteTags>` | Get all the tags in the remote or local repository. |
| `getConventionalForPackage(package_info: PackageInfo, no_fetch_all?: boolean cwd?: string, conventional_options?: ConventionalPackageOptions): ConventionalPackage` | Get the conventional commits for a particular package, changelog output and package info. |
| `getBumps(options: BumpOptions): Array<BumpPackage>` | Output bumps version for packages and it's dependencies |
| Function | Description |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| `getProjectRootPath(root?: string): string or undefined` | Get the root path of the project. |
| `getDefinedPackageManager(root?: string): string or undefined` | Get the package manager defined in the project. |
| `detectPackageManager(root: string): PackageManager or undefined` | Detect the package manager defined in the project. |
| `getPackages(cwd?: string): Array<PackageInfo>` | Get the list of packages in the monorepo. |
| `getChangedPackages(sha?: string, cwd: string): Array<PackageInfo>` | Get the list of packages that have changed since the given sha ('main'). |
| `gitFetchAll(cwd?: string, fetch_tags?: boolean): boolean` | Execute a `fetch` command to get the latest changes from the remote repository. You can also retrieve tags |
| `gitCommit(message: string, body?: string, footer?: string cwd?: string): boolean` | Commit the changes. |
| `gitTag(tag: string, message?: string, cwd?: string): boolean` | Tag the repository with the given tag. |
| `gitPush(cwd?: string, follow_tags?: boolean): boolean` | Push the changes to the remote repository, including optional tags. |
| `gitCurrentBranch(cwd?: string): string or undefined` | Get the current branch name. |
| `gitCurrentSha(cwd?: string): string` | Get's the current commit id. |
| `gitPreviousSha(cwd?: string): string or undefined` | Get's the previous commit id. |
| `gitFirstSha(cwd?: string, branch?: string): string or undefined` | Get's the first commit id in a branch. Compare is done between branch..Head, and it should be used as main..HEAD |
| `isWorkdirUnclean(cwd?: string): boolean` | Check if the workdir is unclean (uncommited changes). |
| `gitCommitBranchName(sha: string, cwd?: string): string or undefined` | Get the branch name for the commit id. |
| `gitAllFilesChangedSinceSha(sha: string, cwd?: string): Array<String>` | Get all files changed sinc branch, commit id etc. |
| `getDivergedCommit(sha: string, cwd?: string): string or undefined` | Get the diverged commit from the given sha (main). |
| `getCommitsSince(cwd?: string, since?: string, relative?: string): Array<Commit>` | Get the commits since the given sha (main) for a particular package. |
| `getAllFilesChangedSinceBranch(package_info: Array<PackageInfo>, branch: string, cwd?: string): Array<String>` | Get all the files changed for a branch (main). |
| `getLastKnownPublishTagInfoForPackage(package_info: PackageInfo, cwd?: string): Array<PublishTagInfo>` | Get the last known publish tag info for a particular package. |
| `getLastKnownPublishTagInfoForAllPackages(package_info: Array<PackageInfo>, cwd?: string): Array<PublishTagInfo>` | Get the last known publish tag info for all packages. |
| `getRemoteOrLocalTags(cwd?: string, local?: boolean): Array<RemoteTags>` | Get all the tags in the remote or local repository. |
| `getConventionalForPackage(package_info: PackageInfo, no_fetch_all?: boolean cwd?: string, conventional_options?: ConventionalPackageOptions): ConventionalPackage` | Get the conventional commits for a particular package, changelog output and package info. |
| `getBumps(options: BumpOptions): Array<BumpPackage>` | Output bumps version for packages and it's dependencies |
| `initChanges(cwd?: string, change_options?: ChangesOptions): ChangesFileData` | Creat changes file or retrieve is data if already exist |
| `add_change(change: Change, cwd?: string): boolean` | Adds a new change to the change file |
| `remove_change(branch_name: String, cwd?: string): boolean` | Removes the change from the changes files. |
| `change_exist(branch_name: string, cwd?: string): boolean` | Check if change already exist. |
| `get_change(branch_name: string, cwd?: string): Array<Change>` | Get the list of changes for the branch. |
| `get_changes(cwd?: string): Changes` | Get all changes. |

## Develop requirements

Expand Down
Loading