Git Product home page Git Product logo

create-windowless-app's Introduction

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

Or with npm

You can install create-windowless-app globally:

npm install -g create-windowless-app

And then you can run:

create-windowless-app my-app

npx create-windowless-app my-app

Or in interactive mode:

npx create-windowless-app --interactive

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:

dist 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)

create-windowless-app's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar renovate-bot avatar renovate[bot] avatar yoavain avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

create-windowless-app's Issues

Possible typo in home page

Hello, hope I'm not being dumb but it looks to me there may be a typo in the repo home page:

image

note it says windowsless instead of windowless.

Have a good day!

Launcher icon

Allow an option to replace default icon to the launcher

NodeJS version

Allow to configure a different NodeJS version to bundle using nexe

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.

Error when building default app

Not sure what I am doing wrong. Any help would be appreciated.

OS Version Windows 2012 R2 (64 bit)
Node Version 12.18.2
MSBuild Version 14.0.25420.1

Creating the app:

C:\imprs-sw-portal-9.2\9.2>npx create-windowless-app ws-relay-app --no-typescript --icon C:\imprs-sw-portal-9.2\9.2\WEBMI\basic\images\favicon.ico

Creating a new windowless app in C:\imprs-sw-portal-9.2\9.2\ws-relay-app.

Installing dependencies.

+ [email protected]
+ [email protected]
added 40 packages from 25 contributors and audited 40 packages in 5.248s

3 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

Installing dev dependencies.

+ [email protected]
+ [email protected]
+ [email protected]
+ [email protected]
+ [email protected]
+ [email protected]
+ [email protected]
+ [email protected]
+ [email protected]
added 615 packages from 382 contributors and audited 656 packages in 44.893s

57 packages are looking for funding
  run `npm fund` for details

found 1 moderate severity vulnerability
  run `npm audit fix` to fix them, or `npm audit` for details
Using latest nexe release: windows-x64-14.15.3
Building project files.

Building project launcher.

Building launcher with icon: C:\imprs-sw-portal-9.2\9.2\WEBMI\basic\images\favicon.ico.
Microsoft (R) Build Engine version 14.0.25420.1
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 2/17/2022 9:43:56 AM.
Project "C:\imprs-sw-portal-9.2\9.2\ws-relay-app\launcher\launcher.csproj" on node 1 (default targets).
Compile:
  C:\Program Files (x86)\MSBuild\14.0\bin\csc.exe /out:../resources/bin/ws-relay-app-launcher.exe /target:winexe /win32icon:./launc
  her.ico ./launcher.cs
  The output file is ../resources/bin/ws-relay-app-launcher.exe
Done Building Project "C:\imprs-sw-portal-9.2\9.2\ws-relay-app\launcher\launcher.csproj" (default targets).


Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:07.93
Done

Building the app:

C:\imprs-sw-portal-9.2\9.2\ws-relay-app>npm run build

> [email protected] build C:\imprs-sw-portal-9.2\9.2\ws-relay-app
> npm run webpack && npm run nexe


> [email protected] prewebpack C:\imprs-sw-portal-9.2\9.2\ws-relay-app
> rimraf build && rimraf dist


> [email protected] webpack C:\imprs-sw-portal-9.2\9.2\ws-relay-app
> webpack

(node:7540) ExperimentalWarning: The ESM module loader is experimental.
[webpack-cli] HookWebpackError: Only file and data URLs are supported by the default ESM loader
    at makeWebpackError (C:\imprs-sw-portal-9.2\9.2\ws-relay-app\node_modules\webpack\lib\HookWebpackError.js:48:9)
    at C:\imprs-sw-portal-9.2\9.2\ws-relay-app\node_modules\webpack\lib\Compilation.js:3058:12
    at eval (eval at create (C:\imprs-sw-portal-9.2\9.2\ws-relay-app\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:48:1)
    at C:\imprs-sw-portal-9.2\9.2\ws-relay-app\node_modules\webpack\lib\Compilation.js:509:26
    at C:\imprs-sw-portal-9.2\9.2\ws-relay-app\node_modules\copy-webpack-plugin\dist\index.js:708:13
-- inner error --
Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only file and data URLs are supported by the default ESM loader
    at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:727:11)
    at Loader.resolve (internal/modules/esm/loader.js:97:40)
    at Loader.getModuleJob (internal/modules/esm/loader.js:243:28)
    at ModuleWrap.<anonymous> (internal/modules/esm/module_job.js:46:40)
    at link (internal/modules/esm/module_job.js:45:36) caused by plugins in Compilation.hooks.processAssets
Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only file and data URLs are supported by the default ESM loader
    at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:727:11)
    at Loader.resolve (internal/modules/esm/loader.js:97:40)
    at Loader.getModuleJob (internal/modules/esm/loader.js:243:28)
    at ModuleWrap.<anonymous> (internal/modules/esm/module_job.js:46:40)
    at link (internal/modules/esm/module_job.js:45:36)
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] webpack: `webpack`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] webpack script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator.WIN2012DEV\AppData\Roaming\npm-cache\_logs\2022-02-17T15_17_57_318Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] build: `npm run webpack && npm run nexe`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator.WIN2012DEV\AppData\Roaming\npm-cache\_logs\2022-02-17T15_17_57_355Z-debug.log

Your .dependabot/config.yml contained invalid details

Dependabot encountered the following error when parsing your .dependabot/config.yml:

Automerging is not enabled for this account. You can enable it from the [account settings](https://app.dependabot.com/accounts/yoavain/settings) screen in your Dependabot dashboard.

Please update the config file to conform with Dependabot's specification using our docs and online validator.

Add script to re-build launcher

  • Include script to re-build launcher in package.json
  • Include icon in project to use in launcher re-build script
  • maybe use husky for pre-commit task to build launcher on src change

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • Update actions/checkout action to v4.1.4
  • Update dependency @tsconfig/node20 to v20.1.4
  • Update dependency typescript to v5.4.5
  • Update dependency @types/node to v20.12.7
  • Update dependency webpack to v5.91.0
  • Update dependency winston to v3.13.0
  • Update dependency eslint to v9
  • Update dependency eslint-plugin-jest to v28
  • Update dependency eslint-plugin-security to v3
  • 🔐 Create all rate-limited PRs at once 🔐

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

github-actions
.github/workflows/codeql-analysis.yml
  • actions/checkout v4
  • github/codeql-action v3
  • github/codeql-action v3
  • github/codeql-action v3
.github/workflows/new-dependencies-advisor.yml
  • actions/checkout v4.1.1
  • lirantal/github-action-new-dependencies-advisor v1.2.0
.github/workflows/nodejs.yml
  • actions/checkout v4.1.1
  • actions/setup-node v4.0.2
  • microsoft/setup-msbuild v2.0.0
  • codecov/codecov-action v3.1.6
  • actions/checkout v4.1.1
  • GuillaumeFalourd/setup-windows10-sdk-action v1.12
  • myci-actions/export-env-var-powershell 1
  • actions/setup-node v4.0.2
  • microsoft/setup-msbuild v2.0.0
  • softprops/action-gh-release v1
npm
package.json
  • chalk 4.1.2
  • cross-spawn 7.0.3
  • fs-extra 11.2.0
  • inquirer 8.2.6
  • validate-npm-package-name 5.0.0
  • yargs 17.7.2
  • @tsconfig/node20 20.1.2
  • @types/cross-spawn 6.0.6
  • @types/fs-extra 11.0.4
  • @types/inquirer 8.2.10
  • @types/jest 29.5.12
  • @types/mock-fs 4.13.4
  • @types/node 20.11.30
  • @types/node-notifier 8.0.5
  • @types/validate-npm-package-name 4.0.2
  • @types/winston 2.4.4
  • @typescript-eslint/eslint-plugin 5.62.0
  • @typescript-eslint/parser 5.62.0
  • add-shebang 0.1.0
  • copy-webpack-plugin 12.0.2
  • cross-env 7.0.3
  • del 6.1.1
  • eslint 8.57.0
  • eslint-plugin-import 2.29.1
  • eslint-plugin-jest 27.9.0
  • eslint-plugin-node 11.1.0
  • eslint-plugin-security 1.7.1
  • global-npm 0.5.0
  • husky 8.0.3
  • jest 29.7.0
  • lint-staged 15.2.2
  • mock-fs 5.2.0
  • mocked-env 1.3.5
  • node-notifier 10.0.1
  • nyc 15.1.0
  • postject 1.0.0-alpha.6
  • prettier 3.2.5
  • rimraf 5.0.5
  • tmp-promise 3.0.3
  • ts-jest 29.1.2
  • ts-loader 9.5.1
  • ts-node 10.9.2
  • typescript 5.4.2
  • webpack 5.90.3
  • webpack-cli 5.1.4
  • winston 3.12.0
  • node >=20
  • npm >=9

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.