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

soko

v0.6.0

Published

A toolbox of cli tools for building and running javascript applications.

Downloads

14

Readme

Soko

A toolbox of cli tools for building and running javascript apps.

tool box

Dan Abromov talked about his idea for "tool boxes" in his talk The Melting Pot of Javascript which could bundle developers' tools together in an updatable package using the most sensible defaults that would enable new users to hit the ground running without getting tangled in a web of configuration. These are my tools.

These are certainly not exhaustive for every situation, but these are a set of core tools I find myself reusing in each of my projects. This way, when I want to update my version of babel, or use some new fangled compression algorithm, or add new deployment methods, I can do that in one place and all my projects will be updated.

Install

npm install soko --save-dev

Install in your project locally to keep it in sync with how your project works.

Usage

npx soko <command>

Soko can be installed in your project's local node_modules folder and run using npm's new npx command (which will search in your $PATH, but also in your local node_modules/.bin for any matching command).

npx is a tool that came out with npm v5.2.0 "is meant to make it easy to use CLI tools and other executables hosted on the registry".

This is how you install node and update npm.

Launch a NodeJS Server

npx soko server /path/to/nodejs/app.js

If there's a server already running, kill it.

Watch for Changes

npx soko watch
  --cssIn /path/to/styles.scss
  --jsIn /path/to/app.js
  --assetsIn /path/to/assets/folder`

Watch source files for any changes and rebuild outputs if necessary.

Start Development Environment

npx soko dev /path/to/nodejs/app.js

Build all front-end files, start server, watch source files for changes, and restart server when they do.

Build All Front-end Assets

You can also execute all build commands in one go.

npx soko build
  --cssIn /path/to/styles.scss
  --jsIn /path/to/app.js
  --assetsIn /path/to/assets/folder`

Build React and/or ES2015+ Javascripts

npx soko build:js /path/to/app.js

Use Babel with the env preset to target specific environments (using browserlist format) for output along with Browserify to enable multi-file modules, then pass the results through uglify to make it super small.

Build SASS Styles

npx soko build:css /path/to/styles.scss

Compile SASS and minify CSS. Makes use of autoprefixer, so you can just write pure SASS/CSS.

Build Assets

Simply copy static asset files to build folder to place them altogether beside your scripts and styles. Static assets might also include HTML files ;)

npx soko build:assets /path/to/assets/folder

Revisioning All Files

npx soko rev

Copy all static assets to build folder and rename them using a hash of their contents such that the hash (and filename) will change if the contents change thereby breaking any cacheing mechanisms automatically.

Using a manifest of all renamed files, update all references to those files in any JS, CSS, or HTML files that need to load them.

Revisioning Static Assets

npx soko rev:assets

Revisioning JS

npx soko rev:js

Revisionsing CSS

npx soko rev:css

Revisioning HTML

npx soko rev:html

Deploy Build to Remote

npx soko deploy --host 100.200.111.222

Use rsync to sync files in your build folder with a remote server and run any necessary remote commands (e.g., npm install in nodejs folder to update its dependencies and then restart the server).

TODO

  • always reduce the amount of configuration required
  • add more error checking for inputs
  • return better error messages to make things obvious when they go wrong
  • write unit tests
  • add commands to build docker containers easily

License

MIT