2.0.94 • Published 4 months ago

nobj-build-nw v2.0.94

Weekly downloads
-
License
MIT
Repository
bitbucket
Last release
4 months ago

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 nobj-build-nw@53.1.37 --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="\
git@bitbucket.org:user/repo-app-1 app-1
git@bitbucket.org:user/repo-app-2 app-2
git@bitbucket.org: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

2.0.94

4 months ago

2.0.91

5 months ago

2.0.92

5 months ago

2.0.86

5 months ago

2.0.90

5 months ago

2.0.85

6 months ago

2.0.84

9 months ago

2.0.82

12 months ago

2.0.83

9 months ago

2.0.79

1 year ago

2.0.77

1 year ago

2.0.78

1 year ago

2.0.80

1 year ago

2.0.81

12 months ago

2.0.75

1 year ago

2.0.76

1 year ago

2.0.73

1 year ago

2.0.74

1 year ago

2.0.72

2 years ago

2.0.59

2 years ago

2.0.68

2 years ago

2.0.69

2 years ago

2.0.66

2 years ago

2.0.67

2 years ago

2.0.64

2 years ago

2.0.65

2 years ago

2.0.62

2 years ago

2.0.63

2 years ago

2.0.60

2 years ago

2.0.61

2 years ago

2.0.71

2 years ago

2.0.70

2 years ago

2.0.57

2 years ago

2.0.58

2 years ago

2.0.56

2 years ago

2.0.37

2 years ago

2.0.38

2 years ago

2.0.35

2 years ago

2.0.36

2 years ago

2.0.39

2 years ago

2.0.48

2 years ago

2.0.49

2 years ago

2.0.46

2 years ago

2.0.47

2 years ago

2.0.44

2 years ago

2.0.45

2 years ago

2.0.42

2 years ago

2.0.43

2 years ago

2.0.40

2 years ago

2.0.41

2 years ago

2.0.55

2 years ago

2.0.53

2 years ago

2.0.54

2 years ago

2.0.51

2 years ago

2.0.52

2 years ago

2.0.50

2 years ago

2.0.33

2 years ago

2.0.34

2 years ago

2.0.31

2 years ago

2.0.32

2 years ago

2.0.28

2 years ago

2.0.29

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.4

2 years ago

2.0.7

2 years ago

2.0.6

2 years ago

2.0.9

2 years ago

2.0.8

2 years ago

2.0.30

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

58.0.9

2 years ago

2.0.15

2 years ago

2.0.16

2 years ago

2.0.13

2 years ago

2.0.14

2 years ago

2.0.11

2 years ago

2.0.12

2 years ago

2.0.10

2 years ago

2.0.19

2 years ago

2.0.17

2 years ago

2.0.18

2 years ago

2.0.26

2 years ago

2.0.27

2 years ago

2.0.24

2 years ago

2.0.25

2 years ago

2.0.22

2 years ago

2.0.23

2 years ago

2.0.20

2 years ago

2.0.21

2 years ago

58.0.5

2 years ago

58.0.6

2 years ago

58.0.7

2 years ago

58.0.8

2 years ago

58.0.0

3 years ago

58.0.1

3 years ago

58.0.3

3 years ago

54.1.0

3 years ago

53.1.72

3 years ago

53.1.71

3 years ago

53.1.70

3 years ago

53.1.69

3 years ago

53.1.68

3 years ago

53.1.67

3 years ago

53.1.66

3 years ago

53.1.65

3 years ago

53.1.64

3 years ago

53.1.62

3 years ago

53.1.61

3 years ago

53.1.60

3 years ago

53.1.59

3 years ago

53.1.58

3 years ago

53.1.57

3 years ago

53.1.55

3 years ago

53.1.53

3 years ago

53.1.52

3 years ago

53.1.51

3 years ago

53.1.50

3 years ago

53.1.48

3 years ago

53.1.47

3 years ago

53.1.46

3 years ago

53.1.45

3 years ago

53.1.44

3 years ago

53.1.43

3 years ago

53.1.42

3 years ago

53.1.41

3 years ago

53.1.40

3 years ago

53.1.39

3 years ago

53.1.38

3 years ago

53.1.37

3 years ago

0.0.36

3 years ago

0.0.34

3 years ago

0.0.33

3 years ago

0.0.32

3 years ago

0.0.31

3 years ago

0.0.30

3 years ago

0.0.29

3 years ago

0.0.28

3 years ago

0.0.27

3 years ago

0.0.26

3 years ago

0.0.25

3 years ago

0.0.24

3 years ago

0.0.23

3 years ago

0.0.22

3 years ago

0.0.21

3 years ago

0.0.20

3 years ago

0.0.18

3 years ago

0.0.17

3 years ago

0.0.16

3 years ago

0.0.15

3 years ago

0.0.14

3 years ago

0.0.13

3 years ago

0.0.12

3 years ago

0.0.11

3 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago