-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Publishing to node #1
Comments
No problem about the old issue - just glad you're back :) I've opened a couple of discussions to deal with the wider issues - see Scope and name of different repositories and How best to support other developers. For now let's limit this issue to implementing an npm release for the library itself, on the assumption we go ahead with it. I'm fine with semver for the library, although for the record we will also need to use the git commit ID in some places. In particular, the report is read by doctors who I'd expect to interpret a commit ID as gibberish they don't care about, but who might think "1.2.3" is some kind of annoying typo. Also, it's more important for that PDF to contain an automated guarantee that nothing's changed, rather than a handwritten guarantee about exactly what has changed. I don't think that argues against showing a semver to developers, it's just another little wrinkle to be aware of. One important point is that I'm not opposed to npm in principle, it's just that it needs to add enough value to be worth the time it will actually take. That means looking for ways to both maximise value and minimise time. So, what can we do to maximise value? Documentation is the thing I always value most in packages I use, but as you've no doubt guessed, I'm not that familiar with npm's particular conventions. It seems like you normally add some keywords and a small And minimising time generally means automating the release process once we've got everything set up. GitHub Actions turn out to be a huge time-saver, and I'd want to make it so pushing to GitHub automatically deployed an npm package as well. GitHub's guide for that also suggests you publish a GitHub package - I'd probably look to do that at the same time, unless there's an obvious reason not to. Also, GitHub Actions already run inside a container, so we'd probably need to build it the node way. |
I'm reworking the Docker build process in a way that will make this (and everything else) easier to manage. It'll take a few days, but the current plan is:
Example commands will look something like:
I'm planning to just push this change out and mention it here when it's done, because it seems like the sort of thing that's best reviewed in a real-world setting. If you'd like to review a PR (or rather, one PR per repository), let me know and I'll work something out. |
Update on how this is going: The new build process is done. Among other things, this means people no longer need to build their own images, and commands to build a new release can go in the much smaller entrypoint.sh. The "library" repository is now "core". Please update any links you find with the old name. The argument that finally convinced me is that we might want to add some other library some day, so it's better to avoid the generic word "library" for any particular repository. I'm currently working on the language-agnostic parts of a release-based repository - building a changelog, PGP-signing binaries, and configuring GitHub Actions to give us a nice CI/CD pipeline. In particular, the changelog might be based on commit messages, which means I'll need to be fussier about keeping a neat commit history. I'm increasingly convinced we should standardise on As I mentioned elsewhere, the report and info need to be handled more cleverly than a normal npm package. They're also not yet designed for general use, and frankly I suspect they'll only ever be used in the dashboard (i.e. an already-solved problem). I don't mind adding Finally, to chase up something I mentioned before - what keywords should we add to the |
I'm quite surprised you went with my original proposal of renaming it to core. I found your counterargument, that the name 'core' wrongfully implies that this library is a requirement for other libraries of the sleepdiary project, increasingly convincing. Nonetheless, I'm very happy that it now has a more distinct name. On moving away from I agree that it currently doesn't make sense to publish As far as keywords go, here's a (non-exhausitve) list of keywords I propose to include: keywords: [
'sleep',
'diary',
'sleep-diary',
'sleep-format',
'circadian',
'circadian-rhythm',
'sleep-tools',
'plees-tracker',
'sleepasandroid',
'activitylog',
'sleepmeter',
'sleepchart',
'spreadsheet'
] The more the better, I think. I don't think we need to add anything else other than what |
The build script wants to download this from a public repository. This commit can be reverted once that package goes live. See sleepdiary/core#1
Yes, like many things in this project, renaming "library" to "core" is a gamble that may or may not pay off. The way I see it, there were two obvious choices - stick with "library" or switch to "core". The former was likely to cause more problems than the latter and I couldn't think of a better option, so the best available move was to switch. But that's how development is sometimes - we made a choice and we'll deal with the consequences when the time comes. My only strong opinion about I've now added Finally, here's a half-formed idea I'd like your feedback on: It would be nice if we had another option for releasing code that's public but not stable, like
What do you think about managing packages that way? |
I haven't used Regarding |
Hmm, can you give some examples of improved experience? I can't promise anything, but it's always worth knowing opportunities for improvement. |
Actually I don't see why a requirement to use
That should achieve a lot of useful goals:
|
Updates on this for today: I'm going to create release notes using merge commit messages. To that end, I've made my own forks and will make changes through the normal PR process where possible. This may or may not lead to stricter policies around "good" commit messages. Also, I should explain a side issue related to my previous post. Dependabot created a PR a few days ago that broke one of our workflows in a way that took some time to fix. In fact if you had made a PR during that time, I wouldn't have been able to accept it until the fix went in. I have now added a GitHub Action that runs unit tests on every new PR, which would have caught that bug before it was too late. That's a first step to the plan in the previous message, but I'll wait until you respond before going any further. |
A lot of things came together over this weekend, so this will be the first of several messages talking about how different tasks have moved forward. I've redesigned the build process in order to support the new dev server. That involved switching everything over to I plan to wait for your input on |
First of all, I'm sorry for mostly abandoning the issue I opened in the old repository.
As you pointed out, a lot has changed since the end of January when I initially opened the issue.
One thing however remained mostly unchanged: There is no "practical" way of using the library in node.
What do I mean by practical? For better or worse, npm is the de facto standard for node dependency and version management. The vast, vast majority of node projects use npm. That's by no means limited to server-side projects - most modern frontend frameworks use and depend on npm modules. In other words: If you are starting any new JavaScript project using a modern stack, npm is more or less inevitable.
Now, when you find a good library - like this one - that you want to use in your npm-dependent project, you can't just
npm install
oryarn add
it. Downloading the library and adding it to your project is more cumbersome yet still simple enough. But suddenly there's a moving part in your repository, which is managed completely different from the rest of your dependencies, and you need to keep track of it and update it.So while it's currently not impossible to use this library in a npm-dependent project (read: most JS projects), it's a total pain in the ass to do so.
Good news: It doesn't have to be. It's very easy to publish this library to npm without touching the build system or anything else.
For this to work, the library needs to have a version number (I very strongly suggest following semver) and a name (I'd suggest
@sleepdiary/core
, see at the end of this issue).All we would need to change in the repository is add a
package.json
that looks like this:That's essentially it.
In order to publish a new version of the module, you can either run
npm publish
, which will simply build the library, pack and publish it, or you can use something likenp
, an improvednpm publish
that also helps with versioning, release tagging, etc.To revisit the issue of naming: I propose the syntax of
@sleepdiary/<module>
. The@
symbol indicates that the module belongs to thesleepdiary
user (see npm scope). Moreover, the syntax allows the user to easily identify which modules belong to which project.All three modules that are part of the sleepdiary project could be published this way, named
@sleepdiary/core
,@sleepdiary/info
and@sleepdiary/report
respectively.@sleepdiary/core
is a personal suggestion, as the term library is quite ubiquitous in this context, but it could just as well be named@sleepdiary/library
or anything else. Obviously, it makes sense to keep the names consistent.To summarize: It's very little effort to implement and maintain this and it would allow for this library to be used in any npm-dependent project just as easily as any other module.
The text was updated successfully, but these errors were encountered: