git-publish 2.0.0 → 2.1.0

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.
Files changed (3) hide show
  1. package/README.md +25 -5
  2. package/dist/index.js +71 -79
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,8 +1,13 @@
1
1
  # git-publish
2
2
 
3
- Publish your npm package to a Git branch.
3
+ Publish your npm package to a Git branch. Great for pre-publishing a package for testing.
4
4
 
5
- <sub>Support this project by ⭐️ starring and sharing it. [Follow me](https://github.com/privatenumber) to see what other cool projects I'm working on! ❤️</sub>
5
+ <br>
6
+
7
+ <p align="center">
8
+ <a href="https://github.com/sponsors/privatenumber/sponsorships?tier_id=398771"><img width="412" src="https://raw.githubusercontent.com/privatenumber/sponsors/master/banners/assets/donate.webp"></a>
9
+ <a href="https://github.com/sponsors/privatenumber/sponsorships?tier_id=416984"><img width="412" src="https://raw.githubusercontent.com/privatenumber/sponsors/master/banners/assets/sponsor.webp"></a>
10
+ </p>
6
11
 
7
12
  ## Why?
8
13
 
@@ -86,13 +91,20 @@ Like `npm publish`, you can call the build command it in the [`prepack` script](
86
91
 
87
92
  ### What does this script do?
88
93
 
89
- 1. Run [npm hooks](https://docs.npmjs.com/cli/v8/using-npm/scripts) `prepare` & `prepack`
90
- 2. Create a temporary branch by prefixing the current branch with the `npm/` namespace
94
+ 1. If publish branch exists on remote, check it out to apply changes on top. Otherwise, create a new branch.
95
+ 2. Run [npm hooks](https://docs.npmjs.com/cli/v8/using-npm/scripts) `prepare` & `prepack`
91
96
  3. Detect and commit only the [npm publish files](https://github.com/npm/npm-packlist)
92
97
  4. Push the branch to remote
93
- 5. Delete local branch from Step 2
94
98
  6. Print the installation command for the branch
95
99
 
100
+ ### Why is the commit history preserved in the publish branch?
101
+
102
+ When pushing an npm installable commit to Git, it's important that it's an attached commit.
103
+
104
+ This is because npm lock references the commit hash, and not the branch name. So if the commit is detached, it will be removed upon reference loss and any subsequent npm installations referencing that commit hash will fail.
105
+
106
+ If you'd like a publish branch with a clean commit history despite these drawbacks, you can use the `--fresh` flag to force-push a single-commit branch to the remote.
107
+
96
108
  ### How is this different from simply committing the files to a branch?
97
109
 
98
110
  - There can be missing distribution files (eg. files outside of `dist`). _git-publish_ uses [npm-packlist](https://github.com/npm/npm-packlist) —the same library `npm publish` uses—to detect publish files declared via `package.json#files` and `.npmignore`.
@@ -118,3 +130,11 @@ $ npx git-publish --remote git@github.com:repo-b.git --branch test-pkg
118
130
  ✔ Successfully published branch! Install with command:
119
131
  → npm i 'repo-b#test-pkg'
120
132
  ```
133
+
134
+ ## Sponsors
135
+
136
+ <p align="center">
137
+ <a href="https://github.com/sponsors/privatenumber">
138
+ <img src="https://cdn.jsdelivr.net/gh/privatenumber/sponsors/sponsorkit/sponsors.svg">
139
+ </a>
140
+ </p>