Skip to content

Commit

Permalink
Merge pull request #72 from danfuzz/prep-4.0.2
Browse files Browse the repository at this point in the history
Updates for the release of 4.0.2
  • Loading branch information
danfuzz authored Dec 20, 2016
2 parents 6cb28f0 + e66d807 commit 01f4699
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 47 deletions.
83 changes: 44 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,34 @@ npmbox is intended to be a proof of concept with regards to this issue filled ag

## npmbox news

UPDATE December 20, 2016: v4.0.2 of npmbox is out.
* Fix a couple issues which could cause npmbox to incorrectly try to use the
network.
* Support for top-level install targets that aren't simple npm package names.

UPDATE August 9, 2016: v4.0.0 of npmbox is out.
* Support for bundling multiple packages into a single .npmbox file! (Hooray!)
* Roll back version of tar.gz lib to solve large tar file bug.
* Fix error where npmbox would not give an error on a failure.

Also worthy of note is that npm, inc. has begun thinking and working in how to do this within npm itself (and hopefully obsoletting this project entirely). There's a good blog post over at npm, inc called "dealing with problematic dependencies in a restricted network environment" that details some of the problems: [Check it out here!](http://blog.npmjs.org/post/145724408060/dealing-with-problematic-dependencies-in-a)
Also worthy of note is that npm, inc. has begun thinking and working in how to do this within npm itself (and hopefully obsoleting this project entirely). There's a good blog post over at npm, inc called "dealing with problematic dependencies in a restricted network environment" that details some of the problems: [Check it out here!](http://blog.npmjs.org/post/145724408060/dealing-with-problematic-dependencies-in-a)

## Usage of `npmbox`

Given some package, like `express` this command will create a archive file of that package and all of its dependencies, such that a npmunbox of that archive file will install express and all of its dependencies.

npmbox - Create an archive for offline installation of the given package.
npmbox - Create an archive for offline installation of the given package.

Usage:
Usage:

npmbox --help
npmbox [options] <package> <package>...
npmbox --help
npmbox [options] <package> <package>...

Options:
Options:

-v, --verbose Shows npm output which is normally hidden.
-s, --silent Shows no output whatsoever.
-t, --target Specify the .npmbox file to write.
-v, --verbose Shows npm output which is normally hidden.
-s, --silent Shows no output whatsoever.
-t, --target Specify the .npmbox file to write.

You must specify at least one package.

Expand All @@ -50,25 +55,25 @@ NOTE: When creating an archive file for a package destined to be installed on an

Given some .npmbox file (must end with the .npmbox extension), installs the contents and all of it dependencies.

npmunbox - Extracts a .npmbox file and installs the contained package.
npmunbox - Extracts a .npmbox file and installs the contained package.

Usage:
Usage:

npmunbox --help
npmunbox [options] <nmpbox-file> <npmbox-file>...
npmunbox --help
npmunbox [options] <nmpbox-file> <npmbox-file>...

Options:
Options:

-v, --verbose Shows npm output which is normally hidden.
-s, --silent Shows additional output which is normally hidden.
-p, --path Specify the path to a folder from which the .npmbox file(s) will be read.
-g, --global Installs package globally as if --global was passed to npm.
-C, --prefix npm --prefix switch.
-S, --save npm --save switch.
-D, --save-dev npm --save-dev switch.
-O, --save-optional npm --save-optional switch.
-B, --save-bundle npm --save-bundle switch.
-E, --save-exact npm --save-exact switch.
-v, --verbose Shows npm output which is normally hidden.
-s, --silent Shows additional output which is normally hidden.
-p, --path Specify the path to a folder from which the .npmbox file(s) will be read.
-g, --global Installs package globally as if --global was passed to npm.
-C, --prefix npm --prefix switch.
-S, --save npm --save switch.
-D, --save-dev npm --save-dev switch.
-O, --save-optional npm --save-optional switch.
-B, --save-bundle npm --save-bundle switch.
-E, --save-exact npm --save-exact switch.


You must specify at least one file.
Expand All @@ -87,35 +92,35 @@ A particular use case with npmunbox comes up fairly often: **how do I use npmbox

1). If npmbox is not globally installed on your online system, do so now:

npm install -g npmbox
npm install -g npmbox

2). In a folder in which you can read/write:

npmbox npmbox
npmbox npmbox

3). Copy the resulting `npmbox.npmbox` file to you offline system in whatever manner allowed to you, This could involve coping to movable media and transfering that way, however you would do it.
3). Copy the resulting `npmbox.npmbox` file to you offline system in whatever manner allowed to you, This could involve coping to movable media and transferring that way, however you would do it.

**On the system you want to install npmbox to, do the following:**

1). Create a new directory

mkdir somedir
mkdir somedir

2). Change to it:

cd somedir
cd somedir

3). Copy the npmbox.npmbox folder into this directory.

cp /media/usb/npmbox.npmbox .
cp /media/usb/npmbox.npmbox .

or

copy E:\npmbox.npmbox .
copy E:\npmbox.npmbox .

4). Untar the .npmbox file. This will create the .npmbox.cache folder.

tar --no-same-owner --no-same-permissions -xvzf npmbox.npmbox
tar --no-same-owner --no-same-permissions -xvzf npmbox.npmbox

NOTE: If for some reason ```--no-same-owner``` or ```--no-same-permissions``` do not work, remove them and adjust the permissions/ownership yourself. You will need to ensure that npm can see all the files in the .npmbox.cache file structure.

Expand All @@ -125,19 +130,19 @@ NOTE: On windows you might not have the tar command. You can use another zip ut

5). Install npmbox globally using the following command.

For unix or max...
For unix or macs...

npm install --global --cache ./.npmbox.cache --optional --cache-min 99999 --shrinkwrap false npmbox
npm install --global --cache ./.npmbox.cache --optional --cache-min 99999999999 --shrinkwrap false npmbox

For windows...

npm install --global --cache .\.npmbox.cache --optional --cache-min 99999 --shrinkwrap false npmbox
npm install --global --cache .\.npmbox.cache --optional --cache-min 99999999999 --shrinkwrap false npmbox

NOTE: If you have a file called ```npmbox``` (no extension) in the local directory, this will not work correctly. Please remove said ```npmbox``` file.

6). Once npmbox is installed globally you can use it to install other .npmbox files:

npmunbox blah
npmunbox blah

NOTE: If you are running into issues where npmunbox is still trying to reach out to the internet it may help to try clearing your npm cache on the machine

Expand All @@ -155,7 +160,7 @@ Sorry, I am only one person and I already have a full time job. Using open sour

99% of the time this occurs is because the npmbox didn't get some resource that npmunbox is looking for and cannot find in the npmbox file. This happens. There are TONS of edge cases that npmbox misses. Two worth nothing:
* Some packages reference git repos instead of npm packages. This has been fixed as of version 3.0 of npmbox. Very exciting.
* Packages that execute external scripts that call out to git repos or npm are entirely outside of the controll of npmbox. Not much we can do about that.
* Packages that execute external scripts that call out to git repos or npm are entirely outside of the control of npmbox. Not much we can do about that.

3). When I run the command described above to install npmbox on my offline machine I get an error.

Expand All @@ -165,10 +170,10 @@ This if frequently caused by incorrectly referencing where the ```.npmbox-cache`

npm, inc. is actively working on this problem as we speak. Read this blog post for some of the challenges they are facing: [Check it out here!](http://blog.npmjs.org/post/145724408060/dealing-with-problematic-dependencies-in-a)

5). I used to be able to create multiple .npmbox files with a single command. Why did that change.
5). I used to be able to create multiple .npmbox files with a single command. Why did that change?

In order to support multiple npm packages in a single .npmbox file we had to change how this works. It's still possible to create multiple .npmbox per package, but you will just need to run the command multiple times.

6). But I wanted it to work the old way with one .npmbox file per package.

Sorry. The multiple packages per single file change is a big deal. It lets you create a single .npmbox with multiple packages but without redundent libraries being include multiple times. So nice. Multiple packages in a single .npmbox file also lets you unbox a single .npmbox file and get multiple installs.
Sorry. The multiple packages per single file change is a big deal. It lets you create a single .npmbox with multiple packages but without redundant libraries being include multiple times. So nice. Multiple packages in a single .npmbox file also lets you unbox a single .npmbox file and get multiple installs.
45 changes: 40 additions & 5 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions npmboxxer.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@
npm.commands.cache.add(source,null,null,false,function(err, packageInfo) {
if (err) return done(err);
if (packageInfo && packageInfo.name) {
if (!target) setTarget(packageInfo.name);
if (!target) setTarget(path.basename(packageInfo.name));
rack();
}
else {
Expand All @@ -311,7 +311,7 @@
});
}
else {
if (!target) setTarget(source);
if (!target) setTarget(path.basename(npa(source).name));
rack();
}
};
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"unbox"
],
"description": "npm addon utility for creating and installing from an archive file of an npm install, including dependencies.",
"version": "4.0.1",
"version": "4.0.2",
"homepage": "http://github.com/arei/npmbox",
"bugs": {
"url": "http://github.com/arei/npmbox/issues"
Expand Down

0 comments on commit 01f4699

Please sign in to comment.