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

nwts-tools

v0.3.6

Published

Tools for running, patching, and packaging NW.js apps.

Downloads

23

Readme

NW.ts-Tools

A simple toolkit for running, compiling, patching and packaging NW.js apps.

Usage

# Add NW.ts-Tools as a dependency.
npm i -D nwts-tools

You should also have nw installed as a dependency or devDependency.

patch-codecs

Replaces the FFmpeg library originally included with NW.js. Credits to nwjs-ffmpeg-prebuilt for the prebuilt binaries. Use this patch only for free and open-source projects. Licensing restrictions apply for closed-source software.

More information: FFmpeg License and Legal Considerations.

# Run from your project's root directory:
npx nwts-patch-codecs

package

This script downloads a fresh copy from nw (the same version as you specified in your package.json minus -sdk) and packages it alongside your already built application.

# Run from your project's root directory:
npx nwts-package

# Or, modified by environment variables:
PACKAGE_TYPE=zip NWJS_FFMPEG=PATCH NWJS_VERSION=0.55.0-sdk npx nwts-package

Environment variables used by these scripts are enumerated inside types/env.d.ts.

compile

This script runs nwjc on every Javascript file inside the directory specified in the BUILD_DIRECTORY variable, creating a .bin file for each one of them and replacing the original script's contents with the corresponding call to nw.Window.get().evalNWBin(). Read more here: Protect JavaScript Source Code.

# Run from your project's root directory:
BUILD_DIRECTORY=build npx nwts-compile

run

Used mainly for builing the application, launching it and attaching the debugger in one step.

npx nwts-run

Typed Node.js built-in modules

In NW.js you can import Node.js built-in modules with the nw.require() function, whose return type is any. Here is provided a collection of typed exports from Node.js builtin modules. Some examples:

import util from "nwts-tools/node/util";
import fs from "nwts-tools/node/fs";
import child_process, { promises } from "nwts-tools/node/child_process";
import http from "nwts-tools/node/http";
import os from "nwts-tools/node/os";
import path from "nwts-tools/node/path";

Dependencies

Windows

  • Powershell

MacOS and Linux

  • zip, required for nwts-package when PACKAGE_TYPE is set to zip.
  • unzip, required for nwts-patch-codecs and for nwts-package when NWJS_FFMPEG is set to PATCH.

Check out these starter templates that take full advantage of NW.ts-Tools features:

NW.ts-Tools Vanilla Starter NW.ts-Tools Solid Starter NW.ts-Tools React Starter NW.ts-Tools Gatsby Starter