Skip to content

Commit 3698354

Browse files
Update instructions for publishing…
…taking into account much of the changes from #22.
1 parent dd12a4b commit 3698354

File tree

1 file changed

+40
-33
lines changed

1 file changed

+40
-33
lines changed

docs/developing-for-pulsar/publishing.md

Lines changed: 40 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,69 +3,76 @@ title: Publishing
33
layout: doc.ejs
44
---
55

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.
77

88
See more in [Using PPM](/contributing-to-pulsar/using-ppm/).
99

1010
## Prepare your package
1111

1212
There are a few things you should double check before publishing:
1313

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" }`.
2521

2622
## Publish your package
2723

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.
2925

30-
Now let’s review what the `pulsar -p publish` command does:
26+
If this is your first time publishing, run:
3127

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.
3733

38-
Now run the following commands to publish your package:
34+
Now run the following command to publish your package:
3935

4036
```sh
41-
$ cd path-to-your-package
4237
$ pulsar -p publish minor
4338
```
4439

45-
<!-- TODO: Rewrite this Section once Authentication Information is Public -->
40+
Here’s what that command does:
4641

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.
4847

4948
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.
5049

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`:
5253

53-
```sh
54-
$ pulsar -p publish <version-type>
5554
```
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.
5661

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`:
5863

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`).
6267

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:
6469

6570
```sh
66-
$ pulsar -p publish minor
71+
$ pulsar -p publish patch
6772
```
6873

6974
Check out [semantic versioning](https://semver.org/) to learn more about best practices for versioning your package releases.
7075

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

Comments
 (0)