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

create-windowless-app

v11.0.3

Published

Create a windowless NodeJS app

Downloads

154

Readme

Create Windowless App

CodeQL Actions Status node types commit license create-windowless-app Known Vulnerabilities codecov Renovate visitors Downloads

Create a windowless Node.js app.

You can also start from this template repository create-windowless-app-template

Create Windowless App works on Windows 64-bit only If something doesn't work, please file an issue.

Pre-Requisites for template to work:

  • NodeJS version 20.0.0 or higher
  • MSBuild.exe must be in the PATH environment variable
  • signtool must be in the PATH environment variable

Quick Overview

npx create-windowless-app my-app

Note: There's an open issue regarding running npx on Windows when the user folder path contains a space. For more info and a workaround: npx#146

npm install -g create-windowless-app

And then you can run:

create-windowless-app my-app

Or in interactive mode:

npx create-windowless-app --interactive

Project Structure

create-windowless-app creates the following files:

my-app
├── node_modules
├── package.json
├── sea-config.json
├── tsconfig.json
├── tsconfig.build.json
├── webpack.config.js
├── launcher
│   ├── launcher.cs
│   ├── launcher.csproj
|   ├── launcher.ico
|   └── launcherCompiler.ts
├── resources
│   └── bin
│       └── my-app-launcher.exe
└───src
    └── index.js

No configuration or complicated folder structures, just the files you need to build your app.

Once the installation is done, you can build the project

cd my-app
npm run build

Then you can find in your my-app\dist folder the following files:

  • my-app.exe is the compiled app, with Node.js bundled (using Single Executable Applications)
  • my-app-launcher.exe is the compiled launcher.cs file that executes my-app.exe without a console window
  • snoretoast-x64.exe allows windows notification (using node-notifier)
  • my-app.log will be generated on first run (using winston logger)

create-windowless-app CLI

create-windowless-app <project-directory> [options]

Options:
    --no-typescript                 use javascript rather than typescript
    --no-husky                      do not install husky pre-commit hook for building launcher
    --icon <icon>                   override default launcher icon file

    --interactive                   interactive mode

Only <project-directory> is required.

Why?

Node.js does not have a native windowless mode (like java has javaw). Sometimes, you want to run an app as a scheduled task that runs in the background, or run a long task (i.e. a server) but do not want a console that must always be open. Best solution I could find is using a script that executes the Node.js in windowless mode

This package comes to do the following:

  1. Compile a Node.js (javascript/typescript) project into an *.exe file bundled with Node.js, so no installation is needed
  2. Compile a C# launcher that executes the compiled project, in windowless mode

Template project

The "Hello World" template is a POC containing 2 features you might want when running a windowless app:

  1. Logger
  2. Notifications

The template project build script does the following things

  1. Compiles TypeScript to JavaScript (if in a TypeScript template)
  2. Runs WebPack to bundle all JavaScript into a single file, and copy binary files into the "dist" folder
  3. Runs Node's single executable applications scripts to compile the single WebPack JavaScript output file to an exe file bundled with Node.js (Currently experimental in Node.js 20)