git-publish 1.0.1 → 2.0.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 +22 -19
  2. package/dist/index.js +63 -63
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -6,32 +6,34 @@ Publish your npm package to a Git branch.
6
6
 
7
7
  ## Why?
8
8
 
9
- For testing published packages without publishing to npm.
9
+ To test a package without publishing to npm.
10
10
 
11
- Making a prerelease to npm using `npm publish` has the following drawbacks:
11
+ #### Why not use `npm publish` to make a pre-release?
12
12
 
13
- - Needs a unique version for every release.
13
+ Because of the following drawbacks:
14
14
 
15
- - Hard to remove due to npm's [strict unpublish policy](https://docs.npmjs.com/policies/unpublish).
15
+ - **Versioning concerns:** even though you're just testing, you still need to version bump
16
+ - **Undeleteable:** releases are hard to remove due to npm's [strict unpublish policy](https://docs.npmjs.com/policies/unpublish)
17
+ - **Unverifyable:** npm does not offer a great way to browse the contents of a package
18
+ - **Risky:** Publishing tests to a production environment can be dangerous (eg. accidentally publish as stable)
16
19
 
17
- - Cumbersome to verify the contents of the published package.
20
+ #### What about `npm link`?
21
+ - No [npm life cycle scripts](https://docs.npmjs.com/cli/v8/using-npm/scripts#life-cycle-scripts)
22
+ - Includes non-publishable assets
23
+ - Doesn't install dependencies
18
24
 
19
- - Production environment—risky if you make a mistake (eg. accidentally publish as stable).
20
25
 
21
- Using `npm link` has the drawback of not running [npm life cycle scripts](https://docs.npmjs.com/cli/v8/using-npm/scripts#life-cycle-scripts) and including non-publishable assets.
26
+ #### So why `git-publish`?
22
27
 
28
+ - **No versions:** Instead of versions, branch names are used. Branches can be updated to reflect latest change.
23
29
 
24
- In contrast, `git-publish` has the following benefits:
30
+ - **Deletable:** Simply delete the branch when you're done with it.
25
31
 
26
- - **Unversioned** Instead of versions, branch names are used. Branches can be updated to reflect latest change.
32
+ - **Browsable:** Use GitHub to easily verify the contents of the branch. You can even share a link for others to see.
27
33
 
28
- - **Deletable** Simply delete the branch when you're done with it.
34
+ - **Dev environment:** Low risk of mistakes.
29
35
 
30
- - **Browsable** Use GitHub to verify the contents of the branch. You can even share a link for others to see.
31
-
32
- - **Dev environment** Low risk of mistakes.
33
-
34
- - **Simulates `npm publish`** Runs npm life cycle scripts and only includes publishable assets.
36
+ - **Simulates `npm publish`:** Runs npm life cycle scripts and only includes publishable assets.
35
37
 
36
38
  ## Usage
37
39
 
@@ -41,7 +43,7 @@ Publish your npm package to a branch on the Git repository:
41
43
  npx git-publish
42
44
  ```
43
45
 
44
- > **⚠️ Warning:** This command will force-push to the remote branch `npm/<current branch>`. Make sure there are no unsaved changes there.
46
+ This command will publish to the remote branch `npm/<current branch>`.
45
47
 
46
48
 
47
49
  ### Global install
@@ -61,6 +63,7 @@ git-publish
61
63
  | - | - |
62
64
  | `-b, --branch <branch name>` | The branch to publish the package to. Defaults to prefixing "npm/" to the current branch or tag name. |
63
65
  | `-r, --remote <remote>` | The remote to push to. (default: `origin`) |
66
+ | `-o, --fresh` | Publish without a commit history. Warning: Force-pushes to remote |
64
67
  | `-d, --dry` | Dry run mode. Will not commit or push to the remote. |
65
68
  | `-h, --help` | Show help |
66
69
  | `--version` | Show version |
@@ -79,14 +82,14 @@ git-publish
79
82
 
80
83
  ### How can I include a build step?
81
84
 
82
- Call the build command it in the [`prepack` script](https://docs.npmjs.com/cli/v8/using-npm/scripts#:~:text=on%20npm%20publish.-,prepack,-Runs%20BEFORE%20a).
85
+ Like `npm publish`, you can call the build command it in the [`prepack` script](https://docs.npmjs.com/cli/v8/using-npm/scripts#:~:text=on%20npm%20publish.-,prepack,-Runs%20BEFORE%20a).
83
86
 
84
87
  ### What does this script do?
85
88
 
86
89
  1. Run [npm hooks](https://docs.npmjs.com/cli/v8/using-npm/scripts) `prepare` & `prepack`
87
90
  2. Create a temporary branch by prefixing the current branch with the `npm/` namespace
88
- 3. Detect and commit the [npm publish files](https://github.com/npm/npm-packlist)
89
- 4. Force push the branch to remote
91
+ 3. Detect and commit only the [npm publish files](https://github.com/npm/npm-packlist)
92
+ 4. Push the branch to remote
90
93
  5. Delete local branch from Step 2
91
94
  6. Print the installation command for the branch
92
95