Code Monkey home page Code Monkey logo

nw-builder's Introduction

nw-builder

npm Join the chat at https://gitter.im/nwjs/nw-builder

Build NW.js applications for Mac, Windows and Linux.

For version 3, please go to the corresponding branch.

Major Features

  • Get, run or build applications.
  • Integrate FFmpeg community builds
  • Configure executable fields and icons
  • Downloading from mirrors
  • Node Native Addon support

Table of Contents

Install

Every NW.js release includes a modified Node.js binary at a specific version. It is recommended to install exactly that version on the host system. Not doing so may download ABI incompatible Node modules. Consult the NW.js versions manifest for what Node.js version to install. It is recommended to use a Node version manager (such as volta, n, nvm, or nvm-windows) to be able to easily install and switch between Node versions.

For example, NW.js v0.83.0 comes with Node.js v21.1.0.

$: node --version
v21.1.0

Usage

This package can be used via a command line interface, be imported as a JavaScript module, or configured via the Node manifest as a JSON object.

ESM import:

import nwbuild from "nw-builder";

CJS import:

let nwbuild;
import("nwbuild")
  .then((object) => {
    nwbuild = obj;
  })
  .catch((error) => {
    console.error(error);
  });

Node manifest usage:

{
    "nwbuild": {
        // user specified options
    }
}

From here on we will show nw-builder functionality by using the JavaScript module. Please note that the same method applies when using a command line or Node manifest.

Concepts

nw-builder can get, run and build NW.js applications. We refer to them as get, run and build modes.

Get Mode

Deprecation warning: From v4.6.4 onward, run mode is deprecated. This logic will be ported over to nwjs/npm-installer repo and removed in the next major release.

By default you get the normal build of the latest NW.js release for your specific platform and arch. For more information, please refer to the API reference.

nwbuild({
  mode: "get"
});

Get the community built FFmeg which contains proprietary codecs. This options is disabled by default. Please read the license's constraints before enabling this option.

nwbuild({
  mode: "get",
  ffmpeg: true
});

Get Node headers if you have to rebuild Node addons.

nwbuild({
  mode: "get",
  nativeAddon: "gyp"
});

Run Mode

Deprecation warning: From v4.6.0 onward, run mode is deprecated. This logic will be ported over to nwjs/npm-installer repo and removed in the next major release.

nwbuild({
  mode: "run",
  srcDir: "./app",
  glob: false,
});

Build Mode

Build with defaults:

nwbuild({
  mode: "build",
});

Managed Manifest

You can let nw-builder manage your node modules. The managedManifest options accepts a boolean, string or object type. It will then remove devDependencies, autodetect and download dependencies via the relevant packageManager. If none is specified, it uses npm as default.

Setting it to true will parse the first Node manifest it encounters as the NW manifest.

nwbuild({
  mode: "build",
  managedManifest: true,
});

Setting it to a string implies that you are passing the file path to the NW manifest.

nwbuild({
  mode: "build",
  managedManifest: "./nw.js",
});

Setting it to a object implies you are directly passing the NW manifest as a JavaScript object.

nwbuild({
  mode: "build",
  managedManifest: {
    name: "nwdemo",
    main: "index.html"
  },
});

Rebuild Node addons

Currently this feature is quite limited. It only builds node addons which have a binding.gyp file in the srcDir. There are plans to support nan, cmake, ffi and gn and auto rebuild native addons which are installed as node modules.

nwbuild({
  mode: "build",
  nodeAddon: "gyp",
});

We recommend rebuilding Node addons for NW.js via node-gyp if you are using NW.js v0.83.0 or above.

node-gyp rebuild --target=21.1.0 --nodedir=/path/to/nw/node/headers

NW.js's Node version should match the Node version on the host machine due to ABI differences in V8.

API Reference

Options

Name Type Default Description
mode "get" | "run" | "build" "build" Choose between get, run or build mode
version string | "latest" | "stable" "latest" Runtime version
flavor "normal" | "sdk" "normal" Runtime flavor
platform "linux" | "osx" | "win" Host platform
arch "ia32" | "x64" | "arm64" Host architecture
downloadUrl "https://dl.nwjs.io" | "https://npm.taobao.org/mirrors/nwjs" | https://npmmirror.com/mirrors/nwjs | "https://github.com/corwin-of-amber/nw.js/releases/" "https://dl.nwjs.io" Download server. Supports file systems too (for example file:///home/localghost/nwjs_mirror)
manifestUrl "https://nwjs.io/versions" | "https://raw.githubusercontent.com/nwutils/nw-builder/main/src/util/osx.arm.versions.json" "https://nwjs.io/versions" Versions manifest
cacheDir string "./cache" Directory to cache NW binaries
srcDir string "./" File paths to application code
outDir string "./out" Directory to store build artifacts
managedManifest boolean | string | object false Managed manifest
nodeAddon false | "gyp" false Rebuild Node native addons
cache boolean true If true the existing cache is used. Otherwise it removes and redownloads it.
ffmpeg boolean false If true the chromium ffmpeg is replaced by community version with proprietary codecs.
glob boolean true If true file globbing is enabled when parsing srcDir.
logLevel "error" | "warn" | "info" | "debug" "info" Specify level of logging.
zip boolean | "zip" | "tar" | "tgz" false If true, "zip", "tar" or "tgz" the outDir directory is compressed.

Guides

Get unofficial MacOS builds

If you're running older Apple machines, you can download the unofficial builds.

Note: You will have to manually remove quarantine flag.

sudo xattr -r -d com.apple.quarantine /path/to/nwjs.app
nwbuild({
  mode: "get",
  platform: "osx",
  arch: "arm64",
  downloadUrl: "https://github.com/corwin-of-amber/nw.js/releases/download",
  manifestUrl: "https://raw.githubusercontent.com/nwutils/nw-builder/main/src/util/osx.arm.versions.json",
});

Note: Community FFmpeg binaries may not be available for unofficial builds. You will have to rebuild them yourself.

Get binaries via mirrors

China mirror:

nwbuild({
  mode: "get",
  downloadUrl: "https://npm.taobao.org/mirrors/nwjs",
});

Singapore mirror:

nwbuild({
  mode: "get",
  downloadUrl: "https://cnpmjs.org/mirrors/nwjs/",
});

Let nw-builder manage your native addons

Note: this behaviour is buggy and quite limited. This guide is to show what will be possible in the coming minor releases.

nwbuild({
  mode: "build",
  managedManifest: true,
  nativeAddon: "gyp",
});

Contributing

External contributor

  • We use Conventional Commits style of commit messages.
  • On opening a new PR, the comments will guide you on how to construct the new PR.
  • When making changes, try to follow SOLID and DRY principles.
  • Pull requests are squashed and merged onto the main branch.
  • PR title is used as commit's first line, PR description is used as commit body.
  • Only commit messages starting with fix, feat and chore are recognised by the Release Please bot.
  • Lint your code before commiting your change.
  • Add tests whenever possible.

Maintainer guidelines

  • Approve pull requests before merging.
  • Enforce conventional commits before merging pull requests.
  • A commit's first line should be formatted as <type>[optional scope]: <description>.
  • A commit's body should have a description of changes in bullet points followed by any links it references or issues it fixes or closes. It may include an optional Notes: ... section to provide additional context on why the PR is being merged when it doesn't seem like it should.
  • Google's Release Please Action is used to update the changelog, bump the package version and generate GitHub releases.
  • NPM Publish Action publishes to npm if there is a version bump.

Roadmap

Bugs

  • Managed Manifest is broken. If glob is disabled and srcDir has no package.json, build fails.
  • Add back error, info, warn and debug logs

Features

  • feat(get): support canary releases
  • feat(bld): rename MacOS Helper apps
  • feat(pkg): add AppImage installer
  • feat(pkg): add NSIS installer
  • feat(pkg): add DMG installer
  • feat(get): add Linux ARM unofficial support
  • feat(bld): add source code protection
  • feat(pkg): add code signing

Chores

  • chore(cli): migrate from yargs to commander
  • chore(get): verify sha checksum for downloads
  • chore: annotate file paths as fs.PathLike instead of string.
  • chore(bld): factor out core build step
  • chore(bld): factor out linux config
  • chore(bld): factor out macos config
  • chore(bld): factor out windows config
  • chore(bld): factor out native addon
  • chore(bld): factor out compressing
  • chore(bld): factor out managed manifest
  • chore(bld): move .desktop entry file logic to create-desktop-shortcuts package
  • chore(util): factor out file paths as constant variables

FAQ

License

MIT License.

nw-builder's People

Contributors

1j01 avatar ad9491 avatar adam-lynch avatar ayushmanchhabra avatar badsyntax avatar bamboocz avatar bastimeyer avatar clooth avatar davedoesdev avatar dblk avatar dependabot[bot] avatar egauci avatar eridal avatar freakinside avatar gabepaez avatar github-actions[bot] avatar greenkeeperio-bot avatar hammerowen avatar ivantodorovich avatar kessler avatar nathan avatar nrako avatar piwonesien avatar rocketvibes avatar steffenmllr avatar sysrage avatar thejaredwilcurt avatar trevorah avatar yoshuawuyts avatar zkrige avatar

Stargazers

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

Watchers

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

nw-builder's Issues

Error: EMFILE, open

When I run the node-webkit-builder, I get the following error

events.js:72
throw er; // Unhandled 'error' event
^
Error: EMFILE, open '/Users/robin/project/xxxxxxx--xxxx.js'
Warning: -> error 8 /Users/robin/project/xx---xxxxxxxxx.js (1671ms) Use --force to continue.

Aborted due to warnings.

I initially thought that its because of too many files in my project, but I still get this even if I reduce the number of files in my project significantly.

Surprising it works when I run it through terminal of my Intellij. This sounds too weird to me also.

Building for Linux on Windows doesn't work

{ [Error: ENOENT, no such file or directory 'C:......\cache\0.9.1\linux32\nw']
errno: 34,
code: 'ENOENT',
path: 'C:......\cache\0.9.1\linux32\nw',
syscall: 'lstat' }

It looks to me like it's because nw is not a child of the linux32 directory, but a grandchild;
capture

Promise Error Handling Issue

If you try to download a version that isn't there (which happens by default now, fixed by #27 ), the download failing does not report an error. Instead, the zlib module errors out while trying to gunzip the package which gives this cryptic error message from bluebird.

~/node-webkit-test/node_modules/node-webkit-builder/node_modules/bluebird/js/main/promise_resolver.js:119
        throw new TypeError("Illegal invocation, resolver resolve/reject must 
              ^
TypeError: Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.
    at Gunzip.PromiseResolver$reject (~/node-webkit-test/node_modules/node-webkit-builder/node_modules/bluebird/js/main/promise_resolver.js:119:15)
    at Gunzip.emit (events.js:117:20)
    at Zlib._binding.onerror (zlib.js:298:10)

Instead, the download should properly fail by listening to the 'error' event from request. I'm not sure about the bluebird error, but I think it has to do with the call to Promise#reject in the wrong context.

Access downloads through proxy

Downloads don't work from behind a corporate firewall.

I made two changes:

  • updated "request" to 2.40.0
  • Added "rq.proxy = true;" to downloadAndUnpack in downloader.js

And it works. (setting rq.proxy to true allows request to use process.env.HTTP_PROXY et al if available).

I can only test on a Win 7 machine behind the firewall.

(I'm willing to submit a pull request, but my ability to test on different platforms is limited.)

Window features not working on Windows

Hi there,

I've compiled an app for all OS from a Mac.
For Mac, everything is allright. For Windows, the app is working fine except for window features: closing or minimizing the app is not possible (using node webkit API)...

I've searched a bit but I found nothing about a similar issue. Any idea?

By the way, your tool is fantastic :) it saves me so much time!

Anolis Resourcer Program has stopped working

image

Description:
Stopped working (wow thanks)

Problem signature:
Problem Event Name: CLR20r3
Problem Signature 01: resourcer.exe
Problem Signature 02: 0.9.3531.38736
Problem Signature 03: 4a9d92b4
Problem Signature 04: mscorlib
Problem Signature 05: 2.0.0.0
Problem Signature 06: 530eec86
Problem Signature 07: 34a9
Problem Signature 08: 119
Problem Signature 09: System.IO.DirectoryNotFound
OS Version: 6.1.7601.2.1.0.768.3
Locale ID: 1033

Read our privacy statement online:
http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409

If the online privacy statement is not available, please read our privacy statement offline:
C:\Windows\system32\en-US\erofflps.txt

Command line output:

bla bla bla
Update executable icon

close program

Unhandled Exception: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\Isaiah\AppData\Local\Anolis\Exceptions.log'.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions o
ptions, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean
bFromProxy)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
   at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize)
   at System.IO.StreamWriter..ctor(String path, Boolean append)
   at Anolis.Resourcer.Program.Main(String[] args)
Error while updating the Windows icon.

Pack custom ffmpegsumo

I need to pack a custom built ffmpegsumo.dll (win), ffmpegsumo.so (osx) and libffmpegsumo.so (linux).

Is there a way to do so using this module?

New syntax proposal

Idea 1

Changes

  • self-instantiated
  • removed build()
  • callback moved to main function

Syntax

promise:

nwbuild({
    files: "src/**/**"
})
.catch(callback)
.then(callback);

callback:

nwbuild({
    files: "src/**/**"
},
function(error) {
    if (error) throw error;
});

Idea 2

Changes

  • self-instantiated
  • config moved to build()
  • callback moved to arguments[1]

Syntax

promise:

nwbuilder.build({
    files: "src/**/**"
})
.catch(callback)
.then(callback);

callback:

nwbuilder.build({
    files: "src/**/**"
},
function(error) {
    if (error) throw error;
});

MAINTAINER NEEDED

Since I don't really have time to finish this at the moment and a couple of people are using it it would be great if somebody would take lead on this and do the following tasks:

If you feel up for the tasks I'll give your write permissions to the repo and to npm.

ERROR: Using v0.10.1-1

(Manually specifying a version works.)

Latest Version: v0.10.1-1
Using v0.10.1-1
Create cache folder in C:\Users\Isaiah\Code\GitHub\node-webkit-builder\cache\0.10.1-1
Downloading: http://dl.node-webkit.org/v0.10.1-1/node-webkit-v0.10.1-1-win-ia32.zip
ERROR: The version 0.10.1-1 does not have a corresponding build posted at http://dl.node-webkit.org/. Please choose a version from that list.
Unable to download nodewebkit.

The package nodewebkit is at 0.10.1-1 so it tries to dl 0.10.1-1 whereas http://dl.node-webkit.org/ has v0.10.2, which it ought to somehow find.

Should this be taken up as an issue on https://github.com/shama/nodewebkit to release v0.10.2? Why are we taking the versions from "An installer for node-webkit"? Scraping seems more reliable, as long as http://dl.node-webkit.org/ stays as an index listing.

At any rate, we can't expect the package not to have intermediate versions. Maybe we should just strip out the dash part.

Build fails when building offline

Gives you some kind of error about the version, while what it should do is implement a check whether or not it can fetch the resource from the server.

it's --quite --quiet in here

quite should be quiet

also, there are a few more "plattform" spellings of "platform" (one in the readme and 3 in bin/nwbuild)

๐Ÿ’ค good night ๐ŸŒ” โ›ต ๐Ÿ’จ

Getting error: "The application cannot be opened because its executable is missing." when trying to open the app.

After building my app, the Windows version works fine, but when I try to open the osx version (using open appName.app in terminal), I get "The application cannot be opened because its executable is missing."

I've looked at the Info.plist file, and it lists node-webkit as the executable. I found that file in appName.app/Contents/MacOS. Tried changing Info.plist to specify that path, but that didn't help.

Any ideas? Thank you very much for your help.

Built via terminal on Mac, using "sudo nwbuild -p osx app.nw" (my app is in the app.nw directory).

Sort long path problems for Windows

What would cause a nw.exe to open on the dummy page with the ascii art? How can I troubleshoot it?

I've seen it a good few times before. Right now it's happening consistently. I can build for Mac on any platform without problems, but if I build for Windows (on Windows / Mac) it'll build fine but when ran it shows the ascii art screen. To be clear, I've even built the app on a Mac and transferred the files to a Windows machine. I've tried multiple Windows machines.

The exe looks the right size and if I rename it to nw.zip & extract, then it seems all my files are there.

Can you clarify how node-webkit-builder works?

Description says this:

It will download the prebuilt binaries for a newest version, unpacks it, creates a release folder, create the app.nw file for a specified directory and copies the app.nw file where it belongs.

Does that mean that a binary is made by downloading node-webkit and packaging it as part of the release binary. OR does this mean that the binary itself, when installed on an end-user's computer, will download the prebuilt node-webkit binary? And if it doesn't do the second, could it? (As that would be really awesome.)

Cannot start linux64 (32?) build on win8

./[...]: error while loading shared libraries: libudev.so.0: cannot open shared object file: No such file or directory
I get above error message. Are the builds incomplete?

using run() with more than one platform always run the windows executable

Code to recreate:

var NwBuilder = require('node-webkit-builder')
var nw = new NwBuilder({
    files: './nwapp/**/**', // use the glob format
    platforms: ['win','osx']
})
nw.run(cb)

when run on OSX results in:

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: spawn EACCES
    at errnoException (child_process.js:998:11)
    at Process.ChildProcess._handle.onexit (child_process.js:789:34)

when debugging the problem I discovered that its because the executable being run is nw.exe
this is because of the runApp() implementation (lib/index.js):

NwBuilder.prototype.runApp = function () {
    var self = this,
        platform = this._platforms[0],  // <------ this is the problem
        executable = path.resolve(platform.cache, platform.runable);

        self.emit('log', 'Launching App');
        return new Promise(function(resolve, reject) {
            var p = spawn(executable, ['--enable-logging', self.options.files.replace(/\*[\/\*]*/,"")]);

            p.stdout.on('data', function(data) {
                self.emit('stdout', data);
            });

            p.stderr.on('data', function(data) {
                self.emit('stderr', data);
            });

            p.on('close', function(code) {
                self.emit('log', 'App exited with code ' + code);
                resolve();
            });
        });
};

this doesn't happen when running from command line because (bin/nwbuild):

// Check Plattform, if we are in run mode
if(argv.r) {
    switch(process.platform) {
        case 'darwin':
            options.platforms = ['osx'];
        break;

        case 'win32':
            options.platforms = ['win'];
        break;

        case 'linux':
            options.platforms = [(process.arch === 'x64' ? 'linux64' : 'linux32')];
        break;
        default:
            console.log('Unable to run app - plattform is not supported');
            process.exit(0);
        break;
    }
}

which cause _platforms to contain only 1 platform

PR will follow...

Fatal error: ZIP end of central directory

Im getting the following error when i try to run:

~/code/nodewebkit/nodewebkit-angular-sass-grunt-example (763): grunt build
Running "nodewebkit:src" (nodewebkit) task
Downloading: http://dl.node-webkit.org/v0.0.1/node-webkit-v0.0.1-win-ia32.zip
Downloading: http://dl.node-webkit.org/v0.0.1/node-webkit-v0.0.1-osx-ia32.zip
Unzipping: .../nodewebkit/nodewebkit-angular-sass-grunt-example/dist/cache/win/0.0.1/node-webkit-v0.0.1-win-ia32.zip
Fatal error: ZIP end of central directory record signature invalid (expects 0x06054b50, actually 0x4f44213c)

This is how my grunt fconfig looks:
nodewebkit: {
options: {
build_dir: './dist', // Where the build version of my node-webkit app is saved
mac: true, // We want to build it for mac
win: true, // We want to build it for win
linux32: false, // We don't need linux32
linux64: false, // We don't need linux64
//download_url: 'http://www.soundnodeapp.com/build/',
//mac_icns: './app/soundnode.icns',
version: '0.0.1'
},
src: [
'./app//*'
//'!./app/public/stylesheets/sass',
//'!./app/public/stylesheets/config.rb',
//'!./
/*.sass-cache',
//'!./app/public/assets'
]
},

What is wrong heeler, the error message tells me nothing.

options.winIco produces broken applications

The builder work fine (in windows) until i add the winIco in the options. The icon changes but when i run the program all i get is a node-webkit default window.

I've tried to add the icon with resource hacker and the program works with the new icon

Download fails sometimes

There's no error, it just sits at 1%

Here's a screenshot where it has downloaded the osx version, but won't download the windows version, so it sits at about 50%

image

It might be only the windows version that it sometimes fails to download but I'm not sure.

It usually works the second time.
#66 could fix this.

RangeError: Maxium call stack size exceeded.

Hi,

I get the following error when trying to build with nwbuild:

{ [RangeError: Maximum call stack size exceeded]
errno: 47,
code: 'EEXIST',
path: '',
syscall: 'mkdir' }

It seems to work fine when dragging my folder onto nw.exe. Any ideas what is causing this?

Thanks,
-John

Help using using the module with GulpJS.

Hello,

What am I doing wrong with this? I've tried two approaches:

gulpfile.js:

// Load the required modules
var gulp = require('gulp');
var nib = require('nib');
var stylus = require('gulp-stylus');
var NwBuilder = require('node-webkit-builder');

gulp.task('stylus', function () {
    gulp.src('./src/app/styl/app.styl')
    .pipe(stylus({
        use: [nib()],
        compress: true
    }))
    .pipe(gulp.dest('./src/app/css'));
});

gulp.task('nw', ['stylus'], function () {
    gulp.src( ['./src/**', './node_modules/**', '!./node_modules/gulp*/**', './package.json', './README.md', './LICENSE.txt' ])
    .pipe(NwBuilder({
        version: '0.9.2',
        platforms: [ 'win', 'osx', 'linux32', 'linux64' ],
        macIcns: './images/appicon.icns',
        appName: 'App Name'
    }))
    .pipe(gulp.dest('./build'));
});

gulp.task('nodewebkit', ['stulys'], function () {
    var nw = new NwBuilder({
        version: '0.9.2',
        files: [ './src/**', './node_modules/**', '!./node_modules/gulp*/**', './package.json', './README.md', './LICENSE.txt' ],
        platforms: [ 'win', 'osx', 'linux32', 'linux64' ],
        macIcns: './images/appicon.icns',
        appName: 'App Name'
    });

    // Log stuff you want
    nw.on('log',  console.log);

    // Build retruns a promise
    nw.build().then(function () {
        console.log('all done!');
    }).catch(function (error) {
        console.error(error);
    });
});

gulp.task('default', ['stylus']);

gulp.task('css', ['stylus']);

I am fairly new to both Node & Gulp, but I am eager to learn! Please, if anyone can see my logic, please help me in the right direction. Any help is really appreciated!

locales directory required to be copied for Win/Linux 0.10.* or over

node-webkit apps are now required to be shipped with locales folder for Windows and Linux 0.10.* or over, otherwise 'navigator.language' becomes empty and fails to detect OS language.

Sorry, I have no time to create PR now but hope this information helps.
nwjs/nw.js#2031

FYI, we have temporarily made a quick fix to add another Grunt task to copy locales dir but this can be done on node-webkit-builder side.

Can't build 0.10.2 for linux64 on OS X (EISDIR error)

Get this EISDIR error when trying to build my app for linux64:

It only happens with v0.10.2 (0.10.1 worked fine) and if linux is included in the platforms array. Here's options I pass (except version, they didn't change since 0.10.1):

nodewebkit: {
    dist: {
        options: {
            version: '0.10.2',
            platforms: ['win', 'osx', 'linux32', 'linux64'],
            appName: 'App',
            appVersion: '<%= pkg.version %>',
            distDir: 'build/',
            cacheDir: 'build/cache/',
            macCredits: 'support/Credits.html',
            macIcns: 'support/app.icns'
        },
        src: ['<%= distDir %>/**']
    }
}

Windows app icon

Passing a winIco breaks things. I get the dummy "node webkit" (in ascii art) app. macIcns works fine.

Can someone provide an example for macPlist field?

I've tried to set my app as the default app to open *.keeex files in OSX and I configured the builder to change plist file (see below). Finally, when building I've got the error:
>> There was an Error: You have to set the appName and appVersion in the Plist options
What's wrong I had done?
Can someone provide an example for my case?

Thank you very much.

My configuration:

mac: {
    options: {
        version: '0.9.2',
        platforms: ['osx'],
        buildDir: './webkitbuilds',
        macPlist: '<?xml version="1.0" encoding="UTF-8"?>' +
            '<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">' +
            '<plist version="1.0">' +
                '<dict>' +
                    '<key>BuildMachineOSBuild</key>' +
                    '<string>12C3006</string>' +
                    '<key>CFBundleDevelopmentRegion</key>' +
                    '<string>en</string>' +
                    '<key>CFBundleDisplayName</key>' +
                    '<string>KeeeX</string>' +
                    '<key>CFBundleExecutable</key>' +
                    '<string>node-webkit</string>' +
                    '<key>CFBundleIconFile</key>' +
                    '<string>nw.icns</string>' +
                    '<key>CFBundleIdentifier</key>' +
                    '<string>com.intel.nw</string>' +
                    '<key>CFBundleInfoDictionaryVersion</key>' +
                    '<string>6.0</string>' +
                    '<key>CFBundleName</key>' +
                    '<string>KeeeX</string>' +
                    '<key>CFBundlePackageType</key>' +
                    '<string>APPL</string>' +
                    '<key>CFBundleShortVersionString</key>' +
                    '<string>Version lydig-1.0</string>' +
                    '<key>CFBundleVersion</key>' +
                    '<string>lydig-1.0</string>' +
                    '<key>DTSDKBuild</key>' +
                    '<string>11E52</string>' +
                    '<key>DTSDKName</key>' +
                    '<string>macosx10.7</string>' +
                    '<key>DTXcode</key>' +
                    '<string>0452</string>' +
                    '<key>DTXcodeBuild</key>' +
                    '<string>4G2008a</string>' +
                    '<key>LSFileQuarantineEnabled</key>' +
                    '<true/>' +
                    '<key>LSMinimumSystemVersion</key>' +
                    '<string>10.6.0</string>' +
                    '<key>NSPrincipalClass</key>' +
                    '<string>NSApplication</string>' +
                    '<key>NSSupportsAutomaticGraphicsSwitching</key>' +
                    '<true/>' +
                    '<key>SCMRevision</key>' +
                    '<string>239963</string>' +
                    '<key>CFBundleDocumentTypes</key>' +
                    '<array>' +
                        '<dict>' +
                            '<key>CFBundleTypeName</key>' +
                            '<string>keeex</string>' +
                            '<key>CFBundleTypeIconFile</key>' +
                            '<string>nw.icns</string>' +
                            '<key>LSHandlerRank</key>' +
                            '<string>Owner</string>' +
                            '<key>LSItemContentTypes</key>' +
                            '<array>' +
                                '<string>com.keeex.keeex</string>' +
                            '/array>' +
                        '/dict>' +
                    '/array>' +
                    '<key>UTExportedTypeDeclarations</key>' +
                    '<array>' +
                        '<dict>' +
                            '<key>UTTypeConformsTo</key>' +
                            '<array>' +
                                '<string>public.data</string>' +
                            '/array>' +
                            '<key>UTTypeDescription</key>' +
                            '<string>KeeeX</string>' +
                            '<key>UTTypeIconFile</key>' +
                            '<string>nw.icns</string>' +
                            '<key>UTTypeIdentifier</key>' +
                            '<string>com.keeex.keeex</string>' +
                            '<key>UTTypeReferenceURL</key>' +
                            '<string>https://keeex.io</string>' +
                            '<key>UTTypeTagSpecification</key>' +
                            '<dict>' +
                                '<key>com.apple.ostype</key>' +
                                '<string>keeex</string>' +
                                '<key>public.filename-extension</key>' +
                                '<array>' +
                                    '<string>keeex</string>' +
                                '/array>' +
                                '<key>public.mime-type</key>' +
                                '<string>application/octet-stream</string>' +
                            '/dict>' +
                        '/dict>' +
                    '/array>' +
                '</dict>' +
            '</plist>'
    },
    src: ['./dist/mac/**/*']
}

env: node\r: No such file or directory

Can't run nwbuild

It returns env: node\r: No such file or directory with every execution

nwbuild -r .
env: node\r: No such file or directory

nwbuild -h
env: node\r: No such file or directory

Platform based plugin copying

Hi
Currently all files in app/plugin folder are are copied to all different builds. Instead it should only copy the plugin files relevant to the platform. Currently i am shipping my builds (mac/windows) with flashplayer (Flash Player.plugin & pepflashplayer.dll). when running the deploy build, i got these both the files copied to both the builds. This is unnecessary, and end up taking more space than expected.

Is there any way to copy the plugin files on conditional basis?. If there isn't any existing approach, i would like to make a patch?

Please let me know

Linux: Uses older nw version

Hey,
I'm on kubuntu 13.10 here. Nwbuild doesn't fetch the latest node-webkit version.

Running nwbuild for any of the platforms gives me the following output:

Using v0.9.1
Create cache folder in /usr/local/lib/node_modules/node-webkit-builder/cache/0.9.1
Using cache for: linux32
Launching App
App exited with code 2

I always get the libudev missing error (https://github.com/rogerwang/node-webkit/wiki/The-solution-of-lacking-libudev.so.0), so the exited with code 2 might just be that with a useless error message since it's an older nw version.

Cheers

Use node-webkit 0.10.0-rc1 and build for Mac failed

Config:

nodewebkit: {
      options: {
        version: '0.10.0-rc1',
        build_dir: './build',
        app_version: '0.0.1',
        keep_nw: true,
        zip: false,
        mac: true,
        win: false,
        linux32: false,
        linux64: false
      },
      src: ['public/**/*.*'] // Your node-webkit app
    }

When build on mac, the generated app cannot be launched. When building same thing on 0.9.2 it works fine.

0.10.0 doesn't download

When I set the version to 0.10.0 (the latest), it strips out the last 0 and tries to download the wrong url.

Thanks.

Building with Node-Webkit 0.10.2

I've just tried to upgrade to using the latest Node-Webkit build (0.10.2) and am having trouble building it in Grunt.

It downloads the correct version and reports it as unzipping but after that it seems to stop. The file list in the webkitFiles array don't seem to match what is in the ZIP (icudtl.dll seems to be icudtl.dat now).

Trying again with 0.10.0 seems to stop at the unzipping step too.

My Grunt definition is:

nodewebkit: {
        options: {
            version  : '0.10.0',
            build_dir: buildPath, // Where the build version of my node-webkit app is saved
            credits  : '', // html file to show in About screen
            mac_icns : './example/icon.icns', // Path to the Mac icon file
            mac      : true, // We want to build it for mac
            win      : true, // We want to build it for win
            linux32  : false, // We don't need linux32
            linux64  : false // We don't need linux64
        },
        src    : buildPath + '/**/*' // Your node-webkit app
    }

Is this a known issue with this latest version or am I facing a different issue?

Thanks!

EISDIR when building for linux & node-webkit 0.10.5

Was fine with 0.8.6, switched to building for 0.10.5, then got this:

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: EISDIR, open 'E:\...\cache\0.10.5\linux32\locales'

I've tried deleting the cache directory beforehand, doesn't help. Works when building just for Mac & Windows.

macZip option broken: fix is easy: just fix the filename to "app.nw"

Currently the "macZip: true" option seems to be broken as the generated Zip file is stored over the file "nw.icns" instead of creating a new file named "app.nw".

See line 346 in lib/index.js:
https://github.com/mllrsohn/node-webkit-builder/blob/master/lib/index.js#L346

Currently it reads:
copiedFiles.push(Utils.copyFile(self._nwFile, path.resolve(platform.releasePath,
self.options.appName+'.app', 'Contents', 'Resources', 'nw.icns')));

But it should read:
copiedFiles.push(Utils.copyFile(self._nwFile, path.resolve(platform.releasePath, self.options.appName+'.app', 'Contents', 'Resources', 'app.nw')));

Please fix this so the "macZip" option works as expected. Thanks.

Support renaming generated files

Thanks for this program! It has made working with node-webkit a bit easier.

I'd like to suggest that the generated files take on the application's name. In particular: nw on linux, node-webkit.app on osx and nw.exe on windows. If you're for it, I'll submit a PR, but It's a bit awkward to have this generate the specified names without knowing that's what's going to happen. From the README, it seems that the name supplied (or the one in the package.json) would be the name of the application when it was generated. You could still default it to the original names if not supplied anything. I've not found anything that states this isn't possible, and from testing, renaming seems to work on all os's.

Is there any reason why this isn't/can't be supported? If not, expect a PR soon.

Use Resource Hacker instead of rcedit

To replace the windows icon, rcedit simply doesn't work as it generates the wrong icon resource headers resulting in ugly window icons. Using Resource Hacker with command line

ResHacker.exe -modify "Project.exe", "Project.exe", "ProgramIcon.ico", ICONGROUP, MAINICON, 0

Works perfectly generating the correct icon header and results in high quality icons.

Building on Windows for Windows creates a dummy executable

It just creates a nw.exe which shows "node-webkit" in ASCII art.

My usage:

var nwBuilder = new (require('node-webkit-builder'))({
    files: './_public/**/**',
    plattforms: ['win', 'osx'],
    version: '0.9.2',
    buildDir: './dist'
});

It is at least taking some information from dist/package.json because in dist there's a directory with the name field as its name (and then a directory per platform inside, of course).

Allow tweaks to app manifest per platform

Because of nwjs/nw.js#2390, I'm now wondering if it handy if we allow the user to specify platform-specific exceptions in the app manifest; e.g. a user that frame is true for Mac but false for everything else.

node-webkit-builder would have to copy over the manifest somewhere and create a new copy per platform, then run a separate build on each.

Thoughts?

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.