2.0.105 • Published 6 months ago

nobj-build-nw v2.0.105

Weekly downloads
-
License
MIT
Repository
bitbucket
Last release
6 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.105

6 months ago

2.0.104

8 months ago

2.0.103

12 months ago

2.0.102

1 year ago

2.0.101

1 year ago

2.0.100

1 year ago

2.0.99

1 year ago

2.0.97

1 year ago

2.0.98

1 year ago

2.0.95

1 year ago

2.0.96

1 year ago

2.0.94

1 year ago

2.0.91

1 year ago

2.0.92

1 year ago

2.0.86

1 year ago

2.0.90

1 year ago

2.0.85

2 years ago

2.0.84

2 years ago

2.0.82

2 years ago

2.0.83

2 years ago

2.0.79

2 years ago

2.0.77

2 years ago

2.0.78

2 years ago

2.0.80

2 years ago

2.0.81

2 years ago

2.0.75

2 years ago

2.0.76

2 years ago

2.0.73

3 years ago

2.0.74

3 years ago

2.0.72

3 years ago

2.0.59

3 years ago

2.0.68

3 years ago

2.0.69

3 years ago

2.0.66

3 years ago

2.0.67

3 years ago

2.0.64

3 years ago

2.0.65

3 years ago

2.0.62

3 years ago

2.0.63

3 years ago

2.0.60

3 years ago

2.0.61

3 years ago

2.0.71

3 years ago

2.0.70

3 years ago

2.0.57

3 years ago

2.0.58

3 years ago

2.0.56

3 years ago

2.0.37

3 years ago

2.0.38

3 years ago

2.0.35

3 years ago

2.0.36

3 years ago

2.0.39

3 years ago

2.0.48

3 years ago

2.0.49

3 years ago

2.0.46

3 years ago

2.0.47

3 years ago

2.0.44

3 years ago

2.0.45

3 years ago

2.0.42

3 years ago

2.0.43

3 years ago

2.0.40

3 years ago

2.0.41

3 years ago

2.0.55

3 years ago

2.0.53

3 years ago

2.0.54

3 years ago

2.0.51

3 years ago

2.0.52

3 years ago

2.0.50

3 years ago

2.0.33

3 years ago

2.0.34

3 years ago

2.0.31

3 years ago

2.0.32

3 years ago

2.0.28

3 years ago

2.0.29

3 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.4

3 years ago

2.0.7

3 years ago

2.0.6

3 years ago

2.0.9

3 years ago

2.0.8

3 years ago

2.0.30

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

58.0.9

3 years ago

2.0.15

3 years ago

2.0.16

3 years ago

2.0.13

3 years ago

2.0.14

3 years ago

2.0.11

3 years ago

2.0.12

3 years ago

2.0.10

3 years ago

2.0.19

3 years ago

2.0.17

3 years ago

2.0.18

3 years ago

2.0.26

3 years ago

2.0.27

3 years ago

2.0.24

3 years ago

2.0.25

3 years ago

2.0.22

3 years ago

2.0.23

3 years ago

2.0.20

3 years ago

2.0.21

3 years ago

58.0.5

4 years ago

58.0.6

4 years ago

58.0.7

4 years ago

58.0.8

4 years ago

58.0.0

4 years ago

58.0.1

4 years ago

58.0.3

4 years ago

54.1.0

4 years ago

53.1.72

4 years ago

53.1.71

4 years ago

53.1.70

4 years ago

53.1.69

4 years ago

53.1.68

4 years ago

53.1.67

4 years ago

53.1.66

4 years ago

53.1.65

4 years ago

53.1.64

4 years ago

53.1.62

4 years ago

53.1.61

4 years ago

53.1.60

4 years ago

53.1.59

4 years ago

53.1.58

4 years ago

53.1.57

4 years ago

53.1.55

4 years ago

53.1.53

4 years ago

53.1.52

4 years ago

53.1.51

4 years ago

53.1.50

4 years ago

53.1.48

4 years ago

53.1.47

4 years ago

53.1.46

4 years ago

53.1.45

4 years ago

53.1.44

4 years ago

53.1.43

4 years ago

53.1.42

4 years ago

53.1.41

4 years ago

53.1.40

4 years ago

53.1.39

4 years ago

53.1.38

4 years ago

53.1.37

4 years ago

0.0.36

4 years ago

0.0.34

4 years ago

0.0.33

4 years ago

0.0.32

4 years ago

0.0.31

4 years ago

0.0.30

4 years ago

0.0.29

4 years ago

0.0.28

4 years ago

0.0.27

4 years ago

0.0.26

4 years ago

0.0.25

4 years ago

0.0.24

4 years ago

0.0.23

4 years ago

0.0.22

4 years ago

0.0.21

4 years ago

0.0.20

4 years ago

0.0.18

4 years ago

0.0.17

4 years ago

0.0.16

4 years ago

0.0.15

4 years ago

0.0.14

4 years ago

0.0.13

4 years ago

0.0.12

4 years ago

0.0.11

4 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago