npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@gorjusborg/hello

v1.0.1

Published

To get a grip on basics of clojurescript on node, writing a hello world app using shadow-cljs.

Downloads

4

Readme

hellow world

To get a grip on basics of clojurescript on node, writing a hello world app using shadow-cljs.

npm install -g shadow-cljs
shadow-cljs init
npm init -y

Using the approach outlined in https://medium.com/@cruzw/build-and-publish-your-first-command-line-application-with-npm-6192f4044779 for the directory layout.

npm install ws --save-dev
npm install source-map-support -save-dev
shadow-cljs node-repl

Cannot find module 'ws'

Install ws node module

npm install ws --save-dev

Get rid of no source map support warnings by installing source map support npm install source-map-support --save-dev

Build the cli client (app is name I have it in the edn config file): shadow-cljs compile app

The file ends up in bin/hello. I had to set its executable bit with chmod +x.

installing the cli app

At the root of the project: npm install -g

uninstalling the cli app

npm uninstall -g

publishing the app to npm

I'm going by this article: https://zellwk.com/blog/publish-to-npm/.

Seems reasonable to use np to manage the process.

Also, I'm going to be pushing a scoped package.

ignoring files

The first thing I noticed when trying to publish for the first time was that all the files in the package were being added (even hidden files). It turns out that npm will honor .gitignore, but you can also use a .npmignore file with the same syntax.

publishing and lock files

Also, it occurs to me that I don't know whether the lock file should be included in the npm package.

From the docs, it seems that npm-shrinkwrap.json predates the package-lock.json, and you can opt to use the older file. However, you cannot publish a package-lock.json to npm. However, you can run npm shrinkwrap to convert a package-lock.json to a shrinkwrap file, and that can be published to npm. This effectively forces locks on install.

From https://docs.npmjs.com/files/shrinkwrap.json I gathered that apps deployed through npm should include a shrinkwrap file to lock dependencies when installed by users.

So, I converted the package-lock.json to npm-shrinkwrap.json by using: npm shrinkwrap

I then did a dry run of the publish:

npm publish --dry-run

Then, I did the real publish: npm publish

Oh, but it didn't work. I got an HTTP 402 error, I think because I'm trying to publish to a scoped package name, and I don't have a paid npm account. I can still publish to a scoped name by making it public (the default must be private).

npm publish --access public

Verifying the public package

To verify the publish worked, I ran: npm install -g @gorjusborg/hello

This worked, and I was able to run the command (as I had the npm bin on my PATH). However, the command failed due to an import reference to the .shadow-cljs directory. This directory was stripped on publish, and it turns out the dev build needs it. Oh, and I guess I published a dev build. Oops.

So I then ran: shadow-cljs release

This seemed to take a while, but the output file (./bin/hello) seemed to have minified javascript code in it. No more external loading from .shadow-cljs/.