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

nobj-build-nw

v2.0.104

Published

Nobj NW Application packer (ALPHA)

Downloads

29

Readme

nobj-build-nw

A tool to build applications for the NW platform. Features:

  • Installable as devDependencies with just one line
  • Joins + Obfuscates closures for NodeJS context
  • Joins + Obfuscates code, css, assets for Local Webapps
  • Compiles 100% of NodeJS context to bytecode using ByteNode (arch dependent)
  • Compiles 100% of local webapps to bytecode using NWJC (arch / plaf dependent)
  • Builds distribution packages for OSX and Windows

Installing

1 - Install the tool

  • Declare the dependency in ```devDependencies````
npm install [email protected] --save-dev

You will get the package inserted into devDependencies

  "devDependencies": {
    "nobj-build-nw": "^53.1.37"
  }
  • NW.JS version are the first two numbers: 53.1 means NWJS 0.53.1
  • Minor is the tool revision for the NWJS Version
  • Your package.json has to match this version number or compiled binaries will not work.

2 - Add scripts to package.json

You can declare the following scripts in the parent project for ease of use:

"scripts": {
    "build": "nobj-nw-build",
    "build:osx-x64": "nobj-nw-build-plaf osx x64",
    "build:win-x64": "nobj-nw-build-plaf win x64",
    "dist:osx-x64": "nobj-nw-dist osx x64",
    "dist:win-x64": "nobj-nw-dist win x64",
    "sign:osx": "nobj-nw-sign-osx dist/$npm_package_name-$npm_package_version-mac-x64/Holopoke.app",
    "proto:osx": "nobj-nw-proto-osx dist/$npm_package_name-$npm_package_version-mac-x64/Holopoke.app"
  }

3 - Setup deployment in package.json

  • The tool uses nw-builder-phoenix internally, so check out the documentation to configure the deployment. Use this as an example:
  "build": {
    "appId": "my.cool.application",
    "nwVersion": "0.53.1",
    "nwFlavor": "normal",
    "output": "./dist/",
    "packed": false,
    "targets": [
      "nsis"
    ],
    "files": [
      "bin/**",
      "app/**"
    ],
    "ffmpegIntegration": false,
    "mac": {
      "name": "MyApp",
      "displayName": "MyApp",
      "copyright": "Copyright (C) Disaster Might Happen",
      "icon": "dist.src/osx/icon-1024.icns"
    },
    "win": {
      "productName": "MyApp",
      "companyName": "NDisaster Might Happen",
      "copyright": "Copyright (C) Disaster Might Happen",
      "icon": "dist.src/win/icon.ico"
    },
    "nsis": {
      "icon": "dist.src/win/icon.ico",
      "solid": true
    }
  }

4. Create the manifest

Manifest is in .template file. This file is parsed by nobj-build-tools, that are used internally to buld the different modules.


export TEMPLATE=default

# Closure Compiler Mode
export CCMODE="--language_out=ECMASCRIPT_2018 --language_in=ECMASCRIPT_2018"

# Apple Certificate
export APPLECF_NAME="xxxxxxx"
export APPLECF_ID="xxxxxxxx"

# NW Version
export NW_VERSION=0.53.1

# Local Apps to build
export BUILD_APPS="\
[email protected]:user/repo-app-1 app-1
[email protected]:user/repo-app-2 app-2
[email protected]:user/repo-lib-1 lib-1
.
.
"
  • Each entry in BUILD_APPS will download that application, and build it using nobj-build-tools.
  • Later steps compile each application into bytecode.

Invoking the scripts

After the .template file is created, you can run the scripts.

npm run build

  • Builds the non-arch-dependent part of the applications

npm run build:osx-x64 / npm run build:win-x64

Builds the arch-dependent part of the applications

  • Compiles the source code into Bytecode.
  • Run after npm run build
  • CROSS-COMPILING IS NOT SUPPORTED, due to the fact that NWJC does not support cross-compilation: You can only generate bytecode for the current platform.

npm run dist:osx-x64 / npm run dist:win-x64

  • Creates the distribution packages under dist/
  • Will also prepare and sign the application

npm run sign:osx

  • Signs the OSX application with credentials supplied in .template
  • Called automatically by dist

npm run proto:osx

  • Adds functionality to the application manifest such as Custom Protocol Mappings
  • Called automatically by dist

Dependencies

  • To sign OSX applications, you need XCODE pre-installed, as it uses codesign.
  • To run under windows, you need CygWin pre-installed. Also suggested is to use a decent terminal other than the one included with Windows.

Work in progress

This is a work in progress and several features still don´t work, but will do soon:

  • Code Signing for Windows.
  • Code Signing for mac works barebones. Probably there are more files to sign, or refine the codesign parameters.
  • Add the Custom Protocol for Windows.
  • Windows NSIS target does not boot. Seems a packaging issue as the uncompressed target does work)

Copyright

(C) 2018-2021 Nebular Streams. License: CC 4.0 Attribution Sharealike