Giter Club home page Giter Club logo

npm-haxe's Introduction

npm-haxe v5

TravisCI Build Status AppVeyor Build Status dependencies Status

Installs Haxe using Node Package Manager aka npm

WARNING : The version contains breaking changes from npm-haxe v4

Key-features

  • Global or per-project, sandboxed, standard Haxe installation
  • Includes Haxelib
  • Includes Neko
  • Support both Haxelib and NPM dependencies
  • Tested on Ubuntu/Linux and Windows

Usage

CLI installation

npm install haxe

By default, this will make haxe and haxelib available to npm scripts only, with haxelib repository sandboxed to your current working directory.

To have haxe and haxelib commands available globally, use the -g flag. This will also make the haxelib repo global.

Package.json sample

{
  "scripts":{
    "postinstall": "haxelib --always install build.hxml",
    "build": "haxe build.hxml"
  },
  "dependencies": {
    "haxe": "^5.0.0" // the npm haxe module
  },
 "haxeDependencies": {
   "haxe": "3.4.7", // haxe version
   "haxelib": "3.3.0", // haxelib version
   "neko": "2.2.0", // neko version
   "pixijs": "4.5.5", // additionnal haxelib dependency
   "tamina": "git+https://github.com/damoebius/taminahx.git" //haxelib git dependency
 }
}

Please notice the --always flag in the haxelib command, to avoid having to confirm haxelibs installation.

Running Haxe from NodeJS

This package also comes with the minimal bindings to run the Haxe compiler from NodeJS.

var haxe = require('haxe').haxe;
var haxelib = require('haxe').haxelib;

// all commands return a ChildProcess instance

haxe( "-version" );
haxelib( "install", "hxnodejs" );

var server = haxe("--wait", "6000");

See also test.js

Configuration options

The following configuration options can be set in your package.json.

Please note they must be set before installing the package.

"haxeDependencies": {
   "haxe": "3.4.7",
   "haxelib": "3.3.0",
   "neko": "2.2.0",
   "pixijs": "4.5.5",
   "perfjs": "1.1.18"
 }

Version

See Haxe Download list. Please notice the directory name in the archive must match.

In this case, the haxeDependencies.haxe value is still used, and must match the one of the directory extracted from the archive.

Haxelib

haxeDependencies.haxelib must match a release from the official Haxelib repo

Known issues

The package relies on the node command, which [has issues on some Ubuntu versions] (http://stackoverflow.com/questions/21168141/cannot-install-packages-using-node-package-manager-in-ubuntu).

If you get an error similar to this :

sh: 1: node: not found
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read /usr/share/doc/nodejs/README.Debian

Just install the nodejs-legacy package:

sudo apt-get install nodejs-legacy

npm-haxe's People

Contributors

clemos avatar andyli avatar damoebius avatar cmandlbaur avatar alebles avatar gama11 avatar jgranick avatar maniues avatar gravis avatar

Stargazers

Flainn avatar Alex Zinkevych avatar Richard Oliver Bray avatar flumpus avatar  avatar Gemk83 avatar Shawn Charles avatar Daniel Báez avatar hlizard avatar Sho Kuroda avatar Asakura Mizu avatar Tomáš Hübelbauer avatar Matthew avatar Dario Vladović avatar Andre Fuchs avatar George Corney avatar Bruno Araujo avatar  avatar chuanhaisoft avatar Victor Nogueira avatar 艾梦 avatar Bryan avatar Jean-Denis Boivin avatar Jonas Malaco avatar Thomas Fétiveau avatar Jérémy Faivre avatar Roma Chi avatar Jesse Talavera avatar  avatar Lucas Jones avatar Zénon Roy avatar Domagoj Štrekelj avatar Elias Ku avatar Alex Lemanski avatar Jason Staten avatar Paulo Roberto Cruz França avatar 曹文忠 avatar  avatar Stéphane Le Dorze avatar 70/V9 avatar Marcelo Serpa avatar Anders Nissen avatar  avatar SlavaRa avatar

Watchers

 avatar  avatar  avatar Stéphane Le Dorze avatar James Cloos avatar  avatar Domagoj Štrekelj avatar  avatar

npm-haxe's Issues

Stuck at `haxelib install`

Hey Clément,

Nice stuff you've got here!

I've got a small issue though -- when running npm install everything runs fine until it starts installing the haxelibs:

npm install                                                                                                                                                                                [2.2.1]

> [email protected] install /Users/fullofcaffeine/workspace/code/todomvc/node_modules/haxe
> node install.js

Getting Haxe 3.2.1
     fetch : http://haxe.org/website-content/downloads/3.2.1/downloads/haxe-3.2.1-osx.tar.gz
  progress : [====================] 100% 0.0s

Getting Haxelib 3.2.0-rc.1

> TodoMVC@ postinstall /Users/fullofcaffeine/workspace/code/todomvc
> haxelib install build.hxml

Loading info about the required libraries
Haxelib is going to install these libraries:
  angular.haxe - 0.0.6
  hxnodejs - 4.0.3
Continue? [y/n/a] ? y <== *** it just hangs in here forever ***

My package.json:

  1 {
  2   "name": "Foobar",
  3   "description": "Foobar",
  4   "main": "main.js",
  5   "scripts":{
  6     "postinstall": "haxelib install build.hxml",
  7     "build": "haxe build.hxml"
  8   },
  9   "dependencies": {
 10     "haxe": "clemos/npm-haxe"
 11   }
 12 }

Any hints?

Segmentation Fault with haxelib on MacOSX

Hello, I'm trying to install this package on my Mac and it's currently failing. Here's my package.json:

{
  "dependencies": {
    "haxe": "^5.0.0"
  },
  "haxeDependencies": {
    "haxe": "3.4.7",
    "haxelib": "3.3.0",
    "neko": "2.2.0"
  }
}

npm install finishes with no errors, but when I run npx haxelib it fails:

$ npx haxelib
Called from C:\Users\nadako\Code\haxe\std/neko/_std/Date.hx line 98
Uncaught exception - Segmentation fault

Some info about my setup:

  • Node: 10.7.0
  • NPM: 6.4.1
  • OS: 10.14.4

Let me know if I can help in any way! Thanks!

Downloads Resources over HTTP

The latest version of NPM includes security auditing by default upon npm install and manually under npm audit, and haxe triggers a high severity warning:

                       === npm audit security report ===


                                 Manual Review
             Some vulnerabilities require your attention to resolve

          Visit https://go.npm.me/audit-guide for additional guidance


  High            Downloads Resources over HTTP

  Package         haxe

  Patched in      No patch available

  Dependency of   haxe [dev]

  Path            haxe

  More info       https://nodesecurity.io/advisories/177


[!] 1 vulnerability found - Packages audited: 17806 (17803 dev, 266 optional)
    Severity: 1 High

Is there a place to download the Haxe packages that is HTTPS, instead of HTTP?

Binaries are not downloaded

I just tried haxe-npm but it does not seem to download the actual binaries of Haxe. This leads to

#npm install haxe -g
npm WARN deprecated [email protected]: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
/usr/bin/haxe -> /usr/lib/node_modules/haxe/bin/haxe
/usr/bin/haxelib -> /usr/lib/node_modules/haxe/bin/haxelib
/usr/bin/neko -> /usr/lib/node_modules/haxe/bin/neko
> [email protected] install /usr/lib/node_modules/haxe
> node install.js
no dependencies
clean folder
Installing Haxelib Dependencies to /root
+ [email protected]
added 283 packages from 129 contributors in 6.617s
# haxe --help
{ Error: spawn /usr/lib/node_modules/haxe/downloads/haxe/haxe ENOENT
    at exports._errnoException (util.js:1020:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:197:32)
    at onErrorNT (internal/child_process.js:376:16)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickCallback (internal/process/next_tick.js:104:9)
    at Module.runMain (module.js:606:11)
    at run (bootstrap_node.js:383:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:496:3
  code: 'ENOENT',
  errno: 'ENOENT',
  syscall: 'spawn /usr/lib/node_modules/haxe/downloads/haxe/haxe',
  path: '/usr/lib/node_modules/haxe/downloads/haxe/haxe',
  spawnargs: [ '--help' ] }

Binaries caching?

I understand this npm module downloads the right binary for your platform - is there any caching strategy? In CI scenarios, without caching I'm anticipating that every clean build will download the binaries - in our Docker CI we heavily depend on npm cache and usually do clean builds.

Apparently npm has a mechanism to cache data (in the general .npm cache):
https://www.npmjs.com/package/cacache

npm i gets stuck

when running
npm i
It seems like it will get stuck one of the lib sometimes.
There is no error message, but yeah it just doesn't progress, this coupled with that fact that after the initial install the only way to update the libs is to completely delete the node_modules I'm finding it almost impossible to get my libs installed.

Intellij Idea configuration

How to configure intellij with the new module ?

I create a new Haxe SDK, targeting node_modules\haxe\current [OK]
While compiling i a have unknown error

Error:compilation failed
Warning:Not_found

With the -v compiler option i get this :

Warning:Classpath : C:/Projects/David/developpement/haxe/taminahx/node_modules/createjs-haxe/;
C:/Projects/David/developpement/haxe/taminahx/node_modules/msignal/;
C:/Projects/David/developpement/haxe/taminahx/node_modules/mconsole-npm/;
C:/Projects/David/developpement/haxe/taminahx/src/;
C:\Projects\Happy\SakuraHx\heidi\node_modules\taminahx\node_modules\haxe\bin/../std/js/_std/;
C:\Projects\Happy\SakuraHx\heidi\node_modules\taminahx\node_modules\haxe\bin/../std/

It seems that the too last lines are from my HAXE_STD_PATH environnement variable

The previous module manage this variable during the installation
https://github.com/damoebius/haxe-npm/blob/master/bin/haxe-cli.js

Release ?

Maybe it's time to release the package on npmjs.org/haxe, now ?
How can I help ?

Current status and features query

I have tried to setup the plugin and have run into a few issues.

  1. How do you update the version after initial install? I tried running install again and it doesn't make the change. I had to delete my node_modules and then it reinstalled.
  2. I can't seem to get specific development build versions to work. Not sure if I am configuring it correctly though.
  3. How do I setup the haxelibs to install to a local folder rather than globally?

I am running windows 10, node 12.

Thanks!

haxe 3.4

hi try to install haxe 3.4.0 with rc.1 when i run haxlib from folder node_modules/haxe/bin i get

node_modules/haxe/downloads/haxelib/src/tools/haxelib/Data.hx:66: characters 9-22 : Cannot access non-static field toValidatable from static method

test on Windows®

The package is currently not tested at all on windows, and very likely to not work.

Unsupported platform for [email protected] for M1 Ventura

What

In private project there's a dependency that has haxe. When I run:

npm i

I see the following error:

npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for [email protected]: wanted {"os":"win32,win64,darwin,linux","arch":"x64,ia32"} (current: {"os":"darwin","arch":"arm64"})
npm ERR! notsup Valid OS:    win32,win64,darwin,linux
npm ERR! notsup Valid Arch:  x64,ia32
npm ERR! notsup Actual OS:   darwin
npm ERR! notsup Actual Arch: arm64

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/alexey.berezin/.npm/_logs/2023-03-01T12_33_41_606Z-debug.log

My colleagues with the same setup don't have this error (at least 2 people)

Reproduction

I've created a small project where I see the same behaviour – https://github.com/Beraliv/haxe-example

Let me know if I need to share any additional information

I've mistaken by creating issue in HaxeFoundation/haxe#10989 in the first place

New npm release

Any chance of getting a newer release up onto npm?

I currently reference a specific hash on the repo to get the package with the security work around I need.

haxelib binary doesn't seem to work on macOS

My setup:
Machine: Macbook Pro, Late 2016 Edition
OS: Mac OS Sierra 10.12.3
Npm Version: 5.3.0 (although I've tried it with multiple versions, and this is my current/latest)
Dependencies/Package.json:

  "devDependencies": {
    "browserify": "^14.4.0",
    "decomment": "^0.9.0",
    "dom-parser": "^0.1.5",
    "find-parent-dir": "^0.3.0",
    "haxe": "github:clemos/npm-haxe#3.3.0-rc.1",
    "rimraf": "^2.5.4",
    "stackblur-canvas": "^1.4.0",
    "uglify-js": "2.7.5",
    "xml2js": "*"
  }

When I attempt to run the following script:

"scripts": {
    "docs": "HAXELIB_ENABLE_NEKO=1 haxelib run dox -i dist -o dist/docs",
  },

or, if I attempt to run ./node_modules/haxe/bin/haxelib run dox -i dist -o dist/docs (or any haxelib command), I receive the following:

Type not found : haxelib.client.Main

However, if I run the manually-installed haxelib binary (from the package installed from haxe.org, which is what I use for my 'global' haxe installation), I have the following experience:

$ haxelib
Haxe Library Manager 3.3.0 - (c)2006-2016 Haxe Foundation
  Usage: haxelib [command] [options]
  Basic
    install   : install a given library, or all libraries from a hxml file
    update    : update a single library (if given) or all installed libraries
    remove    : remove a given library/version
    list      : list all installed libraries
    set       : set the current version for a library
  Information
    search    : list libraries matching a word
    info      : list information on a given library
    user      : list information on a given user
    config    : print the repository path
    path      : give paths to libraries
    version   : print the currently using haxelib version
    help      : display this list of options
  Development
    submit    : submit or update a library package
    register  : register a new user
    dev       : set the development directory for a given library
    git       : use Git repository as library
    hg        : use Mercurial (hg) repository as library
  Miscellaneous
    setup     : set the haxelib repository path
    newrepo   : create a new local repository
    deleterepo: delete the local repository
    convertxml: convert haxelib.xml file to haxelib.json
    run       : run the specified library with parameters
    proxy     : setup the Http proxy
  Available switches
    --flat    : do not use --recursive cloning for git
    --always  : answer all questions with yes
    --debug   : run in debug mode, imply not --quiet
    --quiet   : print less messages, imply not --debug
    --system  : run bundled haxelib version instead of latest update
    --never   : answer all questions with no
    --global  : force global repo if a local one exists

Running the dox command with the globally-installed haxelib binary works as expected, so it seems as though something is incorrect with the npm-installed version.

Clarify neko dependency

While neko is not required for "basic" use-cases (-lib, haxelib install ..., ...), the README mentions it's still needed for haxelib run ....
From what I understand, haxelib, when run by the Haxe interpreter, still has a few minor limitations regarding SemVer (?)

In any case, it might be worth :

  • Adding a warning message in the wrapper, in case the user runs into errors with haxelib run ....
  • Creating a neko npm package ?

Configuration options don't work?

Hello,

I am trying to use configuration options in order to install a specific version of Haxe. However, it seems like the options are always ignored in favour of the options provided in npm-haxe's package.json.

For reference, here is my project's package.json file:

{
  "name": "haxe-js",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "build": "haxe build.hxml"
  },
  "author": "dstrekelj <[email protected]>",
  "license": "IDGAF",
  "devDependencies": {
    "haxe": "^4.0.0"
  },
  "config": {
    "haxe:nightly": "2016-10-26_development_bc173ef",
    "haxe:haxelib_version": "3.2.0-rc.1"
  }
}

I also tried omitting the haxe: prefix from the config options, but without success.

Any help or insight is appreciated!

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.