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.
- package/README.md +22 -19
- package/dist/index.js +63 -63
- 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
|
-
|
|
9
|
+
To test a package without publishing to npm.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
#### Why not use `npm publish` to make a pre-release?
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
Because of the following drawbacks:
|
|
14
14
|
|
|
15
|
-
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
30
|
+
- **Deletable:** Simply delete the branch when you're done with it.
|
|
25
31
|
|
|
26
|
-
- **
|
|
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
|
-
- **
|
|
34
|
+
- **Dev environment:** Low risk of mistakes.
|
|
29
35
|
|
|
30
|
-
- **
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
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
|
|