Skip to content

Instantly share code, notes, and snippets.

@ajnsit
Forked from ursi/publishing-packages.md
Created January 12, 2021 04:02
Show Gist options
  • Save ajnsit/c57c46a987fc9d35c51c96445d239260 to your computer and use it in GitHub Desktop.
Save ajnsit/c57c46a987fc9d35c51c96445d239260 to your computer and use it in GitHub Desktop.
The current process for Publishing PureScript packages

PureScript is currently in a transitional period with regards to how new packages are published. As such, the process of publishing a package is rather arduous. You will need: spago, pulp, and bower.

  1. Make sure your package name is unique by searching for it in bower-packages.json and new-packages.json. Alternatively you can search Pursuit as well, but those two files are the sources of truth.
  2. Make sure the module names in your package are globally unique by searching for them on Pursuit. Unfortunately this is a requirement with the current technology. However, finding a module with the same name on Pursuit doesn't mean all hope is lost. Module names only have to be unique in the package set. So you can use the information in step 6 to see if your module name is actually taken. There is a good number of packages published on Pursuit that have not been added to the package set.
  3. Submit a PR adding your package to new-packages.json.
  4. If you only care about adding a package to the package set so it can be used with spago, and don't care to publish its documentation to pursuit. Skip to step 6.
  5. Publishing a package to Pursuit
    1. Add a license field to your spago.dhall containing a valid SPXD license.
    2. Add a repository field to your spago.dhall with the link to the Git repository.
    3. If you package only depends on packages already in the Bower registry (i.e. in bower-packages.json) go to step 5.v. If not, we have a bit of manual work to do.
    4. Your package depends on packages that aren't in the bower registry
      1. Make sure your spago.dhall file is commited and create a new branch in your package repo.
      2. Remove the packages that aren't in the Bower registry from the dependencies in your spago.dhall and commit it.
      3. Use spago bump-version to generate a bower.json file that contains everything but the non-bower dependencies. Delete the tag if it was created.
      4. In the dependencies field of your newly generated bower.json, manually add back in your non-bower dependencies with the syntax "<repo name>": "<github username>/<repo name>#<version>".
      5. Switch to your master branch and commit the bower.json. You can delete the branch we used to generate it if you like.
      6. Run bower i install the dependencies with Bower.
      7. Use pulp version to create/bump your package version.
      8. Go to step 5.vi.
    5. Your package only depends on packages that are in the bower registry
      1. Use spago bump-version to generate a bower.json file and create/bump your package version.
    6. Use pulp publish to publish your documentation to Pursuit.
  6. Adding a package to the package set
    1. Fork and clone the package set repo.
    2. cd to src/groups, This is where you will add your package. Have a look around at the other package sets to see how to format things.
    3. Once you add your package, run make to update packages.json.
    4. Commit your changes and put in a PR.
    5. In order to use your package with the packages.dhall that spago generates for you, you need to ask for a new package to be released after your PR is accepted. You can do this in the PR itself or in a separate issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment