Giter VIP home page Giter VIP logo

lix.client's Introduction

Gitter

lix - a dependable package manager for your Haxe projects

lix is a package manager that makes it easy for you to track dependencies used in your Haxe project, and to make sure everyone always has the right versions when they build your app.

  • lix tracks everything in version control so you know exactly when and how a dependency changed. As a result:
    • lix helps you avoid "software erosion", so that when you come back to a project 6 months later on a different computer, you can still get things compiling exactly as they did last time you were working on it.
    • lix makes it easy to collaborate with other developers even when dependencies are changing regularly.
  • lix works with all existing haxelibs, as well as dependencies hosted on GitHub or GitLab.
  • lix lets you switch branches and update the dependencies much faster than haxelib.
  • lix installs dependencies faster than haxelib.

The core proposition of lix is that all dependencies should be fully locked down and versioned, so that every state can be reliably replicated.

To track dependencies, lix leverages the conventions put forth by haxeshim. This means that for each dependency, there is a <libName>.hxml in the project's haxe_libraries folder. In addition to putting all required compiler arguments into a library's hxml, lix also leaves behind installation instructions that allow to redownload the exact same version on another machine. If you check out any particular state of a project, then lix download will download any missing library versions.

You can depend on lix to manage your haxe dependencies.


Contents


Haxe Shim

Before we get started: lix is made to work on top of Haxe Shim. You can read more about it here, but essentially, you can think of it just normal Haxe with a slightly tweaked cli. What it does is to replace the tight coupling in the haxe toolchain in favor of simple conventions:

  • decouple the haxe command from the haxe compiler (which are right now the very same thing) and instead use project specific configuration of the Haxe version, meaning that you can seamlessly have different Haxe versions in different projects on the same machine and also ensure that the same project will use the same Haxe version across different machines
  • decouple Haxe from Haxelib (which are right now tied at the hip) and instead use project specific configuration of dependencies in a simple hxml-based format. Any tool capable of writing these hxmls can thus supply dependencies to the project. Moreover, this setup also ensures frictionless use of different dependency versions in different projects and reliable replication of dependency versions across separate machines.

Installation

lix is installed through npm (or yarn). If you don't have one of these installed, you can find out how to install NodeJS and NPM here.

To install lix:

npm install -g lix

After this you will have the commands lix, haxe, haxelib and neko available.

For each project you want to use lix for, you should create a "scope":

lix scope create
lix use haxe stable

This will create a ".haxerc" in the cwd, saying we should use the current stable Haxe version for this project. It will also tell Haxe Shim that this project should expect to find information about haxelibs in the "haxe_libraries" folder.

Usage

Downloading all dependencies

lix download

This will make sure all dependencies are installed and on the right versions. It will also fetch neko and the project specific haxe version.

You should use this after using git clone, git pull, git checkout and similar commands.

Adding a new dependency

lix install <scheme>:<library>

The schemes you can use include haxelib, github, gitlab, and http/https:

  • haxelib:<name>[#<version>] - will get the library from haxelib, either the specific version or the latest. Use --haxelib-url <url> (either an https or http url) to use a different server consistently. You may also use haxelib://custom.server[:<port>]/<name>[#<version>], but in that case further dependencies will again be resolved against the official haxelib. If you leave the port unspecified, https assumed, otherwise http.
  • github:<owner>/<repo>[#<branch|tag|sha>] - will get the library from GitHub, either master or a specific branch/tag/commit.
  • gh:... an alias for github
  • gitlab:<owner>/<repo>[#<branch|tag|sha>] - will get the library from GitLab. Use gitlab://custom.server/<owner>/<repo>[#<branch|tag|sha>] to get it from a server of your choice.
  • git:<host>:/path/to/repo - where <host> is an ip, a qualified domain or even a name in your system's hosts file.
  • http:<url> or https:<url> - will get the library from an arbitrary URL, pointing to a haxelib zip file... you MUST BE reasonably sure that the targeted resource NEVER changes. (For example, if the filename is "mylib-latest.zip", it will probably change. If it is "mylib-v1.0.0.zip", it is reasonably likely to not change).

Note that for github and gitlab you can specify credentials using the --gh-credentials and --gl-private-token parameters respectively. Be warned though that these credentials are then baked into the hxmls as well. Be very careful about using this option.

Because haxelib is a prominent source for stable versions, a shortcut is available: lix +lib <libname>. e.g. lix +lib hxcpp#3.4.188 is equivalent for lix install haxelib:hxcpp#3.4.188.

Removing a dependency

To remove a dependency simply delete the related .hxml file from your haxe_libraries folder.

This however won't remove the downloaded sources from the global cache. To do that you would have to delete it from ~/haxe/haxe_libraries or %AppData%\haxe\haxe_libraries.

Aliasing

You can always download a library under a different name and version, example:

lix install haxelib:tink_core as othername#1.2.3

You will find something like the following othername.hxml in your haxe_libraries:

# @install: lix --silent download "haxelib:tink_core#1.16.1" into tink_core/1.16.1/haxelib
-D othername=1.2.3
-cp ${HAXESHIM_LIBCACHE}/tink_core/1.16.1/haxelib/src

Hxml files

Once you've installed a dependency with lix and it exists in your haxe_libraries folder, you can add it to your haxe build (hxml file) with:

-lib mylibrary

where "mylibrary" has a valid file in haxe_libraries/mylibrary.hxml.

It's worth noting that we don't include the haxelib version in the hxml anymore, so doing this:

-lib mylibrary:1.0.0

is no longer accepted.

Version control

We recommend you add the entire haxe_libraries folder to your version control. For example, if you're using git:

git add haxe_libraries

Then every time you change a dependency with lix, you should commit those changes to git.

Every time you switch branches, pull, merge, or clone a new repo, if the files in "haxe_libraries" have changed, you should re-run:

lix download

(A fun fact: despite the name, lix download often doesn't have to download anything, especially if you've used those dependencies before, as they will be cached. This makes switching branches and syncing dependencies incredibly fast and painless).

Local development

If you develop your own haxelibs, you might be used to using haxelib dev to tell haxelib to use a local folder rather than a downloaded library while you develop your library, so that changes you make in the local folder are always used in the next build.

With lix, there is no command to do this, you just edit the relevant hxml file.

For example, change haxe_libraries/tink_core.hxml from:

# @install: lix --silent download "haxelib:tink_core#1.15.0" into tink_core/1.15.0/haxelib
-D tink_core=1.15.0
-cp ${HAXESHIM_LIBCACHE}/tink_core/1.15.0/haxelib/src

to:

# @install: lix --silent download "haxelib:tink_core#1.15.0" into tink_core/1.15.0/haxelib
-D tink_core=1.15.0
-cp /home/jason/workspace/tink_core/src/

When you do this, it will show up as a modified file in git. You should avoid commiting this change, as it won't work for anyone else who wants to use your project but doesn't have the exact same project in the exact same location.

Instead, once you've finished the work on your dependency, (even if it's a work in progress), push your changes to Github, and then use that:

lix install github:haxetink/tink_core#my_work_in_progress_branch

This way if anyone else wants to use your work-in-progress, they'll be able to.

Scripting

Lix supports running "haxe scripts" on either the interpreter or nodejs. The first argument must be something that looks like a class name (i.e. a dot path where the last part starts with an upper case letter, e.g. ExportAssets or tasks.export.Assets).

The class name resolution is as follows:

  • attempt to find the class in the current scope's root (e.g. ExportAssets.hx or tasks/export/Assets/hx)
  • attempt to find the class in the scripts sub directory of the current scope's root (e.g. scripts/ExportAssets.hx or scripts/tasks/export/Assets/hx) while using scripts as a class path
  • if your project has a haxelib.json that defines a classPath, it is looked up therein. If there's a corresponding haxe_libraries/<libname>.hxml then the project is compiled with -lib <libname>, otherwise the classPath and dependencies are taken from the haxelib.json

With the file and class paths being established, lix will read the file. A leading #!-line will be ignored. It will scan lines so long as they are empty or start with //!, the latter ones being allowed to pass additional args to the compiler.

Example:

//! -lib foo -D something=somevalue
class ExportAssets {
  static function main() {
    trace('Look at me, I am exporting ${Sys.args().join(', ')}!');
  }
}

Any additional arguments are passed to the script. Suppose ExportAssets were in the scripts directory, then the invokation would look like this:

Input:

  lix ExportAssets sword shield axe

Becomes:

  haxe -lib foo -D something=somevalue -cp scripts --run ExportAssets sword shield axe

Outputs:

  ExportAssets.hx:4: Look at me, I am exporting sword, shield, axe!

NodeJS scripting

A special case occurs when compiling with -lib hxnodejs. Let's slightly adjust the above example:

//! -lib hxnodejs
class ExportAssets {
  static function main() {
    js.Node.console.log('Look at me, I am import ${Sys.args().join(', ')}!');
  }
}
Input:

  lix ExportAssets sword shield axe

Becomes:

  haxe -lib hxnodejs -cp scripts -main ExportAssets -js scripts/ExportAssets.js
  node scripts/ExportAssets.js sword shield axe

Outputs:

  Look at me, I am exporting sword, shield, axe!

Note that the JS script will attempt to delete itself when run.

Concepts

lix was designed based on a few key concepts that we believe have helped package managers for other languages be successful. Understanding these concepts can help you understand the way lix works.

  • Every haxe dependency is easy to find, look in haxe_libraries/${libName}.hxml.

    We learned this lesson from NodeJS, where there are simple rules to find dependencies - NodeJS expects each dependency to be a folder inside "node_modules". Because NodeJS just looks in that folder, it has allowed both NPM and Yarn, competing package managers, to operate side by side, allowing innovation, competition and collaboration between the projects.

    In Haxe, this was hard because the Haxe compiler didn't know how to find the dependencies, it ran haxelib to find out where they are. Breaking this apart is one of the things Haxe Shim does, by intercepting any "-lib" arguments and replacing them with "-cp" arguments based on a simple standard.

    What's the standard Haxe Shim expects (and that lix provides)?

    There is a "haxe_libraries" folder, and inside it is one hxml file for each dependency. When haxe wants to use "tink_core", it looks for "haxe_libraries/tink_core.hxml", and then uses all of the arguments, class paths and defines from that hxml file in the haxe build.

  • You can run one command, lix download to get all of your dependencies installed after cloning, pulling or checking out a branch.

    The hxml files lix generates have information about how to install the dependency - from haxelib, GitHub, GitLab, or Http. This allows it to rebuild the exact same environment it is expecting, whether you are switching branches, revisiting old code or cloning a repo for the first time.

    Just run lix download and your dependencies will be perfectly in sync.

    On top of downloading the necessary libraries, lix will also download the right Haxe version and make sure neko is available too.

  • Your entire haxe_libraries folder should be tracked in version control.

    NPM and Yarn have a package.json file. Yarn has a yarn.lock file. Hmm has a "hmm.json" file. With lix, you just commit the whole "haxe_libraries" folder to version control, making it easy to track any changes to dependency versions.

    This means whenever you switch branches, pull an update or merge changes it is easy to get the exact dependencies in sync.

    It also means that if you are hacking away on a development version of a library, git status will remind you that the library you're editing is using a non-standard classpath, a hint that you should correct it before pushing your changes.

  • Dependency versions should be scoped to each project, rather than global.

    Haxelib eventually supported this with haxelib newrepo and a hidden .haxelib/ folder.

    With lix and Haxe Shim, we look for the haxe_libraries/ folder in the same place as the .haxerc file.

    This is why you call lix scope create when you introduce lix to your project - it creates the .haxerc file that tells Haxe Shim to look here for the haxe_libraries/ folder.

FAQ

What does this do differently to haxelib?

Haxelib was built many years ago, before npm even existed. It was great at first, but suffers from a few limitations:

  • The only thing tracked in version control is your hxml files, which works when you install libraries directly from Haxelib, but is very hard to manage when installing dependencies from GitHub etc.
    • This made it difficult to use when you had to use unreleased versions of a library, or a fork of a library.
    • This also failed to track the exact versions of dependencies, meaning even if the right version of tink_macro was installed, the wrong version of tink_core might be installed, etc.
  • The way haxe and haxelib are tightly coupled makes it difficult to maintain, so development has really stalled for several years. (Haxe Shim breaks this dependency by instead using a standardised way to locate information about dependencies, making it much easier to build a tool like lix.)
  • Juraj, who started lix, was actually the main maintainer of Haxelib for about two years, and resolved that replacing it was a more effective plan than trying to improve it.

How does this compare to hmm?

Hmm is another tool that aims to improve package management for haxe projects. It does this by storing version information and installation instructions in "hmm.json", allowing you to restore state based on those instructions.

It's a big step forward from Haxelib, but we think lix is a step forward again.

Reasons you might prefer hmm:

  • you do not want to install NodeJS or NPM.
  • you do not want to use Haxe Shim, you'd prefer to use normal Haxe and normal Haxelib.

Reasons you might prefer lix:

  • Hmm install tracks the dependencies you installed directly, but it doesn't track the sub dependencies, so it's possible when you restore a project the sub-dependency versions might change. In this way builds aren't reproducible and your project might still be subject to "software erosion"
  • Hmm still uses Haxelib to run the installs, and lix is much faster than Haxelib.

Is this similar to npm / yarn / cargo / $packageManager?

lix has taken inspiration from each of these package managers, and tries to learn lessons from each. It is not exactly the same in its implementation as any other package manager.

For example, like npm lix will know how to install dependencies from GitHub, which is great for using unreleased development versions.

Like yarn, lix will cache the exact versions installed, including the exact versions of all dependencies, the exact commit SHAs for any dependencies loaded from Github, and more, meaning you have a reproducible build.

Unlike either, lix does not make a local copy of each library inside a folder in your project, preferring instead to keep the source code in a global folder, to save install time and disk space.

How to use non-minimized versions of the shims?

By default the shims generated as a jsnode target by this project are minimized to accelerate loading. For developing or debugging lix that can be a problem, here is how to unminimize them:

  1. In Build.hx find a line with ncc like cmd('npm run -- ncc -m build $file');,
  2. Remove the -m option as seen in ncc documentation and save the file,
  3. Reinstall using e.g. npm -g install . in the lix.client folder (possibly sudo is needed).

Can I use these tools without installing them globally?

Yes, assuming your project has a package.json. If not, you can create it by:

  • echo "{}" > package.json (will just create an empty file)
  • npm init (will take you through the whole setup process)

With that in place, install lix just skipping the "-g" option:

npm install lix --save

And then you can run each of the commands with:

npx lix
npx haxe
npx haxelib
npx neko

Not that npx requires you to either have npm >= 5.2.0 or installing it via npm i -g npx (use sudo as appropriate).

If you prefer yarn:

yarn add lix

And then

yarn lix
yarn haxe
yarn haxelib
yarn neko

Consider adding this to your package.json, for frictionless intallation:

"scripts": {
    "postinstall": "lix download"
}

This will make sure lix installs its packages every time npm or yarn installs their packages.

Help and support

If you find a bug or have an issue, please file an issue on GitHub.

If you would like to chat through an issue, you can often find someone helpful on our Gitter channel.

We try to be friendly!

Contributing

We welcome contributions - whether it's to help triage GitHub issues, write new features, support other users or improve documentation.

If you would like to know how to help, or would like to discuss a feature you're considering implementing, please reach out to us on Gitter.

Your help will be much appreciated!

Acknowledgements

Very special thanks to Geir who was kind to hand over the lix package on npm. From this point forward, that package is now available as lix-index.

lix.client's People

Contributors

andyli avatar back2dos avatar benmerckx avatar dpomier avatar gama11 avatar grepsuzette avatar jasononeil avatar kevinresol avatar markknol avatar nanjizal avatar nqnstudios avatar richardbray avatar sebthom avatar starburst997 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

lix.client's Issues

Clean command

I use lix to deploy to heroku but heroku only provides mechanism to ignore (remove) files at the very beginning of a build. As a result, my deployed container image includes all the downloaded haxe libraries. It would be nice if lix has a command to delete everything it that it has downloaded, which can be called after haxe compiles.

Lib not found message misplaced

Kevins-MacBook-Pro:pushx.fcm kevin$ lix install gh:kevinresol/some_lib
downloading <url>
mounting as some_lib#0.0.0
Installing dependency some_dep
Installing dependency tink_streams
already downloaded: haxelib:tink_streams#0.2.1
mounting as tink_streams#0.2.1
Failed to install dependencies:
  Not Found

Note that some_dep cannot be found on lib.haxe.org but the failure message appear at the end

[mac] Completion in vscode doesn't work

How to reproduce:

  1. Install lix/switchx/haxeshim
  2. Install tink_io (and dependencies) at global scope
  3. Go to those new hxml and modify the path so that they all point to local dev path
  4. Switch to latest commit(branch): tink_io(pure) & tink_streams(pure) & tink_chunk(master)
  5. (optional) In settings.json, set haxe.displayServer.haxePath to the npm/yarn's haxe binary

Then it shows sth like tink.io.nodejs.WrappedBuffer not found in vscode's Output Panel (Haxe)

Btw, it also make Haxe consumes 100% CPU. Not sure why though.

C# build fails if hxcs.hxml exists

The steps to reproduce is pretty simple:

  1. Use lix
  2. Create a hello world program
  3. build with haxe -cs. It should work fine
  4. now run lix +lib hxcs and retry the build step, it fails
haxelib run hxcs hxcs_build.txt --haxe-version 4000 --feature-level 1
Unknown command-line option /Users/kevin/Codes/test/bin/cs
 Usage : haxelib run hxcs buildFile.txt [?... options]
 Options :
  --haxe-version <version> : sets what baseline haxe version was it compiled with
  --feature-level <level> : sets the feature level needed to compile the buildFile. Defaults to 0
  --out <filename> : sets the output file path

Failed to invoke `haxelib run-dir hxcs /Users/kevin/haxe/haxe_libraries/hxcs/3.4.0/haxelib hxcs_build.txt --haxe-version 4000 --feature-level 1` because Error: Command failed: haxelib run-dir hxcs /Users/kevin/haxe/haxe_libraries/hxcs/3.4.0/haxelib hxcs_build.txt --haxe-version 4000 --feature-level 1
Error: Build failed

Read dependencies from haxelib.json

lix should read and install depenencies from haxelib.json.

This way there is no need to call manually lix install... for each dependency, but you can simply define them in the haxelib.json file.

This way it's even easier to migrate from haxelib to lix.

git submodule libraries

Coming from a Kha/khamake background, i used git submodules for versioning. Now i'm working on a couple of projects not using it, but i'm trying lix instead. I think it would be very nice to have submodule support for that in lix as well. What i have in mind:

from project root, some-lib is already added as submodule in haxe_libraries

lix install submodule:haxe_libraries/some-lib

final directory layout

/project
    /haxe_libraries
        /some-lib - this is the git submodule
        some-lib.hxml - created by lix and would point to project/haxe_libraries/some-lib

I can now have different versions for each project without having to constantly push to git and run lix during development, and mainly using VSCode nowadays, i can even browse the lib as it lives in the project directory as well.

Thoughts?

Quoting broken on windows

Using single quotes to escape URL breaks on Windows.

The simplest solution would be to use double quotes. That said I wonder: do we need quotes at all? The commit says it's to deal with & but given that whitespace is illegal in URLs it is safe to assume that no isolated & is generated and given that & is a valid character in file names, I don't think any OS can just randomly interpret & occurring mid-argument, no?

show dependencies under 'HAXE DEPENDENCIES' in vscode

I'm not quite sure if this is a lix issue or vshaxe/haxeshim/switchx or where to even start looking at whats going on, but it would be nice if lix managed libraries would show up under the 'HAXE DEPENDENCIES' tab in vscode.

image

My setup is on windows 10, vscode 1.19.2, lix 0.14.0, haxeshim 0.12.2, switchx: 0.14.6 and i tried to point the completionserver to the local haxeshim managed one via settings.json:

    "haxe.executable": "node_modules/.bin/haxe.cmd"

In the screenshot it shouldn't even point to hxnodejs 4.0.9 but 6.9. I generally use the github versions of the libraries (lix install gh:...stuff...) and not haxelib ones in case it matters. I think the 4.0.9 only shows up b/c i also have it installed via haxelib.

Unknown scheme in url

Trying to install the libraries of examples-todomvc. I went the npm route and noticed it points to an older version of switchx/haxeshim (which gives you an error about scoped not being a valid value for resolveLibs). So I changed the dependencies to:

  "dependencies": {
    "less": "2.7.2",
    "lix.pm": "^0.9.1",
    "switchx": "^0.12.0"
  }

Now when I try to install I get the following:

switchx install && lix download
  ... already downloaded!
Now using official release 3.4.2
digging: C:\projects\examples-todomvc
config found: true
digging: C:\projects\examples-todomvc
config found: true
lix --silent download 'https://github.com/MVCoconut/coconut.data/archive/0a38a12b2957d3acea610f7d267c275d462a2ec8.tar.gz' into coconut.data/0.4.1/github/0a38a12b2957d3acea610f7d267c275d462a2ec8
digging: C:\projects\examples-todomvc
config found: true
Unknown scheme in url 'https://github.com/MVCoconut/coconut.data/archive/0a38a12b2957d3acea610f7d267c275d462a2ec8.tar.gz'

Running that lix --silent download command by itself gives me the same error.

haxe 4 preview 4 issue

class Main {
    static function main() {
        var name = 'Foo';
        trace('${name}');
    }
}

Try to trigger code completion anywhere in the above code:

Haxe language server started
Listening on port 6004
Building Cache...
Parsing Classpaths...
Done.

(triggered)

Haxe server restart requested: Haxe process was killed
Restarted Haxe server: Haxe process was killed
Building Cache...
Parsing Classpaths...
Done.

(triggered)

Haxe server restart requested: Haxe process was killed
Restarted Haxe server: Haxe process was killed
Building Cache...
Parsing Classpaths...
Done.

(triggered)

Error message from the compiler:

ers/kevin/.config/yarn/global/node_modules/lix/bin/haxeshim.js:3774
					throw new js__$Boot_HaxeError("unknown variable " + name);
					^
Error: unknown variable name
    at Function.DwVIsOsueSK3bnvdZSxLjXktoi3h6HfPjLbDQVj8wSE=.haxeshim_Resolver.interpolate (/Users/kevin/.config/yarn/global/node_modules/lix/bin/haxeshim.js:3774:12)
    at haxeshim_Resolver.process (/Users/kevin/.config/yarn/global/node_modules/lix/bin/haxeshim.js:3945:30)
    at haxeshim_Resolver.resolve (/Users/kevin/.config/yarn/global/node_modules/lix/bin/haxeshim.js:3850:8)
    at haxeshim_Scope.resolve (/Users/kevin/.config/yarn/global/node_modules/lix/bin/haxeshim.js:3715:24)
    at processData (/Users/kevin/.config/yarn/global/node_modules/lix/bin/haxeshim.js:2750:88)
    at reduce (/Users/kevin/.config/yarn/global/node_modules/lix/bin/haxeshim.js:2772:7)
    at Socket.<anonymous> (/Users/kevin/.config/yarn/global/node_modules/lix/bin/haxeshim.js:2799:4)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)

The first two triggers will kill the server.
The third trigger crashes with an error unknown variable name which is due to haxeshim somehow trying to parse the Haxe expr and resolve the name variable as env var.

Git libraries in lix library cache are named "0.0.0"

Under my roaming folder:

C:\Users\Me\AppData\Roaming\haxe\haxe_libraries\

I have a file named "0.0.0" which corresponds to a library I checked out via git (see #56):

lix install git:https://www.github.com/username/my_lib.git

I have a haxelib.json in the root of the repo with the version and name specified. lix picks up on this when I add the library to my scope:

mounting as my_lib#0.0.1

Why does the folder in the library cache not reflect this?

Dependencies should resolve from .haxerc if present instead of haxelib.json

Maybe that's already the case and didn't notice, but let's say I have dependencies that do use "lix", instead of reading the additional dependencies from the haxelib.json, I think it should try to resolve them from their haxe_libraries directory, as far as I know there is no way to specify a git repo in haxelib.json right?

Registry

The registry is taking shape, though not fully complete yet. But I think we can start trying to integrate into the command line (on a separate branch of course)

lix login
should acquire a login session as demonstrated here

lix submit (or publish?)
should submit a directory as demonstrated here

These two should be easy: just add new Command(...) in the list

There should also be:

lix init
should create the lix.json manifest
This one requires user input, but I think new Command(...) can also handle it.

Installer: check PATH after installation

If a user already has haxe in his PATH, the lix installer displays an error when it tries to run haxe --run show-version.

The last part of npm install lix -g looks like this:

[email protected] postinstall C:\Users\username\AppData\Roaming\npm\node_modules\lix
node bin/postinstall.js
Error: Could not process argument show-version
invalid character: -
C:\Users\username\AppData\Roaming\npm
`-- [email protected]

In this case the user assumed that the lix install had failed.

So it seems that after lix is installed, it tries to run haxe --run show-version using whatever haxe is first in PATH, which might not be the command the lix one. By the way, does lix install some version(s) of haxe when it is installed?

I think it would be an improvement if lix checks if it's haxe is present in PATH as the first match, and if not, tell the user which particular dir must be added to PATH (with a mention of precedence in case there are other haxe in PATH already), instead of trying to run haxe --run show-version.

Note:

  • lix use haxe 3.4.7 produced an error unknown haxe version or smth like that
  • lix haxe-versions printed an empty list
  • lix install haxe 3.4.7 downloaded 3.4.7 and set is as default
    Does it sound correct?

Create possibility for local installations

Like in haxelib or npm you have the possibility to install a dependency locally or globally.
Normally I prefer local installs as it's much cleaner even to reference or browse the sources.

Proposal is to keep the same logic as npm:
everything is local except if you define you want to install it globally.

Unknown scheme in url 'haxelib:travix#0.9.0'

Got this on windows w/ lix 0.10.2, when running lix download with hxml directive lix --silent download 'haxelib:travix#0.9.0' into travix/0.9.0/haxelib
Is it due to the extra quote?

Refactor Download.hx

I think it contains a lot of hand-written code that can be replaced by tink_io, tink_http and archive

Or are there some reasons it is written against the node api specifically?

Add list/view subcommand to `lix scope`

It would be nice to be able to view the current scope in a human-readable way.
Something like lix scope list (or view, print, etc.).
The command should display in a human-readable way the haxe version and the dependencies with their versions.
Thanks :)

Support `Lix remove xx`

I would love to have a remove function lix remove xx that removes the haxe_libraries/xx.hxml file. I had a case where I wanted to swap a library for another library, would be nice to be able to do this command line.

It is not needed to remove the actual sources from the local registry, (this could be a lix uninstall xx but don't have a use-case for this).

downloading dependencies from haxelib fails for multiple tink libraries on linux

I'm not sure if this is the right place for the issue (or even somehow useful info), but anyways:

I just tried to build a project on a new install of ubuntu 16 and running lix download fails for multiple tink libraries (getting the zips from https://lib.haxe.org/p/.../download)

  • tink_json 0.4.0
  • tink_streams 0.2.0
  • tink_stringly 0.1.0
  • tink_typecrawler 0.4.0
  • tink_url 0.2.0

it works for

  • tink_core 1.9.1
  • tink_io 0.5.0
  • tink_macro 0.13.3

The error i get is

events.js: 163
    throw er;

Error: incorrect header check
    at Zlib._handle.onerror(zlib.js:355:17)

I then installed every failed library again with f.ex lix install gh:haxetink/tink_json#0.4.0 (this time getting the zips from https://github.com/haxetink/tink_LIB/archive/COMMIT.tar.gz), and everything downloads and unzips ok.

"version" field in haxe.lib json is required now?

Lix 0.9.1 crashes when installing a github library, and the haxelib.json doesn't contain a "version" field.
This didn't happen when i tried last time with lix version 0.4.0. It simply used 'undefined' as version i think.

example

lix install gh:kevinresol/mongo

output

downloading https://github.com/kevinresol/mongo/archive/6af4cdac0191b9066151d33893b2eb005c55af2e.tar.gz
C:\Users\dklein\AppData\Roaming\npm\node_modules\lix.pm\bin\lix.js:400
        return s.split(sub).join(by);
                ^

TypeError: Cannot read property 'split' of undefined
    at Function.StringTools.replace (C:\Users\dklein\AppData\Roaming\npm\node_modules\lix.pm\bin\lix.js:400:10)
    at lix_client_DownloadedArchive.escape (C:\Users\dklein\AppData\Roaming\npm\node_modules\lix.pm\bin\lix.js:2266:19)
    at Array.map (native)
    at Function.lix_client_DownloadedArchive.path (C:\Users\dklein\AppData\Roaming\npm\node_modules\lix.pm\bin\lix.js:2271:15)
    at Function.lix_client_DownloadedArchive.fresh (C:\Users\dklein\AppData\Roaming\npm\node_modules\lix.pm\bin\lix.js:2290:42)
    at C:\Users\dklein\AppData\Roaming\npm\node_modules\lix.pm\bin\lix.js:2621:45
    at C:\Users\dklein\AppData\Roaming\npm\node_modules\lix.pm\bin\lix.js:4627:10
    at C:\Users\dklein\AppData\Roaming\npm\node_modules\lix.pm\bin\lix.js:4353:11
    at tink_core__$Callback_ListCell.cb (C:\Users\dklein\AppData\Roaming\npm\node_modules\lix.pm\bin\lix.js:4508:5)
    at Object.tink_core__$Callback_CallbackList_$Impl_$.invoke (C:\Users\dklein\AppData\Roaming\npm\node_modules\lix.pm\bin\lix.js:4225:9)

Feature request: private GitHub dependencies without adding a token to the hxml

Currently to add private dependencies you have to add a token to the hxml. Looking at the code, it looks like this is because the GitHub source in lix uses the GitHub API rather than automating Git. There are pluses and minuses to this approach: it's much simpler than automating Git, but at the same time you can't use the effective environment (e.g. whatever keys ssh-agent is set up with) to access repositories. One additional advantage of using Git automation over API calls: it would work for both GitLab and GitHub without needing separate sources for each.

My current workaround is to use Git submodules for private repo dependencies and simply add them to my classpath. It's sub-optimal (I would much rather use lix for everything ๐Ÿ˜„) but works.

lix download haxe

I think lix wrongly decides I want to download a lib using this command:

$ lix download haxe 4.0.0-preview.3
too many arguments

The docs suggest this is the way to use it though:

download haxe <version>|<alias>

(v15.0.0-rc.2)

lix download error when no haxe_libraries is present

I got this lix download error when no haxe_libraries folder is present.

$ lix download
fs.js:904
  return binding.readdir(pathModule._makeLong(path), options.encoding);
                 ^

Error: ENOENT: no such file or directory, scandir 'C:\mark\projects\supersecretproj\haxe_libraries'
    at Object.fs.readdirSync (fs.js:904:18)
    at haxeshim_Scope.getInstallationInstructions (C:\mark\projects\supersecretproj\node_modules\lix\bin\lix.js:4433:24)

    at haxeshim_HaxeCli.installLibs (C:\mark\projects\supersecretproj\node_modules\lix\bin\lix.js:4096:22)
    at C:\mark\projects\supersecretproj\node_modules\lix\bin\lix.js:5046:34
    at C:\mark\projects\supersecretproj\node_modules\lix\bin\lix.js:8027:11
    at C:\mark\projects\supersecretproj\node_modules\lix\bin\lix.js:7880:5
    at Object.DI3BfV/mmfQQnRVj5XUFw20N55EGIq3Pb67/UbzF5xE=.tink_core__$Callback_Callback_$Impl_$.invoke (C:\mark\project
s\supersecretproj\node_modules\lix\bin\lix.js:7481:3)
    at Object.DI3BfV/mmfQQnRVj5XUFw20N55EGIq3Pb67/UbzF5xE=.tink_core__$Callback_CallbackList_$Impl_$.invoke (C:\mark\pro
jects\supersecretproj\node_modules\lix\bin\lix.js:7579:42)
    at tink_core_FutureTrigger.trigger (C:\mark\projects\supersecretproj\node_modules\lix\bin\lix.js:7895:46)
    at f (C:\mark\projects\supersecretproj\node_modules\lix\bin\lix.js:9478:242)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

Using lix 15.1.0-rc.2

Would expect a more friendly warning

Git Repo Support

I would like to start using lix, but my main constraint for this is support for pointing directly at a git repo url.

Quick look at the source and I feel there might be 2 shortcuts that could taken here:

  1. Install via haxelib git support.
  2. At least allow for switching out the url for gitlab, many private installations are using their enterprise version.

Dont mind trying to implement, just need to some guidance on whether there are other plans for this and if there are already plans for this.

postDownload issues

lix download
lix --silent download "gh://github.com/back2dos/travix#5797fc2613e9fc730adf5ff2e
1fb496cfebea057" into travix/0.11.0/github/5797fc2613e9fc730adf5ff2e1fb496cfebea
057
gh://github.com/back2dos/travix#5797fc2613e9fc730adf5ff2e1fb496cfebea057
cd C:\Users\Ben\AppData\Roaming/haxe/haxe_libraries/travix/0.11.0/github/5797fc2
613e9fc730adf5ff2e1fb496cfebea057 && lix download && haxe build-neko.hxml
Error: ENOENT: no such file or directory, open 'P:\hyperscript\build-neko.hxml'

Problem is I was on drive P:\ and you can't cd to a direcory on another drive like that (thanks Windows), it should be cd /d C:\.....

Also it seems that if postDownload fails, the library install still succeeds. So if I run lix download again it doesn't try to re-install.

Print meaningful error when lib not found on lib.haxe.org

$ lix install haxelib:tink_unit

/Users/kevin/.config/yarn/global/node_modules/lix.pm/bin/lix.js:125
                        throw new js__$Boot_HaxeError("EReg::matched");
                        ^
Error: EReg::matched
    at EReg.matched (/Users/kevin/.config/yarn/global/node_modules/lix.pm/bin/lix.js:125:10)
    at Object.tink__$Url_Url_$Impl_$.parse (/Users/kevin/.config/yarn/global/node_modules/lix.pm/bin/lix.js:3647:18)
    at Function.lix_client_sources_Haxelib.getArchive (/Users/kevin/.config/yarn/global/node_modules/lix.pm/bin/lix.js:2801:221)
    at tmp (/Users/kevin/.config/yarn/global/node_modules/lix.pm/bin/lix.js:2796:38)
    at /Users/kevin/.config/yarn/global/node_modules/lix.pm/bin/lix.js:4144:10
    at /Users/kevin/.config/yarn/global/node_modules/lix.pm/bin/lix.js:3870:11
    at tink_core__$Callback_ListCell.cb (/Users/kevin/.config/yarn/global/node_modules/lix.pm/bin/lix.js:4025:5)
    at Object.tink_core__$Callback_CallbackList_$Impl_$.invoke (/Users/kevin/.config/yarn/global/node_modules/lix.pm/bin/lix.js:3747:9)
    at tink_core_FutureTrigger.trigger (/Users/kevin/.config/yarn/global/node_modules/lix.pm/bin/lix.js:4049:47)
    at f (/Users/kevin/.config/yarn/global/node_modules/lix.pm/bin/lix.js:4437:242)

note the typo: haxelib:tink_unit (should be haxelib:tink_unittest)

npm install lix seems to break everything

Sorry if I'm being dumb, but I recently tried to install lix and it seems to have broken quite a few things:

I opened a command line in Windows 10 and ran this:

npm install --global lix

Then I ran this:
lix

And got this:

C:\Users\Lars Doucet>lix
C:\Users\Lars Doucet\AppData\Roaming\npm\node_modules\lix\bin\lix.js:1420
const EOF = Buffer.alloc(1024)
                   ^

TypeError: Buffer.alloc is not a function
    at __dirname./PWO1pM5lLwyqdlyaovRHUOu+lELk9nNqLmH97GuFYg=.opt.filter.Promise.2AFNYz4lSXwSlQQf3/eWu6omuc8tXeaHDhk7oeZQsP4=.p.on.files.forEach.t.2qKOuoyDrIbn3tXU28MnQI6TzoWc0B5TyIq68LcLqd4=.opt.onentry.opt.filter.p.3cvmAZk8FK1SBh8Ge8NUCWlDUWArxUeTcVe2v8XYctY=.Parser.constructor.opt.ondone.stream.on.stream.on.entry.(anonymous function).entry.(anonymous function).fs.lstat.Unpack.4Qo/V2sAfYSCXwRWGyedb6H4upRdwnVV4faxt79hltM=.module.exports.fs.lstat.56qWjByKztF5uZPT3/DJRKRxgtAKle3Xm5h2aKcXSRU=.MiniPass.constructor.opt.zip.on.zip.on.zip.on.on.job.(anonymous function).on.job.readdir.forEach (C:\Users\Lars Doucet\AppData\Roaming\npm\node_modules\lix\bin\lix.js:1420:20)
    at load (C:\Users\Lars Doucet\AppData\Roaming\npm\node_modules\lix\bin\lix.js:14:5)
    at C:\Users\Lars Doucet\AppData\Roaming\npm\node_modules\lix\bin\lix.js:17:29
    at __dirname./PWO1pM5lLwyqdlyaovRHUOu+lELk9nNqLmH97GuFYg=.opt.filter.Promise.2AFNYz4lSXwSlQQf3/eWu6omuc8tXeaHDhk7oeZQsP4=.p.on.files.forEach.createSync (C:\Users\Lars Doucet\AppData\Roaming\npm\node_modules\lix\bin\lix.js:167:14)
    at load (C:\Users\Lars Doucet\AppData\Roaming\npm\node_modules\lix\bin\lix.js:14:5)
    at C:\Users\Lars Doucet\AppData\Roaming\npm\node_modules\lix\bin\lix.js:17:29
    at __dirname./PWO1pM5lLwyqdlyaovRHUOu+lELk9nNqLmH97GuFYg=.opt.filter.Promise.2AFNYz4lSXwSlQQf3/eWu6omuc8tXeaHDhk7oeZQsP4=.p.on.files.forEach.t.2qKOuoyDrIbn3tXU28MnQI6TzoWc0B5TyIq68LcLqd4=.opt.onentry.opt.filter.p.3cvmAZk8FK1SBh8Ge8NUCWlDUWArxUeTcVe2v8XYctY=.Parser.constructor.opt.ondone.stream.on.stream.on.entry.(anonymous function).entry.(anonymous function).fs.lstat.Unpack.4Qo/V2sAfYSCXwRWGyedb6H4upRdwnVV4faxt79hltM=.module.exports.fs.lstat.56qWjByKztF5uZPT3/DJRKRxgtAKle3Xm5h2aKcXSRU=.MiniPass.constructor.opt.zip.on.zip.on.zip.on.on.job.(anonymous function).on.job.IHzFTXFK768mHhaTa50fJLoNbqriK7aGJ03V/M/piPo=.padOctal.IRCPAQdxxTPxDSNVEjbpJrDey6YtBZTsHyHy3quzDzk=.module.exports.SX9P+POf3/GXLCE0cLDxEkkQ4tPflmjCjO2alrFH938=.EE.set.enc.pipe.opts.emit.data.hWgHoyC4ICUyk4ZXQMqKFVM8HT2nRBT3U8d54EJfPVM=.hmnRD7etIIKY8nGARtOEtPwLHJ5n8EdTamzJ/6pL3mg=.parse.i0E8knuUHabWe79/B8YbGgCVTW4N43yTAuri+/11BNk=.p.on.files.forEach.addFilesAsync.mf8OAFaZOMvEeUCmNGD49bLJuxVBwZ7aQi9fSVkX2Xs=.MiniPass.nB1sORH0sHB3HwuVwSIfqP+HqxiOeLKDcklHFiMBvGk=.qf32nrRJcz5ulBOhqaOhbRFR1PGe8tScTbGJRKCNRk0=.Pax.parse.merge.rShkRzOhrA698Po52a5kgqfF/najh4ymb9PcXu4a8ec= (C:\Users\Lars Doucet\AppData\Roaming\npm\node_modules\lix\bin\lix.js:12856:30)
    at load (C:\Users\Lars Doucet\AppData\Roaming\npm\node_modules\lix\bin\lix.js:14:5)
    at C:\Users\Lars Doucet\AppData\Roaming\npm\node_modules\lix\bin\lix.js:17:29
    at C:\Users\Lars Doucet\AppData\Roaming\npm\node_modules\lix\bin\lix.js:7302:38

C:\Users\Lars Doucet>

Did I do something obviously wrong?

Haxelib library names are case sensitive

The first call didnt work, second one did (note the "M" vs "m" of Minifier)

image

Juraj Kirchheim @back2dos 17:32
case sensitivity on haxelib is a weird thing
but yeah, the haxelib client deals with it properly, while lix doesn't

Bundling lix into a single file.

To whom it may concern: I have just published v0.10.2 which (after two failed attempts seems to run just fine on travis and) has its dependencies bundled and doesn't need to get them through npm.

The main reason for this is speed. On a decent connection I get this:

It makes for a reasonably sized bundle (~450K which could be minified to ~180K), because lix has just two highly stable npm dependencies and I don't see the numbers increasing drastically in the foreseeable future - if anything I'm hoping we'll have streaming zip and tar decompression ported to Haxe some day.

Anyway: I'd like to hear your opinions on pursuing this approach and hear about any issues arising from this ;)

[Feature] Support for HTTP proxy

I want to use Lix, but I am behind an HTTP proxy. It would be great to add support for using Lix behind a proxy. I would actually be willing to help out and try to work on this, but I wanted to know if the owners of this project have any preference on how it is implemented.

I am on an Ubuntu machine and I would definitely like it if Lix would be able to read my http_proxy environment variables and configure the proxy accordingly. It does seem like it might be a good idea to add a proxy configuration subcommand as well.

Infinite loop installing `haxelib:mcover#2.1.1`

C:\project\haxe-checkstyle # lix install haxelib:mcover#2.1.1
C:\project\haxe-checkstyle # "C:\Users\evgeny.pavlovskiy\AppData\Roaming\npm\lix.CMD" install haxelib:mcover#2.1.1
downloading haxelib:mcover#2.1.1
Done!
mounting as mcover#2.1.1
Installing dependency mconsole
already downloaded: haxelib:mconsole#1.6.0
mounting as mconsole#1.6.0
Installing dependency munit
downloading haxelib:munit#2.2.3
Done!
mounting as munit#2.2.3
Installing dependency mlib
downloading haxelib:mlib#2.0.2
Done!
mounting as mlib#2.0.2
Installing dependency mcover
already downloaded: haxelib:mcover#2.1.1
mounting as mcover#2.1.1
Installing dependency munit
already downloaded: haxelib:munit#2.2.3
mounting as munit#2.2.3
Installing dependency mcover
already downloaded: haxelib:mcover#2.1.1
mounting as mcover#2.1.1
Installing dependency munit
already downloaded: haxelib:munit#2.2.3
...

Doing lix install haxelib:munit has the same affect.
A quick check of the munit and mcover repos does show that they do indeed list each other as dependencies in lib.json and project.json.

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.