@babajide234/git-merge-workflow 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  @{
2
2
  RootModule = 'GitMergeWorkflow.psm1'
3
- ModuleVersion = '1.0.0'
3
+ ModuleVersion = '1.0.1'
4
4
  GUID = 'a1b2c3d4-e5f6-7890-abcd-ef1234567890'
5
5
  Author = 'babajide Tomoshegbo'
6
6
  CompanyName = 'babajide234'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babajide234/git-merge-workflow",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Automated Git workflow for merging feature branches through staging to develop",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -1,96 +0,0 @@
1
- # Developer Guide: Git Merge Workflow (GMW)
2
-
3
- This guide explains how the **Git Merge Workflow** PowerShell module works and how you can modify it.
4
-
5
- ## 📂 Project Structure
6
-
7
- The module is located at:
8
- `c:\Users\jyde2\OneDrive\Documents\WindowsPowerShell\Modules\GitMergeWorkflow`
9
-
10
- - **GitMergeWorkflow.psd1**: The *Module Manifest*. Contains metadata (version, author, description) and defines which files are processed when the module is imported.
11
- - **GitMergeWorkflow.psm1**: The *Script Module*. Contains the actual source code and logic for the functions. **This is where you will make most changes.**
12
- - **Install.ps1**: A helper script to install the module on a new machine.
13
- - **package.json**: configuration for NPM publishing (if applicable).
14
-
15
- ## 🧠 How It Works
16
-
17
- The core logic resides in `GitMergeWorkflow.psm1`.
18
-
19
- ### Main Function: `Invoke-GitMergeWorkflow`
20
- This is the function executed when you run `gmw`.
21
-
22
- 1. **Configuration Loading**:
23
- - Calls `Get-GitWorkflowConfig` to look for a `.git-merge-workflow.json` file in your repository root.
24
- - Sets defaults (`develop` for target, `-staging` for suffix) if no config is found.
25
-
26
- 2. **Environment Checks**:
27
- - Checks if `git` is available and if the current directory is a git repository.
28
- - Validates that you are NOT currently on the target branch (e.g., `develop`) or the staging branch.
29
-
30
- 3. **Staging Phase**:
31
- - Determines the staging branch name (e.g., `feature-xyz-staging`).
32
- - Checks if the staging branch exists locally or remotely.
33
- - **Merges** your current feature branch into this staging branch.
34
- - **Pushes** the staging branch to the remote (`origin`).
35
- - *Recent Update*: This step now includes error handling. If the push fails (e.g., permissions issue), it asks if you want to skip and proceed.
36
-
37
- 4. **Target Phase**:
38
- - Checkouts the target branch (`develop`).
39
- - Pulls the latest changes.
40
- - **Merges** the staging branch into the target branch.
41
- - **Pushes** the target branch to remote.
42
-
43
- 5. **Cleanup**:
44
- - Returns you to your original feature branch.
45
-
46
- ### Helper Functions
47
- - `Exec-Git`: A wrapper around git commands to handle errors and verbose output consistently.
48
- - `New-GitWorkflowConfig`: Generates the JSON configuration file.
49
-
50
- ## 🛠️ How to Edit and Test
51
-
52
- Since this is a PowerShell module, changes are not picked up immediately if the module is already loaded in your session.
53
-
54
- ### 1. Edit the Code
55
- Open `GitMergeWorkflow.psm1` in VS Code or your preferred editor.
56
-
57
- **Example**: Adding a new log message.
58
- ```powershell
59
- # Inside Invoke-GitMergeWorkflow
60
- Write-Host "Starting my custom workflow..." -ForegroundColor Magenta
61
- ```
62
-
63
- ### 2. Reload the Module
64
- After saving your changes, you must reload the module in your PowerShell terminal to see them take effect.
65
-
66
- Run this command:
67
- ```powershell
68
- Import-Module GitMergeWorkflow -Force
69
- ```
70
- *The `-Force` flag is crucial as it unloads the old version and loads the new one.*
71
-
72
- ### 3. Test
73
- Run the command again:
74
- ```powershell
75
- gmw -WhatIf
76
- ```
77
- *Using `-WhatIf` (Dry Run) is a safe way to test logic changes without actually running git commands, provided the script supports it (mostly used for ShouldProcess).*
78
-
79
- For real testing, just run `gmw` in a test repository.
80
-
81
- ## 📦 Configuration
82
-
83
- The behavior can be customized per-repository using a `.git-merge-workflow.json` file:
84
-
85
- ```json
86
- {
87
- "TargetBranch": "main",
88
- "StagingSuffix": "-qa",
89
- "Remote": "upstream"
90
- }
91
- ```
92
-
93
- You can generate this file using:
94
- ```powershell
95
- New-GitWorkflowConfig
96
- ```
package/PUBLISHING.md DELETED
@@ -1,41 +0,0 @@
1
- # How to Publish `@babajide234/git-merge-workflow` to npm
2
-
3
- ## Prerequisites
4
-
5
- 1. **NPM Account**: You must have an account on [npmjs.com](https://www.npmjs.com/).
6
- 2. **Login**: You must be logged in as `babajide234`.
7
-
8
- ## Publishing Steps
9
-
10
- 1. **Login to npm**:
11
- Open your terminal in the project directory and run:
12
- ```bash
13
- npm login
14
- ```
15
- Follow the prompts to authenticate via the browser.
16
-
17
- 2. **Verify Configuration**:
18
- Ensure `package.json` has the correct version.
19
- Current version: `1.0.0`
20
-
21
- 3. **Publish**:
22
- By default, scoped packages (`@org/pkg`) are published as **private**.
23
-
24
- - **To publish publicly** (visible to everyone):
25
- ```bash
26
- npm publish --access public
27
- ```
28
-
29
- - **To publish privately** (only visible to org members - requires paid npm plan):
30
- ```bash
31
- npm publish
32
- ```
33
-
34
- ## Post-Publishing
35
-
36
- - **Update Version**: For future updates, remember to bump the version number in `package.json` (e.g., `1.0.1`) before publishing again.
37
- ```bash
38
- npm version patch # 1.0.0 -> 1.0.1
39
- npm version minor # 1.0.0 -> 1.1.0
40
- npm version major # 1.0.0 -> 2.0.0
41
- ```