-
Notifications
You must be signed in to change notification settings - Fork 497
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
47 changed files
with
1,508 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
echo "Building binary in docker" | ||
|
||
docker build . -t schlez/nsw-static-binary | ||
|
||
echo "Copying to ./nsw-linux" | ||
|
||
docker run --rm -v $(pwd):$(pwd) --workdir $(pwd) schlez/nsw-static-binary cp /app/_build/default/executable/NswApp.exe ./nsw-linux |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
sed -i 's@"flags": \[\]@"flags": ["-ccopt", "-static"]@' package.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
shift 2 | ||
sha1sum $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
_build | ||
_esy | ||
node_modules | ||
Dockerfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ _esy/ | |
nsw.install | ||
.DS_Store | ||
*.install | ||
.tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
FROM frolvlad/alpine-glibc | ||
|
||
RUN apk add --no-cache nodejs bash npm curl g++ make m4 patch gmp-dev perl git jq | ||
ADD .ci/shasum /usr/bin/shasum | ||
|
||
USER root | ||
|
||
RUN npm -g config set user root | ||
RUN npm i -g esy@latest | ||
|
||
WORKDIR /app | ||
ADD . /app | ||
|
||
RUN jq '. | .buildDirs.executable.flags |= . + ["-ccopt", "-static"]' package.json > package.json.new && mv package.json.new package.json | ||
RUN npx esy i | ||
RUN npx esy pesy | ||
RUN npx esy b | ||
RUN npx esy test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,45 @@ | ||
# nsw | ||
<h1 align="center"> | ||
Node Switcher (<code>nsw</code>) <a href="https://dev.azure.com/galstar0385/nsw/_build/latest?definitionId=1?branchName=master"><img alt="Build Status" src="https://dev.azure.com/galstar0385/nsw/_apis/build/status/Schniz.nsw?branchName=master" /></a> | ||
</h1> | ||
|
||
> A simple and fast `nvm` replacement, built in native ReasonML. | ||
[![CircleCI](https://circleci.com/gh/yourgithubhandle/nsw/tree/master.svg?style=svg)](https://circleci.com/gh/yourgithubhandle/nsw/tree/master) | ||
:rocket: Single executable :rocket: Blazing fast :rocket: | ||
|
||
![Blazing fast](./docs/nvm_comparison.png) | ||
|
||
**Contains the following libraries and executables:** | ||
## Features | ||
- Single file, easy installation :sparkles: | ||
- Fast fast fast fast :rocket: | ||
- Install multiple node versions without a hassle! :clap: | ||
- [Project-specific `.nvmrc` file support](./features_tests/nvmrc) | ||
|
||
``` | ||
[email protected] | ||
│ | ||
├─test/ | ||
│ name: TestNsw.exe | ||
│ main: TestNsw | ||
│ require: nsw.lib | ||
│ | ||
├─library/ | ||
│ library name: nsw.lib | ||
│ namespace: Nsw | ||
│ require: | ||
│ | ||
└─executable/ | ||
name: NswApp.exe | ||
main: NswApp | ||
require: nsw.lib | ||
``` | ||
## Installation | ||
|
||
* Download the [latest release binary](https://github.com/Schniz/nsw/releases) for your system | ||
* Make it available globally on `$PATH` | ||
* Add the following line to your `.bashrc`/`.zshrc` file: | ||
|
||
```bash | ||
eval `nsw env` | ||
``` | ||
|
||
## TODO | ||
- [ ] Feature: make versions complete the latest: `10` would infer the latest minor and patch versions of node 10. `10.1` would infer the latest patch version of node 10.1 | ||
- [ ] Feature: `nsw use --install`, `nsw use --quiet` | ||
- [ ] Feature: `nsw install lts`? | ||
- [ ] Feature: `nsw alias`? | ||
- [ ] Feature: Consider nvm-like per-shell usage with symlinks on `/tmp` directory | ||
- [ ] OSX: Add to homebrew? | ||
- [ ] Windows Support? | ||
- [ ] Linux: Replace `curl` usage with `cohttp`/`ocurl` or something else which is statically-linkable | ||
- [ ] Linux: Replace `tar` with a statically linked library too (for ungzip + untar) | ||
|
||
## Developing: | ||
|
||
``` | ||
npm install -g esy | ||
git clone <this-repo> | ||
git clone https://github.com/Schniz/nsw.git | ||
esy install | ||
esy build | ||
``` | ||
|
@@ -39,12 +49,15 @@ esy build | |
After building the project, you can run the main binary that is produced. | ||
|
||
``` | ||
esy x NswApp.exe | ||
esy x nsw.exe | ||
``` | ||
|
||
## Running Tests: | ||
|
||
``` | ||
# Runs the "test" command in `package.json`. | ||
# Runs some smoke-unity test | ||
esy test | ||
# Runs the feature tests | ||
feature_tests/run.sh | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.