Skip to content

Commit e5eb041

Browse files
Dimitar TachevDimitar Tachev
Dimitar Tachev
authored and
Dimitar Tachev
committed
fix: fix the relative paths in order to allow both tgz and npm link plugin usage.
1 parent adb90a4 commit e5eb041

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

demo/app/App_Resources/Android/app.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
android {
99
defaultConfig {
1010
generatedDensities = []
11-
applicationId = "__PACKAGE__"
11+
applicationId = "org.nativescript.demo"
1212
}
1313
aaptOptions {
1414
additionalParameters "--no-version-vectors"

demo/package.json

+7
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,20 @@
77
"id": "org.nativescript.demo",
88
"tns-ios": {
99
"version": "3.0.0"
10+
},
11+
"tns-android": {
12+
"version": "3.4.1"
1013
}
1114
},
1215
"dependencies": {
1316
"nativescript-theme-core": "^1.0.4",
1417
"tns-core-modules": "^3.0.0"
1518
},
1619
"devDependencies": {
20+
"babel-traverse": "6.26.0",
21+
"babel-types": "6.26.0",
22+
"babylon": "6.18.0",
23+
"lazy": "1.0.11",
1724
"nativescript-dev-sass": "file:.."
1825
}
1926
}

lib/converter.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ var currentSassProcess = null;
99
function convert(logger, projectDir, options) {
1010
return new Promise(function (resolve, reject) {
1111
options = options || {};
12-
13-
var peerSassPath = path.join(__dirname, '../../node-sass');
14-
var sassPath = path.join(peerSassPath, 'bin/node-sass');
12+
var sassPath = require.resolve('node-sass/bin/node-sass');
1513
var appDir = path.join(projectDir, "app");
1614
var importerPath = path.join(__dirname, "importer.js");
1715

@@ -36,7 +34,9 @@ function convert(logger, projectDir, options) {
3634
}
3735

3836
logger.trace(process.execPath, nodeArgs.join(' '));
39-
currentSassProcess = spawn(process.execPath, nodeArgs);
37+
var env = Object.create( process.env );
38+
env.PROJECT_DIR = projectDir;
39+
currentSassProcess = spawn(process.execPath, nodeArgs, { env: env });
4040

4141
var isResolved = false;
4242
var watchResolveTimeout;

lib/importer.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ var path = require("path");
33
module.exports = function(url, prev, done) {
44
if (url[0] === '~' && url[1] !== '/') {
55
// Resolve "~" paths to node_modules
6-
url = path.resolve(__dirname, "../../../node_modules", url.substr(1));
6+
url = path.resolve(process.env.PROJECT_DIR, "node_modules", url.substr(1));
77
} else if (url[0] === '~' && url[1] === '/') {
88
// Resolve "~/" paths to the app root
9-
url = path.resolve(__dirname, "../../../app/"+ url.substr(2));
9+
url = path.resolve(process.env.PROJECT_DIR, "app/"+ url.substr(2));
1010
}
1111

1212
return { file: url };

0 commit comments

Comments
 (0)