You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/developing-for-pulsar/publishing.md
+40-33Lines changed: 40 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,69 +3,76 @@ title: Publishing
3
3
layout: doc.ejs
4
4
---
5
5
6
-
Pulsar bundles a command line utility called `ppm` into every installation of Pulsar, to search for and install packages via the command line. This is invoked by using the `pulsar` command with the `-p` or `--package` option. Optionally, you are still able to call PPM directly via `ppm`in the command line. The `pulsar -p` command can also be used to publish Pulsar packages to the public registry and update them.
6
+
Pulsar bundles a command line utility called `ppm` into every installation; it lets you search for and install packages via the command line. It’s invoked by using the `pulsar` command with the `-p` or `--package` option. (Usually, though, you are still able to call PPM directly via `ppm`on the command line.) The `pulsar -p` command can also be used to publish Pulsar packages to the public registry and update them.
7
7
8
8
See more in [Using PPM](/contributing-to-pulsar/using-ppm/).
9
9
10
10
## Prepare your package
11
11
12
12
There are a few things you should double check before publishing:
13
13
14
-
- Your `package.json` file has `name`, `description`, and `repository` fields.
15
-
- Your `package.json``name` is URL-safe — meaning it contains no emoji or other special characters that are invalid in a URL.
16
-
- Your `package.json` file has a `version` field with a value of `"0.0.0"`.
17
-
- Your `package.json``version` field is [SemVer v2](https://semver.org/spec/v2.0.0.html) compliant.
18
-
- Your `package.json` file has an `engines` field that contains an entry for
19
-
`atom` such as: `"engines": {"atom": ">=1.0.0 <2.0.0"}`.
20
-
- Your package has a `README.md` file at the root.
21
-
- Your `repository` URL in the `package.json` file is the same as the URL of
22
-
your repository.
23
-
- Your package is in a Git repository that has been pushed to
24
-
[GitHub](https://github.com). Follow [this guide](https://help.github.com/articles/importing-a-git-repository-using-the-command-line/) if your package isn’t already on GitHub.
14
+
- Your package is in a Git repository that has been pushed to [GitHub](https://github.com). Follow [this guide](https://help.github.com/articles/importing-a-git-repository-using-the-command-line/) if your package isn't already on GitHub.
15
+
- Your `package.json` file…
16
+
- …has a “URL-safe” `name` field — without emoji or special characters.
17
+
- …has a `description` field.
18
+
- …has a `repository` field containing the URL of your repository.
19
+
- …has a `version` field that is [Semver V2](https://semver.org/spec/v2.0.0.html) compliant and has a value of `"0.0.0"` before the first release.
20
+
- has an `engine` field that contains an entry for `atom` such as: `"engines": { "atom": ">=1.0.0 <2.0.0" }`.
25
21
26
22
## Publish your package
27
23
28
-
Before you publish a package, it’s a good idea to check ahead of time if a package with the same name has already been published to [the Pulsar Package Registry](https://packages.pulsar-edit.dev/packages). You can do that by visiting `https://packages.pulsar-edit.dev/packages/your-package-name` to see if the package already exists. If it does, update your package’s name to something that is available before proceeding.
24
+
Before you publish a package, it’s a good idea to check ahead of time if a package with the same name has already been published to [the Pulsar Package Registry](https://packages.pulsar-edit.dev/). You can do that by visiting `https://packages.pulsar-edit.dev/packages/your-package-name` to see if the package already exists. If it does, update your package’s name to something that is available before proceeding.
29
25
30
-
Now let’s review what the `pulsar -p publish` command does:
26
+
If this is your first time publishing, run:
31
27
32
-
1. Registers the package name on Pulsar Package Registry if it is being published for the first time.
33
-
2. Updates the `version` field in the `package.json` file and commits it.
34
-
3. Creates a new [Git tag](https://git-scm.com/book/en/Git-Basics-Tagging) for the version being published.
35
-
4. Pushes the tag and current branch up to GitHub.
36
-
5. Updates Pulsar Package Registry with the new version being published.
28
+
```sh
29
+
$ pulsar -p login
30
+
```
31
+
32
+
This will let you create and set an API token in your [keychain](https://en.wikipedia.org/wiki/Keychain_(software)) to permit interacting with the GitHub API.
37
33
38
-
Now run the following commands to publish your package:
34
+
Now run the following command to publish your package:
39
35
40
36
```sh
41
-
$ cd path-to-your-package
42
37
$ pulsar -p publish minor
43
38
```
44
39
45
-
<!-- TODO: Rewrite this Section once Authentication Information is Public -->
40
+
Here’s what that command does:
46
41
47
-
If this is the first package you are publishing, the `pulsar -p publish` command may prompt you to authenticate.
42
+
1. Registers the package name on Pulsar Package Registry if it is being published for the first time.
43
+
2. Updates the `version` field in the `package.json` file — incrementing the minor version, in this example — and commits it.
44
+
3. Creates a new [Git tag](https://git-scm.com/book/en/Git-Basics-Tagging) for the version being published.
45
+
4. Pushes the tag and current branch up to GitHub.
46
+
5. Updates Pulsar Package Registry with the new version being published.
48
47
49
48
Your package is now published and available on Pulsar Package Registry. Head on over to `https://packages.pulsar-edit.dev/packages/your-package-name` to see your package’s page.
50
49
51
-
With `pulsar -p publish`, you can bump the version and publish by using
50
+
## Advanced usage of `publish`
51
+
52
+
How else can we use the `publish` command? Let’s ask for its usage information via `pulsar -p help publish`:
52
53
53
-
```sh
54
-
$ pulsar -p publish <version-type>
55
54
```
55
+
Usage: ppm publish [<newversion> | major | minor | patch]
56
+
ppm publish --tag <tagname>
57
+
ppm publish --rename <new-name>
58
+
```
59
+
60
+
This tells us some useful things.
56
61
57
-
where `version-type`can be`major`, `minor`, or `patch`:
62
+
First: we can specify an exact version number we want to use for the new release… or we can specify`major`, `minor`, or `patch`:
58
63
59
-
-`major` when you make backwards-incompatible API changes,
60
-
-`minor` when you add functionality in a backwards-compatible manner, or
61
-
-`patch` when you make backwards-compatible bug fixes.
64
+
*`major` when you make backwards-incompatible API changes (`1.0.0` becomes `2.0.0`),
65
+
*`minor` when you add functionality in a backwards-compatible manner (`1.0.0` becomes `1.1.0`), or
66
+
*`patch` when you make backwards-compatible bug fixes (`1.0.0` becomes `1.0.1`).
62
67
63
-
For instance, to bump a package from v1.**0**.0 to v1.**1**.0:
68
+
For instance, if all you’ve done since the last release is fix small bugs, you’ll probably want to run this command to publish:
64
69
65
70
```sh
66
-
$ pulsar -p publish minor
71
+
$ pulsar -p publish patch
67
72
```
68
73
69
74
Check out [semantic versioning](https://semver.org/) to learn more about best practices for versioning your package releases.
70
75
71
-
You can also run `pulsar -p help publish` to see all the available options and `pulsar -p help` to see all the other available commands.
76
+
Second: If we have an existing tag that we want to publish — instead of asking `ppm` to create a new tag for us — we can specify that instead! Keep in mind that it must be of the form `vx.y.z` — for example, `ppm publish --tag v1.12.0` — and the tag must not have been published previously.
77
+
78
+
Finally: we can also rename our package at publish time! `ppm` handles the chore of changing the name in `package.json` and tells the Pulsar Package Registry about the new name. The registry takes care of updating the record and ensuring that the old name is never used again (to prevent supply chain attacks). All users that are subscribed to our package under the old name will still be notified about the new version and will have their local copy renamed once they download the update.
0 commit comments