Skip to content

Commit

Permalink
use ../icu4c-data when -g
Browse files Browse the repository at this point in the history
fixes #2
  • Loading branch information
srl295 committed Oct 20, 2015
1 parent 50caf6e commit 281e2c9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions install-spawn.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ var path = require('path');
var fs = require('fs');
var child_process = require('child_process');

var isglobal = process.env.npm_config_global === 'true';

module.exports = function npmInstallNpm(fullIcu, advice) {
var icupkg = fullIcu.icupkg;
var icudat = fullIcu.icudat;
Expand All @@ -33,11 +35,16 @@ module.exports = function npmInstallNpm(fullIcu, advice) {
} else if(spawned.status !== 0) {
throw(Error(cmdPath + ' ' + args.join(' ') + ' --> status ' + spawned.status));
} else {
var datPath = path.join('node_modules','icu4c-data',icudat);
var datPath;
if(isglobal) {
datPath = path.join('..','icu4c-data',icudat);
} else {
datPath = path.join('node_modules','icu4c-data',icudat);
}
if(fs.existsSync(icudat)) {
console.log(' √ ' + icudat + " (existing symlink?)");
} else if(!fs.existsSync(datPath)) {
console.log(' • ' + ' (no ' + icudat + ')');
console.log(' • ' + ' (no ' + icudat + ' at ‘' + datPath+'’)');
} else {
try {
fs.symlinkSync(datPath, icudat);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "full-icu",
"version": "1.0.0",
"version": "1.0.1",
"description": "install 'full-icu' data for your current node",
"scripts": {
"postinstall": "node postinstall.js"
Expand Down

0 comments on commit 281e2c9

Please sign in to comment.