Monday | 15 APR 2024
[ previous ]
[ next ]

Adding a Package

Title:
Date: 2023-12-26
Tags:  

Table of Contents

  1. Currently How it Works
  2. Thoughts

This is the steps to creating a package for myself. It's a bit convoluted so I want to describe it here. Hopefully I can simplify it at some point in the future.

Currently How it Works

The first step is to write the utility. This requires the header to be a specific format so that my GIT.PUSH command can push the file to my package repo.

*
   GIT.FILENAME = 'NPM'
   GIT.REPO = 'https://github.com/Krowemoh/npm.git'
*

The first few line should be this. The GIT.FILENAME is the filename that the file will be pushed under. This doesn't have to match the actual name of the file. The GIT.REPO is the repo I want to push to.

GIT.PUSH is a BASIC wrapper around my git.push program written in golang.

Once the file is pushed to a git repo, I now need to update the README.

Once that is done, I finally need to update NPM. I need to add the new package to the list of packages available.

*
   PACKAGES<1,-1> = 'LIST.DIRECTORY'
   PACKAGES<2,-1> = 'List a directory'
   PACKAGES<3,-1> = 'https://raw.githubusercontent.com/Krowemoh/TCL-Utilities/main/LIST.DIRECTORY'
*

This describes the name of the package and the path to where the code is.

Once NPM is updated with the new package, it can be pushed out to the repo with GIT.PUSH.

Now the new version of NPM is available and the local copy of NPM can be updated.

NPM INSTALL BP NPM

This will refresh NPM and you can now install the new packages that were added.

Thoughts

I think adding some sort of description and help text to the file itself that can then be parsed out might be a good way to skip having to update the README. This would help to automatically get NPM to pick up the new package.

I shouldn't need to update NPM at the very least. I should have a master list of all the packages available and NPM should be able to poll and cache that. That way I can skip having to constantly update NPM. I don't mind updating the README as much as that feels like it should be a manual process.