Skip to content

Commit

Permalink
fix(shrinkpack): Repair support for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Hewison committed Apr 3, 2015
1 parent 047895f commit bc5e53c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 21 deletions.
6 changes: 5 additions & 1 deletion shrinkpack.js → index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#!/usr/bin/env node

'use strict';

var childProcess = require('child_process');
var fs = require('fs');
var is = require('is');
Expand All @@ -11,7 +15,7 @@ var traverse = require('./src/traverse');
var terminal = require('./src/terminal');

function getProjectPath() {
return process.env.PWD;
return process.env.PWD || process.cwd();
}

function getFilePath(file) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"license": "MIT",
"homepage": "https://github.com/JamieMason/shrinkpack",
"bin": {
"shrinkpack": "shrinkpack"
"shrinkpack": "index.js"
},
"repository": {
"type": "git",
Expand Down
16 changes: 0 additions & 16 deletions shrinkpack

This file was deleted.

10 changes: 7 additions & 3 deletions src/tarball.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ var os = require('os');
var path = require('path');

var isWindows = /^win[0-9]{2}$/.test(os.platform());
var HOME = process.env[isWindows ? 'USERPROFILE' : 'HOME'];
var HOME = process.env[isWindows ? 'APPDATA' : 'HOME'];
var CACHE = isWindows ? 'npm-cache' : '.npm';

function getProjectPath() {
return process.env.PWD || process.cwd();
}

module.exports = {

getRegistryUrl: function(name, version) {
Expand Down Expand Up @@ -41,15 +45,15 @@ module.exports = {
if (name && version) {
return path.resolve(
path.join(
process.env.PWD,
getProjectPath(),
'node_shrinkwrap',
name + '-' + version + '.tgz'
)
);
}
return path.resolve(
path.join(
process.env.PWD,
getProjectPath(),
'node_shrinkwrap'
)
);
Expand Down

0 comments on commit bc5e53c

Please sign in to comment.